From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D72503F54DD; Wed, 8 Jul 2026 07:16:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783494962; cv=none; b=a28Y2uNbxZy6QRNh3ch9JLZZiNw+UmIXif0iN31+JajZnUodDmp+mWpqR2IQPRG9ZvxNBl7Ywu96eAHiM0juXRfWOTUSyGDmvSAKPmM5zD/hNu4+euenESuoks1ZqogdHz5KucIlaBLvHnIv5ic1l1pXJl6GCVG/Y2AKefk5tw8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783494962; c=relaxed/simple; bh=/ejZ9kEPzd3EuCno7ps+9xBx6LGHpjeL3VowrnL2/78=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uBKJroeev+azTK3qnGYKBVwZJ8R0PLVo3Sutew7za+QCDWbXPjMIo1HiPBFJwutcTKq4ItMJ6L1gLFwG7nuQwDjuuV24EEktkJCMYK3cXGdoh2h0cmuA9/0wjCHr7lhgwjSSFvdMDzzzHRgy7G+XrzY4PiCpqql16yXd+Z+NPKE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EkA2XLCe; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="EkA2XLCe" Received: by smtp.kernel.org (Postfix) with ESMTPS id CD0BFC2BCFB; Wed, 8 Jul 2026 07:16:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1783494960; bh=/ejZ9kEPzd3EuCno7ps+9xBx6LGHpjeL3VowrnL2/78=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=EkA2XLCetEn+0X3MLOpEK0EDgDo4DCBZKaerH//y9NGxL+gOzpZ5yDGvIqJY40geb QIStN89D9V9eiOsbg8lhNBXoMcB/vmzUi3vH3IKoJp1G1duTUiFEm4lYkvIRNzJoXA +9cXElE6H+m339LtH8vm0Xp8FdoF43kGu5UVaUkofZ9mSQYO44YcRxOsGB9gtwrS05 6yInfa0rxgwvXSvyXJIVI8s0eioZ5l6jTjpXpAooxRjmJOwNBhIa8lamZdtHJm5IqV UHUorOMEs5ZInv4vgyu65aw7g90+h+FKDi058XukEXNhIAF3dzM8Gr2nqJSzBrT0EG gBbUM7aG6pOdg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id B616BC44503; Wed, 8 Jul 2026 07:16:00 +0000 (UTC) From: Sven Peter Date: Wed, 08 Jul 2026 09:15:40 +0200 Subject: [PATCH RFC 4/6] arm64/efi: Honor EFI_MEMORY_ISA_MASK for Device-nGnRnE vs -nGnRE Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260708-efi-psci-v1-4-9efb3abf0e4c@kernel.org> References: <20260708-efi-psci-v1-0-9efb3abf0e4c@kernel.org> In-Reply-To: <20260708-efi-psci-v1-0-9efb3abf0e4c@kernel.org> To: Mark Rutland , Lorenzo Pieralisi , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Ard Biesheuvel , Ilias Apalodimas , Catalin Marinas , Will Deacon , Sudeep Holla , Janne Grunau , Neal Gompa 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 X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1905; i=sven@kernel.org; h=from:subject:message-id; bh=/ejZ9kEPzd3EuCno7ps+9xBx6LGHpjeL3VowrnL2/78=; b=owGbwMvMwCXmIlirolUq95LxtFoSQ5bvT20VobN/mkSjXybcUAyb9+Z88s/JF8WfOJrfK1Ge9 T/5kZhWRykLgxgXg6yYIsv2/famTx6+EVy66dJ7mDmsTCBDGLg4BWAiR68wMsw/Pqu0ZI/KjOyn DLbql2JYL5V908i9WRd1+mWnzWJHcUlGhqttB8R9OEyec165K7C9z9xZ4uftR93tR4XKbs1h4mX 6wQ4A X-Developer-Key: i=sven@kernel.org; a=openpgp; fpr=A1E3E34A2B3C820DBC4955E5993B08092F131F93 X-Endpoint-Received: by B4 Relay for sven@kernel.org/default with auth_id=407 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 --- 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 #include #include #include @@ -16,6 +17,7 @@ #include #include +#include #include @@ -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