From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Google-Smtp-Source: AFSGD/UDzPbFOCFw7V39oBSWwpbT84wZr8PgXk2yC+qn4DQ/htYq5HTgceFapAN6syFkqfytgx2FWg== 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 Cc: Ard Biesheuvel , Michael D Kinney , Liming Gao , Jian J Wang , Hao Wu , Leif Lindholm , Laszlo Ersek , Eric Auger , Andrew Jones , Philippe Mathieu-Daude 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: [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: , X-List-Received-Date: Fri, 07 Dec 2018 11:23:13 -0000 Content-Transfer-Encoding: 8bit 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(-) 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; } -- 2.19.2