From patchwork Fri Dec 7 11:22:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 153136 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp376157ljp; Fri, 7 Dec 2018 03:23:15 -0800 (PST) X-Google-Smtp-Source: AFSGD/UtW9Uu+5M/dMEGbvk5OqPz4hcK4eRzHn8iGlFgbLvun9x6+KW3OU6SVs91bFn6ki5MMzLj X-Received: by 2002:a62:4714:: with SMTP id u20mr1845236pfa.144.1544181795641; Fri, 07 Dec 2018 03:23:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544181795; cv=none; d=google.com; s=arc-20160816; b=QynvLf1Aae75ubyTBmXMsvV13VNGVwTGeqh4E7kPvrvKuhsQfsTcvisn21HAoJemht 5TrCzXnN4o+8Ua2Mm5Cr1Wz61hziuTMyuDuJe1y1/QR8WiMCSvhvfsMowHCjTSYQzonS kXdhcx0n5bB70KkyGyT9mNtFEx/EIAqv4nf/DQ1IUoMrs9ATqkxHQt76T0n0tkerb5Fp LYP+JRNCq8s3oZLYDz/Z1sdbbBisE3EW0NkJAKa2S5mbGfxtoKQ5sjQp1UgE460SzIXa 9N92Jvb0PlCK6kl9DHUh0gq6kIOaIxpKvuWY4DmQJJE1ETBp58AAiC0GTQsactgSsaG/ eNHA== 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=mXy5QaBleh0MmSL2ffC1nfN+Pr2jILhtaU5yqjfo+Fo=; b=Abzvs7MSqHJHA7iXtXyEEaVvrYFAsIoARjPHfKDgKIgIqJJlHGfCJW4q4n1w1wYUgD IK2uVUKLpz+HnmkX2nG1XTVB24TxtPSdiRX2ySR2SqRQcptnjzNtHJ4kAlyKbs1Q3Ht9 uRlFkpjapRGp6sryLRGcvTuOTxPJz7vO2w7qn/Ln9S/NRDYPArpB2Za+Egh7lp6h8Yms MwKbW2/aUDuhi13382aljJO7OEmct/AvPGifIt1jehoh4kmhiaChm7gX8hSeD2hOZf0w wYeXBhwhf8Y82IAWud9u2AWJtMwpWDjCnWq1Tn7gabMz96YYIEeo8ro4wxh4vxHcgFZN CRxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ZvPSRhBO; 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 n12si2469358pgb.563.2018.12.07.03.23.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Dec 2018 03:23:15 -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=ZvPSRhBO; 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 8D03321196812; Fri, 7 Dec 2018 03:23:13 -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::444; helo=mail-wr1-x444.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) (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 C1A1E21962301 for ; Fri, 7 Dec 2018 03:23:11 -0800 (PST) Received: by mail-wr1-x444.google.com with SMTP id c14so3488125wrr.0 for ; Fri, 07 Dec 2018 03:23:11 -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=w7VVg+yArbsU91j6JpTdvhIEl1GeUVtKoqELN4+cO8k=; b=ZvPSRhBObEooaMCLO1vjgnfYXNuVTxJab94SUIJVcfv3RQLDhO5ewghNQO+JwWOmWT 0UOWiC4uCHAB9+nZmf2jrxGUYlf3oyYxUUx4UoeRQfZl6qkZy5ElcYpWcb0ry4T8AMN3 y5aCC6m2ClKeERkjwEz2ZPqan8FCHplO3vPDk= 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=w7VVg+yArbsU91j6JpTdvhIEl1GeUVtKoqELN4+cO8k=; b=haoZBpWo/GjPwItw0roGFl3qjkRJnrVrOrpCD9o6Rmxyo9codbeqgLqLxXCrKTpyPH 2hAQszj3ICJ6QNf0M9zagssE8OqDGcz0Qva5GC6Vh3hCmOqXO+F4hzCfB4K+TCaRgAkX QW1sdfxLijSS985XHMwmrtQjh4zV4fzjTxYAEZtBWmJt9UiSDQPqzTCDLeKUq465B/4x GXjILx8O59xBjkPzHblfdiYgvt2gPG5+RBc+3p5L2xHBtScK4RXSqGu7Xxd5HeflnOuK jd/mpMMs1qRLoQWdf2q1xQ1aZ5QwojXOdSQTZzlh+Rv57L08WiNAAtiseiDPjGmHjjMn 4CWA== X-Gm-Message-State: AA+aEWZqRaEQIX0pM1VqPWEPAuLgYhPkTzAPSVpHwNcBAmbbz3DkjEa9 BUhpTGtZZG7t9T3tnI4fKLDrQDKf/1XDwA== X-Received: by 2002:a5d:4e47:: with SMTP id r7mr1519484wrt.264.1544181790048; Fri, 07 Dec 2018 03:23:10 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:2cd0:a19e:84ff:4800]) by smtp.gmail.com with ESMTPSA id f187sm2813542wma.4.2018.12.07.03.23.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Dec 2018 03:23:09 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Fri, 7 Dec 2018 12:22:58 +0100 Message-Id: <20181207112304.19765-2-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181207112304.19765-1-ard.biesheuvel@linaro.org> References: <20181207112304.19765-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Subject: [edk2] [RFC PATCH 1/7] 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. Initially, it just defaults to MAX_ADDRESS, but later on, architectures may elect to override it to a smaller number. This means that all replacements of MAX_ADDRESS with MAX_ALLOC_ADDRESS are functional no-ops unless an architecture sets a value for the latter. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- MdePkg/Include/Base.h | 4 ++++ 1 file changed, 4 insertions(+) -- 2.19.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Laszlo Ersek diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h index bc877d8125a5..618f8ea85ce7 100644 --- a/MdePkg/Include/Base.h +++ b/MdePkg/Include/Base.h @@ -404,6 +404,10 @@ struct _LIST_ENTRY { #define MIN_INT32 (((INT32) -2147483647) - 1) #define MIN_INT64 (((INT64) -9223372036854775807LL) - 1) +#ifndef MAX_ALLOC_ADDRESS +#define MAX_ALLOC_ADDRESS MAX_ADDRESS +#endif + #define BIT0 0x00000001 #define BIT1 0x00000002 #define BIT2 0x00000004 From patchwork Fri Dec 7 11:22:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 153137 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp376201ljp; Fri, 7 Dec 2018 03:23:18 -0800 (PST) X-Google-Smtp-Source: AFSGD/XgevTmuFjNDJ4cbiPjyK61Eq58dxlstk4iiSj801PGd4zDpRS6oaXl9iV/2tSnY2+/AG5o X-Received: by 2002:a17:902:9045:: with SMTP id w5mr1712413plz.32.1544181798673; Fri, 07 Dec 2018 03:23:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544181798; cv=none; d=google.com; s=arc-20160816; b=A2e9TMOZhb3juNEov7Oq+cWmKuqeE/iRCnVljapnN1dIE7dis2iHnv4ztDaY9PMP0+ 82c1NGQKuOkomB6ahHT9UvgEMn2APyjAim1A1/qV9qyKOnY1d/n7z1K1N2XheVGa5l/K RYX1vnACknfIjIktk9UqJYtZwx2r3y1nGAYFbqFjkFlZ9BTikFR+NV+yOQdqbjZhdRHy 9RzTwHhy+9axU6J3s6WYYvj/gP77sl7bRv94DaRdXsUSABqOKtHvQd5kvEmpNTI3BiTs EkKKzB8vNTc/geljQcBMscAxpRH2HHsyNTD76KR32kk85yxsOwOLvLd1G4t/bLueyjBT GdFQ== 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=goF33YG5R17rdPQbP2ltoQFWrJS0NRvvRlNXGnW8tWk=; b=jvjuIZLRZAIOMhVylhWiw+qQT5DSyg6XPXw3812JtSwBjZVvsZgppUZyBz5yrOdPPY bqMIeAekGqPXal6HtEXdvJogwrOYOdN1VkhWGZvK/cLuMOFxdGHzCtTQbSSlEC7MokRL g6dpQ1tt5w+/Iu9mM63gz2O3YdXDDpntes2kJ9nIbjq5ivaCdNk5LNarAaU3+6MKeuVr 4yGoLSLQFdYGpGs0joPbOuZnn5jQaEyelziG1CtTrUZf00wBvBpA5KDA+K5B/tJG1O6f 1LkWxGa6PTfdSgl/TkLfvfxssZbu3u88qOTuZHMm7hOHzARXohxNEZUR54+7Gd6//gG/ 886w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=hnsh7kI4; 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 e68si2785173pfb.101.2018.12.07.03.23.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Dec 2018 03:23:18 -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=hnsh7kI4; 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 BF86B21199B08; Fri, 7 Dec 2018 03:23:14 -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::341; helo=mail-wm1-x341.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) (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 7120F21962301 for ; Fri, 7 Dec 2018 03:23:13 -0800 (PST) Received: by mail-wm1-x341.google.com with SMTP id y139so3984788wmc.5 for ; Fri, 07 Dec 2018 03:23:13 -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=XZ+dWXyr9j05awcz5gbVG8KfYBA3N8m+XuRAKmjfHKI=; b=hnsh7kI4MbDOEMbgf0U5qe0z742sINbEBnrpf9Y9CbkEQOrzav3kVJJ9xLAhjbpkRN JEorOPenYL/FRjeLY92YrN8ItYV9p1bHcLmJOL/X5QPvZsHAU3y95Ex/JfHxy2uf5/a5 nuews3C2tsgUR+3kSgjsjRfz5APJ4ntfh1q9A= 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=XZ+dWXyr9j05awcz5gbVG8KfYBA3N8m+XuRAKmjfHKI=; b=r+5b3ofVgE+uHG5eSTwlPGhsBL4ntCkd8R5cvUqTjSDLrGSb05LfUAhT+0S5lE8zQ2 cfGnarlOdxDMSXM6Fi8lmKCzjSeghI0fOWy3jk/elF4Aa9ue31IDL3UVoFGtfLxUx50v dwUAZGXD3vhiDUdtdZWRSwo+63QyERhB7WRAzmV/MfAHXcKgdthEegSVQTVdnihoaPdV kB8pa/9eMhSwGwI04yEVUxplfyUHQcoz4h5uLVrWHXW3ZfKmkQ1yw/MVn6nO+ZC70lQ0 1h1nwBYfvZP/XwdatW4BFIAFGhrSwmyQqLDXu8PEyqCOa3gnkz7TtMot5wCQX1EttlQW x20g== X-Gm-Message-State: AA+aEWbrJ3RiK4ANYHRKyTuZ5YGzxaPoQCQP8AvDSPtl5bRiSE/c4rBr M2vZn8ecZQcpKX+pAdPt5ADFyFYCNmIJ5Q== X-Received: by 2002:a1c:7306:: with SMTP id d6mr1822685wmb.98.1544181791404; Fri, 07 Dec 2018 03:23:11 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:2cd0:a19e:84ff:4800]) by smtp.gmail.com with ESMTPSA id f187sm2813542wma.4.2018.12.07.03.23.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Dec 2018 03:23:10 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Fri, 7 Dec 2018 12:22:59 +0100 Message-Id: <20181207112304.19765-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181207112304.19765-1-ard.biesheuvel@linaro.org> References: <20181207112304.19765-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Subject: [edk2] [RFC PATCH 2/7] 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 --- 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 Reviewed-by: Jian J Wang 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 Fri Dec 7 11:23:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 153138 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp376249ljp; Fri, 7 Dec 2018 03:23:22 -0800 (PST) X-Google-Smtp-Source: AFSGD/UBrRaGyaLQ+3f81uA9J5/CzYY8eTmaLfAec5KJVt5j4zJH6HbuUrRi4upV3RI4z6iplaXA X-Received: by 2002:a62:3305:: with SMTP id z5mr1901049pfz.112.1544181802250; Fri, 07 Dec 2018 03:23:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544181802; cv=none; d=google.com; s=arc-20160816; b=VBw3arJ5rmZizvQYk/0T+TeWisryAdgP+UAuRmwk5GY6FAA+nSwdVbsufbiBRG1VFf GG0wsFR4J9fpQaFj2Q94bcvd04SPbnH/wTPc8vNs+0rRZ0lTcIbhpElzX1ibvvmHw8og nT7+4jZheyi7uW50saz4+hTuInmhyUI2MJXEr/xAWtK89QW/ywHgmhgle9wIV+CCpFZG t+PpOa9qO/Lm77P51TtM754/8/UGguVwBuHCZqSw2yXP1gwY9SrgLtmKSBRmTetgNaom kgMUdTefylH7zUUyJ3Hnd49oDPuyGdPiQza8HtQSxlJ1O07DdWFTKAxWWaHdnQUqJHNr w4+g== 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=YyX9xzKGo5b96HrUMFFmtgj0X4cPr+ADjQXb+W0KUNabDiOgenB+j51Picb2ZgTELz 2LhjINYOeshckoUwV21G0f9exBq7junBn0jZh/EHJssz8RGTWbgO+4e15B1yswX6U8uE f8YuOY3RZ/p6apcseDYm+dw7eu7RHnCe3UnPpMJuFMxHhSbpx2QV1GmCXxemcF5CrG0u /Z29f6qnsy5E/C2b1FWRXgVD/7syPknaAuq5eGIAjso/nrI/q6oS3R5SJ04RVgnV5dku 7G6D9B/8x5skM1RIf0frqMCIRn2OT9Brs12AJdLIK7PAsVIrnyG614j4X7iulm4dsfzj F/KA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=XXbSzyLP; 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 5si2812760plx.391.2018.12.07.03.23.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Dec 2018 03:23:22 -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=XXbSzyLP; 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 EB61B21199B0A; Fri, 7 Dec 2018 03:23:15 -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 98F6421199554 for ; Fri, 7 Dec 2018 03:23:14 -0800 (PST) Received: by mail-wm1-x342.google.com with SMTP id r11-v6so3995595wmb.2 for ; Fri, 07 Dec 2018 03:23:14 -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=XXbSzyLPhaWNFArTzZTtajE1FkZwJsrguWJ/dAyHn4Esy37I7qUoG1gDw6PvEhrilk xfpIF5oginPlwmKs6ifMRpb8NdQyL6pvArdXPXCs251wpkLk31uqu8NWgkDXbzf4172K ON1A6Zat6H7V0Vvygph8IrMJNE2tckS/RGM0w= 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=BgTfOnh4N5nzrzTKVe6L/k0axIrtfMGlbiYZ8MNVN8S+yW8e5FUKeQ/eLpGh39kJy7 hwFHv7AWXpjJQD2jrpW4PTXChUCFeiPZ+SOLWuxuxamf7eZOdxmKkhYcoc0TVPw3mEn0 5gVr8W/i7xzrTR8yaRWqRi0Pm8+UyRpw8UW1ygdP+xtgzBQJDS3GrdZVfV+2jt0zReBK pdi/PH9BJEWSlJFLhEhaK3Ah8TZ6qA6RR8ilhaYg1H8vHglJn1aO2mZYH8Pa3kT5kId+ 4OIzJetBLtEwDA+Pm57OQUsqoncvvVSDywL+G7XS8WSzFefVS/mTVFNdSlsJblEXzarK SkuQ== X-Gm-Message-State: AA+aEWb83J2wGEkBR26ttugBYErXno7HrmhAXgmjOmT8t/bHatGoJjHG jKvafc4/8UakcgLlXFvylrpzbZ3fW92GbQ== X-Received: by 2002:a1c:dd04:: with SMTP id u4mr1890775wmg.84.1544181792753; Fri, 07 Dec 2018 03:23:12 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:2cd0:a19e:84ff:4800]) by smtp.gmail.com with ESMTPSA id f187sm2813542wma.4.2018.12.07.03.23.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Dec 2018 03:23:12 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Fri, 7 Dec 2018 12:23:00 +0100 Message-Id: <20181207112304.19765-4-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181207112304.19765-1-ard.biesheuvel@linaro.org> References: <20181207112304.19765-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Subject: [edk2] [RFC PATCH 3/7] 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 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 Fri Dec 7 11:23:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 153139 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp376303ljp; Fri, 7 Dec 2018 03:23:25 -0800 (PST) X-Google-Smtp-Source: AFSGD/UzSp4LyLsr8zacPougAj7CaYVWAQKuVY6FA1JUqaxogvBQxCL0/Y+H+VQvThFW8ullSwDF X-Received: by 2002:a63:ea4f:: with SMTP id l15mr1569855pgk.102.1544181805631; Fri, 07 Dec 2018 03:23:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544181805; cv=none; d=google.com; s=arc-20160816; b=t1woXGP5O65IQFyluU9IzGbktFibZdNobJNTdLYQau9jA/ZcweYQav7Dt6Iy7Wm3KG tZnvIFHdzcbIgTpg5S5gHebexAtDnlPzSWQal4a5QId1W3IfYog5gT9y6sM6fn7AO8Mm Fxh/kDYhZNkU0p1qBm2ubKc02II8uQlP5jOaGxjJNB32F4W/xnbyhkTEeWnM0Bwt35xq aYeY1upj6zzgc1akkbXLG9orvoJZg75BkTQRTVHp85AqknLMRhheQ0S6Jo9WJLfnSqCU ty4Rq5fTNkGHWwOg6OEaw11E1wH7zz7ihi8NsOHgimqhHZOqAcc250kxw6gjV8g1FRdZ D1Tg== 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=pbt3sloztgW0dXV5pvwZYPf0zdCFXYCjM6u7dezI2jk=; b=qAtke9lMhxkBnyfg4M3y/lHes6XHSqG4ss04DbCw3U4wSTapnHSC/Zd/0C3SenJWdY 7ucGASi9nDVkKjxDs7EoROZfIDKi52uAFIDYHX/lVQ17893M2uC0eebzZqdwKPYUGZJJ 5UCzEdEu8vYgATD+Agybsr92+bzRHHRa0u5BBOL/RYEVGtGqij5m9kpE+bOgv56/cplH kf4fId97dNVHvigCu0B6laKCj4EZqUXJZhUFpEbaod0oIka7VWfcwkfp0q3JPBjJS4oQ 0egagh8GZwxNXo99mP+jS2RMOYaZUVk3ego3w/0RldX0NPbNpqELkd3Fte0VGNomoE0e ACqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=iei2piK4; 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 j10si1954287pgt.155.2018.12.07.03.23.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Dec 2018 03:23:25 -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=iei2piK4; 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 2491D21199B0E; Fri, 7 Dec 2018 03:23:18 -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 3045A21197073 for ; Fri, 7 Dec 2018 03:23:16 -0800 (PST) Received: by mail-wm1-x342.google.com with SMTP id z18so4018314wmc.4 for ; Fri, 07 Dec 2018 03:23:16 -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=986LJYRJSexLnJiwlOxmyPLRPWQWMAWGD/EBilKLGuw=; b=iei2piK4IJAs0VCGKe3AvbO+kXw8wT9weVNlhXeoGgcF30ERfe4IdNUvOt/p1x0yhL wVt/mdGEKv51GTJAi7tmcGoNfbJRFglW7jb52OQAHCGGdYYRbzWOSbAd9Uah104LNdN3 zAa56Tyoc6gxNHwmUhkme1ECZiUP8+CxnsqVE= 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=986LJYRJSexLnJiwlOxmyPLRPWQWMAWGD/EBilKLGuw=; b=p9yCRj1MD0b8MMz6j+GTkxJX99L1fZzcgTy9kTmvVIKyfMY9xFZ9yYjejHwUX5wtx1 yKT+yjI/IxofXbg0XmWkQQFXCeS2ZIral7+mRXeQ6ZqAtlOw5gyA8m89UJ2qP9HMdybW TxLa570UT8TtmyBAI4Zv/JP4hADixN4yoGWmw5j1rbS/VxWSfY1oXhROc+LuplEHBB0C a5XUBjDBc1UrDJuLc5mTzmwkM+aOOnC48A5NUJj2ypsTVrg3g66uSEVth/gNpBpI16RG paCsEkI0mlGsdwfvV+2HCvoPFQ6sEf+fTrrXaKCfh602BApaPGq97wlMuUlI9BoJAp+i FHtA== X-Gm-Message-State: AA+aEWaU8O1Nlzvob53vS29lnVSdtOF4ZwgCo8JcgLbuKaQ+lh6wv6oT FgH0bDxGwj59KdHnvTfNX/keXPSRmzVwfg== X-Received: by 2002:a1c:8b09:: with SMTP id n9mr1883605wmd.38.1544181794505; Fri, 07 Dec 2018 03:23:14 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:2cd0:a19e:84ff:4800]) by smtp.gmail.com with ESMTPSA id f187sm2813542wma.4.2018.12.07.03.23.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Dec 2018 03:23:13 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Fri, 7 Dec 2018 12:23:01 +0100 Message-Id: <20181207112304.19765-5-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181207112304.19765-1-ard.biesheuvel@linaro.org> References: <20181207112304.19765-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Subject: [edk2] [RFC PATCH 4/7] 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 --- 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: Laszlo Ersek 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 Fri Dec 7 11:23:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 153140 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp376346ljp; Fri, 7 Dec 2018 03:23:29 -0800 (PST) X-Google-Smtp-Source: AFSGD/XRQEp7gobxcHDZmvlO0lGY+RiccxrIufY9qzFCY0xSC59y4ScWAScGYeQsXqLk49pudzNs X-Received: by 2002:a17:902:7044:: with SMTP id h4mr1748177plt.35.1544181809541; Fri, 07 Dec 2018 03:23:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544181809; cv=none; d=google.com; s=arc-20160816; b=ANihzNafj+tn1EcFiWxbR+ihfYgOZcw2hQcTbM6S/a7n0j9tDeBcGrXtAFhYSkghaG 5ZKKl/Lhd51jYgny0xN7m9LDWsxGmatqyS8rOzIwBXhq0VeA5XYuMLACarJOjAf6b1lo E8c8YSTW0rVtLW6dny/wJ1QtqfDjUT6r0EH6Id3gjNUKMDM/HgAqe2UKScXNMphX+rh1 EkDQzBCUaD8xM4ynrh4iHHS6T46aEz7qrJYIm5n85XzjnbBLmfxw3dF8d1Uz8Ojw0yUt j4Qk5NLyI2HbZkmoCgS0VXmzIWsQGa+KBrK2fyF+9cponr+oIvhQ7jOxJg2+dzOj/LBP 7FyA== 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=BN/XuSDFClwe69/uE1FurFs3J1nyV4mKxmFJfxcLjjI=; b=dsEnnMhuZ9N3baGnnwMesk42Kkv/rzX4wVCR0TSNTiSCoeVstmvq5A4jstjcLfXowC bCQirsdwXGcKtSNke0R6TAqKNStPh/ynY1SBso3HatReaDZG/hQclZ0T1IPRytIxnwko wJ2+UrBSiHkFlV58l37c1JpGjKiGxMAiHhK+G/3GF6GZcSS9nZB33/15Wv2mic9gyc3z wnwv/R0RoWAj8sb/rrzk44rK+gylP/f7C4HheXvubEdXtjHoOcCjUEWvNE/vHvt2I7wt GKer/ofGGJt2IythQW9LRLkOcBaHSD9VjsmlYd6KoB5lUfnFFXpdCsoe0gWdRQxwzwjo SYPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=IpZ+KKbG; 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 b18si2632570plz.105.2018.12.07.03.23.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Dec 2018 03:23:29 -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=IpZ+KKbG; 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 4FA1021199554; Fri, 7 Dec 2018 03:23:19 -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::341; helo=mail-wm1-x341.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) (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 730C321199B0D for ; Fri, 7 Dec 2018 03:23:17 -0800 (PST) Received: by mail-wm1-x341.google.com with SMTP id g67so4137880wmd.2 for ; Fri, 07 Dec 2018 03:23:17 -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=i3cWjav9UST3HWLrezcpXfEn3OuGMecc/UMuZDc9PZ4=; b=IpZ+KKbG+EEzfzGJF7jLxfUupt6QLrS5g0m0YrF9873jQ2uhOpVokucY0XdHPKgyUG 01ZdiVbhvS00isH3kyBuRfn0gOplR25YWoAPowywix1ejNFOJNRLO71RxiJqh0cFCdxJ BMttFh3N1UQamZh6XOiZRa2wVtxABivMtLZRU= 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=i3cWjav9UST3HWLrezcpXfEn3OuGMecc/UMuZDc9PZ4=; b=RQXFCvISBWSyx2dp7KMl74HNHaRVfw2mJ3TREYhFy0gdHA0tMJMRUHFDbqpsqwu2Io aT0iQ4I6DlXgBA/tYFVwuqm6zTClU8neie2QVOGmkM6a1SBLYuhghTHRKAorhIVtv6oE tisHI/tty8X/EZSIoYYvS7FArA7Cj9MvNURVlkO3FOLf53CGsePuWo4aF283zEJ1VUjN +oULPm3+SdfFZWkSZfpHO0pH0hydlKOr7pWViwPG6QGITkYX8DFvkloURPebSLdNmlPG P5nBZCiEhQCrYUrVVgDRl46iDoqkiDygZRFacPWHrI+tGGVIXjnRbFpCTEhx7oMi0dZL upZA== X-Gm-Message-State: AA+aEWasIyajPFuolWiRBYWdPmCI2x3I9yLhXChsS26yVTY5BRaIfops MhnSbccX315OcSkQmR2RaZGcubA4ackvvw== X-Received: by 2002:a1c:f116:: with SMTP id p22mr1913448wmh.0.1544181795780; Fri, 07 Dec 2018 03:23:15 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:2cd0:a19e:84ff:4800]) by smtp.gmail.com with ESMTPSA id f187sm2813542wma.4.2018.12.07.03.23.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Dec 2018 03:23:15 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Fri, 7 Dec 2018 12:23:02 +0100 Message-Id: <20181207112304.19765-6-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181207112304.19765-1-ard.biesheuvel@linaro.org> References: <20181207112304.19765-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Subject: [edk2] [RFC PATCH 5/7] 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.19.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c b/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c index 389a2e6f1abd..25db87fb2374 100644 --- a/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c +++ b/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c @@ -109,8 +109,8 @@ InitializeMemory ( 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 Fri Dec 7 11:23:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 153141 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp376394ljp; Fri, 7 Dec 2018 03:23:33 -0800 (PST) X-Google-Smtp-Source: AFSGD/XtxVgh7fscX0iCE7hwSfUst/VSRGTI7xm515g3kx7PCaaPBxbI7uwTcZIWOsvZi7jq+zO4 X-Received: by 2002:a17:902:7d82:: with SMTP id a2mr1760011plm.163.1544181813379; Fri, 07 Dec 2018 03:23:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544181813; cv=none; d=google.com; s=arc-20160816; b=Mt7SZVB/oHWXEhK6QP58Y1oDBYSHo47WH+euHG3gdR3fWjmpKvlK3GABeLLr3O4+LS Qr7agG7xxpDq9tWmTXqYGRP2tlD+jaHZa/UnbAAHZ5H/MwzM5DllfQCrpLDepruYCYGC cWuSA5H7uUgLHBLLmkjgP8V0/bXXjVDvW7CO07BESvUrlN2UNklBrObrsUSptrubQrCF rpFKz9En2hBpMNSHOIpUzprkfFUBcPe+VhQqA73KICxEOB7qGnC7SEbwMLqGHv5Uz8Hg jeGy1RZ16NcP6U9vpWXU/xBqcIFqYpm3qScmLJJRYR9SsFVmn4+waZZMd5yrxO1tY9pv s/eA== 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=4K2PBMpZdNXfkpKx1jGM9otKYeiX3M1YVK5ui4OaP+c=; b=AS20lV8VZX7PLiOFSJ2+itpBMkP3DHB/0kjaa3sxFuGtMeFkTnhNf45UmiG+dTyQOr Gtb2BCYBRcdzduAbqAG0m1iBbcBUFr35qv+Db6k9nZLk6xtl5oZ3ajxKzJeCWlnJtvgK Yko3xwHM+bljz/DSg+2h1Qo2kI/rBQcq1U94kI7hFQq0EBvaXjiD5nfFf9jdkRBnVoFx l20TLD4qP63E0T3W9MSs8ZdINBkLO97nOKoIMdg9yETxU+btWNCDJs6QuSFi0T2x+Hei /ZKm+1bPKZWJLj0+FUd3YcKGdWDp261XB/1pWCDCSzT7t0Vo5KevUpn6nOWORALw0w4y 92kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=IJ4u+JlT; 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 n1si2997255pfh.96.2018.12.07.03.23.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Dec 2018 03:23:33 -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=IJ4u+JlT; 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 7ABB221199B15; Fri, 7 Dec 2018 03:23:20 -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 E0A6F2194D3B3 for ; Fri, 7 Dec 2018 03:23:18 -0800 (PST) Received: by mail-wm1-x343.google.com with SMTP id q26so4128541wmf.5 for ; Fri, 07 Dec 2018 03:23:18 -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=3IE+0gzD9Q1fewtX4Fi1C84/sWK8X+MtQY2OcUr/9e0=; b=IJ4u+JlTrxdle6zenBvYNzPmfA50Ar8iZGoVNWesMRzg5jbEV56gdvyl1MDjB3loYw OWZVH6JKnmvYl2UDi6gkFC1C5F91fiju6Cyfgd4vnhrBcneiZxiMPYLiBPm+u9Gy2fMn NsMevN7zZ0aycJZdIKjtFZuXejDfl4vWqoBew= 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=3IE+0gzD9Q1fewtX4Fi1C84/sWK8X+MtQY2OcUr/9e0=; b=MbiNlv9qAzztNqpSmCZ0Hq8aqVlnIO8A3NX8Kj8oaxcyRvmPHVEjlUTprUY/ldm+Zb N1SlfrXEfnNBy5RBh1AywXzcMCxms8FxKy8mohJ0L1+yx0+OtkkOS24qhY3YMR2Fvf4q mBDBycAhKM3ruh2tTHP4GG6kexlhL4CBrJL+PZhOyGg682YogoE9Cf1Yi1M7k1QZWhJg VqAscCwRRMbR69Mob/G9FDwTcQidgkp5foa9kXX+9Gp2TFU7sr3K7LjA16NEHOXIo8fa C9OxVrsLbNw80sJdCCQz3mOKc8yaEppAw8+AF/kX6nuFCDCEi6ITOKEHAsVHnjm78pKP LC6Q== X-Gm-Message-State: AA+aEWYz28Dx0QGXL7NzQp0+cQ/0EvU3iSf3s1PpNKjrkq63F7e0H1rd nmRokARDWBbUmuQ9QGxyc3hTqLfDLZtIJw== X-Received: by 2002:a1c:c2d4:: with SMTP id s203mr1890785wmf.3.1544181797113; Fri, 07 Dec 2018 03:23:17 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:2cd0:a19e:84ff:4800]) by smtp.gmail.com with ESMTPSA id f187sm2813542wma.4.2018.12.07.03.23.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Dec 2018 03:23:16 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Fri, 7 Dec 2018 12:23:03 +0100 Message-Id: <20181207112304.19765-7-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181207112304.19765-1-ard.biesheuvel@linaro.org> References: <20181207112304.19765-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Subject: [edk2] [RFC PATCH 6/7] 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 --- 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 Reviewed-by: Laszlo Ersek 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 ( From patchwork Fri Dec 7 11:23:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 153142 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp376445ljp; Fri, 7 Dec 2018 03:23:37 -0800 (PST) X-Google-Smtp-Source: AFSGD/X5IO+GSyaS5WYbJRH/uduP8Vsr+hK7qGct2nILK7kzx3IPVav4Ok4A+1ywugzHgG6Efwen X-Received: by 2002:a17:902:9345:: with SMTP id g5mr1736169plp.148.1544181817052; Fri, 07 Dec 2018 03:23:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544181817; cv=none; d=google.com; s=arc-20160816; b=KBqJQWWul8UWAHuZQT+grXmqYJ8HBKxoDU0+QEHdYfh7gscWSC6iDfoW8w+zDgEW/k TsQdV4XoKV1yr0XH7DhKlX+7jhDcWi/J3VcJF6LpnYinFdwqU7WMzqgQnO1mSIne05Cr 0U1P0I0u35jdVByT3meKE5GhXc1XEhpNs9/hLD6PFAzTqKvWeWrNOmykq21ToyNoiqZq ONYJxYAf0XGjANFU0mHep82U7InimyvUs66cZ1lb8at//b0gcF2sp7rbHboSVg1Aa5wc XBp6TuPR6aogm6IWcQw2YKZ3SNPkv18D9D9RJBYCMnxs2vVULI6K/Zdya9v529/MHC+E qISQ== 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=cDCxsYetRBH27A+GBqIi1BCWgv4gGzIxfLrJt4CJu2Q=; b=K3QYrgbtlrvTwXNXIIdP1jbLk6Cb++rCkz+SeV+Ot6VZEmWa8q0iZveIuXCOzO87Di Tedclfieu9UZBczD2od4YKleIN6sGOFqnCEP0L3/GEs5Uxw+JuBWsVJ3V3rkn0w+veIl Z5SUmMtPyUHWkPu9z6l48YV8jAV6Nlh4Q8f0gSCbO7IxbEhK+Be9Gnh16OCCk47cXVdk MmfzP3qx3QxF2iFUTMtZ5ZROgwXaHB8gDKgiF8Zq8VmeNb50LOYiquABwSZDcQ6dyJtq Ud0BIsEK78Xwq4P+466iqoGz1j54hXmV/TBp5H0h2py9poezDXa2EFJZHldNpiKXeJPj j2Og== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ZSRwNwfH; 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 b91si2779542plb.11.2018.12.07.03.23.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Dec 2018 03:23:37 -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=ZSRwNwfH; 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 A913C21199B12; Fri, 7 Dec 2018 03:23:21 -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 30A6321199B13 for ; Fri, 7 Dec 2018 03:23:20 -0800 (PST) Received: by mail-wr1-x441.google.com with SMTP id r10so3421213wrs.10 for ; Fri, 07 Dec 2018 03:23:20 -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=jP4a319MdppnHukW2bJYz6cGZyZ1NgoG/PyFmZObgxo=; b=ZSRwNwfHDLUtQiFWo4mSMSzNTIA7YsvHKX1uRT6TFanUyfx8ELd3fyvP+CW3cnzbE6 woUZkqBdzHSPTxdVpMSjWiJk1f9I3IeIBakmXTBbssA84pvrfwzAsn4U7XvS2FPzX3Ye sWlz5XVJzt1nDQtuKWXX75wlZJnudgRuVeZZY= 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=jP4a319MdppnHukW2bJYz6cGZyZ1NgoG/PyFmZObgxo=; b=gMiLpvNQZi9TbAnoo/Qr0h4eybiLU53dBwDgDKWAqFrl+FLsrJj8LiZ0rBo1vYuJgL +w/ix1ZRN7NqZgLV5vhdmcFizUIDlqIRrujiBCC8W97Hzut9ZBMEhtdH7tBT9Jr+zaAL E24SkqBU5IIMYIBR3ts2JQrfCuFDMZ4mK2v9Y3VrXkSfuQj8PM9//51uw7XWPtndSEKi M3norSPrLwmcRRzMiGLVnWuHd+vsFJ3YGxjNrr0VLCGpZPyd2zs/pTdSIzQHpArFB7gy A4FuwgYolaWQS5XoowWA3ImqM3xocZ3VVz1wU8f8CKyKs4TM5/k4E36NhqMPjKHxo/lw sP2g== X-Gm-Message-State: AA+aEWYaRKELysrdZnJzwHodcsBq+ejncf8VjoOyO41MWyH+TxlQINXq wT+P7/a9i4zt3QV27B3fvm+wzGjTxLfeLg== X-Received: by 2002:a5d:6187:: with SMTP id j7mr1474668wru.300.1544181798413; Fri, 07 Dec 2018 03:23:18 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:2cd0:a19e:84ff:4800]) by smtp.gmail.com with ESMTPSA id f187sm2813542wma.4.2018.12.07.03.23.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Dec 2018 03:23:17 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Fri, 7 Dec 2018 12:23:04 +0100 Message-Id: <20181207112304.19765-8-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181207112304.19765-1-ard.biesheuvel@linaro.org> References: <20181207112304.19765-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Subject: [edk2] [RFC PATCH 7/7] MdePkg/ProcessorBind AARCH64: limit MAX_ALLOC_ADDRESS to 48 bits 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 MAX_ALLOC_ADDRESS to 48 bits on AArch64 so that the memory handling routines running at boot time take care not to allocate memory that the CPU itself cannot access due to the fact that it runs with 4 KB pages and thus an address space that is limited to 256 TB. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- MdePkg/Include/AArch64/ProcessorBind.h | 5 +++++ 1 file changed, 5 insertions(+) -- 2.19.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Laszlo Ersek diff --git a/MdePkg/Include/AArch64/ProcessorBind.h b/MdePkg/Include/AArch64/ProcessorBind.h index 968c18f915ae..a8c698484a1d 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 address usable at boot services time (48 bits for 4 KB pages) +/// +#define MAX_ALLOC_ADDRESS 0xFFFFFFFFFFFFULL + /// /// Maximum legal AArch64 INTN and UINTN values. ///