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; }