From nobody Thu Nov 13 20:44:01 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail header.i=jiaxun.yang@flygoat.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=flygoat.com ARC-Seal: i=1; a=rsa-sha256; t=1582863388; cv=none; d=zohomail.com; s=zohoarc; b=SOg+8PLI+zin//a07O4vrVGRAZBg5OR3dX+hURSeqQrxqsIADuaFWurhMTMByuHlE6pi9EoT/s1y9bH8XQlzQZH86FOMBw5WU5hPMVon66QwMTRg73uGthoQgxdH10eGFnDY5MwY2cIPwCcWVtpXZe/0kO2JSFERo1CdOuDCXCs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582863388; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=EICltnfGI58mGsw6+plx9ZtF+XFqPFk81aLbfzMKQ0E=; b=mnwutEzxdRzrbza0ral5hggli4CEHFXDY3AbAdglD/h0LxBRO0K0B2mOwj037JLbSs67R+Q7enL2CyFg4tlnzVIjvrST+QbrxC4VF5NvYVZK0XZyW8aSRp+pLJ6fB3jge7prhpKysjPxsPPQpsIUw7tq9q64DjWgRBmx7Wc9QgA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail header.i=jiaxun.yang@flygoat.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1582863388453573.8792214633892; Thu, 27 Feb 2020 20:16:28 -0800 (PST) Received: from localhost ([::1]:41538 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j7X4c-0001wJ-NL for importer@patchew.org; Thu, 27 Feb 2020 23:16:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60357) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j7WJ3-0001va-P0 for qemu-devel@nongnu.org; Thu, 27 Feb 2020 22:27:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j7WJ1-0003LI-O1 for qemu-devel@nongnu.org; Thu, 27 Feb 2020 22:27:16 -0500 Received: from sender3-op-o12.zoho.com.cn ([124.251.121.243]:17941) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j7WIz-0003ES-A7 for qemu-devel@nongnu.org; Thu, 27 Feb 2020 22:27:15 -0500 Received: from localhost.localdomain (39.155.141.144 [39.155.141.144]) by mx.zoho.com.cn with SMTPS id 1582860384866161.72019006047776; Fri, 28 Feb 2020 11:26:24 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1582860388; s=mail; d=flygoat.com; i=jiaxun.yang@flygoat.com; h=From:To:Cc:Message-ID:Subject:Date:MIME-Version:Content-Transfer-Encoding:Content-Type; bh=EICltnfGI58mGsw6+plx9ZtF+XFqPFk81aLbfzMKQ0E=; b=LfF7kDvZp0fnDJz3hOquzRAjSy3Ae5Pxu0MmGsurGfFFOGZh2ml8DvkfOYaVXP7P mJrRpbOFdkAooqVGfFDUqtSPg78uZcveWoE0TmVB+gSK9OUutKWeD0r2O92DkZFHWIg AC8P9TTcN4vDLWr/j0sFU3w6uu+EtY/cLm8B/whI= From: Jiaxun Yang To: qemu-devel@nongnu.org Message-ID: <20200228032613.1049955-1-jiaxun.yang@flygoat.com> Subject: [PATCH] mips/mips_malta: Allow more than 2G RAM Date: Fri, 28 Feb 2020 11:26:13 +0800 X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoCNMailClient: External X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 124.251.121.243 X-Mailman-Approved-At: Thu, 27 Feb 2020 23:15:45 -0500 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: Yunqiang Su , philmd@redhat.com, Jiaxun Yang , amarkovic@wavecomp.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" When malta is coupled with MIPS64 cpu which have 64bit address space, it is possible to have more than 2G RAM. So we removed ram_size check and overwrite memory layout for these targets. Signed-off-by: Jiaxun Yang Suggested-by: Yunqiang Su --- hw/mips/mips_malta.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 6e7ba9235d..de89cdcfc1 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -98,7 +98,8 @@ typedef struct { } MaltaState; =20 static struct _loaderparams { - int ram_size, ram_low_size; + unsigned int ram_low_size; + ram_addr_t ram_size; const char *kernel_filename; const char *kernel_cmdline; const char *initrd_filename; @@ -1023,6 +1024,7 @@ static int64_t load_kernel(void) { int64_t kernel_entry, kernel_high, initrd_size; long kernel_size; + char mem_cmdline[128]; ram_addr_t initrd_offset; int big_endian; uint32_t *prom_buf; @@ -1099,20 +1101,28 @@ static int64_t load_kernel(void) prom_buf =3D g_malloc(prom_size); =20 prom_set(prom_buf, prom_index++, "%s", loaderparams.kernel_filename); + + /* + * Always use cmdline to overwrite mem layout + * as kernel may reject large emesize. + */ + sprintf(&mem_cmdline[0], + "mem=3D0x10000000@0x00000000 mem=3D0x%" PRIx64 "@0x90000000", + loaderparams.ram_size - 0x10000000); if (initrd_size > 0) { prom_set(prom_buf, prom_index++, - "rd_start=3D0x%" PRIx64 " rd_size=3D%" PRId64 " %s", - xlate_to_kseg0(NULL, initrd_offset), + "%s rd_start=3D0x%" PRIx64 " rd_size=3D%" PRId64 " %s", + &mem_cmdline[0], xlate_to_kseg0(NULL, initrd_offset), initrd_size, loaderparams.kernel_cmdline); } else { - prom_set(prom_buf, prom_index++, "%s", loaderparams.kernel_cmdline= ); + prom_set(prom_buf, prom_index++, "%s %s",&mem_cmdline[0] ,loaderpa= rams.kernel_cmdline); } =20 prom_set(prom_buf, prom_index++, "memsize"); prom_set(prom_buf, prom_index++, "%u", loaderparams.ram_low_size); =20 prom_set(prom_buf, prom_index++, "ememsize"); - prom_set(prom_buf, prom_index++, "%u", loaderparams.ram_size); + prom_set(prom_buf, prom_index++, "%lu", loaderparams.ram_size); =20 prom_set(prom_buf, prom_index++, "modetty0"); prom_set(prom_buf, prom_index++, "38400n8r"); @@ -1253,12 +1263,14 @@ void mips_malta_init(MachineState *machine) /* create CPU */ mips_create_cpu(machine, s, &cbus_irq, &i8259_irq); =20 - /* allocate RAM */ +#ifdef TARGET_MIPS32 + /* MIPS32 won't accept more than 2GiB RAM due to limited address space= */ if (ram_size > 2 * GiB) { error_report("Too much memory for this machine: %" PRId64 "MB," " maximum 2048MB", ram_size / MiB); exit(1); } +#endif =20 /* register RAM at high address where it is undisturbed by IO */ memory_region_add_subregion(system_memory, 0x80000000, machine->ram); --=20 2.25.1