From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=209.132.183.28; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 58F4021197073 for ; Fri, 7 Dec 2018 02:41:13 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A28C2300297E; Fri, 7 Dec 2018 10:41:12 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-214.rdu2.redhat.com [10.10.120.214]) by smtp.corp.redhat.com (Postfix) with ESMTP id B36F8100194A; Fri, 7 Dec 2018 10:41:10 +0000 (UTC) To: Ard Biesheuvel , edk2-devel@lists.01.org Cc: Leif Lindholm , Liming Gao , Eric Auger , Andrew Jones , Philippe Mathieu-Daude References: <20181206213722.7597-1-ard.biesheuvel@linaro.org> From: Laszlo Ersek Message-ID: <14bc84c4-9b86-51b0-3b09-152e8877950c@redhat.com> Date: Fri, 7 Dec 2018 11:41:09 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20181206213722.7597-1-ard.biesheuvel@linaro.org> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Fri, 07 Dec 2018 10:41:12 +0000 (UTC) Subject: Re: [PATCH] Revert "MdePkg/ProcessorBind.h AARCH64: limit MAX_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: , X-List-Received-Date: Fri, 07 Dec 2018 10:41:14 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 12/06/18 22:37, Ard Biesheuvel wrote: > This reverts commit 82379bf6603274e81604d5a6f6bb14bdde616286. > > On AArch64, we can only use 48 address bits while running in UEFI, > while the GCD and UEFI memory maps may describe up to 52 bits of > physical address space. For this reason, MAX_ADDRESS was reduced > to 48 bits, to ensure that the firmware does not inadvertently > attempt to allocate memory that we cannot access. > > However, MAX_ADDRESS is used in runtime drivers as well, and > runtime drivers may deal with kernel virtual addresses, which have > bits [63:48] set. In fact, the OS may be running with 64 KB pages > and pass addresses into the runtime services that use up to 52 > bits of address space, either with the top bits set or cleared, > even if the physical address space does not extend beyond 48 bits. > > In summary, changing MAX_ADDRESS is a mistake, and needs to be > reverted. > > Cc: Leif Lindholm > Cc: Liming Gao > Cc: Laszlo Ersek > Cc: Eric Auger > Cc: Andrew Jones > Cc: Philippe Mathieu-Daude > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Ard Biesheuvel > --- > MdePkg/Include/AArch64/ProcessorBind.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/MdePkg/Include/AArch64/ProcessorBind.h b/MdePkg/Include/AArch64/ProcessorBind.h > index dad75df1c579..968c18f915ae 100644 > --- a/MdePkg/Include/AArch64/ProcessorBind.h > +++ b/MdePkg/Include/AArch64/ProcessorBind.h > @@ -138,9 +138,9 @@ typedef INT64 INTN; > #define MAX_2_BITS 0xC000000000000000ULL > > /// > -/// Maximum legal AARCH64 address (48 bits for 4 KB page size) > +/// Maximum legal AARCH64 address > /// > -#define MAX_ADDRESS 0xFFFFFFFFFFFFULL > +#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFFULL > > /// > /// Maximum legal AArch64 INTN and UINTN values. > I was worried the patch could regress some things, but unfortunately, I couldn't name any specific area of concern. Sorry about that. For this change: Reviewed-by: Laszlo Ersek Topic change: the patch that's being reverted was originally posted as: [edk2] [PATCH v3 05/16] MdePkg/ProcessorBind.h AARCH64: limit MAX_ADDRESS to 48 bits in the series [edk2] [PATCH v3 00/16] [Arm|ArmVirt|MdePkg|Embedded]Pkg: lift 40-bit IPA space limit In further patches of that series, we depended on the lowered limit of MAX_ADDRESS. Given that MAX_ADDRESS is being raised back to its original value, I think those dependent locations should be re-checked. For example, in [edk2] [PATCH v3 08/16] ArmPkg/ArmMmuLib: take the CPU supported maximum PA space into account (commit e36b243c7178), we added // // Limit the virtual address space to what we can actually use: UEFI // mandates a 1:1 mapping, so no point in making the virtual address // space larger than the physical address space. We also have to take // into account the architectural limitations that result from UEFI's // use of 4 KB pages. // MaxAddress = MIN (LShiftU64 (1ULL, ArmGetPhysicalAddressBits ()) - 1, MAX_ADDRESS); Presumably, we should now replace MAX_ADDRESS with 0xFFFFFFFFFFFFULL. (I'm unsure if other modules updated by the rest of the patches are affected -- I tried to grep them for MAX_ADDRESS, and I couldn't find any (obvious) matches.) Thanks, Laszlo