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