Skip to contentSkip to conversation

EFI changes for v4.7

GIT PULL Ingo Molnar 1 participant 1 message May 16, 2016

Subsystems (9)
lore
Share & tools
lore
#0 lore raw

Linus,

Please pull the latest efi-core-for-linus git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git efi-core-for-linus

# HEAD: 6c5450ef66816216e574885cf8d3ddb31ef77428 efivarfs: Make efivarfs_file_ioctl() static

The main changes in this cycle were:

* Drop the unused EFI_SYSTEM_TABLES efi.flags bit and ensure the ARM/arm64 EFI System Table mapping is read-only (Ard Biesheuvel)

* Add a comment to explain that one of the code paths in the x86/pat code is only executed for EFI boot (Matt Fleming)

* Improve Secure Boot status checks on arm64 and handle unexpected errors (Linn Crosetto)

* Remove the global EFI memory map variable 'memmap' as the same information is already available in efi::memmap (Matt Fleming)

* Add EFI Memory Attribute table support for ARM/arm64 (Ard Biesheuvel)

* Add EFI GOP framebuffer support for ARM/arm64 (Ard Biesheuvel)

* Add EFI Bootloader Control driver for storing reboot(2) data in EFI variables for consumption by bootloaders (Jeremy Compostella)

* Add Core EFI capsule support (Matt Fleming)

* Add EFI capsule char driver (Kweh, Hock Leong)

* Unify EFI memory map code for ARM and arm64 (Ard Biesheuvel)

* Add generic EFI support for detecting when firmware corrupts CPU status register bits (like IRQ flags) when performing EFI runtime service calls (Mark Rutland)

* ... other misc cleanups.

Thanks,

Ingo

------------------>
Ard Biesheuvel (19):
efi: Get rid of the EFI_SYSTEM_TABLES status bit
efi/arm*: Drop writable mapping of the UEFI System table
efi: Check EFI_MEMORY_DESCRIPTOR version explicitly efi/arm*: Use memremap() to create the persistent memmap mapping ARM/efi: Apply strict permissions for UEFI Runtime Services regions arm64/efi: Apply strict permissions to UEFI Runtime Services regions
efi: Add support for the EFI_MEMORY_ATTRIBUTES_TABLE config table
efi: Implement generic support for the Memory Attributes table efi/arm*: Take the Memory Attributes table into account x86/efi: Prepare GOP handling code for reuse as generic code efi/libstub: Move Graphics Output Protocol handling to generic code x86/efi/efifb: Move DMI based quirks handling out of generic code
efifb: Use builtin_platform_driver and drop unused includes arm64/efi/libstub: Make screen_info accessible to the UEFI stub efi/arm/libstub: Make screen_info accessible to the UEFI stub efi/arm*/libstub: Wire up GOP protocol to 'struct screen_info' efi/arm*: Wire up 'struct screen_info' to efi-framebuffer platform device
efifb: Enable the efi-framebuffer platform driver for ARM and arm64 efi/arm-init: Reserve rather than unmap the memory map for ARM as well

Compostella, Jeremy (1):
efibc: Add EFI Bootloader Control module

Ingo Molnar (1):
efi: Remove unnecessary (and buggy) .memmap initialization from the Xen EFI driver

Jeremy Compostella (1):
efibc: Fix excessive stack footprint warning

Julia Lawall (1):
efi: Merge boolean flag arguments

Kweh, Hock Leong (1):
efi: Add misc char driver interface to update EFI firmware

Linn Crosetto (2):
efi/arm64: Report unexpected errors when determining Secure Boot status efi/arm64: Check SetupMode when determining Secure Boot status

Mark Rutland (10):
efi/runtime-wrappers: Add {__,}efi_call_virt() templates arm64/efi: Move to generic {__,}efi_call_virt() arm/efi: Move to generic {__,}efi_call_virt() x86/efi: Move to generic {__,}efi_call_virt() efi/runtime-wrappers: Remove redundant #ifdefs efi/runtime-wrappers: Detect firmware IRQ flag corruption arm64/efi: Enable runtime call flag checking arm/efi: Enable runtime call flag checking x86/efi: Enable runtime call flag checking efi/runtime-wrappers: Remove ARCH_EFI_IRQ_FLAGS_MASK #ifdef

