Skip to content

Commit 491db21

Browse files
Suzuki K Poulosectmarinas
authored andcommitted
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 <[email protected]> Reviewed-by: Catalin Marinas <[email protected]> Signed-off-by: Suzuki K Poulose <[email protected]> Signed-off-by: Steven Price <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent 3c6c706 commit 491db21

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

arch/arm64/kernel/efi.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,16 @@ static __init pteval_t create_mapping_protection(efi_memory_desc_t *md)
3434
u64 attr = md->attribute;
3535
u32 type = md->type;
3636

37-
if (type == EFI_MEMORY_MAPPED_IO)
38-
return PROT_DEVICE_nGnRE;
37+
if (type == EFI_MEMORY_MAPPED_IO) {
38+
pgprot_t prot = __pgprot(PROT_DEVICE_nGnRE);
39+
40+
if (arm64_is_protected_mmio(md->phys_addr,
41+
md->num_pages << EFI_PAGE_SHIFT))
42+
prot = pgprot_encrypted(prot);
43+
else
44+
prot = pgprot_decrypted(prot);
45+
return pgprot_val(prot);
46+
}
3947

4048
if (region_is_misaligned(md)) {
4149
static bool __initdata code_is_misaligned;

0 commit comments

Comments
 (0)