From: Sven Peter <sven@kernel.org>
To: Mark Rutland <mark.rutland@arm.com>,
Lorenzo Pieralisi <lpieralisi@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Ard Biesheuvel <ardb@kernel.org>,
Ilias Apalodimas <ilias.apalodimas@linaro.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Sudeep Holla <sudeep.holla@kernel.org>,
Janne Grunau <j@jannau.net>, Neal Gompa <neal@gompa.dev>
Cc: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org,
asahi@lists.linux.dev, Sven Peter <sven@kernel.org>
Subject: [PATCH RFC 4/6] arm64/efi: Honor EFI_MEMORY_ISA_MASK for Device-nGnRnE vs -nGnRE
Date: Wed, 08 Jul 2026 09:15:40 +0200 [thread overview]
Message-ID: <20260708-efi-psci-v1-4-9efb3abf0e4c@kernel.org> (raw)
In-Reply-To: <20260708-efi-psci-v1-0-9efb3abf0e4c@kernel.org>
On Apple Silicon, access to MMIO requires Device-nGnRnE while Device-nGnRE
results in SErrors. UEFI defines the EFI_MEMORY_ISA_MASK for cases like
that which just contains the MAIR attribute bits. We cannot support any
other Device- types without changing MAIR so just warn and fall back to
the previous default, Device-nGnRE, if we encounter anything else.
Signed-off-by: Sven Peter <sven@kernel.org>
---
arch/arm64/kernel/efi.c | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c
index e40885567f9e..50ba8e9112fc 100644
--- a/arch/arm64/kernel/efi.c
+++ b/arch/arm64/kernel/efi.c
@@ -7,6 +7,7 @@
* Copyright (C) 2013, 2014 Linaro Ltd.
*/
+#include <linux/bitfield.h>
#include <linux/efi.h>
#include <linux/init.h>
#include <linux/kmemleak.h>
@@ -16,6 +17,7 @@
#include <asm/efi.h>
#include <asm/stacktrace.h>
+#include <asm/sysreg.h>
#include <asm/vmap_stack.h>
@@ -38,7 +40,27 @@ static __init ptval_t create_mapping_protection(efi_memory_desc_t *md)
u32 type = md->type;
if (type == EFI_MEMORY_MAPPED_IO) {
- pgprot_t prot = __pgprot(PROT_DEVICE_nGnRE);
+ pgprot_t prot;
+
+ if (attr & EFI_MEMORY_ISA_VALID) {
+ u8 mair = FIELD_GET(EFI_MEMORY_ISA_MASK, attr);
+
+ switch (mair) {
+ case MAIR_ATTR_DEVICE_nGnRnE:
+ prot = __pgprot(PROT_DEVICE_nGnRnE);
+ break;
+ case MAIR_ATTR_DEVICE_nGnRE:
+ prot = __pgprot(PROT_DEVICE_nGnRE);
+ break;
+ default:
+ prot = __pgprot(PROT_DEVICE_nGnRE);
+ pr_warn("unsupported MAIR attribute %#x for EFI MMIO region at 0x%llx, using Device-nGnRE\n",
+ mair, md->phys_addr);
+ break;
+ }
+ } else {
+ prot = __pgprot(PROT_DEVICE_nGnRE);
+ }
if (arm64_is_protected_mmio(md->phys_addr,
md->num_pages << EFI_PAGE_SHIFT))
--
2.55.0
next prev parent reply other threads:[~2026-07-08 7:16 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-08 7:15 [PATCH RFC 0/6] PSCI-via-EFI to support firmware and kernel sharing EL2 for Apple Silicon Sven Peter
2026-07-08 7:15 ` [PATCH RFC 1/6] dt-bindings: arm: psci: Add EFI conduit Sven Peter
2026-07-08 7:15 ` [PATCH RFC 2/6] arm64/efi: Add and parse custom PSCI EFI configuration table Sven Peter
2026-07-08 7:39 ` sashiko-bot
2026-07-08 7:15 ` [PATCH RFC 3/6] efi: Add EFI_MEMORY_ISA_{MASK,VALID} Sven Peter
2026-07-08 7:25 ` sashiko-bot
2026-07-08 7:15 ` Sven Peter [this message]
2026-07-08 7:33 ` [PATCH RFC 4/6] arm64/efi: Honor EFI_MEMORY_ISA_MASK for Device-nGnRnE vs -nGnRE sashiko-bot
2026-07-08 7:15 ` [PATCH RFC 5/6] firmware/psci: Add EFI runtime conduit Sven Peter
2026-07-08 7:46 ` sashiko-bot
2026-07-08 7:15 ` [PATCH RFC 6/6] arm64: dts: apple: t8103: Add PSCI and CPU idle states Sven Peter
2026-07-08 7:48 ` sashiko-bot
2026-09-03 11:34 ` [PATCH RFC 0/6] PSCI-via-EFI to support firmware and kernel sharing EL2 for Apple Silicon Ard Biesheuvel
2026-09-03 11:42 ` Mark Rutland
2026-09-03 12:15 ` Will Deacon
2026-09-03 13:25 ` Ard Biesheuvel
2026-09-03 16:26 ` Sven Peter
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=20260708-efi-psci-v1-4-9efb3abf0e4c@kernel.org \
--to=sven@kernel.org \
--cc=ardb@kernel.org \
--cc=asahi@lists.linux.dev \
--cc=catalin.marinas@arm.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=ilias.apalodimas@linaro.org \
--cc=j@jannau.net \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=mark.rutland@arm.com \
--cc=neal@gompa.dev \
--cc=robh@kernel.org \
--cc=sudeep.holla@kernel.org \
--cc=will@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.