Matt Fleming (9):
x86/mm/pat: Document the (currently) EFI-only code path
efi: Iterate over efi.memmap in for_each_efi_memory_desc()
efi: Remove global 'memmap' EFI memory map
x86/efi: Remove the always true EFI_DEBUG symbol
efi: Move efi_status_to_err() to drivers/firmware/efi/
efi: Add 'capsule' update support
x86/efi: Force EFI reboot to process pending capsules efi/capsule: Make efi_capsule_pending() lockless efi/capsule: Move 'capsule' to the stack in efi_capsule_supported()

Peter Jones (1):
efivarfs: Make efivarfs_file_ioctl() static

 arch/arm/include/asm/efi.h                     |  37 +--
 arch/arm/kernel/efi.c                          |  41 +++
 arch/arm/kernel/setup.c                        |   3 +-
 arch/arm64/include/asm/efi.h                   |  37 +--
 arch/arm64/kernel/efi.c                        |  57 +++-
 arch/arm64/kernel/image.h                      |   1 +
 arch/ia64/kernel/efi.c                         |   2 -
 arch/x86/boot/compressed/eboot.c               | 308 +--------------------
 arch/x86/boot/compressed/eboot.h               |  74 ------
 arch/x86/include/asm/efi.h                     |  52 ++--
 arch/x86/kernel/reboot.c                       |   9 +
 arch/x86/kernel/sysfb_efi.c                    |  15 ++
 arch/x86/mm/pageattr.c                         |   8 +-
 arch/x86/platform/efi/efi.c                    | 133 +++++-----
 arch/x86/platform/efi/efi_64.c                 |  10 +-
 arch/x86/platform/efi/quirks.c                 |  10 +-
 drivers/firmware/efi/Kconfig                   |  25 ++
 drivers/firmware/efi/Makefile                  |   5 +-
 drivers/firmware/efi/arm-init.c                |  96 +++++--
 drivers/firmware/efi/arm-runtime.c             |  45 ++--
 drivers/firmware/efi/capsule-loader.c          | 343 ++++++++++++++++++++++++
 drivers/firmware/efi/capsule.c                 | 308 +++++++++++++++++++++
 drivers/firmware/efi/efi.c                     |  48 +++-
 drivers/firmware/efi/efibc.c                   | 113 ++++++++
 drivers/firmware/efi/efivars.c                 |   5 +-
 drivers/firmware/efi/fake_mem.c                |  43 ++-
 drivers/firmware/efi/libstub/Makefile          |   2 +-
 drivers/firmware/efi/libstub/arm-stub.c        |  77 +++++-
 drivers/firmware/efi/libstub/arm32-stub.c      |  37 +++
 drivers/firmware/efi/libstub/efi-stub-helper.c |   6 +-
 drivers/firmware/efi/libstub/gop.c             | 354 +++++++++++++++++++++++++
 drivers/firmware/efi/memattr.c                 | 182 +++++++++++++
 drivers/firmware/efi/reboot.c                  |  12 +-
 drivers/firmware/efi/runtime-wrappers.c        |  60 +++++
 drivers/firmware/efi/vars.c                    |  56 +---
 drivers/video/fbdev/Kconfig                    |   2 +-
 drivers/video/fbdev/efifb.c                    |  21 +-
 drivers/xen/efi.c                              |   1 -
 fs/efivarfs/file.c                             |   2 +-
 fs/efivarfs/super.c                            |   3 +-
 include/linux/efi.h                            | 167 +++++++++++-
 41 files changed, 2097 insertions(+), 713 deletions(-)
 create mode 100644 drivers/firmware/efi/capsule-loader.c
 create mode 100644 drivers/firmware/efi/capsule.c
 create mode 100644 drivers/firmware/efi/efibc.c
 create mode 100644 drivers/firmware/efi/libstub/gop.c
 create mode 100644 drivers/firmware/efi/memattr.c
arch/arm/include/asm/efi.h +20 -17
index e0eea72deb87..a708fa1f0905 100644
@@ -17,34 +17,28 @@
 #include <asm/mach/map.h>
 #include <asm/mmu_context.h>
 #include <asm/pgtable.h>
+#include <asm/ptrace.h>
 
 #ifdef CONFIG_EFI
 void efi_init(void);
 
 int efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md);
