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::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-Google-Smtp-Source: AFSGD/Wa4dXmQ08Id6qj7TDwuG8N25g1RwXi5zTznIsCTKhky5Z0EHaTFWrtZ38psdZDMZkA1upm6w== 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 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: 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: [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: , X-List-Received-Date: Wed, 19 Dec 2018 20:57:00 -0000 Content-Transfer-Encoding: 8bit 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(-) 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 ( -- 2.19.2