From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:4864:20::334; helo=mail-wm1-x334.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 084052119377F for ; Mon, 26 Nov 2018 14:38:26 -0800 (PST) Received: by mail-wm1-x334.google.com with SMTP id y139so19799987wmc.5 for ; Mon, 26 Nov 2018 14:38:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=yjmlYE2u8gIr4cM3a3i5qKxbFhil4OQWwOMLOonAeu8=; b=hG9ILI5S6MaNTkP+xdxuoq7Je/U+jXr67QepJgZAZlP3860KRlMeeARhQo1pv4YqpZ hrQO8vE1GpNZ4RZ+7qkxxdCw5YyZSG7ZQU2+Zky6877eTBGKnUDiAd5j9riTGNO4HOzo Yo2QEDlKvCtM6f1h1mEoVPkDLoXIpb9S9gwAc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=yjmlYE2u8gIr4cM3a3i5qKxbFhil4OQWwOMLOonAeu8=; b=PuhZQg0cHQ+UfNVkuWpCHKfdF1Fz5DvAX7ow1T2dnQYkJY+ZZakhQSyspkLdfoDvTi 1Q/610hGwxRnWZw670qtrQhABAn4sZhk9C0EwAepy07bEyapXAiMnRvVNrlmLuAKSlkE qQLseZxZNqRetjPnrxxMO25IIChEv7nuCNoVHllJ4s7EZsIye3fHNSyOHseH3pVVB9MH dzrNaNw52dCC/1skOr4/xwoPj3FETa29R0DFAQxdcuwY61z1eJ0B0Mt6eXY+9nE6bGAg ZOem6nISGF8sq2w5wagqIIOt7kdtjYW1LoH6mM20vdPS4t3/XgpQ8hL8050C+yWfq42K b2Uw== X-Gm-Message-State: AA+aEWaKWQNanwBrPCdtWAZtT5wswpfM/DjWfL4N/Xv1m216t2YfooIh 6u5i24S1c/SHAfw9g8+NPEnXx4p4Z9c= X-Google-Smtp-Source: AFSGD/WbaUeeZf9E2CEM6BAnEcyP1Gsdm//aUcUDLFLsIRfcLfmr4uaxi/WgosaSVUWkTKT4x8q2AA== X-Received: by 2002:a1c:bb85:: with SMTP id l127mr24841609wmf.98.1543271904847; Mon, 26 Nov 2018 14:38:24 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:8571:4c23:4f5c:5eb7]) by smtp.gmail.com with ESMTPSA id v5sm2641916wrn.71.2018.11.26.14.38.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Nov 2018 14:38:24 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Cc: Ard Biesheuvel , Laszlo Ersek , Leif Lindholm , Eric Auger , Andrew Jones , Philippe Mathieu-Daude , Julien Grall Date: Mon, 26 Nov 2018 23:37:48 +0100 Message-Id: <20181126223801.17121-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Subject: [PATCH v2 00/13] ArmPkg, ArmVirtPkg: lift 40-bit IPA space limit X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Nov 2018 22:38:27 -0000 Content-Transfer-Encoding: 8bit The ArmVirtQemu targets currently limit the size of the IPA space to 40 bits because that is all what KVM supports. However, this is about to change, and so we need to update the code if we want to ensure that our UEFI firmware builds can keep running on systems that set values other than 40 (which could be > 40 or < 40) So refactor the way we deal with this limit, both for bare metal and for virtual targets, so that a) the range of the GCD memory map is based directly on the CPU's PA range b) the range of the 1:1 mapping in the page tables is based on the CPU's PA range (unless it exceeds what the architecture permits for 4k pages) c) PcdPrePiCpuMemorySize is no longer needed, and can be removed. Patch #1 introduces ARM_MMU_IDMAP_RANGE and ArmGetPhysicalAddressBits () in ArmLib. Patch #2 updates the virt targets to replace a local definition of ArmGetPhysicalAddressBits () with the new ArmLib implementation. Patch #3 updates the ARM MMU code so that the maximum size of the virtual address space is based on ArmGetPhysicalAddressBits () or ARM_MMU_IDMAP_RANGE (whichever produces the smallest result), and no longer on PcdPrePiCpuMemorySize Patch #4 - #8 update all invocations of BuildCpuHob() so that the size of the GCD memory map is based on the CPU's capabilities (and no longer on PcdPrePiCpuMemorySize) Patch #9 and #10 drop some unused PCD references from .inf files. Patch #11 updates QemuVirtMemInfoLib to no longer take PcdPrePiCpuMemorySize into account. Patch #12 removes all overrides of PcdPrePiCpuMemorySize Patch #13 (which should only be merged after edk2-platforms has been updated as well) removes PcdPrePiCpuMemorySize entirely. Changes since v1: - add a define ARM_MMU_IDMAP_RANGE that describes the maximum size of the virtual address space when running with 4k pages, which may deviate from the maximum size when running under the OS - to avoid having to reason in complicated ways between ARM_MMU_IDMAP_RANGE, the number of physical address bits supported by the CPU and the size of the GCD memory map, just drop PcdPrePiCpuMemorySize entirely Note that I dropped a couple of acks (from Laszlo and Philippe) due to the fact that the code looks rather different now. Cc: Laszlo Ersek Cc: Leif Lindholm Cc: Eric Auger Cc: Andrew Jones Cc: Philippe Mathieu-Daude Cc: Julien Grall Ard Biesheuvel (13): ArmPkg/ArmLib: add support for reading the max physical address space size ArmVirtPkg: refactor reading of the physical address space size ArmPkg/ArmMmuLib: take the CPU supported maximum PA space into account ArmPkg/CpuPei: base GCD memory space size on CPU's PA range ArmPlatformPkg/PrePi: base GCD memory space size on CPU's PA range ArmVirtPkg/PrePi: base GCD memory space size on CPU's PA range BeagleBoardPkg/PrePi: base GCD memory space size on CPU's PA range EmbeddedPkg/PrePiHobLib: base GCD memory space size on CPU's PA range ArmPlatformPkg/PlatformPei: drop unused PCD references EmbeddedPkg/PrePiLib: drop unused PCD reference ArmVirtPkg/QemuVirtMemInfoLib: ignore PcdPrePiCpuMemorySize ArmVirtPkg: drop PcdPrePiCpuMemorySize assignments from all platforms EmbeddedPkg/EmbeddedPkg.dec: drop PcdPrePiCpuMemorySize declarations EmbeddedPkg/EmbeddedPkg.dec | 4 -- ArmVirtPkg/ArmVirt.dsc.inc | 3 -- ArmVirtPkg/ArmVirtQemu.dsc | 4 -- ArmVirtPkg/ArmVirtQemuKernel.dsc | 4 -- ArmPkg/Drivers/CpuPei/CpuPei.inf | 1 - ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf | 3 -- ArmPkg/Library/ArmMmuLib/ArmMmuPeiLib.inf | 3 -- ArmPlatformPkg/PlatformPei/PlatformPeiLib.inf | 3 -- ArmPlatformPkg/PlatformPei/PlatformPeim.inf | 3 -- ArmPlatformPkg/PrePi/PeiMPCore.inf | 1 - ArmPlatformPkg/PrePi/PeiUniCore.inf | 1 - .../QemuVirtMemInfoLib/QemuVirtMemInfoLib.inf | 7 ---- .../QemuVirtMemInfoPeiLib.inf | 7 ---- .../XenVirtMemInfoLib/XenVirtMemInfoLib.inf | 6 --- .../PrePi/ArmVirtPrePiUniCoreRelocatable.inf | 1 - BeagleBoardPkg/PrePi/PeiUniCore.inf | 1 - .../Library/PrePiHobLib/PrePiHobLib.inf | 1 - EmbeddedPkg/Library/PrePiLib/PrePiLib.inf | 1 - ArmPkg/Include/Library/ArmLib.h | 17 ++++++++ .../Include/Library/ArmVirtMemInfoLib.h | 1 + ArmPkg/Drivers/CpuPei/CpuPei.c | 2 +- .../Library/ArmMmuLib/AArch64/ArmMmuLibCore.c | 11 +++++- ArmPlatformPkg/PrePi/PrePi.c | 2 +- .../ArmVirtMemoryInitPeiLib.c | 5 ++- .../QemuVirtMemInfoLib/QemuVirtMemInfoLib.c | 11 +----- .../XenVirtMemInfoLib/XenVirtMemInfoLib.c | 8 +--- ArmVirtPkg/PrePi/PrePi.c | 2 +- BeagleBoardPkg/PrePi/PrePi.c | 2 +- EmbeddedPkg/Library/PrePiHobLib/Hob.c | 2 +- ArmPkg/Library/ArmLib/AArch64/ArmLibSupport.S | 16 ++++++++ ArmPkg/Library/ArmLib/Arm/ArmLibSupport.S | 8 ++++ .../QemuVirtMemInfoLib/AArch64/PhysAddrTop.S | 39 ------------------- .../QemuVirtMemInfoLib/Arm/PhysAddrTop.S | 24 ------------ .../XenVirtMemInfoLib/AArch64/PhysAddrTop.S | 39 ------------------- .../XenVirtMemInfoLib/Arm/PhysAddrTop.S | 24 ------------ 35 files changed, 64 insertions(+), 203 deletions(-) delete mode 100644 ArmVirtPkg/Library/QemuVirtMemInfoLib/AArch64/PhysAddrTop.S delete mode 100644 ArmVirtPkg/Library/QemuVirtMemInfoLib/Arm/PhysAddrTop.S delete mode 100644 ArmVirtPkg/Library/XenVirtMemInfoLib/AArch64/PhysAddrTop.S delete mode 100644 ArmVirtPkg/Library/XenVirtMemInfoLib/Arm/PhysAddrTop.S -- 2.19.1