+int efi_set_mapping_permissions(struct mm_struct *mm, efi_memory_desc_t *md);
 
-#define efi_call_virt(f, ...)						\
-({									\
-	efi_##f##_t *__f;						\
-	efi_status_t __s;						\
-									\
-	efi_virtmap_load();						\
-	__f = efi.systab->runtime->f;					\
-	__s = __f(__VA_ARGS__);						\
-	efi_virtmap_unload();						\
-	__s;								\
-})
+#define arch_efi_call_virt_setup()	efi_virtmap_load()
+#define arch_efi_call_virt_teardown()	efi_virtmap_unload()
 
-#define __efi_call_virt(f, ...)						\
+#define arch_efi_call_virt(f, args...)					\
 ({									\
 	efi_##f##_t *__f;						\
-									\
-	efi_virtmap_load();						\
 	__f = efi.systab->runtime->f;					\
-	__f(__VA_ARGS__);						\
-	efi_virtmap_unload();						\
+	__f(args);							\
 })
 
+#define ARCH_EFI_IRQ_FLAGS_MASK \
+	(PSR_J_BIT | PSR_E_BIT | PSR_A_BIT | PSR_I_BIT | PSR_F_BIT | \
+	 PSR_T_BIT | MODE_MASK)
+
 static inline void efi_set_pgd(struct mm_struct *mm)
 {
 	check_and_switch_context(mm, NULL);
@@ -59,7 +53,16 @@ void efi_virtmap_unload(void);
 
 /* arch specific definitions used by the stub code */
 
-#define efi_call_early(f, ...) sys_table_arg->boottime->f(__VA_ARGS__)
+#define efi_call_early(f, ...)		sys_table_arg->boottime->f(__VA_ARGS__)
+#define __efi_call_early(f, ...)	f(__VA_ARGS__)
+#define efi_is_64bit()			(false)
+
+struct screen_info *alloc_screen_info(efi_system_table_t *sys_table_arg);
+void free_screen_info(efi_system_table_t *sys_table, struct screen_info *si);
+
+static inline void efifb_setup_from_dmi(struct screen_info *si, const char *opt)
+{
+}
 
 /*
  * A reasonable upper bound for the uncompressed kernel size is 32 MBytes,
arch/arm/kernel/efi.c +41 -0

52 lines not on this page · raw message

arch/arm/kernel/setup.c +2 -1
index 2c4bea39cf22..7d4e2850910c 100644
@@ -883,7 +883,8 @@ static void __init request_standard_resources(const struct machine_desc *mdesc)
 		request_resource(&ioport_resource, &lp2);
 }
 
-#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE)
+#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE) || \
+    defined(CONFIG_EFI)
 struct screen_info screen_info = {
  .orig_video_lines	= 30,
  .orig_video_cols	= 80,
arch/arm64/include/asm/efi.h +22 -15
index 8e88a696c9cb..622db3c6474e 100644
@@ -4,6 +4,7 @@
 #include <asm/io.h>
 #include <asm/mmu_context.h>
 #include <asm/neon.h>
+#include <asm/ptrace.h>
 #include <asm/tlbflush.h>
 
 #ifdef CONFIG_EFI
@@ -14,32 +15,29 @@ extern void efi_init(void);
 
 int efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md);
 
-#define efi_call_virt(f, ...)						\
+#define efi_set_mapping_permissions	efi_create_mapping
+
+#define arch_efi_call_virt_setup()					\
 ({									\
-	efi_##f##_t *__f;						\
-	efi_status_t __s;						\
-									\
 	kernel_neon_begin();						\
 	efi_virtmap_load();						\
-	__f = efi.systab->runtime->f;					\
-	__s = __f(__VA_ARGS__);						\
-	efi_virtmap_unload();						\
-	kernel_neon_end();						\
-	__s;								\
 })
 
-#define __efi_call_virt(f, ...)						\
+#define arch_efi_call_virt(f, args...)					\
 ({									\
 	efi_##f##_t *__f;						\
-									\
-	kernel_neon_begin();						\
-	efi_virtmap_load();						\
 	__f = efi.systab->runtime->f;					\
-	__f(__VA_ARGS__);						\
+	__f(args);							\
+})
+
+#define arch_efi_call_virt_teardown()					\
+({									\
 	efi_virtmap_unload();						\
 	kernel_neon_end();						\
 })
 
+#define ARCH_EFI_IRQ_FLAGS_MASK (PSR_D_BIT | PSR_A_BIT | PSR_I_BIT | PSR_F_BIT)
+
 /* arch specific definitions used by the stub code */
 
 /*
@@ -50,7 +48,16 @@ int efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md);
 #define EFI_FDT_ALIGN	SZ_2M   /* used by allocate_new_fdt_and_exit_boot() */
 #define MAX_FDT_OFFSET	SZ_512M
 
-#define efi_call_early(f, ...) sys_table_arg->boottime->f(__VA_ARGS__)
+#define efi_call_early(f, ...)		sys_table_arg->boottime->f(__VA_ARGS__)
+#define __efi_call_early(f, ...)	f(__VA_ARGS__)
+#define efi_is_64bit()			(true)
+
+#define alloc_screen_info(x...)		&screen_info
+#define free_screen_info(x...)
+
+static inline void efifb_setup_from_dmi(struct screen_info *si, const char *opt)
+{
+}
 
 #define EFI_ALLOC_ALIGN		SZ_64K
 
arch/arm64/kernel/efi.c +43 -14

65 lines not on this page · raw message

arch/arm64/kernel/image.h +1 -0
index 5e360ce88f10..1428849aece8 100644
@@ -112,6 +112,7 @@ __efistub___memset		= KALLSYMS_HIDE(__pi_memset);
 __efistub__text			= KALLSYMS_HIDE(_text);
 __efistub__end			= KALLSYMS_HIDE(_end);
 __efistub__edata		= KALLSYMS_HIDE(_edata);
+__efistub_screen_info		= KALLSYMS_HIDE(screen_info);
 
 #endif
 
arch/ia64/kernel/efi.c +0 -2
index 300dac3702f1..bf0865cd438a 100644
@@ -531,8 +531,6 @@ efi_init (void)
 	       efi.systab->hdr.revision >> 16,
 	       efi.systab->hdr.revision & 0xffff, vendor);
 
-	set_bit(EFI_SYSTEM_TABLES, &efi.flags);
-
 	palo_phys      = EFI_INVALID_TABLE_ADDR;
 
 	if (efi_config_init(arch_tables) != 0)
arch/x86/boot/compressed/eboot.c +1 -307

320 lines not on this page · raw message

arch/x86/boot/compressed/eboot.h +0 -74

80 lines not on this page · raw message

arch/x86/include/asm/efi.h +22 -30

107 lines not on this page · raw message

arch/x86/kernel/reboot.c +9 -0
index ab0adc0fa5db..a9b31eb815f2 100644
@@ -535,6 +535,15 @@ static void native_machine_emergency_restart(void)
 	mode = reboot_mode == REBOOT_WARM ? 0x1234 : 0;
 	*((unsigned short *)__va(0x472)) = mode;
 
+	/*
+	 * If an EFI capsule has been registered with the firmware then
+	 * override the reboot= parameter.
+	 */
+	if (efi_capsule_pending(NULL)) {
+		pr_info("EFI capsule is pending, forcing EFI reboot.\n");
+		reboot_type = BOOT_EFI;
+	}
+
 	for (;;) {
 		/* Could also try the reset bit in the Hammer NB */
 		switch (reboot_type) {
arch/x86/kernel/sysfb_efi.c +15 -0
index 5da924bbf0a0..623965e86b65 100644
@@ -68,6 +68,21 @@ struct efifb_dmi_info efifb_dmi_list[] = {
 	[M_UNKNOWN] = { NULL, 0, 0, 0, 0, OVERRIDE_NONE }
 };
 
+void efifb_setup_from_dmi(struct screen_info *si, const char *opt)
+{
+	int i;
+
+	for (i = 0; i < M_UNKNOWN; i++) {
+		if (efifb_dmi_list[i].base != 0 &&
+		    !strcmp(opt, efifb_dmi_list[i].optname)) {
+			si->lfb_base = efifb_dmi_list[i].base;
+			si->lfb_linelength = efifb_dmi_list[i].stride;
+			si->lfb_width = efifb_dmi_list[i].width;
+			si->lfb_height = efifb_dmi_list[i].height;
+		}
+	}
+}
+
 #define choose_value(dmivalue, fwvalue, field, flags) ({	\
 		typeof(fwvalue) _ret_ = fwvalue;		\
 		if ((flags) & (field))				\
arch/x86/mm/pageattr.c +7 -1
index 01be9ec3bf79..a1f0e1d0ddc2 100644
@@ -1125,8 +1125,14 @@ static int populate_pgd(struct cpa_data *cpa, unsigned long addr)
 static int __cpa_process_fault(struct cpa_data *cpa, unsigned long vaddr,
 			       int primary)
 {
-	if (cpa->pgd)
+	if (cpa->pgd) {
+		/*
+		 * Right now, we only execute this code path when mapping
+		 * the EFI virtual memory map regions, no other users
+		 * provide a ->pgd value. This may change in the future.
+		 */
 		return populate_pgd(cpa, vaddr);
+	}
 
 	/*
 	 * Ignore all non primary paths.
arch/x86/platform/efi/efi.c +62 -71

318 lines not on this page · raw message

arch/x86/platform/efi/efi_64.c +3 -7
index 49e4dd4a1f58..6e7242be1c87 100644
@@ -55,14 +55,12 @@ struct efi_scratch efi_scratch;
 static void __init early_code_mapping_set_exec(int executable)
 {
 	efi_memory_desc_t *md;
-	void *p;
 
 	if (!(__supported_pte_mask & _PAGE_NX))
 		return;
 
 	/* Make EFI service code area executable */
-	for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
-		md = p;
+	for_each_efi_memory_desc(md) {
 		if (md->type == EFI_RUNTIME_SERVICES_CODE ||
 		    md->type == EFI_BOOT_SERVICES_CODE)
 			efi_set_executable(md, executable);
@@ -253,7 +251,7 @@ int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages)
 	 * Map all of RAM so that we can access arguments in the 1:1
 	 * mapping when making EFI runtime calls.
 	 */
-	for_each_efi_memory_desc(&memmap, md) {
+	for_each_efi_memory_desc(md) {
 		if (md->type != EFI_CONVENTIONAL_MEMORY &&
 		    md->type != EFI_LOADER_DATA &&
 		    md->type != EFI_LOADER_CODE)
@@ -398,7 +396,6 @@ void __init efi_runtime_update_mappings(void)
 	unsigned long pfn;
 	pgd_t *pgd = efi_pgd;
 	efi_memory_desc_t *md;
-	void *p;
 
 	if (efi_enabled(EFI_OLD_MEMMAP)) {
 		if (__supported_pte_mask & _PAGE_NX)
@@ -409,9 +406,8 @@ void __init efi_runtime_update_mappings(void)
 	if (!efi_enabled(EFI_NX_PE_DATA))
 		return;
 
-	for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
+	for_each_efi_memory_desc(md) {
 		unsigned long pf = 0;
-		md = p;
 
 		if (!(md->attribute & EFI_MEMORY_RUNTIME))
 			continue;
arch/x86/platform/efi/quirks.c +4 -6
index ab50ada1d56e..097cb09d917b 100644
@@ -195,10 +195,9 @@ static bool can_free_region(u64 start, u64 size)
 */
 void __init efi_reserve_boot_services(void)
 {
-	void *p;
+	efi_memory_desc_t *md;
 
-	for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
-		efi_memory_desc_t *md = p;
+	for_each_efi_memory_desc(md) {
 		u64 start = md->phys_addr;
 		u64 size = md->num_pages << EFI_PAGE_SHIFT;
 		bool already_reserved;
@@ -250,10 +249,9 @@ void __init efi_reserve_boot_services(void)
 
 void __init efi_free_boot_services(void)
 {
-	void *p;
+	efi_memory_desc_t *md;
 
-	for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
-		efi_memory_desc_t *md = p;
+	for_each_efi_memory_desc(md) {
 		unsigned long long start = md->phys_addr;
 		unsigned long long size = md->num_pages << EFI_PAGE_SHIFT;
 
drivers/firmware/efi/Kconfig +25 -0
index e1670d533f97..6394152f648f 100644
@@ -87,6 +87,31 @@ config EFI_RUNTIME_WRAPPERS
 config EFI_ARMSTUB
 	bool
 
+config EFI_BOOTLOADER_CONTROL
+	tristate "EFI Bootloader Control"
+	depends on EFI_VARS
+	default n
+	---help---
+	  This module installs a reboot hook, such that if reboot() is
+	  invoked with a string argument NNN, "NNN" is copied to the
+	  "LoaderEntryOneShot" EFI variable, to be read by the
+	  bootloader. If the string matches one of the boot labels
+	  defined in its configuration, the bootloader will boot once
+	  to that label. The "LoaderEntryRebootReason" EFI variable is
+	  set with the reboot reason: "reboot" or "shutdown". The
+	  bootloader reads this reboot reason and takes particular
+	  action according to its policy.
+
+config EFI_CAPSULE_LOADER
+	tristate "EFI capsule loader"
+	depends on EFI
+	help
+	  This option exposes a loader interface "/dev/efi_capsule_loader" for
+	  users to load EFI capsules. This driver requires working runtime
+	  capsule support in the firmware, which many OEMs do not provide.
+
+	  Most users should say N.
+
 endmenu
 
 config UEFI_CPER
drivers/firmware/efi/Makefile +4 -1
index 62e654f255f4..a219640f881f 100644
@@ -9,7 +9,8 @@
 #
 KASAN_SANITIZE_runtime-wrappers.o	:= n
 
-obj-$(CONFIG_EFI)			+= efi.o vars.o reboot.o
+obj-$(CONFIG_EFI)			+= efi.o vars.o reboot.o memattr.o
+obj-$(CONFIG_EFI)			+= capsule.o
 obj-$(CONFIG_EFI_VARS)			+= efivars.o
 obj-$(CONFIG_EFI_ESRT)			+= esrt.o
 obj-$(CONFIG_EFI_VARS_PSTORE)		+= efi-pstore.o
@@ -18,7 +19,9 @@ obj-$(CONFIG_EFI_RUNTIME_MAP)		+= runtime-map.o
 obj-$(CONFIG_EFI_RUNTIME_WRAPPERS)	+= runtime-wrappers.o
 obj-$(CONFIG_EFI_STUB)			+= libstub/
 obj-$(CONFIG_EFI_FAKE_MEMMAP)		+= fake_mem.o
+obj-$(CONFIG_EFI_BOOTLOADER_CONTROL)	+= efibc.o
 
 arm-obj-$(CONFIG_EFI)			:= arm-init.o arm-runtime.o
 obj-$(CONFIG_ARM)			+= $(arm-obj-y)
 obj-$(CONFIG_ARM64)			+= $(arm-obj-y)
+obj-$(CONFIG_EFI_CAPSULE_LOADER)	+= capsule-loader.o
drivers/firmware/efi/arm-init.c +70 -26

157 lines not on this page · raw message

drivers/firmware/efi/arm-runtime.c +27 -18

79 lines not on this page · raw message

drivers/firmware/efi/capsule-loader.c new file +343 -0

343 lines not on this page · raw message

drivers/firmware/efi/capsule.c new file +308 -0

308 lines not on this page · raw message

drivers/firmware/efi/efi.c +40 -8

86 lines not on this page · raw message

drivers/firmware/efi/efibc.c new file +113 -0

113 lines not on this page · raw message

drivers/firmware/efi/efivars.c +2 -3
index 096adcbcb5a9..116b244dee68 100644
@@ -661,7 +661,7 @@ static void efivar_update_sysfs_entries(struct work_struct *work)
 			return;
 
 		err = efivar_init(efivar_update_sysfs_entry, entry,
-				  true, false, &efivar_sysfs_list);
+				  false, &efivar_sysfs_list);
 		if (!err)
 			break;
 
@@ -730,8 +730,7 @@ int efivars_sysfs_init(void)
 		return -ENOMEM;
 	}
 
-	efivar_init(efivars_sysfs_callback, NULL, false,
-		    true, &efivar_sysfs_list);
+	efivar_init(efivars_sysfs_callback, NULL, true, &efivar_sysfs_list);
 
 	error = create_efivars_bin_attributes();
 	if (error) {
drivers/firmware/efi/fake_mem.c +21 -22

103 lines not on this page · raw message

drivers/firmware/efi/libstub/Makefile +1 -1
index da99bbb74aeb..c06945160a41 100644
@@ -28,7 +28,7 @@ OBJECT_FILES_NON_STANDARD	:= y
 # Prevents link failures: __sanitizer_cov_trace_pc() is not linked in.
 KCOV_INSTRUMENT			:= n
 
-lib-y				:= efi-stub-helper.o
+lib-y				:= efi-stub-helper.o gop.o
 
 # include the stub's generic dependencies from lib/ when building for ARM/arm64
 arm-deps := fdt_rw.c fdt_ro.c fdt_wip.c fdt.c fdt_empty_tree.c fdt_sw.c sort.c
drivers/firmware/efi/libstub/arm-stub.c +66 -11

129 lines not on this page · raw message

drivers/firmware/efi/libstub/arm32-stub.c +37 -0
index 6f42be4d0084..e1f0b28e1dcb 100644
@@ -26,6 +26,43 @@ efi_status_t check_platform_features(efi_system_table_t *sys_table_arg)
 	return EFI_SUCCESS;
 }
 
+static efi_guid_t screen_info_guid = LINUX_EFI_ARM_SCREEN_INFO_TABLE_GUID;
+
+struct screen_info *alloc_screen_info(efi_system_table_t *sys_table_arg)
+{
+	struct screen_info *si;
+	efi_status_t status;
+
+	/*
+	 * Unlike on arm64, where we can directly fill out the screen_info
+	 * structure from the stub, we need to allocate a buffer to hold
+	 * its contents while we hand over to the kernel proper from the
+	 * decompressor.
+	 */
+	status = efi_call_early(allocate_pool, EFI_RUNTIME_SERVICES_DATA,
+				sizeof(*si), (void **)&si);
+
+	if (status != EFI_SUCCESS)
+		return NULL;
+
+	status = efi_call_early(install_configuration_table,
+				&screen_info_guid, si);
+	if (status == EFI_SUCCESS)
+		return si;
+
+	efi_call_early(free_pool, si);
+	return NULL;
+}
+
+void free_screen_info(efi_system_table_t *sys_table_arg, struct screen_info *si)
+{
+	if (!si)
+		return;
+
+	efi_call_early(install_configuration_table, &screen_info_guid, NULL);
+	efi_call_early(free_pool, si);
+}
+
 efi_status_t handle_kernel_image(efi_system_table_t *sys_table,
 				 unsigned long *image_addr,
 				 unsigned long *image_size,
drivers/firmware/efi/libstub/efi-stub-helper.c +4 -2
index 29ed2f9b218c..3bd127f95315 100644
@@ -125,10 +125,12 @@ unsigned long get_dram_base(efi_system_table_t *sys_table_arg)
 
 	map.map_end = map.map + map_size;
 
-	for_each_efi_memory_desc(&map, md)
-		if (md->attribute & EFI_MEMORY_WB)
+	for_each_efi_memory_desc_in_map(&map, md) {
+		if (md->attribute & EFI_MEMORY_WB) {
 			if (membase > md->phys_addr)
 				membase = md->phys_addr;
+		}
+	}
 
 	efi_call_early(free_pool, map.map);
 
drivers/firmware/efi/libstub/gop.c new file +354 -0

342 lines not on this page · raw message

drivers/firmware/efi/memattr.c new file +182 -0

182 lines not on this page · raw message

drivers/firmware/efi/reboot.c +11 -1
index 9c59d1c795d1..62ead9b9d871 100644

Lines of this file are not shown. View the raw message.

drivers/firmware/efi/runtime-wrappers.c +60 -0

60 lines not on this page · raw message

drivers/firmware/efi/vars.c +10 -46

56 lines not on this page · raw message

drivers/video/fbdev/Kconfig +1 -1
index 983280e8d93f..e5a391aecde1 100644

Lines of this file are not shown. View the raw message.

drivers/video/fbdev/efifb.c +5 -16
index 95d293b7445a..f4c045c0051c 100644

Lines of this file are not shown. View the raw message.

drivers/xen/efi.c +0 -1
index be7e56a338e8..e9d2135445c1 100644

Lines of this file are not shown. View the raw message.

fs/efivarfs/file.c +1 -1
index d48e0d261d78..5f22e74bbade 100644

Lines of this file are not shown. View the raw message.

fs/efivarfs/super.c +1 -2
index 553c5d2db4a4..9cb54a38832d 100644

Lines of this file are not shown. View the raw message.

include/linux/efi.h +159 -8

167 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.