From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web11.20016.1674578068866737267 for ; Tue, 24 Jan 2023 08:34:29 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TBfdGhMd; spf=pass (domain: kernel.org, ip: 139.178.84.217, mailfrom: ardb@kernel.org) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3E44A612A8; Tue, 24 Jan 2023 16:34:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52EE0C4339B; Tue, 24 Jan 2023 16:34:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674578067; bh=VeLydXFQXMXBhoVeMbzJA+uuIRwC/QBve5gqrmHCpEE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TBfdGhMdRjieCxLJ5RTeXqlXSaGXQWTS3kK2NDY5/7gkCB7Tw3ExuFnfder2yFjn9 7tCHHmWPcXCqPETZ1+71fBeNxgSLhMUWBAA1ELzZPDDr5iaXnTfdi5wxh+8JTscpbr YKIPV2eVZRFopucUdyeElBldiFZuk4Ff4QesPaEXTOHckwK0vsmCueIqDDW5o+LLzE Jq4/A9iXC3DGq9MNQ+ugvCTaOvkHLGK/gOHKCdGbPC7yLZrQZwlQMiatBb0Wuschuw 1byNQ4Rre8uXgiN+wwh3JJcAv8puzMpgsulwPaoYa7s/ShgUBFg9vVFVGPviQu/xLs GrnVstHxy7EZg== From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Gerd Hoffmann , Michael Kubacki , Jiewen Yao , Oliver Steffen Subject: [PATCH v2 2/6] ArmVirtPkg/ArmVirtQemu: enlarge initial flash mapping Date: Tue, 24 Jan 2023 17:34:13 +0100 Message-Id: <20230124163417.584727-3-ardb@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230124163417.584727-1-ardb@kernel.org> References: <20230124163417.584727-1-ardb@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable The initial ID map used by ArmVirtQemu only covers 2 MiB of NOR flash, while the NOOPT build can be up to 3 MiB in size, resulting in a crash if the unmapped 1 MiB is accessed before the real page tables are up. So increate the initial flash mapping to 4 MiB. Signed-off-by: Ard Biesheuvel --- ArmVirtPkg/Library/ArmPlatformLibQemu/IdMap.S | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ArmVirtPkg/Library/ArmPlatformLibQemu/IdMap.S b/ArmVirtPkg/Lib= rary/ArmPlatformLibQemu/IdMap.S index 4a4b7b77ed83..584ffcb3ebe2 100644 --- a/ArmVirtPkg/Library/ArmPlatformLibQemu/IdMap.S +++ b/ArmVirtPkg/Library/ArmPlatformLibQemu/IdMap.S @@ -15,6 +15,7 @@ .set TT_MT_MEM, (0x3 << 2) | (0x3 << 8) // MAIR #3=0D =0D .set PAGE_XIP, TT_TYPE_PAGE | TT_MT_MEM | TT_AF | TT_RO | TT_NG=0D + .set BLOCK_XIP, TT_TYPE_BLOCK | TT_MT_MEM | TT_AF | TT_RO | TT_NG=0D .set BLOCK_DEV, TT_TYPE_BLOCK | TT_MT_DEV | TT_AF | TT_XN | TT_NG=0D .set BLOCK_MEM, TT_TYPE_BLOCK | TT_MT_MEM | TT_AF | TT_XN | TT_NG=0D =0D @@ -33,7 +34,8 @@ idmap: /* level 0 */ =0D 20: /* level 2 */=0D .quad 3f + TT_TYPE_TABLE // up to 2 MB of flash=0D - .fill 63, 8, 0x0 // 126 MB of unused flash=0D + .quad BLOCK_XIP | (0x1 << 21) // another 2 MB of flash=0D + .fill 62, 8, 0x0 // 124 MB of unused flash=0D .set idx, 64=0D .rept 448=0D .quad BLOCK_DEV | (idx << 21) // 896 MB of RW- device mappings= =0D --=20 2.39.0