efi: ia64: disable the capsule loader
Ard Biesheuvel
maintainerPATCH v2 1/1 efi: ia64: disable the capsule loader
EFI capsule loading is a feature that was introduced into EFI long after its initial introduction on Itanium, and it is highly unlikely that IA64 systems are receiving firmware updates in the first place, let alone using EFI capsules.
So let's disable capsule support altogether on IA64. This fixes a build error on IA64 due to a recent change that added an unconditional include of asm/efi.h, which IA64 does not provide.
While at it, tweak the make rules a bit so that the EFI capsule component that is always builtin (even if the EFI capsule loader itself is built as a module) is omitted for all architectures if the module is not enabled in the build.
---
v2: - replace #ifdef with #if IS_ENABLED() so the _MODULE case is taken
into account as well
- avoid duplicate definition of efi_capsule_pending() stub
drivers/firmware/efi/Kconfig | 2 +- drivers/firmware/efi/Makefile | 5 ++++- include/linux/efi.h | 10 ++++------ 3 files changed, 9 insertions(+), 8 deletions(-)
drivers/firmware/efi/Kconfig +1 -1
@@ -147,7 +147,7 @@ config EFI_BOOTLOADER_CONTROL config EFI_CAPSULE_LOADER tristate "EFI capsule loader" - depends on EFI + depends on EFI && !IA64 help This option exposes a loader interface "/dev/efi_capsule_loader" for users to load EFI capsules. This driver requires working runtime
drivers/firmware/efi/Makefile +4 -1
@@ -12,7 +12,10 @@ KASAN_SANITIZE_runtime-wrappers.o := n obj-$(CONFIG_ACPI_BGRT) += efi-bgrt.o obj-$(CONFIG_EFI) += efi.o vars.o reboot.o memattr.o tpm.o -obj-$(CONFIG_EFI) += capsule.o memmap.o +obj-$(CONFIG_EFI) += memmap.o +ifneq ($(CONFIG_EFI_CAPSULE_LOADER),) +obj-$(CONFIG_EFI) += capsule.o +endif obj-$(CONFIG_EFI_PARAMS_FROM_FDT) += fdtparams.o obj-$(CONFIG_EFI_VARS) += efivars.o obj-$(CONFIG_EFI_ESRT) += esrt.o
include/linux/efi.h +4 -6
@@ -817,12 +817,6 @@ static inline bool efi_enabled(int feature)static inline void efi_reboot (enum reboot_mode reboot_mode,const char *__unused) {} -static inline bool -efi_capsule_pending (int *reset_type) -{ -return false; -} -static inline bool efi_soft_reserve_enabled (void ) {return false;
@@ -1038,6 +1032,7 @@ bool efivar_validate(efi_guid_t vendor, efi_char16_t *var_name, u8 *data,bool efivar_variable_is_removable (efi_guid_t vendor,const char *name,size_t len); +#if IS_ENABLED (CONFIG_EFI_CAPSULE_LOADER )extern bool efi_capsule_pending (int *reset_type); extern int efi_capsule_supported(efi_guid_t guid, u32 flags,
@@ -1045,6 +1040,9 @@ extern int efi_capsule_supported(efi_guid_t guid, u32 flags,extern int efi_capsule_update (efi_capsule_header_t *capsule,phys_addr_t *pages); +#else +static inline bool efi_capsule_pending (int *reset_type) {return false; } +#endif #ifdef CONFIG_EFI_RUNTIME_MAP int efi_runtime_map_init (struct kobject *);
Signature · 1 line
2.20.1
The following commit has been merged into the efi/core branch of tip:
The following commit has been merged into the efi/core branch of tip:
Commit-ID: e0a6aa30504cb8179d07609fb6386705e8f00663 Gitweb: https://git.kernel.org/tip/e0a6aa30504cb8179d07609fb6386705e8f00663 Author: Ard Biesheuvel <[email protected]> AuthorDate: Sun, 13 Dec 2020 09:39:40 +01:00 Committer: Ard Biesheuvel <[email protected]> CommitterDate: Mon, 14 Dec 2020 16:24:19 +01:00
efi: ia64: disable the capsule loader
EFI capsule loading is a feature that was introduced into EFI long after its initial introduction on Itanium, and it is highly unlikely that IA64 systems are receiving firmware updates in the first place, let alone using EFI capsules.
So let's disable capsule support altogether on IA64. This fixes a build error on IA64 due to a recent change that added an unconditional include of asm/efi.h, which IA64 does not provide.
While at it, tweak the make rules a bit so that the EFI capsule component that is always builtin (even if the EFI capsule loader itself is built as a module) is omitted for all architectures if the module is not enabled in the build.
--- drivers/firmware/efi/Kconfig | 2 +- drivers/firmware/efi/Makefile | 5 ++++- include/linux/efi.h | 10 ++++------ 3 files changed, 9 insertions(+), 8 deletions(-)
drivers/firmware/efi/Kconfig +1 -1
@@ -147,7 +147,7 @@ config EFI_BOOTLOADER_CONTROL config EFI_CAPSULE_LOADER tristate "EFI capsule loader" - depends on EFI + depends on EFI && !IA64 help This option exposes a loader interface "/dev/efi_capsule_loader" for users to load EFI capsules. This driver requires working runtime
drivers/firmware/efi/Makefile +4 -1
@@ -12,7 +12,10 @@ KASAN_SANITIZE_runtime-wrappers.o := n obj-$(CONFIG_ACPI_BGRT) += efi-bgrt.o obj-$(CONFIG_EFI) += efi.o vars.o reboot.o memattr.o tpm.o -obj-$(CONFIG_EFI) += capsule.o memmap.o +obj-$(CONFIG_EFI) += memmap.o +ifneq ($(CONFIG_EFI_CAPSULE_LOADER),) +obj-$(CONFIG_EFI) += capsule.o +endif obj-$(CONFIG_EFI_PARAMS_FROM_FDT) += fdtparams.o obj-$(CONFIG_EFI_VARS) += efivars.o obj-$(CONFIG_EFI_ESRT) += esrt.o
include/linux/efi.h +4 -6
@@ -817,12 +817,6 @@ static inline bool efi_enabled(int feature)static inline void efi_reboot (enum reboot_mode reboot_mode,const char *__unused) {} -static inline bool -efi_capsule_pending (int *reset_type) -{ -return false; -} -static inline bool efi_soft_reserve_enabled (void ) {return false;
@@ -1038,6 +1032,7 @@ bool efivar_validate(efi_guid_t vendor, efi_char16_t *var_name, u8 *data,bool efivar_variable_is_removable (efi_guid_t vendor,const char *name,size_t len); +#if IS_ENABLED (CONFIG_EFI_CAPSULE_LOADER )extern bool efi_capsule_pending (int *reset_type); extern int efi_capsule_supported(efi_guid_t guid, u32 flags,
@@ -1045,6 +1040,9 @@ extern int efi_capsule_supported(efi_guid_t guid, u32 flags,extern int efi_capsule_update (efi_capsule_header_t *capsule,phys_addr_t *pages); +#else +static inline bool efi_capsule_pending (int *reset_type) {return false; } +#endif #ifdef CONFIG_EFI_RUNTIME_MAP int efi_runtime_map_init (struct kobject *);