From patchwork Mon Nov 26 22:37:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 152080 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp465396ljp; Mon, 26 Nov 2018 14:38:28 -0800 (PST) X-Google-Smtp-Source: AFSGD/UJ7P/h13IO47/jUu/qG4a3djnSNX8qHId8V0+bT5cqtNj/5MZriKodTgWLPHOLPzXCbkBc X-Received: by 2002:a17:902:14b:: with SMTP id 69mr30170428plb.52.1543271908686; Mon, 26 Nov 2018 14:38:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543271908; cv=none; d=google.com; s=arc-20160816; b=zwsdpbCDlssJ7GZq+w4cUYVaI4efWiFeekdbujC4pdcP/QBkByFDOJzwuYIQ7zL+h9 DDasJia0JBLOBjmIngSbkrfzTQrYVaUxmM9l24UT+TSEWYOUiOr111ja7nPCzuPm3RvC hiyZu/GVkR3IOjE9Ga5vt3dtXDCrlKqDekSrGMzj7k56LZx7N2eTeBRwjocrjpQYH83P gbszzy/mTITOrogNDWV/CM1BHHv0RKtrDpM7EKziktV+to0aM7763GeiQsydW+yELSYk 6KQaf9XmE8e7PV7K7Om9Ze88zML/UG9ZhUhR1nllLUIEypqXtGg+z9xSqUOFFTfAgxxl pCiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=ToNARiS5DiiBwIcBNvuz1cYD8ZjcIihbNSPh5PtbTG8=; b=Edemh98TsGAHt12EvNaQTOSfXwLfTuTd7gp/KQMaB6MZYK8jzQ2c4GFLrjwvvITTiZ 3R0GCW/Jjq9Sp3tAlAGJ/AHTMQukBYtk2o1zWKRxYnBzCJC1msjtrRvDeSsacfva/XAm eMyCYo3eauOfP50Sxrh/74Vs/+EDbietgWz6btG/H2yR2mPmvThEl0at7uoc1AhVNG3+ 6fSJQeTS9YFog4QYSKJAxDDYR+qT0ARM8b0g2kN7neO4UUpJuDkZk2W7cqIBiBDEM0y7 Es9/oY1O099tjYcJkr+c7c0Lhzpzw4egDkStcR6COV5fA1Ve+/DogyHGLTZwEOi83xIL cemg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=hG9ILI5S; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id 12-v6si1738185pfu.2.2018.11.26.14.38.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Nov 2018 14:38:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=hG9ILI5S; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 1CD6B21A07A82; Mon, 26 Nov 2018 14:38:28 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org 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-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 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: [edk2] [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: , Cc: Andrew Jones , Laszlo Ersek , Eric Auger Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel