From nobody Sat May 4 10:54:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1501541607024965.137295965916; Mon, 31 Jul 2017 15:53:27 -0700 (PDT) Received: from localhost ([::1]:33665 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcJYy-00085M-NQ for importer@patchew.org; Mon, 31 Jul 2017 18:53:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43055) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcJY5-0007oA-8l for qemu-devel@nongnu.org; Mon, 31 Jul 2017 18:52:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dcJY4-0006Mu-JT for qemu-devel@nongnu.org; Mon, 31 Jul 2017 18:52:29 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:100::1]:58130) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dcJY4-00065l-DK for qemu-devel@nongnu.org; Mon, 31 Jul 2017 18:52:28 -0400 Received: from [2001:bc8:30d7:120:9bb5:8936:7e6a:9e36] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1dcJXr-0003Zq-7G; Tue, 01 Aug 2017 00:52:15 +0200 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.89) (envelope-from ) id 1dcJXo-00023X-DB; Tue, 01 Aug 2017 00:52:12 +0200 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Tue, 1 Aug 2017 00:52:10 +0200 Message-Id: <20170731225210.7829-1-aurelien@aurel32.net> X-Mailer: git-send-email 2.13.2 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:bc8:30d7:100::1 Subject: [Qemu-devel] [PATCH for 2.10] mips/malta: leave space for the bootmap after the initrd X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yongbok Kim , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Since commit 9768e2abf7 the initrd is loaded at the end of the low memory to avoid clash for the kernel relocation when kaslr is used. However this in turn conflicts with the bootmap memory that the kernel tries to place after initrd, but in low memory. The bootmap spans the whole usable physical address space. The machine can have at most 2GiB of memory, 256MiB of low memory mapped at 0x00000000, and 1792MiB of high memory mapped at 0x90000000. The biggest bootmap therefore corresponds to the adresses 0x00000000 -> 0xffffffff, which at 1 bit per 4kiB page corresponds to 128kiB in memory. Therefore reserve 128kiB after the initrd. Signed-off-by: Aurelien Jarno --- hw/mips/mips_malta.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 8ecd544baa..9dcec27304 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -843,7 +843,10 @@ static int64_t load_kernel (void) if (loaderparams.initrd_filename) { initrd_size =3D get_image_size (loaderparams.initrd_filename); if (initrd_size > 0) { - initrd_offset =3D (loaderparams.ram_low_size - initrd_size + /* The kernel allocates the bootmap memory in the low memory a= fter + the initrd. It takes at most 128kiB for 2GB RAM and 4kiB + pages. */ + initrd_offset =3D (loaderparams.ram_low_size - initrd_size - 1= 31072 - ~INITRD_PAGE_MASK) & INITRD_PAGE_MASK; if (kernel_high >=3D initrd_offset) { fprintf(stderr, --=20 2.13.2