[PATCH v2 5/5] arm*: efi: take the Memory Attributes table into account
Ard Biesheuvel
ard.biesheuvel at linaro.org
Wed Mar 30 09:38:53 PDT 2016
Call into the generic memory attributes table support code at the
appropriate times during the init sequence so that the UEFI Runtime
Services region are mapped according to the strict permissions it
specifies.
Signed-off-by: Ard Biesheuvel <ard.biesheuvel at linaro.org>
---
arch/arm64/include/asm/efi.h | 2 ++
drivers/firmware/efi/arm-init.c | 1 +
drivers/firmware/efi/arm-runtime.c | 3 +++
3 files changed, 6 insertions(+)
diff --git a/arch/arm64/include/asm/efi.h b/arch/arm64/include/asm/efi.h
index 8e88a696c9cb..4dafc89f373a 100644
--- a/arch/arm64/include/asm/efi.h
+++ b/arch/arm64/include/asm/efi.h
@@ -14,6 +14,8 @@ extern void efi_init(void);
int efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md);
+#define efi_set_mapping_permissions efi_create_mapping
+
#define efi_call_virt(f, ...) \
({ \
efi_##f##_t *__f; \
diff --git a/drivers/firmware/efi/arm-init.c b/drivers/firmware/efi/arm-init.c
index d5df9849544c..9941a4f2f66f 100644
--- a/drivers/firmware/efi/arm-init.c
+++ b/drivers/firmware/efi/arm-init.c
@@ -204,6 +204,7 @@ void __init efi_init(void)
return;
reserve_regions();
+ efi_memattr_init();
early_memunmap(memmap.map, params.mmap_size);
memblock_reserve(params.mmap & PAGE_MASK,
PAGE_ALIGN(params.mmap_size +
diff --git a/drivers/firmware/efi/arm-runtime.c b/drivers/firmware/efi/arm-runtime.c
index b0cfe208c14c..bf1f6ffc9218 100644
--- a/drivers/firmware/efi/arm-runtime.c
+++ b/drivers/firmware/efi/arm-runtime.c
@@ -75,6 +75,9 @@ static bool __init efi_virtmap_init(void)
set_bit(EFI_SYSTEM_TABLES, &efi.flags);
}
}
+
+ if (efi_memattr_apply_permissions(&efi_mm, efi_set_mapping_permissions))
+ return false;
return true;
}
--
2.5.0
More information about the linux-arm-kernel
mailing list