From patchwork Wed Dec 19 20:56:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 154299 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp5381499ljp; Wed, 19 Dec 2018 12:56:55 -0800 (PST) X-Google-Smtp-Source: AFSGD/VHv1SMk3s7r9sDaRXNYt70YF7G7am3+QqTywVQMJSywWBLtffoZcZL72TOFOzbzSTFFS+l X-Received: by 2002:a17:902:b01:: with SMTP id 1mr22041870plq.331.1545253015129; Wed, 19 Dec 2018 12:56:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545253015; cv=none; d=google.com; s=arc-20160816; b=milM/CZkNtnKBGnfIkOwRSfvzNNQ3sJS4nr9Z7Lpp8WwS0H+XuEUS2a1jaWzPtTBo4 FJvN1mjE3yqtN501cbpJqjj/fSBOZgHd35wO5LcBxvrtJOPjOZs38krZ6vvldVUntJZ3 uPz4x9aSEhsBYNaslUZ1mAiITJVtOoNeGWn+GH76yyB2zv7d9f/BGFNkT5R+vvhHV8vD 7XI/n131/ieSyttxca6zpIhjqiO4Uc9ttyyJQqg3cfGvlkhhg3s55+GACMbDWy/IljKP ewD4yukn0jy9HpcaG14eyR+ZUXi/jVwnxS86c+AJd5PWdB25VE3yAHfSV4kM7+7RzpsL hRYA== 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:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=vQEtrpjlJcZ1EtdpONaImNr2Y4mzBxS+dp1zCU/0WTo=; b=j7IhWV/j1oxSdSCzXVIJgmfRHOsGeIPdOhkrYfawIzkUYpZ18yDe3bpeOsMHqlozFT X17lKxTBB7yF7tMLGXYVamuDzBHyz7+xs35TBlpUbv18h9AP+81rVTPpLTSsI8XNLUx8 cp+cSfXI3mLd9S/qbTRBHj61EhMm9+PgLhhMBYyGuZXHVhafSZbDV6vd0520QGC9nuVv YEO3H46p3rEVncSxy+BqrEFfeqC+oz9Njuh1fuFEZzMf5C4kymPtAxmcuFyCAi2c09o2 qmp6pphMBhLel4Oc7loYJshuAuBuBOvH9aWrCifth6m7sKyhsC4g2ca3sXvTZ2Yie554 SmLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Zp2ke9hu; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 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. [198.145.21.10]) by mx.google.com with ESMTPS id w190si16738631pgd.338.2018.12.19.12.56.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Dec 2018 12:56:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Zp2ke9hu; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 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 6DB17211A2D85; Wed, 19 Dec 2018 12:56:54 -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::342; helo=mail-wm1-x342.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) (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 029A5211A209E for ; Wed, 19 Dec 2018 12:56:52 -0800 (PST) Received: by mail-wm1-x342.google.com with SMTP id d15so7428852wmb.3 for ; Wed, 19 Dec 2018 12:56:52 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=uasr7c9HBQ//thAm32QVIgSMAJRKMhO82qqo8kNN7Yw=; b=Zp2ke9hu1PhM7pb8SHwzK+pxcyyVXTgKlAfn8+KkP7Sp8vn/sfxKVg1bVb+IuZw3r0 0zXOKrAGtbleubgnBlkHjyyOXKbTIQB1M3SBtvvFbNfkWL15kBSJY+/FBGHVU4C1U+DS Q2nrjKLv+fWYSgHQ8Chs2pEQ/BMxcqcFkG/4A= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=uasr7c9HBQ//thAm32QVIgSMAJRKMhO82qqo8kNN7Yw=; b=QFBY+VyDNUM0r8X3UpOpNpGZ8Lnwy+mw1W8kzAQmoKgaveLiLoV6gVLxNNLqwZolV9 UV4NRraBRsOD6sx+fZGiKf9gonv2tATNqMx5o9fE6qbumOLndVwPR6zdpw5+yuxFgRkQ tDVa27VVYFWgIWd+5+BRc1Bs31HZdRbDmxdVguo5HQGkAd+BE72JlN0Awa6LqvOLgPjZ QdhZRZeHGDJrs4yr2K29c7whb0AQPMTsQQhC8UTUx4kfXVXjwdc7hcEXI2eaGjimh9AP zybSMUgwuXk1ATavDzDzme9n+Qm3PAMxpjSy3GnLGoQDIBeowH55M1zcD9MhcAG3il72 l35g== X-Gm-Message-State: AA+aEWbMoK+eekJ03t9YKowDUrowZcgvxRlAuKs9N/OxVHzBNncFa+DB 4ZTvfuk9MSmiKY7Sts9nY14H4dLOLQl7fg== X-Received: by 2002:a1c:5545:: with SMTP id j66mr8747577wmb.15.1545253011172; Wed, 19 Dec 2018 12:56:51 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:e5c9:6e00:25cb:e32e]) by smtp.gmail.com with ESMTPSA id j202sm16267294wmf.15.2018.12.19.12.56.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Dec 2018 12:56:50 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Wed, 19 Dec 2018 21:56:35 +0100 Message-Id: <20181219205640.4704-2-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181219205640.4704-1-ard.biesheuvel@linaro.org> References: <20181219205640.4704-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Subject: [edk2] [PATCH v2 1/6] MdePkg/Base: introduce MAX_ALLOC_ADDRESS 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 , Hao Wu , Liming Gao , Michael D Kinney , Laszlo Ersek Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" On some architectures, the maximum representable address deviates from the virtual address range that is accessible by the firmware at boot time. For instance, on AArch64, UEFI mandates a 4 KB page size, which limits the address space to 48 bits, while more than that may be populated on a particular platform, for use by the OS. So introduce a new macro MAX_ALLOC_ADDRESS, which represent the maximum address the firmware should take into account when allocating memory ranges that need to be accessible by the CPU at boot time. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- MdePkg/Include/AArch64/ProcessorBind.h | 5 +++++ MdePkg/Include/Arm/ProcessorBind.h | 5 +++++ MdePkg/Include/Ebc/ProcessorBind.h | 5 +++++ MdePkg/Include/Ia32/ProcessorBind.h | 5 +++++ MdePkg/Include/X64/ProcessorBind.h | 5 +++++ 5 files changed, 25 insertions(+) -- 2.19.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Liming Gao diff --git a/MdePkg/Include/AArch64/ProcessorBind.h b/MdePkg/Include/AArch64/ProcessorBind.h index 968c18f915ae..f4a544b34d78 100644 --- a/MdePkg/Include/AArch64/ProcessorBind.h +++ b/MdePkg/Include/AArch64/ProcessorBind.h @@ -142,6 +142,11 @@ typedef INT64 INTN; /// #define MAX_ADDRESS 0xFFFFFFFFFFFFFFFFULL +/// +/// Maximum usable address at boot time (48 bits using 4 KB pages) +/// +#define MAX_ALLOC_ADDRESS 0xFFFFFFFFFFFFULL + /// /// Maximum legal AArch64 INTN and UINTN values. /// diff --git a/MdePkg/Include/Arm/ProcessorBind.h b/MdePkg/Include/Arm/ProcessorBind.h index 8cca0f3bb050..16a61fc7a325 100644 --- a/MdePkg/Include/Arm/ProcessorBind.h +++ b/MdePkg/Include/Arm/ProcessorBind.h @@ -148,6 +148,11 @@ typedef INT32 INTN; /// #define MAX_ADDRESS 0xFFFFFFFF +/// +/// Maximum usable address at boot time +/// +#define MAX_ALLOC_ADDRESS MAX_ADDRESS + /// /// Maximum legal ARM INTN and UINTN values. /// diff --git a/MdePkg/Include/Ebc/ProcessorBind.h b/MdePkg/Include/Ebc/ProcessorBind.h index 5217cfd97eac..45beb7572817 100644 --- a/MdePkg/Include/Ebc/ProcessorBind.h +++ b/MdePkg/Include/Ebc/ProcessorBind.h @@ -103,6 +103,11 @@ typedef unsigned long UINTN; /// #define MAX_ADDRESS ((UINTN)(~0ULL >> (64 - sizeof (INTN) * 8))) +/// +/// Maximum usable address at boot time (48 bits using 4 KB pages) +/// +#define MAX_ALLOC_ADDRESS MAX_ADDRESS + /// /// Maximum legal EBC INTN and UINTN values. /// diff --git a/MdePkg/Include/Ia32/ProcessorBind.h b/MdePkg/Include/Ia32/ProcessorBind.h index 8e4de7029cfc..71d53e2543bb 100644 --- a/MdePkg/Include/Ia32/ProcessorBind.h +++ b/MdePkg/Include/Ia32/ProcessorBind.h @@ -246,6 +246,11 @@ typedef INT32 INTN; /// #define MAX_ADDRESS 0xFFFFFFFF +/// +/// Maximum usable address at boot time +/// +#define MAX_ALLOC_ADDRESS MAX_ADDRESS + /// /// Maximum legal IA-32 INTN and UINTN values. /// diff --git a/MdePkg/Include/X64/ProcessorBind.h b/MdePkg/Include/X64/ProcessorBind.h index e4254285877b..1c04090c7d03 100644 --- a/MdePkg/Include/X64/ProcessorBind.h +++ b/MdePkg/Include/X64/ProcessorBind.h @@ -260,6 +260,11 @@ typedef INT64 INTN; /// #define MAX_ADDRESS 0xFFFFFFFFFFFFFFFFULL +/// +/// Maximum usable address at boot time +/// +#define MAX_ALLOC_ADDRESS MAX_ADDRESS + /// /// Maximum legal x64 INTN and UINTN values. /// From patchwork Wed Dec 19 20:56:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 154300 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp5381536ljp; Wed, 19 Dec 2018 12:56:57 -0800 (PST) X-Google-Smtp-Source: AFSGD/VhHb75UrWrxOgKJcCfbHuEC0JHM1Jcs+xkdfx3O+fxev0M4RoRj1aAw/G3eS7MLP/kc2mN X-Received: by 2002:a62:2547:: with SMTP id l68mr21563430pfl.131.1545253017842; Wed, 19 Dec 2018 12:56:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545253017; cv=none; d=google.com; s=arc-20160816; b=zcGBjNwQhSFW8pfHxEkgFg+TnpzXJ9RvKtg79+v1aMBSYKvXtKUmTqaGp/0XLVqnT/ FfmA+oyqildUnpS+YnBMoMNw9BwKFXhe4J26BpY5paucFSGvSt9gVEx/R18SSiWAiGXs xT5m4bn8gKQKbgH8lfnDemGeGCGq5/51AoSPgkHfYoqzT+eUv44r+87HpQbreWQxWunG v4DbWullVjDgBPLNPQ3MW5QjrRoVgiNZVlAeYaJmqam94YuJnMmuTf5G/IQ94NuIwVRh TlZLe48X1ww2PlG4riNu2kODpbcy0tMOVL3XXbps/47fPm3ddmR/bJ5NhaOw0D/FZ/WD TdOw== 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:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=r59g/sd4Wwqy9QoEfqbYucycnxKul6TAsbz2g+UGwPg=; b=jawbysTfQ1SU0YpS2H/KnjSZLOowxpobKoAd20lzKnGzjl12U2WfFwkkjS11+P3YMI qN2KuRpyEm/pq0757tjo9H8Xu9tbnO4nd1ZuqvF16feQSEsp+gzat26ajwi1yGE9EqIc rwu85yU9DtA62KzUXujsJ2q8rLI/mFiF1vp83D8s9N9Y4MR+zrNQHdw05RbKMsq/lsgU eSIb5rOmja4mdbZeGlXRsSePGkeHDkBg1MAo+RGqyZhc1Lvv4grAs8OHP2Xm/CXe11Fk RvutOMrPnKV0wq9i8Kgn/Cz52jnms9NUp1IqT7iYTHAG+jUVeRyH57Ss+LX6+8QPCuaI 2T5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=XnfMSgyH; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 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. [198.145.21.10]) by mx.google.com with ESMTPS id v5si15942476ply.74.2018.12.19.12.56.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Dec 2018 12:56:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=XnfMSgyH; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 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 9E90B211A2D90; Wed, 19 Dec 2018 12:56:56 -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::441; helo=mail-wr1-x441.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) (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 748AF211A2D88 for ; Wed, 19 Dec 2018 12:56:54 -0800 (PST) Received: by mail-wr1-x441.google.com with SMTP id l9so20866018wrt.13 for ; Wed, 19 Dec 2018 12:56:54 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=3d0467lefD/nB3Ybk3v99pEO4QMNXBQORMfuohqAGXc=; b=XnfMSgyHj6/Srz9PupGSaNZrhl7i43ds8BAMrD8maey1Ue5oiE8s0MY2XnS83ltCv8 JANCp1aDXLgihRzSuO6Nrn9oa9Rx4Fn5V2vlQj0XIl/QEi589dfXIxm8CSHeR6Y50dJx pucJUXgwgtN3CSngqaA55+959w52V5xR0ahAU= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=3d0467lefD/nB3Ybk3v99pEO4QMNXBQORMfuohqAGXc=; b=rlxJcoeTgPY8CCjLGTB44YMTnUWW3xmPnV1zUmGYDCXDeT6R+Er7A7jEfnHARao9Is pMXcyk57UADC2vQAgUfFBI1h0omhev3xP8EAP+a5Y1NYo6IcrG8Xz3T3OOXozRWN7N6/ rDe6qLRX3Lwx3Dr+iJdwEKGWyJ9xU0wGtk2VX0POHVL9T6q46jwTVvMR9MWdKQG4YjUx Rj9ppj1j8Ls5xsPncZpnZzz3Vv1LRfzy2jeMgFeU7oMfMQrpfOU7gi1VZdqcDShnHyq9 AXQCRN6eiEjnMmSuHV085kFd3ILx173FAbkiOlxo7RQvL2Xfj7yGLMmCNzNlu0s5M6qq LqVQ== X-Gm-Message-State: AA+aEWaOFwdvrUVXvEwq451DgmoaelSTF3iXVUMzSmMU90ZryEbCgbSY 9m0dVXxP1NpTO3An9aYid/CvLNvrjMftbg== X-Received: by 2002:a5d:6a42:: with SMTP id t2mr21753400wrw.50.1545253012744; Wed, 19 Dec 2018 12:56:52 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:e5c9:6e00:25cb:e32e]) by smtp.gmail.com with ESMTPSA id j202sm16267294wmf.15.2018.12.19.12.56.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Dec 2018 12:56:51 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Wed, 19 Dec 2018 21:56:36 +0100 Message-Id: <20181219205640.4704-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181219205640.4704-1-ard.biesheuvel@linaro.org> References: <20181219205640.4704-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Subject: [edk2] [PATCH v2 2/6] MdeModulePkg/Dxe/Gcd: disregard memory above MAX_ALLOC_ADDRESS 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 , Hao Wu , Liming Gao , Michael D Kinney , Laszlo Ersek Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Update the GCD memory map initialization code so it disregards memory that is not addressable by the CPU at boot time. This only affects the first memory descriptor that is added, other memory descriptors are permitted that describe memory ranges that may be accessible to the CPU itself only when executing under the OS. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Reviewed-by: Jian J Wang --- MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.19.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c index a76d2db73c46..504e14a74e1d 100644 --- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c +++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c @@ -2284,7 +2284,7 @@ CoreInitializeMemoryServices ( // region that is big enough to initialize the DXE core. Always skip the PHIT Resource HOB. // The max address must be within the physically addressible range for the processor. // - HighAddress = MAX_ADDRESS; + HighAddress = MAX_ALLOC_ADDRESS; for (Hob.Raw = *HobStart; !END_OF_HOB_LIST(Hob); Hob.Raw = GET_NEXT_HOB(Hob)) { // // Skip the Resource Descriptor HOB that contains the PHIT @@ -2300,7 +2300,7 @@ CoreInitializeMemoryServices ( } // - // Skip Resource Descriptor HOBs that do not describe tested system memory below MAX_ADDRESS + // Skip Resource Descriptor HOBs that do not describe tested system memory below MAX_ALLOC_ADDRESS // ResourceHob = Hob.ResourceDescriptor; if (ResourceHob->ResourceType != EFI_RESOURCE_SYSTEM_MEMORY) { @@ -2309,14 +2309,14 @@ CoreInitializeMemoryServices ( if ((ResourceHob->ResourceAttribute & MEMORY_ATTRIBUTE_MASK) != TESTED_MEMORY_ATTRIBUTES) { continue; } - if ((ResourceHob->PhysicalStart + ResourceHob->ResourceLength) > (EFI_PHYSICAL_ADDRESS)MAX_ADDRESS) { + if ((ResourceHob->PhysicalStart + ResourceHob->ResourceLength) > (EFI_PHYSICAL_ADDRESS)MAX_ALLOC_ADDRESS) { continue; } // // Skip Resource Descriptor HOBs that are below a previously found Resource Descriptor HOB // - if (HighAddress != (EFI_PHYSICAL_ADDRESS)MAX_ADDRESS && ResourceHob->PhysicalStart <= HighAddress) { + if (HighAddress != (EFI_PHYSICAL_ADDRESS)MAX_ALLOC_ADDRESS && ResourceHob->PhysicalStart <= HighAddress) { continue; } From patchwork Wed Dec 19 20:56:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 154301 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp5381587ljp; Wed, 19 Dec 2018 12:57:01 -0800 (PST) X-Google-Smtp-Source: AFSGD/VTMeYkpWM9oFJoh4IKRpH88UfQiJEHnivoHWOeooKiP47YeeEF/VkyhRaT7doMSqZxXM4t X-Received: by 2002:a63:235f:: with SMTP id u31mr20569178pgm.122.1545253021092; Wed, 19 Dec 2018 12:57:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545253021; cv=none; d=google.com; s=arc-20160816; b=QpG5jh2i2AWlkPGjxL5uv6wvTQAcviZ3O9pOyAj+H98HhhXBblwi/SrHoNPlUwPq4l kD6L0zabwPS6IOTMnAMFs6ar+pimAfYNqfoOTbqpIqbPC0Bb4gjqR8qzxMPf4dSTq+NP e5jX85L2XCPsBkJCEz1MKrJ+cGLF7MeF/pqRusiYp0e6FwPZ2iB5PaJZXzvIbPDhoE51 bi/zVvIR2yFHDuJbHG0QWtuYwGAq5pyujVhOD/WWSN1DNDBFzVMMR39DEeZOXNI7ST97 7Hw90QDBDxUr00zdnCeIjYKV0Ai9PT4iK3DYzHYAKoUFsxGUW0m+Pq/WmDppOvuGhDB+ rArQ== 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:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=V+H4luQWa4qx+F0zMMi4bhXjNvj6iy5mYuh1+oi4VS4=; b=QZe5WWpq55Wz81b5I7/gM7yJHIiS3DQ4RebU0vLP0uKug0Sn7T+ROHoM9uSxigJYdB +oVBak1A1OjjQbqWRNv27g1SicczJkXmhoWDjcHG9RGgME+fUFV78L+AS9Z9UPO+JfmN tyj6gk42PCdhQ/cMCj6d1QAHTywneYOnH4IvemvatpQmvaRLSihkD0JXOMPpNm4Hk4GV p2h/ZnFtk6QMAAku+i+nRCMUMZO6QDc3edViB1JS2BdhbwC22baPfF7iWLGwn/qqzMc+ KRslGse2mq5BqeS7t78soyusQFxGGGLCYTtl5EEURMQu/r4V1T+vnIbHqDU11V2j1nCs Lwjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=W0d6SWtD; 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 g1si16555437pgu.149.2018.12.19.12.57.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Dec 2018 12:57:01 -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=W0d6SWtD; 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 CF6C4211A2D92; Wed, 19 Dec 2018 12:56:58 -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::343; helo=mail-wm1-x343.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) (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 3CA8D211A2D88 for ; Wed, 19 Dec 2018 12:56:56 -0800 (PST) Received: by mail-wm1-x343.google.com with SMTP id p6so7576440wmc.1 for ; Wed, 19 Dec 2018 12:56:56 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=aCUdqos/08USlHIiVgndGXk235pO7GX3DEnUuk7DuCw=; b=W0d6SWtD5wxXkOMbw/ae8b/Y5AzaUoIDWJzAn1rOebzbqMTb4CcdwnZei0SwkavRae niGjEXsbcMs1Sivmow1qHbMLsgBKeWFMMvgEgBrxu0Thnme2px2sHm2NrIjVIBjsbV10 7Zp9Yewa4IHUuSr7HwEB8z8d09dK61sCJ/caI= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=aCUdqos/08USlHIiVgndGXk235pO7GX3DEnUuk7DuCw=; b=DPd4K7WCGLYX40PZ7p3eE7DryLNg53aX9C3RK34j70841zkAxfM1R2Z3Tb7CcdkXTv SyZTRwK0A8Tcqp7lXR2sd7CTl3mtJn9RD+00RDssu8PDYHbpvyWTX2KcX+RBVuxZDSa8 NVvKXAKdj+s86jAujInQcxbAdddDfkU97ZvvrkY2jOK2tEKJYzz/aFGFbcNsYh+uFX5q Cy6ST54p4G/yFo0N0HTY+GwjHns4g3IHJ2EGooEO3iwRdphAl5sx+6KCrWTBTMVYCPVk bqkk7lBsmrsTDclca4HqBAyvOd1IbAIyKjv259cewDQg+CUens3WymEY3e+dNVBLd8/m UkGQ== X-Gm-Message-State: AA+aEWZqSNIishOOuVtw+4dPRGvtitgbkTNK/lPeDKgUR4Ku2AZqmbDt jS3UPgXvp1wIaCevRJlCXe7mqxNeyrLsMw== X-Received: by 2002:a1c:6442:: with SMTP id y63mr8261244wmb.143.1545253014255; Wed, 19 Dec 2018 12:56:54 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:e5c9:6e00:25cb:e32e]) by smtp.gmail.com with ESMTPSA id j202sm16267294wmf.15.2018.12.19.12.56.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Dec 2018 12:56:53 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Wed, 19 Dec 2018 21:56:37 +0100 Message-Id: <20181219205640.4704-4-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181219205640.4704-1-ard.biesheuvel@linaro.org> References: <20181219205640.4704-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Subject: [edk2] [PATCH v2 3/6] MdeModulePkg/Dxe/Page: take MAX_ALLOC_ADDRESS into account 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 , Hao Wu , Liming Gao , Michael D Kinney , Laszlo Ersek Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Take MAX_ALLOC_ADDRESS into account in the implementation of the page allocation routines, so that they will only return memory that is addressable by the CPU at boot time, even if more memory is available in the GCD memory map. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- MdeModulePkg/Core/Dxe/Mem/Page.c | 52 ++++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) -- 2.19.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Jian J Wang diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c b/MdeModulePkg/Core/Dxe/Mem/Page.c index 961c5b833546..5ad8e1171ef7 100644 --- a/MdeModulePkg/Core/Dxe/Mem/Page.c +++ b/MdeModulePkg/Core/Dxe/Mem/Page.c @@ -52,26 +52,26 @@ LIST_ENTRY mFreeMemoryMapEntryList = INITIALIZE_LIST_HEAD_VARIABLE (mFreeMemor BOOLEAN mMemoryTypeInformationInitialized = FALSE; EFI_MEMORY_TYPE_STATISTICS mMemoryTypeStatistics[EfiMaxMemoryType + 1] = { - { 0, MAX_ADDRESS, 0, 0, EfiMaxMemoryType, TRUE, FALSE }, // EfiReservedMemoryType - { 0, MAX_ADDRESS, 0, 0, EfiMaxMemoryType, FALSE, FALSE }, // EfiLoaderCode - { 0, MAX_ADDRESS, 0, 0, EfiMaxMemoryType, FALSE, FALSE }, // EfiLoaderData - { 0, MAX_ADDRESS, 0, 0, EfiMaxMemoryType, FALSE, FALSE }, // EfiBootServicesCode - { 0, MAX_ADDRESS, 0, 0, EfiMaxMemoryType, FALSE, FALSE }, // EfiBootServicesData - { 0, MAX_ADDRESS, 0, 0, EfiMaxMemoryType, TRUE, TRUE }, // EfiRuntimeServicesCode - { 0, MAX_ADDRESS, 0, 0, EfiMaxMemoryType, TRUE, TRUE }, // EfiRuntimeServicesData - { 0, MAX_ADDRESS, 0, 0, EfiMaxMemoryType, FALSE, FALSE }, // EfiConventionalMemory - { 0, MAX_ADDRESS, 0, 0, EfiMaxMemoryType, FALSE, FALSE }, // EfiUnusableMemory - { 0, MAX_ADDRESS, 0, 0, EfiMaxMemoryType, TRUE, FALSE }, // EfiACPIReclaimMemory - { 0, MAX_ADDRESS, 0, 0, EfiMaxMemoryType, TRUE, FALSE }, // EfiACPIMemoryNVS - { 0, MAX_ADDRESS, 0, 0, EfiMaxMemoryType, FALSE, FALSE }, // EfiMemoryMappedIO - { 0, MAX_ADDRESS, 0, 0, EfiMaxMemoryType, FALSE, FALSE }, // EfiMemoryMappedIOPortSpace - { 0, MAX_ADDRESS, 0, 0, EfiMaxMemoryType, TRUE, TRUE }, // EfiPalCode - { 0, MAX_ADDRESS, 0, 0, EfiMaxMemoryType, FALSE, FALSE }, // EfiPersistentMemory - { 0, MAX_ADDRESS, 0, 0, EfiMaxMemoryType, FALSE, FALSE } // EfiMaxMemoryType + { 0, MAX_ALLOC_ADDRESS, 0, 0, EfiMaxMemoryType, TRUE, FALSE }, // EfiReservedMemoryType + { 0, MAX_ALLOC_ADDRESS, 0, 0, EfiMaxMemoryType, FALSE, FALSE }, // EfiLoaderCode + { 0, MAX_ALLOC_ADDRESS, 0, 0, EfiMaxMemoryType, FALSE, FALSE }, // EfiLoaderData + { 0, MAX_ALLOC_ADDRESS, 0, 0, EfiMaxMemoryType, FALSE, FALSE }, // EfiBootServicesCode + { 0, MAX_ALLOC_ADDRESS, 0, 0, EfiMaxMemoryType, FALSE, FALSE }, // EfiBootServicesData + { 0, MAX_ALLOC_ADDRESS, 0, 0, EfiMaxMemoryType, TRUE, TRUE }, // EfiRuntimeServicesCode + { 0, MAX_ALLOC_ADDRESS, 0, 0, EfiMaxMemoryType, TRUE, TRUE }, // EfiRuntimeServicesData + { 0, MAX_ALLOC_ADDRESS, 0, 0, EfiMaxMemoryType, FALSE, FALSE }, // EfiConventionalMemory + { 0, MAX_ALLOC_ADDRESS, 0, 0, EfiMaxMemoryType, FALSE, FALSE }, // EfiUnusableMemory + { 0, MAX_ALLOC_ADDRESS, 0, 0, EfiMaxMemoryType, TRUE, FALSE }, // EfiACPIReclaimMemory + { 0, MAX_ALLOC_ADDRESS, 0, 0, EfiMaxMemoryType, TRUE, FALSE }, // EfiACPIMemoryNVS + { 0, MAX_ALLOC_ADDRESS, 0, 0, EfiMaxMemoryType, FALSE, FALSE }, // EfiMemoryMappedIO + { 0, MAX_ALLOC_ADDRESS, 0, 0, EfiMaxMemoryType, FALSE, FALSE }, // EfiMemoryMappedIOPortSpace + { 0, MAX_ALLOC_ADDRESS, 0, 0, EfiMaxMemoryType, TRUE, TRUE }, // EfiPalCode + { 0, MAX_ALLOC_ADDRESS, 0, 0, EfiMaxMemoryType, FALSE, FALSE }, // EfiPersistentMemory + { 0, MAX_ALLOC_ADDRESS, 0, 0, EfiMaxMemoryType, FALSE, FALSE } // EfiMaxMemoryType }; -EFI_PHYSICAL_ADDRESS mDefaultMaximumAddress = MAX_ADDRESS; -EFI_PHYSICAL_ADDRESS mDefaultBaseAddress = MAX_ADDRESS; +EFI_PHYSICAL_ADDRESS mDefaultMaximumAddress = MAX_ALLOC_ADDRESS; +EFI_PHYSICAL_ADDRESS mDefaultBaseAddress = MAX_ALLOC_ADDRESS; EFI_MEMORY_TYPE_INFORMATION gMemoryTypeInformation[EfiMaxMemoryType + 1] = { { EfiReservedMemoryType, 0 }, @@ -419,7 +419,7 @@ PromoteMemoryResource ( Entry = CR (Link, EFI_GCD_MAP_ENTRY, Link, EFI_GCD_MAP_SIGNATURE); if (Entry->GcdMemoryType == EfiGcdMemoryTypeReserved && - Entry->EndAddress < MAX_ADDRESS && + Entry->EndAddress < MAX_ALLOC_ADDRESS && (Entry->Capabilities & (EFI_MEMORY_PRESENT | EFI_MEMORY_INITIALIZED | EFI_MEMORY_TESTED)) == (EFI_MEMORY_PRESENT | EFI_MEMORY_INITIALIZED)) { // @@ -640,7 +640,7 @@ CoreAddMemoryDescriptor ( gMemoryTypeInformation[FreeIndex].NumberOfPages ); mMemoryTypeStatistics[Type].BaseAddress = 0; - mMemoryTypeStatistics[Type].MaximumAddress = MAX_ADDRESS; + mMemoryTypeStatistics[Type].MaximumAddress = MAX_ALLOC_ADDRESS; } } return; @@ -697,7 +697,7 @@ CoreAddMemoryDescriptor ( } } mMemoryTypeStatistics[Type].CurrentNumberOfPages = 0; - if (mMemoryTypeStatistics[Type].MaximumAddress == MAX_ADDRESS) { + if (mMemoryTypeStatistics[Type].MaximumAddress == MAX_ALLOC_ADDRESS) { mMemoryTypeStatistics[Type].MaximumAddress = mDefaultMaximumAddress; } } @@ -1318,15 +1318,15 @@ CoreInternalAllocatePages ( // // The max address is the max natively addressable address for the processor // - MaxAddress = MAX_ADDRESS; + MaxAddress = MAX_ALLOC_ADDRESS; // // Check for Type AllocateAddress, // if NumberOfPages is 0 or - // if (NumberOfPages << EFI_PAGE_SHIFT) is above MAX_ADDRESS or + // if (NumberOfPages << EFI_PAGE_SHIFT) is above MAX_ALLOC_ADDRESS or // if (Start + NumberOfBytes) rolls over 0 or - // if Start is above MAX_ADDRESS or - // if End is above MAX_ADDRESS, + // if Start is above MAX_ALLOC_ADDRESS or + // if End is above MAX_ALLOC_ADDRESS, // return EFI_NOT_FOUND. // if (Type == AllocateAddress) { @@ -1968,7 +1968,7 @@ CoreAllocatePoolPages ( // // Find the pages to convert // - Start = FindFreePages (MAX_ADDRESS, NumberOfPages, PoolType, Alignment, + Start = FindFreePages (MAX_ALLOC_ADDRESS, NumberOfPages, PoolType, Alignment, NeedGuard); // From patchwork Wed Dec 19 20:56:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 154302 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp5381635ljp; Wed, 19 Dec 2018 12:57:04 -0800 (PST) X-Google-Smtp-Source: AFSGD/UIjnfd5bfYdLHvMJ7eTF0m+8gf59z2uD9a/A4WmNFX0e7iDqZzEuIdC27x/dweOq5glOJE X-Received: by 2002:a63:d40a:: with SMTP id a10mr20369054pgh.394.1545253024411; Wed, 19 Dec 2018 12:57:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545253024; cv=none; d=google.com; s=arc-20160816; b=d9UeqJaNUB1pmRxmM7IhoSry3MXoZC+X6V4PB1SaW86Uk1Uf1kTTiEXEy3s8aUjpvm HPn3lNIDDunxV4T5uT95vqQupvCgFI+leKSBUL6JhV5uk4PQzMQu0RnD/EHeG7IqW7Pv q+34bjU+Fxl8ZIlYws0JOrq3raBapPx9Gx720vF7VDxcxFjfCEQ0Ae3M7DIUYsYuKz9f Rtldfo1HLD3vecFYf/besna/NaVX2PMz5MYj7qB3cGbDIm2WE237kts2/X1o7IfcDgny 3bJSu+JjMtdc0LX7fQXw7vwXrwofLLmZuCoCmlGLVJZ+ACGxEpRwikx1erU5EBuok/m2 uT0A== 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:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=9wYNmT0xZ7fxsCaGjCqPmIJmy2Q/uql/Ox/Sp2lNuUA=; b=HEDSSGm0nFmtrGzsZVYVaGh5/2shvpi0dX6W19DeIsAO7IvnGnJw/RDkQ5BqcD3YwU 2azLpse4qbGJlmBVRvwBCRUg6E1z0Y7oxqz7761y6ognH9deMl56NtChIBHpAiaiptEk ry5882g/Nw/aMZr4pTj4eTghBxI4b4OETfE+BripTOH/2XSgeA9jqA7vxGe3nDrdSaml nNzcRe+DRfQ758e5AiInKTcKj6FrNfWy70r+uKHiRtNkfCdhfegCo53GN5aTyhoocC0w nFGrlOfIYlqPVtccXQY+laIZy4MK0HIY8kzGaJEoYCJwVbLKAoWhxOluW7j4KYyPBDxf hLJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=iUvmngVL; 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 c32si16800741plj.38.2018.12.19.12.57.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Dec 2018 12:57:04 -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=iUvmngVL; 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 0BB3C211A2D99; Wed, 19 Dec 2018 12:57:00 -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::343; helo=mail-wm1-x343.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) (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 9408E211A2098 for ; Wed, 19 Dec 2018 12:56:57 -0800 (PST) Received: by mail-wm1-x343.google.com with SMTP id a62so7421543wmh.4 for ; Wed, 19 Dec 2018 12:56:57 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=vdxkNkHkdkTSDdm/fPvLD3Gzy8B9mEIMa4UrE55LChU=; b=iUvmngVL8lBUtlC1TQGRGoartXp/UUGT0SHmTYcxBP/b5r4tItIBh/kPP3BhAXG14e KYnnQyh9mx12TelAh7727sAMikNAJb9/3QtzUASgInnzQ0a358kQkIV3o5vU00RO+LLw 7JRZvAEacDvbpPfRMgWbpchDdVDnghDLtJ7P0= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=vdxkNkHkdkTSDdm/fPvLD3Gzy8B9mEIMa4UrE55LChU=; b=fOr1nQ07vvXyc5RaRfDtn5DFv8E9UOxRNGRvoIs5RvsCqHTuqDGt34cO6sU7Zb67eY L7PqBVS5iytkOvjyFc/F9Hnkyk7xY0d7jqVWuEQ2xRVVvuTrcHVfsUrA/oR2M2StHKvX 0WBMgDrPHIW2GOnwmBCIeyWgYc8mYQJnJsJLptc8bf2Kon7HEBBGwvwEMMRWSM7GBPtl eI/LdiraEktjVHtY2D/4hWxOYwaqT4OzjDO2gY/ZfGXlydxWMiJ9a2A8hbbuQhC6vMyx iJmXrhk1FeErcd39j6sYIuHXXFuOmUfuSegxEgyz/ZRxpSTfflcvPgT21IO9aLB6PHcv 6a7A== X-Gm-Message-State: AA+aEWa+YE5XoCyW5x91SspdvISuZndbR4nJ4MiBLS0rtQKGoE0N0pnY C3Z8O/zUe22UIcL2TjNlr9b5i5lH8rD62g== X-Received: by 2002:a1c:8089:: with SMTP id b131mr8709467wmd.141.1545253015892; Wed, 19 Dec 2018 12:56:55 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:e5c9:6e00:25cb:e32e]) by smtp.gmail.com with ESMTPSA id j202sm16267294wmf.15.2018.12.19.12.56.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Dec 2018 12:56:55 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Wed, 19 Dec 2018 21:56:38 +0100 Message-Id: <20181219205640.4704-5-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181219205640.4704-1-ard.biesheuvel@linaro.org> References: <20181219205640.4704-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Subject: [edk2] [PATCH v2 4/6] ArmPkg/ArmMmuLib: take MAX_ALLOC_ADDRESS into account 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 , Hao Wu , Liming Gao , Michael D Kinney , Laszlo Ersek Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" When creating the page tables for the 1:1 mapping, ensure that we don't attempt to map more than what is architecturally permitted when running with 4 KB pages, which is 48 bits of VA. This will be reflected in the value of MAX_ALLOC_ADDRESS once we override it for AArch64, so use that macro instead of MAX_ADDRESS. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Reviewed-by: Laszlo Ersek --- ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.19.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Leif Lindholm diff --git a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c index 5403b8d4070e..e41044142ef4 100644 --- a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c +++ b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c @@ -612,7 +612,7 @@ ArmConfigureMmu ( // use of 4 KB pages. // MaxAddress = MIN (LShiftU64 (1ULL, ArmGetPhysicalAddressBits ()) - 1, - MAX_ADDRESS); + MAX_ALLOC_ADDRESS); // Lookup the Table Level to get the information LookupAddresstoRootTable (MaxAddress, &T0SZ, &RootTableEntryCount); From patchwork Wed Dec 19 20:56:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 154303 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp5381671ljp; Wed, 19 Dec 2018 12:57:07 -0800 (PST) X-Google-Smtp-Source: AFSGD/UVS6Ah9LOnHhZNiUU7xTa5hYXOdnWGd+isC0aUYPd3kh59vyS7o/VLcMIejjUaZcpXEBiR X-Received: by 2002:a63:42c1:: with SMTP id p184mr20560258pga.202.1545253027714; Wed, 19 Dec 2018 12:57:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545253027; cv=none; d=google.com; s=arc-20160816; b=ZnVHxlcZBBCtlqWj2d7hrZiw1DM2KLs/7Jp/gvr67ignadOrF1MX2IJjH7l1VsddPs PRStm/nmODD9xYjfa0NnrayZ9Zqi/D2cNQwxw50Bynpd0gLEBhp19zKuCrG3/hDU6WxI fSnl8GGclLWhrBmBB5ucaEWaKsdVZiX1MfFBtg7HtjbGKseYu00aYw1LTSm4S8D4ENnY 14+d6E83UMGtRjSJ2/PQ7gg4BgdXNp17ITY2vZEQoQT+8SIkaLrEkbX206zWRDyaiR0Q sDo2aHKhNdxCxOd3DdENnrAouycNXS8+NzGcncy8HfeVdX4kwX1gsihgN0AN2fQapSad ry2A== 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:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=5qyqw1dINdPa3tlbsaPoJeEcj2NDW597AhvCcJmagwQ=; b=GgSAstKkzhIWEn8ue/LzrL0RzIknk6pTSPIwddiHwRJQXsp50yTDOgxHCNYZsXICIU QdGNAPcKAGQJ/oGIBalfAbuKms0f+ANunoCpqNqpfs/UPIm5gBSw5+fxCTbQuz67oeY0 vyccDlbOInycP9arCyRDK+6lHHN7UiOnX02B3dJpKCbHW+PUr7ebdHn7NMgrtu68H0Sf 2EDtZY+FOoRd7DBO77wjnmPbNLbjFqCUCaSR0HjstC+yKCAFikGkjPzAOO/ceVxXI7/3 gXLDTszPGfbe6bJJyvqIUvSlq1BAjtPEIxeUyumIzNN0Gs3Ji/DyGgRFW1AJHORWkPLO 2wnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=e5lCZyj9; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 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. [198.145.21.10]) by mx.google.com with ESMTPS id g1si16917011pld.197.2018.12.19.12.57.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Dec 2018 12:57:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=e5lCZyj9; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 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 3773C211A2D9D; Wed, 19 Dec 2018 12:57:00 -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::443; helo=mail-wr1-x443.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) (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 1650F211A2D83 for ; Wed, 19 Dec 2018 12:56:58 -0800 (PST) Received: by mail-wr1-x443.google.com with SMTP id p4so20918189wrt.7 for ; Wed, 19 Dec 2018 12:56:58 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=8o2UomuBLMrpu3ZOFLbhutPIjS8YZaTTqE4M6XaXwBI=; b=e5lCZyj9NAD/Pa3RwdnZuqJBFrN3TQGY2Qh7BFJ+RU43NCWMw9Hhh5ivy9kAyvApMX U2weiT6gTHawIbKzmYMUhvcfJ6SCurtF34yZQgAfm3yq/coD/vbcR3yTeX4y0vDbvKUU dUCOPwZasM+2HVDG4Mh73WrM/PIRl76g8Wxx8= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=8o2UomuBLMrpu3ZOFLbhutPIjS8YZaTTqE4M6XaXwBI=; b=kEWbQoWMkzzkAJw3jkcfQe1t3du4cos6JfM07EOARjnzc/+XP+d1Xn2hsSMFZLpq8v 4MsRUPrszCXqRkM8VFoFhRuaNDUliBFO65zGZ7P9bTdHwgu/O/RTbRyPjzV8lQmuKxO5 1vqNar+8KM4Z+Pjx3unZVQHTORtbUj+KCn218t5dTI/ihOey2iWJ/YCgCXQZ7HmbM7dN RqvtZag/MCIwzTxIZiPOZlCDAoJcQJdW1r9Iboh+7yTjf2Vy9Gp7BWkDKy6gJRDW8xGI 5wjQdAHGMPKI0AH/Tb3AO+uUFhGkHjxd1WhsOFzoXXxLrYR8n9ZC6O/nzH1zqWZrxkPn lKwg== X-Gm-Message-State: AA+aEWaweMHV3Xvz5I2z2MM1xMVpyolsngik2QX195yX8iKWEPqVaduO 1Kdd4OQ3ad5X44f4Sqx9WqnsK4fCDYnoqQ== X-Received: by 2002:adf:e488:: with SMTP id i8mr20840857wrm.10.1545253017251; Wed, 19 Dec 2018 12:56:57 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:e5c9:6e00:25cb:e32e]) by smtp.gmail.com with ESMTPSA id j202sm16267294wmf.15.2018.12.19.12.56.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Dec 2018 12:56:56 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Wed, 19 Dec 2018 21:56:39 +0100 Message-Id: <20181219205640.4704-6-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181219205640.4704-1-ard.biesheuvel@linaro.org> References: <20181219205640.4704-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Subject: [edk2] [PATCH v2 5/6] ArmPlatformPkg/MemoryInitPeim: take MAX_ALLOC_ADDRESS into account 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 , Hao Wu , Liming Gao , Michael D Kinney , Laszlo Ersek Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Limit the PEI memory region so it will not extend beyond what we can address architecturally when running with 4 KB pages. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.19.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Leif Lindholm diff --git a/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c b/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c index 389a2e6f1abd..010f93add76b 100644 --- a/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c +++ b/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c @@ -105,12 +105,12 @@ InitializeMemory ( // Ensure PcdSystemMemorySize has been set ASSERT (PcdGet64 (PcdSystemMemorySize) != 0); - ASSERT (PcdGet64 (PcdSystemMemoryBase) < (UINT64)MAX_ADDRESS); + ASSERT (PcdGet64 (PcdSystemMemoryBase) < (UINT64)MAX_ALLOC_ADDRESS); SystemMemoryBase = (UINTN)PcdGet64 (PcdSystemMemoryBase); SystemMemoryTop = SystemMemoryBase + PcdGet64 (PcdSystemMemorySize); - if (SystemMemoryTop - 1 > MAX_ADDRESS) { - SystemMemoryTop = (UINT64)MAX_ADDRESS + 1; + if (SystemMemoryTop - 1 > MAX_ALLOC_ADDRESS) { + SystemMemoryTop = (UINT64)MAX_ALLOC_ADDRESS + 1; } FdBase = (UINTN)PcdGet64 (PcdFdBaseAddress); FdTop = FdBase + (UINTN)PcdGet32 (PcdFdSize); From patchwork Wed Dec 19 20:56:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 154304 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp5381724ljp; Wed, 19 Dec 2018 12:57:11 -0800 (PST) X-Google-Smtp-Source: AFSGD/Xh3cWxv+L6BFEZn/0fmofmL0xXnHO1jUsoLWU24qEEUumV+sA5ChIPHzr89/ZbEbx2XgoW X-Received: by 2002:a62:8893:: with SMTP id l141mr21589648pfd.1.1545253031221; Wed, 19 Dec 2018 12:57:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545253031; cv=none; d=google.com; s=arc-20160816; b=LgsLRbdBkHuox3tvF2MWkGhbmRkYKxtImKOuGDnMCKylajOS44zl04epIPFPRGZZs4 K7M13gGmYiSqFHviVydR6KXJhdgUEs1U81SF+KCVgsUADKeXT8yl3Hl5ychmkmcMHTEQ DhNzFXwsxciQ4fdXcUu4Uz7BfOIo9vubCnVLnxuV3toYELazndsZBkhHiwb6UNHBogHZ oSqR/Z1WgiZNrku4S7yLGiRzxtiyCLL9iF8jnw3+pD3rjKyULVKzbPzf2c/u6wFn7uoI ObfGBy3saL5I40yviKdSCOrLT64w9G9R36zIMW+2vsZTuGYakmdK+dL5yijxx+EMNSCg kJ/A== 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:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=rjvJbcCoNur8QGw3+dwKfFGc9jNiBi2aWvcOAmAd59E=; b=ZWPN5ULZQ2K2uz97UFv7Ciblze1jaE11cDaobk120k6bo5bb9bFvzAxJw5ALlS5Seg lbHRULEOKVS8H5V5bPoR4h2CBzEr2QmBJ4gxS1bAMeuR4NxF8vi2wPhhYdrRN9SpNkka p7z3+1itpCnIZ4d+aDnEpYUU4tr6Qun6VWdqpIv3O8n/XBYZ4kTKGNyYo4FTfkpBHVqn pcvgfBX8/MtXOyMt46U52EZOyBUBqt75mNYv8zs0gLns/Yvwp3tgaZUjstWreh+Morml otwnYDh9b6l228I5ZYV/SFlPYLrBxbZq0+v9NNyixm4rwsJWllWjiYyF/2ShHFW1Pw7N ugCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=XqffMjF8; 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 j20si16955675pgb.520.2018.12.19.12.57.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Dec 2018 12:57:11 -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=XqffMjF8; 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 6C58F211A2D83; Wed, 19 Dec 2018 12:57:02 -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::342; helo=mail-wm1-x342.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) (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 7A97D21BADAB9 for ; Wed, 19 Dec 2018 12:57:00 -0800 (PST) Received: by mail-wm1-x342.google.com with SMTP id r24so10406777wmh.0 for ; Wed, 19 Dec 2018 12:57:00 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=7bVdvuU83h2P9wiPhuvrP/br1/gddPHt80CRT2KZ8K0=; b=XqffMjF85REkVOSEgheDjq1vRhm5pK8DFV1uhUVsYRryjY4lOLcFBRDA/J3oL56fh+ WrfCjqPUqL2R1HwLMG1Vk8nkT+2ZbEl8FaeOnEtL+iut4NTqBseCt+IFNDv1v/5kcn/H flLUbZV74RIzXVj62xOq/Kbx0nqCRaPEkvuho= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=7bVdvuU83h2P9wiPhuvrP/br1/gddPHt80CRT2KZ8K0=; b=hTstE4desJpKOmOW6TYzZt+C+RujKT81Zopk7Smi9ilPcKeMsXQh7crw6qKaK+babk fLxaDiamktyWwApfpnYTiOi7aPNLty8+pwp3pbs7JmcCfeXFQptwhYHX0JhCkXraQyfJ P8HrwPWV6DAStM8FG0wfqXUVqpWN0KqmXJyWSNvgySAEn29X84rCHrrqdRgs06A7EEk9 nzHJ/Wq9sGARS+rDuc53/ZnyU4YjNhwCk+5BGmwHYlhluF13B2q0V1O1y7HnNj2wP4N1 q/muQTflDjIUrc3oOaiGQv2Py6BTKLi4i59zdsaWtkMg9TuBlUEr3G3XRaBBID1LCwmr wl8A== X-Gm-Message-State: AA+aEWY/FzCsTFQpBN2EbjRNVXIyEv5H/jGArjayvtJ8vM9FVExpt6mA gIm1bOjo534brAhxL5eJBeh0FKf+Vf759g== X-Received: by 2002:a1c:c10f:: with SMTP id r15mr8582727wmf.27.1545253018638; Wed, 19 Dec 2018 12:56:58 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:e5c9:6e00:25cb:e32e]) by smtp.gmail.com with ESMTPSA id j202sm16267294wmf.15.2018.12.19.12.56.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Dec 2018 12:56:57 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Wed, 19 Dec 2018 21:56:40 +0100 Message-Id: <20181219205640.4704-7-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181219205640.4704-1-ard.biesheuvel@linaro.org> References: <20181219205640.4704-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Subject: [edk2] [PATCH v2 6/6] ArmVirtPkg/MemoryInitPeiLib: split memory HOB based on MAX_ALLOC_ADDRESS 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 , Hao Wu , Liming Gao , Michael D Kinney , Laszlo Ersek Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" The current ArmVirtMemoryInitPeiLib code splits the memory region passed via PcdSystemMemoryBase/PcdSystemMemorySize in two if the region extends beyond the MAX_ADDRESS limit. This was introduced for 32-bit ARM, which may support more than 4 GB of physical address space, but cannot address all of it via a 1:1 mapping, and a single region that is not mappable in its entirety is unusable by the PEI core. AArch64 is in a similar situation now: platforms may support more than 256 TB of physical address space, but only 256 TB is addressable by the CPU, and so a memory region that extends from below this limit to above it should be split. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Reviewed-by: Laszlo Ersek --- ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.19.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c b/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c index 05afd1282422..66925fc05ebd 100644 --- a/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c +++ b/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c @@ -75,18 +75,18 @@ MemoryPeim ( SystemMemoryTop = PcdGet64 (PcdSystemMemoryBase) + PcdGet64 (PcdSystemMemorySize); - if (SystemMemoryTop - 1 > MAX_ADDRESS) { + if (SystemMemoryTop - 1 > MAX_ALLOC_ADDRESS) { BuildResourceDescriptorHob ( EFI_RESOURCE_SYSTEM_MEMORY, ResourceAttributes, PcdGet64 (PcdSystemMemoryBase), - (UINT64)MAX_ADDRESS - PcdGet64 (PcdSystemMemoryBase) + 1 + (UINT64)MAX_ALLOC_ADDRESS - PcdGet64 (PcdSystemMemoryBase) + 1 ); BuildResourceDescriptorHob ( EFI_RESOURCE_SYSTEM_MEMORY, ResourceAttributes, - (UINT64)MAX_ADDRESS + 1, - SystemMemoryTop - MAX_ADDRESS - 1 + (UINT64)MAX_ALLOC_ADDRESS + 1, + SystemMemoryTop - MAX_ALLOC_ADDRESS - 1 ); } else { BuildResourceDescriptorHob (