efi: Introduce the EFI_MEM_ATTR bit and set it from the memory attributes table
authorSai Praneeth <sai.praneeth.prakhya@intel.com>
Tue, 31 Jan 2017 13:21:36 +0000 (13:21 +0000)
committerIngo Molnar <mingo@kernel.org>
Wed, 1 Feb 2017 07:45:44 +0000 (08:45 +0100)
UEFI v2.6 introduces a configuration table called
EFI_MEMORY_ATTRIBUTES_TABLE which provides additional information about
EFI runtime regions. Currently this table describes memory protections
that may be applied to the EFI Runtime code and data regions by the kernel.

Allocate a EFI_XXX bit to keep track of whether this feature is
published by firmware or not.

Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Lee, Chun-Yi <jlee@suse.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Shankar <ravi.v.shankar@intel.com>
Cc: Ricardo Neri <ricardo.neri@intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-efi@vger.kernel.org
Link: http://lkml.kernel.org/r/1485868902-20401-5-git-send-email-ard.biesheuvel@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
drivers/firmware/efi/memattr.c
include/linux/efi.h

index 236004b9a50d3224024d0024b8774b6347995065..4021974605070bed12969894f702720a5c163e5b 100644 (file)
@@ -43,6 +43,7 @@ int __init efi_memattr_init(void)
 
        tbl_size = sizeof(*tbl) + tbl->num_entries * tbl->desc_size;
        memblock_reserve(efi.mem_attr_table, tbl_size);
+       set_bit(EFI_MEM_ATTR, &efi.flags);
 
 unmap:
        early_memunmap(tbl, sizeof(*tbl));
index 6642c4d9d11d70974a5af768191dd528eb4d5c21..5f632bf9969dedb30cf13ed3bebd8b5ce1b04cfb 100644 (file)
@@ -1065,6 +1065,7 @@ extern int __init efi_setup_pcdp_console(char *);
 #define EFI_ARCH_1             7       /* First arch-specific bit */
 #define EFI_DBG                        8       /* Print additional debug info at runtime */
 #define EFI_NX_PE_DATA         9       /* Can runtime data regions be mapped non-executable? */
+#define EFI_MEM_ATTR           10      /* Did firmware publish an EFI_MEMORY_ATTRIBUTES table? */
 
 #ifdef CONFIG_EFI
 /*