From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeremy Linton Subject: Re: [PATCH] arm64/efi: remove spurious WARN_ON for !4K kernels Date: Wed, 25 May 2016 10:38:19 -0500 Message-ID: <5745C6EB.8090004@arm.com> References: <1464189116-30898-1-git-send-email-mark.rutland@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: In-Reply-To: <1464189116-30898-1-git-send-email-mark.rutland-5wv7dgnIgG8@public.gmane.org> Sender: linux-efi-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Mark Rutland , linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org Cc: Ard Biesheuvel , Catalin Marinas , Leif Lindholm , Matt Fleming , Will Deacon , linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: linux-efi@vger.kernel.org On 05/25/2016 10:11 AM, Mark Rutland wrote: > Since commit 1fd55a9a09b0293a ("arm64/efi: Apply strict permissions t= o > UEFI Runtime Services regions"), booting a !4K page kernel results in= a > boot-time splat on some systems, due to to a WARN_ONCE added in that > commit which fires if the base address of an EFI memory descriptor is > not aligned to the kernel page size (which might be 4K, 16K, or 64K). > > On page 38 of the UEFI 2.6 specification it is stated: > > If a 64KiB physical page contains any 4KiB page with any of the > following types listed below, then all 4KiB pages in the 64KiB > page must use identical ARM Memory Page Attributes (as described > in Table 8): > =E2=80=94 EfiRuntimeServicesCode > =E2=80=94 EfiRuntimeServicesData > =E2=80=94 EfiReserved > =E2=80=94 EfiACPIMemoryNVS > Mixed attribute mappings within a larger page are not allowed. > > On page 158 of the UEFI 2.6 specification, in the description of a > memory descriptor, the PhysicalStart and VirtualStart fields are > mandated as being 4K aligned, with NumberOfPages describing the numbe= r > of 4K pages in the region. > > No further restriction on alignment is provided in the UEFI > specification, neither generically nor in a rule specific to AArch64. > > So while attributes within a naturally-aligned 64K region must be > consistent across memory descriptors, the regions described by those > descriptors are not mandated to be 64K aligned. > > Not being able to apply strict permissions is sub-optimal, and worthy= of > some notice, but it is not helpful to erroneously suggest that firmwa= re > is buggy, nor is it beneficial to have a noisy backtrace at boot time= =2E > > This patch downgrades the WARN_ONCE to a pr_warn_once, and re-words t= he > message to also describe the implication of the insufficient alignmen= t. I've been seeing this a lot, and this should help to lower the noise le= vel. Reviewed-by: Jeremy Linton Thanks, > > Signed-off-by: Mark Rutland > Cc: Ard Biesheuvel > Cc: Catalin Marinas > Cc: Jeremy Linton > Cc: Leif Lindholm > Cc: Matt Fleming > Cc: Will Deacon > Cc: linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > --- > arch/arm64/kernel/efi.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c > index 78f5248..95e748e 100644 > --- a/arch/arm64/kernel/efi.c > +++ b/arch/arm64/kernel/efi.c > @@ -30,14 +30,15 @@ static __init pteval_t create_mapping_protection(= efi_memory_desc_t *md) > if (type =3D=3D EFI_MEMORY_MAPPED_IO) > return PROT_DEVICE_nGnRE; > > - if (WARN_ONCE(!PAGE_ALIGNED(md->phys_addr), > - "UEFI Runtime regions are not aligned to 64 KB -- buggy firm= ware?")) > + if (!PAGE_ALIGNED(md->phys_addr)) { > + pr_warn_once("UEFI Runtime regions insufficiently aligned for stri= ct permissions\n"); > /* > * If the region is not aligned to the page size of the OS, we > * can not use strict permissions, since that would also affect > * the mapping attributes of the adjacent regions. > */ > return pgprot_val(PAGE_KERNEL_EXEC); > + } > > /* R-- */ > if ((attr & (EFI_MEMORY_XP | EFI_MEMORY_RO)) =3D=3D >