From: Boqun Feng <boqun.feng@gmail.com>
To: linux-arm-kernel@lists.infradead.org
Cc: stable@vger.kernel.org, Ard Biesheuvel <ardb@kernel.org>,
linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC] efi: Add ACPI_MEMORY_NVS into the linear map
Date: Thu, 15 Feb 2024 14:53:28 -0800 [thread overview]
Message-ID: <Zc6V6GnSQ_q1OAFC@boqun-archlinux> (raw)
In-Reply-To: <20240215225116.3435953-1-boqun.feng@gmail.com>
(Cc the correct arm mailing list)
On Thu, Feb 15, 2024 at 02:51:06PM -0800, Boqun Feng wrote:
> Currently ACPI_MEMORY_NVS is omitted from the linear map, which causes
> a trouble with the following firmware memory region setup:
>
> [..] efi: 0x0000dfd62000-0x0000dfd83fff [ACPI Reclaim|...]
> [..] efi: 0x0000dfd84000-0x0000dfd87fff [ACPI Mem NVS|...]
>
> , on ARM64 with 64k page size, the whole 0x0000dfd80000-0x0000dfd8ffff
> range will be omitted from the the linear map due to 64k round-up. And
> a page fault happens when trying to access the ACPI_RECLAIM_MEMORY:
>
> [...] Unable to handle kernel paging request at virtual address ffff0000dfd80000
>
> To fix this, add ACPI_MEMORY_NVS into the linear map.
>
> Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
> Cc: stable@vger.kernel.org # 5.15+
> ---
> We hit this in an ARM64 Hyper-V VM when using 64k page size, although
> this issue may also be fixed if the efi memory regions are all 64k
> aligned, but I don't find this memory region setup is invalid per UEFI
> spec, also I don't find that spec disallows ACPI_MEMORY_NVS to be mapped
> in the OS linear map, but if there is any better way or I'm reading the
> spec incorrectly, please let me know.
>
> It's Cced stable since 5.15 because that's when Hyper-V ARM64 support is
> added, and Hyper-V is the only one that hits the problem so far.
>
> drivers/firmware/efi/efi-init.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/firmware/efi/efi-init.c b/drivers/firmware/efi/efi-init.c
> index a00e07b853f2..9a1b9bc66d50 100644
> --- a/drivers/firmware/efi/efi-init.c
> +++ b/drivers/firmware/efi/efi-init.c
> @@ -139,6 +139,7 @@ static __init int is_usable_memory(efi_memory_desc_t *md)
> case EFI_LOADER_CODE:
> case EFI_LOADER_DATA:
> case EFI_ACPI_RECLAIM_MEMORY:
> + case EFI_ACPI_MEMORY_NVS:
> case EFI_BOOT_SERVICES_CODE:
> case EFI_BOOT_SERVICES_DATA:
> case EFI_CONVENTIONAL_MEMORY:
> @@ -202,8 +203,12 @@ static __init void reserve_regions(void)
> if (!is_usable_memory(md))
> memblock_mark_nomap(paddr, size);
>
> - /* keep ACPI reclaim memory intact for kexec etc. */
> - if (md->type == EFI_ACPI_RECLAIM_MEMORY)
> + /*
> + * keep ACPI reclaim and NVS memory and intact for kexec
> + * etc.
> + */
> + if (md->type == EFI_ACPI_RECLAIM_MEMORY ||
> + md->type == EFI_ACPI_MEMORY_NVS)
> memblock_reserve(paddr, size);
> }
> }
> --
> 2.43.0
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next parent reply other threads:[~2024-02-15 22:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20240215225116.3435953-1-boqun.feng@gmail.com>
2024-02-15 22:53 ` Boqun Feng [this message]
[not found] ` <CAMj1kXF3L5SdeXDfd3uYSOz-oG7+J31pd3WtZJ+g9eGDHDdOxg@mail.gmail.com>
2024-02-15 23:40 ` [RFC] efi: Add ACPI_MEMORY_NVS into the linear map Ard Biesheuvel
[not found] ` <2024021718-dwindling-oval-8183@gregkh>
[not found] ` <ZdQmCEepdOE2R7gS@boqun-archlinux>
[not found] ` <CAMj1kXGzaUsgn0DGfy15c+Z5ECNqosjWbci-YZyUTsMWXte21A@mail.gmail.com>
2024-02-20 16:28 ` Boqun Feng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zc6V6GnSQ_q1OAFC@boqun-archlinux \
--to=boqun.feng@gmail.com \
--cc=ardb@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox