From patchwork Tue Jun 30 19:57:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 278998 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BC20C433E2 for ; Tue, 30 Jun 2020 19:58:41 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3294E20768 for ; Tue, 30 Jun 2020 19:58:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EkBDPDfm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3294E20768 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:39822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jqMOu-000196-EU for qemu-devel@archiver.kernel.org; Tue, 30 Jun 2020 15:58:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53360) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jqMNm-00089N-9J; Tue, 30 Jun 2020 15:57:30 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:39291) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jqMNl-00044X-1U; Tue, 30 Jun 2020 15:57:30 -0400 Received: by mail-wr1-x443.google.com with SMTP id q5so21326445wru.6; Tue, 30 Jun 2020 12:57:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=U3siTkfLjVJQEaCMkrInYfzFvhXImBmDXKhPhC0qsnI=; b=EkBDPDfm41QjdCyNFfSY3uO9T/oVk/BxIFYE0qDNx+tazx1A4MerVH4FuVtKqPYRAk HPgkYhV0xwggFAYHGpuW1hRR1ZJ2ENpqci1WoNwpu6seNx6nMaegjFFeQnt+BJhLsLay RBpdDcMJmxijtCkxTbnDDa6ciL2TYlvxcDMxwePlKFNRMqiFzJR/ZY/P9LRA0evleq7B 8gPlOXojQZasRhB2eh0vwmIjhAJiJvXqw9EXX3y4+wqsHqWxuTH6Zdl4GtZoJPQuuHaf LbJuqP/EjPR/uS8YUV9M7h6HVX8dRYVy0wa3Sp/Mhf68Z6e1UNPjWm9NKs0OyZA1vwuZ wj6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=U3siTkfLjVJQEaCMkrInYfzFvhXImBmDXKhPhC0qsnI=; b=RyshWyFOkuXxlTbFEjrf5OgHXwaOXi7HMoC6uv6NYzDOT6tj4uIWy+NPkywbZifQXJ DnJtvhCMBCuNauwS69/RluUA2Y+F0xnsddXeldnywbCOMo/1uX2BP44mr0Ly3QQQ8XQc iv4NqK6Yy09X0B5/MR1VOYIy2haQs5vBT9L1xLUD0bLH4ctG0WClh/KaWju8hleJ+lkS 6wjwF/cbOFrBIYVwkywFf65LGGTvTHMgZfHpL5DeB/s2ZVTF9Za2NHZ3/tC68UIEfZ6/ Cr9K8PIliDRi/qV1VE+BthW9P+RKi988EhmJHHAEH7OHjc9ZEOmzW/QnglNIxnTMpdPm 1Zjw== X-Gm-Message-State: AOAM530fvCVCxaPBKEB4Y0xMT0dMAzSRW/7fcgFESqVG2yEfWzye5yJn 8rkPfqRjUDzFTmkxsRssOtBqKpRcg5o= X-Google-Smtp-Source: ABdhPJx2wD5QVQlaXTpGyvQCGyqHMszfdzf6bxNLksOfafCeVC68Eut2P33k2F5fh5WY+mPzFlTdXQ== X-Received: by 2002:adf:f5ce:: with SMTP id k14mr22106264wrp.234.1593547046627; Tue, 30 Jun 2020 12:57:26 -0700 (PDT) Received: from localhost.localdomain (1.red-83-51-162.dynamicip.rima-tde.net. [83.51.162.1]) by smtp.gmail.com with ESMTPSA id k11sm5172979wrd.23.2020.06.30.12.57.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jun 2020 12:57:26 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Yunqiang Su , Aurelien Jarno Subject: [PATCH v3 1/5] hw/mips/malta: Trivial code movement Date: Tue, 30 Jun 2020 21:57:19 +0200 Message-Id: <20200630195723.1359-2-f4bug@amsat.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200630195723.1359-1-f4bug@amsat.org> References: <20200630195723.1359-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::443; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x443.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=1, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aleksandar Rikalo , qemu-trivial@nongnu.org, Michael Tokarev , Laurent Vivier , Jiaxun Yang , =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?b?ZMOp?= , Aleksandar Markovic , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Trivial code movement to make the next patch easier to review. Signed-off-by: Philippe Mathieu-Daudé --- hw/mips/malta.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/mips/malta.c b/hw/mips/malta.c index d95926a89c..5b371c1e34 100644 --- a/hw/mips/malta.c +++ b/hw/mips/malta.c @@ -1426,6 +1426,13 @@ static const TypeInfo mips_malta_device = { .instance_size = sizeof(MaltaState), }; +static void mips_malta_register_types(void) +{ + type_register_static(&mips_malta_device); +} + +type_init(mips_malta_register_types) + static void mips_malta_machine_init(MachineClass *mc) { mc->desc = "MIPS Malta Core LV"; @@ -1442,10 +1449,3 @@ static void mips_malta_machine_init(MachineClass *mc) } DEFINE_MACHINE("malta", mips_malta_machine_init) - -static void mips_malta_register_types(void) -{ - type_register_static(&mips_malta_device); -} - -type_init(mips_malta_register_types) From patchwork Tue Jun 30 19:57:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 278997 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, UNWANTED_LANGUAGE_BODY, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3204C433E0 for ; Tue, 30 Jun 2020 20:00:28 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B3DEF20656 for ; Tue, 30 Jun 2020 20:00:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KuOdhOlS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B3DEF20656 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:45992 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jqMQd-0003eE-Vj for qemu-devel@archiver.kernel.org; Tue, 30 Jun 2020 16:00:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53398) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jqMNq-0008HK-Gp; Tue, 30 Jun 2020 15:57:34 -0400 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:37192) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jqMNo-000454-Tg; Tue, 30 Jun 2020 15:57:34 -0400 Received: by mail-wr1-x444.google.com with SMTP id a6so21339531wrm.4; Tue, 30 Jun 2020 12:57:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lGgsVeM7xoHM5WlT4+jBVtk67mhg6dUQrt0VXLrUTZc=; b=KuOdhOlSzpdz+8R7fTn/jjj5b3nIMecaYResNGEaEOqYaSzQtALmDdwllASsDVATxi l3H4y39wFNfJBtFjWlx1n6VjOq91YcCZ+yRbELRaCGI7pamKAKIn0eg8yB8wQRPMYQtV ut/ABmVo1dTLuaXFA/EV79ZlzgdYLgeVkE99hoVFQSBGmxVIsIVhDlP6jneCPzGhYEIf ObYYgmj7jvDKmvebl2iwVwNR0tW1zDhGAvHuU2jUc9flzEVBCp6TB2LlUUmmaq2rxh71 kSWnrpw3ZBL6TRA7Aaq/kJhpCNK+Xb/fBYqxE/4UXB+cC+RwIdE/GqfgG9cr4H1eDCv8 ccmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=lGgsVeM7xoHM5WlT4+jBVtk67mhg6dUQrt0VXLrUTZc=; b=ROny5cgFjeD0m0NbwBka39BXNpgwujJmNnKSc3FxC7j93gdtPrvan3np95Znb7oRA4 3IoJpGsOvC+LQTDfo0rQgNypQF+SsbmuE64pAqjxIWvnSc0/CAhGeupRNtoTZH+NUxET g9x/nqqth1SKsBQf5Lh5B8Q48TnMoRIl5aZpitVDc614f8gbcm5KnGKILregw6DK83dK jXn0wR+Uaw3zTOTnbz4A//QwzfoOtZPU/Mw9fLCx229Bk5Yn+hB9eURXQxzG3Q5DKCvz Htb8VRkIuLsnwPjkSEcW5P50E9LKLZsrxeOVV5HMZTN12Dy5bfEpKE9myVp+oyd3ASw8 S4qQ== X-Gm-Message-State: AOAM5302hjJS1ZTN2wKIWBpVeooC7+yyvULLcJD/SzpJFDr+ljUMCD/j HLM06UNVj5CZu7fUGOsLyTIEK1Hjg3E= X-Google-Smtp-Source: ABdhPJwbWdNuJ/eygtiCiSvlcovQYHtvYLu1uBvKsSQYPFhmUIxz+gJPdOAkuD7o1aKETkSpSObRzA== X-Received: by 2002:adf:a111:: with SMTP id o17mr22820045wro.257.1593547049065; Tue, 30 Jun 2020 12:57:29 -0700 (PDT) Received: from localhost.localdomain (1.red-83-51-162.dynamicip.rima-tde.net. [83.51.162.1]) by smtp.gmail.com with ESMTPSA id k11sm5172979wrd.23.2020.06.30.12.57.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jun 2020 12:57:28 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Yunqiang Su , Aurelien Jarno Subject: [PATCH v3 3/5] hw/mips/malta: Introduce MaltaMachineClass::max_ramsize Date: Tue, 30 Jun 2020 21:57:21 +0200 Message-Id: <20200630195723.1359-4-f4bug@amsat.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200630195723.1359-1-f4bug@amsat.org> References: <20200630195723.1359-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::444; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x444.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=1, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aleksandar Rikalo , qemu-trivial@nongnu.org, Laurent Vivier , Jiaxun Yang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Aleksandar Markovic , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The maximum RAM size is tied to the machine. First add the MaltaMachineClass, and add 'max_ramsize' to it. Set it to the current value of 2 GB, and adapt the code checking for the requested RAM is usable by the machine. Signed-off-by: Philippe Mathieu-Daudé --- hw/mips/malta.c | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/hw/mips/malta.c b/hw/mips/malta.c index 2c363fe099..fd4964e8b0 100644 --- a/hw/mips/malta.c +++ b/hw/mips/malta.c @@ -56,6 +56,7 @@ #include "sysemu/kvm.h" #include "hw/semihosting/semihost.h" #include "hw/mips/cps.h" +#include "qemu/cutils.h" #define ENVP_ADDR 0x80002000l #define ENVP_NB_ENTRIES 16 @@ -71,6 +72,17 @@ #define MAX_IDE_BUS 2 #define TYPE_MALTA_MACHINE MACHINE_TYPE_NAME("malta-base") +#define MALTA_MACHINE_CLASS(klass) \ + OBJECT_CLASS_CHECK(MaltaMachineClass, (klass), TYPE_MALTA_MACHINE) +#define MALTA_MACHINE_GET_CLASS(obj) \ + OBJECT_GET_CLASS(MaltaMachineClass, (obj), TYPE_MALTA_MACHINE) + +typedef struct MaltaMachineClass { + /* Private */ + MachineClass parent_obj; + /* Public */ + ram_addr_t max_ramsize; +} MaltaMachineClass; typedef struct { MemoryRegion iomem; @@ -1232,7 +1244,7 @@ void mips_malta_init(MachineState *machine) DriveInfo *dinfo; int fl_idx = 0; int be; - + MaltaMachineClass *mmc = MALTA_MACHINE_GET_CLASS(machine); DeviceState *dev = qdev_new(TYPE_MIPS_MALTA); MaltaState *s = MIPS_MALTA(dev); @@ -1248,10 +1260,16 @@ void mips_malta_init(MachineState *machine) /* create CPU */ mips_create_cpu(machine, s, &cbus_irq, &i8259_irq); - /* allocate RAM */ - if (ram_size > 2 * GiB) { - error_report("Too much memory for this machine: %" PRId64 "MB," - " maximum 2048MB", ram_size / MiB); + /* + * The GT-64120A north bridge accepts at most 256 MiB per SCS for + * address decoding, so we have a maximum of 1 GiB. We deliberately + * ignore this physical limitation. + */ + if (ram_size > mmc->max_ramsize) { + char *maxsize_str = size_to_str(mmc->max_ramsize); + error_report("Too much memory for this machine: %" PRId64 " MiB," + " maximum %s", ram_size / MiB, maxsize_str); + g_free(maxsize_str); exit(1); } @@ -1446,6 +1464,7 @@ static void malta_machine_common_class_init(ObjectClass *oc, void *data) static void malta_machine_default_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); + MaltaMachineClass *mmc = MALTA_MACHINE_CLASS(oc); mc->desc = "MIPS Malta Core LV"; mc->block_default_type = IF_IDE; @@ -1456,6 +1475,7 @@ static void malta_machine_default_class_init(ObjectClass *oc, void *data) #else mc->default_cpu_type = MIPS_CPU_TYPE_NAME("24Kf"); #endif + mmc->max_ramsize = 2 * GiB; } static const TypeInfo malta_machine_types[] = { @@ -1468,6 +1488,7 @@ static const TypeInfo malta_machine_types[] = { .name = TYPE_MALTA_MACHINE, .parent = TYPE_MACHINE, .class_init = malta_machine_common_class_init, + .class_size = sizeof(MaltaMachineClass), .abstract = true, } }; From patchwork Tue Jun 30 19:57:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 278996 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F9E7C433E0 for ; Tue, 30 Jun 2020 20:03:03 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5CBCB206A1 for ; Tue, 30 Jun 2020 20:03:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AEs0BuyE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5CBCB206A1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:50640 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jqMT8-0005uG-LJ for qemu-devel@archiver.kernel.org; Tue, 30 Jun 2020 16:03:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53422) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jqMNr-0008LM-Vq; Tue, 30 Jun 2020 15:57:36 -0400 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:37191) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jqMNq-00045P-DE; Tue, 30 Jun 2020 15:57:35 -0400 Received: by mail-wr1-x441.google.com with SMTP id a6so21339600wrm.4; Tue, 30 Jun 2020 12:57:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nCLgw9mQp+ua1T7qd5IhM0F5v0NpMBrPaJh73a54bRE=; b=AEs0BuyEXZ9RJeamwrF5xxzbXzcrkKyRkUalsvgurBeAWQoxrkqvz8hIy8DlYw/MCF /XPuqmSk9nw18tRL3jOcTFRF1YBrScSyrlbSxbIkadbLdC6sOzX0mJqXRvEqjymudgSi GyGloSYJqKL8A1m+vWlAjZl4NbdJuJ0nhcqfekPZylbLQJ8BLyBsZCRFGKrrH6YUkZ4b VzzF9O4pCCAI9J1dICuZ3iztv6lMtUW1uELzG1g40muQhu+ZUk1OpzAtrkCqzPfASjBV sRU63pCLIKW8oz2dnFOFC+Q/dSjhXaMdyqcRwPGs1p+n/R70t3HbaJ20WYo0OPUa+jh2 Y0kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=nCLgw9mQp+ua1T7qd5IhM0F5v0NpMBrPaJh73a54bRE=; b=tCK+FMlcTsdyfKga4CmOpEukNvutiLEB5wpid7gXWhRc8447rk9S+Cj82nyekZ+IDg JyV2P79JmvpQZolZKRoe1ylsTq823MmrYBPiPTVGVxkA/FRAF/nqMLU4YZiexdmcb2mT k4fst7G3X4RO84uMSn1Wf8c9OpA44YAGFo597+0x9k2SNnMv7OpIOcGmnO7c8ukkhAuM TNr1zZnVVcmFbR86BpeQnP3XY+12GOAc7eh/+vQS9CwU+LbzP3XbMkR51LrMkORCDucM ZRh7CEUN2DdiFFDdAWC+Dgcx/vg9AAcZorv1ErGQA+9DRynqiasooHy90fdmcZLV5b1Q L4mA== X-Gm-Message-State: AOAM532ea7wThQQwe/4F7utf07KIQj+rq43x+gVi9s/35BSDvLRmke5d XvL1PeGwqNtnI1SSrMjmk0oh+1FSfLk= X-Google-Smtp-Source: ABdhPJwXCQTVM8a4o8RulKkr4VZJe/q3S+ws33vjOgb3Fjsn7A8QuR5r8Acv6p4/8OpiigMUK17R1w== X-Received: by 2002:adf:aad3:: with SMTP id i19mr23380514wrc.359.1593547051296; Tue, 30 Jun 2020 12:57:31 -0700 (PDT) Received: from localhost.localdomain (1.red-83-51-162.dynamicip.rima-tde.net. [83.51.162.1]) by smtp.gmail.com with ESMTPSA id k11sm5172979wrd.23.2020.06.30.12.57.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jun 2020 12:57:30 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Yunqiang Su , Aurelien Jarno Subject: [PATCH v3 5/5] hw/mips/malta: Verify malta-strict machine uses correct DIMM sizes Date: Tue, 30 Jun 2020 21:57:23 +0200 Message-Id: <20200630195723.1359-6-f4bug@amsat.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200630195723.1359-1-f4bug@amsat.org> References: <20200630195723.1359-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::441; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x441.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=1, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aleksandar Rikalo , qemu-trivial@nongnu.org, Laurent Vivier , Jiaxun Yang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Aleksandar Markovic , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The machine has 4 DIMM slots. Each DIMM must be a power of 2. Add a check the total RAM is a good combination of DIMMs. Example when asking a combination not power of 2: $ qemu-system-mips -M malta-strict -bios /dev/null -m 252 qemu-system-mips: RAM size must be the combination of 4 powers of 2 Working example (as 100 = 64 + 32 + 2 + 2): $ qemu-system-mips -M malta-strict -monitor stdio -S -bios /dev/null -m 100 QEMU 5.0.50 monitor - type 'help' for more information (qemu) info mtree address-space: memory 0000000000000000-ffffffffffffffff (prio 0, i/o): system 0000000000000000-00000000063fffff (prio 0, ram): alias mips_malta_low_preio.ram @mips_malta.ram 0000000000000000-00000000063fffff Signed-off-by: Philippe Mathieu-Daudé --- hw/mips/malta.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hw/mips/malta.c b/hw/mips/malta.c index ac4a618751..17f5833a94 100644 --- a/hw/mips/malta.c +++ b/hw/mips/malta.c @@ -71,6 +71,8 @@ #define MAX_IDE_BUS 2 +#define DIMM_SLOTS_COUNT 4 + #define TYPE_MALTA_MACHINE MACHINE_TYPE_NAME("malta-base") #define MALTA_MACHINE_CLASS(klass) \ OBJECT_CLASS_CHECK(MaltaMachineClass, (klass), TYPE_MALTA_MACHINE) @@ -82,6 +84,7 @@ typedef struct MaltaMachineClass { MachineClass parent_obj; /* Public */ ram_addr_t max_ramsize; + bool verify_dimm_sizes; } MaltaMachineClass; typedef struct { @@ -1260,6 +1263,12 @@ void mips_malta_init(MachineState *machine) /* create CPU */ mips_create_cpu(machine, s, &cbus_irq, &i8259_irq); + if (mmc->verify_dimm_sizes && ctpop64(ram_size) > DIMM_SLOTS_COUNT) { + error_report("RAM size must be the combination of %d powers of 2", + DIMM_SLOTS_COUNT); + exit(1); + } + /* * The GT-64120A north bridge accepts at most 256 MiB per SCS for * address decoding, so we have a maximum of 1 GiB. We deliberately @@ -1493,6 +1502,7 @@ static void malta_machine_strict_class_init(ObjectClass *oc, void *data) #endif mc->default_ram_size = 32 * MiB; mmc->max_ramsize = 256 * MiB; /* 32 MByte PC100 SDRAM DIMMs x 4 slots */ + mmc->verify_dimm_sizes = true; }; static const TypeInfo malta_machine_types[] = {