efi/arm*: Take the Memory Attributes table into account
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Mon, 25 Apr 2016 20:06:46 +0000 (21:06 +0100)
committerIngo Molnar <mingo@kernel.org>
Thu, 28 Apr 2016 09:33:55 +0000 (11:33 +0200)
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@linaro.org>
Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Jones <pjones@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Will Deacon <will.deacon@arm.com>
Cc: linux-efi@vger.kernel.org
Link: http://lkml.kernel.org/r/1461614832-17633-15-git-send-email-matt@codeblueprint.co.uk
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/arm64/include/asm/efi.h
drivers/firmware/efi/arm-init.c
drivers/firmware/efi/arm-runtime.c

index 8e88a696c9cbcbd2c8f717ea1c929b87750f1b03..4dafc89f373a0ed51889ddd6e275e0c00fb45307 100644 (file)
@@ -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;                                               \
index a84dddb54c14943a9cfcfbcde6ec7562f2f640b6..909d974d35d9d6dd039df09fb2eefa34eb692955 100644 (file)
@@ -206,6 +206,7 @@ void __init efi_init(void)
                return;
 
        reserve_regions();
+       efi_memattr_init();
        early_memunmap(efi.memmap.map, params.mmap_size);
 
        if (IS_ENABLED(CONFIG_ARM)) {
index 19283deac375d76a8de6e59796c60b930186ea40..17ccf0a8787a2cf3f7ea1869e2e06801da2c46ef 100644 (file)
@@ -77,9 +77,15 @@ static bool __init efi_virtmap_init(void)
                        systab_found = true;
                }
        }
-       if (!systab_found)
+       if (!systab_found) {
                pr_err("No virtual mapping found for the UEFI System Table\n");
-       return systab_found;
+               return false;
+       }
+
+       if (efi_memattr_apply_permissions(&efi_mm, efi_set_mapping_permissions))
+               return false;
+
+       return true;
 }
 
 /*