aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorSuzuki K Poulose <suzuki.poulose@arm.com>2024-10-17 14:14:29 +0100
committerCatalin Marinas <catalin.marinas@arm.com>2024-10-23 10:19:32 +0100
commit491db21d8256992ab9fe11c42744eb3044315d14 (patch)
tree4634e5815f2c7eee904c73cbf7230f864ea9a10a
parentarm64: rsi: Map unprotected MMIO as decrypted (diff)
downloadwireguard-linux-491db21d8256992ab9fe11c42744eb3044315d14.tar.xz
wireguard-linux-491db21d8256992ab9fe11c42744eb3044315d14.zip
efi: arm64: Map Device with Prot Shared
Device mappings need to be emulated by the VMM so must be mapped shared with the host. Reviewed-by: Gavin Shan <gshan@redhat.com> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> Signed-off-by: Steven Price <steven.price@arm.com> Link: https://lore.kernel.org/r/20241017131434.40935-7-steven.price@arm.com Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to '')
-rw-r--r--arch/arm64/kernel/efi.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c
index 712718aed5dd..1d25d8899dbf 100644
--- a/arch/arm64/kernel/efi.c
+++ b/arch/arm64/kernel/efi.c
@@ -34,8 +34,16 @@ static __init pteval_t create_mapping_protection(efi_memory_desc_t *md)
u64 attr = md->attribute;
u32 type = md->type;
- if (type == EFI_MEMORY_MAPPED_IO)
- return PROT_DEVICE_nGnRE;
+ if (type == EFI_MEMORY_MAPPED_IO) {
+ pgprot_t prot = __pgprot(PROT_DEVICE_nGnRE);
+
+ if (arm64_is_protected_mmio(md->phys_addr,
+ md->num_pages << EFI_PAGE_SHIFT))
+ prot = pgprot_encrypted(prot);
+ else
+ prot = pgprot_decrypted(prot);
+ return pgprot_val(prot);
+ }
if (region_is_misaligned(md)) {
static bool __initdata code_is_misaligned;