Skip to content

Commit

Permalink
Merge tag 'efi-next-for-v5.20' of git://git.kernel.org/pub/scm/linux/…
Browse files Browse the repository at this point in the history
…kernel/git/efi/efi

Pull EFI updates from Ard Biesheuvel:

 - Enable mirrored memory for arm64

 - Fix up several abuses of the efivar API

 - Refactor the efivar API in preparation for moving the 'business
   logic' part of it into efivarfs

 - Enable ACPI PRM on arm64

* tag 'efi-next-for-v5.20' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi: (24 commits)
  ACPI: Move PRM config option under the main ACPI config
  ACPI: Enable Platform Runtime Mechanism(PRM) support on ARM64
  ACPI: PRM: Change handler_addr type to void pointer
  efi: Simplify arch_efi_call_virt() macro
  drivers: fix typo in firmware/efi/memmap.c
  efi: vars: Drop __efivar_entry_iter() helper which is no longer used
  efi: vars: Use locking version to iterate over efivars linked lists
  efi: pstore: Omit efivars caching EFI varstore access layer
  efi: vars: Add thin wrapper around EFI get/set variable interface
  efi: vars: Don't drop lock in the middle of efivar_init()
  pstore: Add priv field to pstore_record for backend specific use
  Input: applespi - avoid efivars API and invoke EFI services directly
  selftests/kexec: remove broken EFI_VARS secure boot fallback check
  brcmfmac: Switch to appropriate helper to load EFI variable contents
  iwlwifi: Switch to proper EFI variable store interface
  media: atomisp_gmin_platform: stop abusing efivar API
  efi: efibc: avoid efivar API for setting variables
  efi: avoid efivars layer when loading SSDTs from variables
  efi: Correct comment on efi_memmap_alloc
  memblock: Disable mirror feature if kernelcore is not specified
  ...
  • Loading branch information
torvalds committed Aug 3, 2022
2 parents ff89dd0 + e3435ff commit 97a77ab
Show file tree
Hide file tree
Showing 31 changed files with 486 additions and 775 deletions.
7 changes: 0 additions & 7 deletions arch/arm/include/asm/efi.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@ int efi_set_mapping_permissions(struct mm_struct *mm, efi_memory_desc_t *md);
#define arch_efi_call_virt_setup() efi_virtmap_load()
#define arch_efi_call_virt_teardown() efi_virtmap_unload()

#define arch_efi_call_virt(p, f, args...) \
({ \
efi_##f##_t *__f; \
__f = p->f; \
__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)
Expand Down
7 changes: 2 additions & 5 deletions arch/arm64/include/asm/efi.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,9 @@ int efi_set_mapping_permissions(struct mm_struct *mm, efi_memory_desc_t *md);
__efi_fpsimd_begin(); \
})

#undef arch_efi_call_virt
#define arch_efi_call_virt(p, f, args...) \
({ \
efi_##f##_t *__f; \
__f = p->f; \
__efi_rt_asm_wrapper(__f, #f, args); \
})
__efi_rt_asm_wrapper((p)->f, #f, args)

#define arch_efi_call_virt_teardown() \
({ \
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,8 @@ void __init arm64_memblock_init(void)
"initrd not fully accessible via the linear mapping -- please check your bootloader ...\n")) {
phys_initrd_size = 0;
} else {
memblock_remove(base, size); /* clear MEMBLOCK_ flags */
memblock_add(base, size);
memblock_clear_nomap(base, size);
memblock_reserve(base, size);
}
}
Expand Down
16 changes: 2 additions & 14 deletions arch/loongarch/include/asm/efi.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,8 @@ void efifb_setup_from_dmi(struct screen_info *si, const char *opt);

#define ARCH_EFI_IRQ_FLAGS_MASK 0x00000004 /* Bit 2: CSR.CRMD.IE */

#define arch_efi_call_virt_setup() \
({ \
})

#define arch_efi_call_virt(p, f, args...) \
({ \
efi_##f##_t * __f; \
__f = p->f; \
__f(args); \
})

#define arch_efi_call_virt_teardown() \
({ \
})
#define arch_efi_call_virt_setup()
#define arch_efi_call_virt_teardown()

#define EFI_ALLOC_ALIGN SZ_64K

Expand Down
2 changes: 0 additions & 2 deletions arch/riscv/include/asm/efi.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ int efi_set_mapping_permissions(struct mm_struct *mm, efi_memory_desc_t *md);
#define arch_efi_call_virt_setup() efi_virtmap_load()
#define arch_efi_call_virt_teardown() efi_virtmap_unload()

#define arch_efi_call_virt(p, f, args...) p->f(args)

#define ARCH_EFI_IRQ_FLAGS_MASK (SR_IE | SR_SPIE)

/* Load initrd anywhere in system RAM */
Expand Down
7 changes: 1 addition & 6 deletions arch/x86/include/asm/efi.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ static inline void efi_fpu_end(void)
efi_fpu_end(); \
})

#define arch_efi_call_virt(p, f, args...) p->f(args)

#else /* !CONFIG_X86_32 */

#define EFI_LOADER_SIGNATURE "EL64"
Expand All @@ -121,6 +119,7 @@ extern asmlinkage u64 __efi_call(void *fp, ...);
efi_enter_mm(); \
})

#undef arch_efi_call_virt
#define arch_efi_call_virt(p, f, args...) ({ \
u64 ret, ibt = ibt_save(); \
ret = efi_call((void *)p->f, args); \
Expand Down Expand Up @@ -383,7 +382,6 @@ static inline bool efi_is_64bit(void)
extern bool efi_reboot_required(void);
extern bool efi_is_table_address(unsigned long phys_addr);

extern void efi_find_mirror(void);
extern void efi_reserve_boot_services(void);
#else
static inline void parse_efi_setup(u64 phys_addr, u32 data_len) {}
Expand All @@ -395,9 +393,6 @@ static inline bool efi_is_table_address(unsigned long phys_addr)
{
return false;
}
static inline void efi_find_mirror(void)
{
}
static inline void efi_reserve_boot_services(void)
{
}
Expand Down
23 changes: 0 additions & 23 deletions arch/x86/platform/efi/efi.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,29 +108,6 @@ static int __init setup_add_efi_memmap(char *arg)
}
early_param("add_efi_memmap", setup_add_efi_memmap);

void __init efi_find_mirror(void)
{
efi_memory_desc_t *md;
u64 mirror_size = 0, total_size = 0;

if (!efi_enabled(EFI_MEMMAP))
return;

for_each_efi_memory_desc(md) {
unsigned long long start = md->phys_addr;
unsigned long long size = md->num_pages << EFI_PAGE_SHIFT;

total_size += size;
if (md->attribute & EFI_MEMORY_MORE_RELIABLE) {
memblock_mark_mirror(start, size);
mirror_size += size;
}
}
if (mirror_size)
pr_info("Memory: %lldM/%lldM mirrored memory\n",
mirror_size>>20, total_size>>20);
}

/*
* Tell the kernel about the EFI memory map. This might include
* more than the max 128 entries that can fit in the passed in e820
Expand Down
30 changes: 15 additions & 15 deletions drivers/acpi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,21 @@ source "drivers/acpi/pmic/Kconfig"
config ACPI_VIOT
bool

config ACPI_PRMT
bool "Platform Runtime Mechanism Support"
depends on EFI && (X86_64 || ARM64)
default y
help
Platform Runtime Mechanism (PRM) is a firmware interface exposing a
set of binary executables that can be called from the AML interpreter
or directly from device drivers.

Say Y to enable the AML interpreter to execute the PRM code.

While this feature is optional in principle, leaving it out may
substantially increase computational overhead related to the
initialization of some server systems.

endif # ACPI

config X86_PM_TIMER
Expand All @@ -589,18 +604,3 @@ config X86_PM_TIMER

You should nearly always say Y here because many modern
systems require this timer.

config ACPI_PRMT
bool "Platform Runtime Mechanism Support"
depends on EFI && X86_64
default y
help
Platform Runtime Mechanism (PRM) is a firmware interface exposing a
set of binary executables that can be called from the AML interpreter
or directly from device drivers.

Say Y to enable the AML interpreter to execute the PRM code.

While this feature is optional in principle, leaving it out may
substantially increase computational overhead related to the
initialization of some server systems.
4 changes: 2 additions & 2 deletions drivers/acpi/prmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static LIST_HEAD(prm_module_list);

struct prm_handler_info {
guid_t guid;
u64 handler_addr;
void *handler_addr;
u64 static_data_buffer_addr;
u64 acpi_param_buffer_addr;

Expand Down Expand Up @@ -148,7 +148,7 @@ acpi_parse_prmt(union acpi_subtable_headers *header, const unsigned long end)
th = &tm->handlers[cur_handler];

guid_copy(&th->guid, (guid_t *)handler_info->handler_guid);
th->handler_addr = efi_pa_va_lookup(handler_info->handler_address);
th->handler_addr = (void *)efi_pa_va_lookup(handler_info->handler_address);
th->static_data_buffer_addr = efi_pa_va_lookup(handler_info->static_data_buffer_address);
th->acpi_param_buffer_addr = efi_pa_va_lookup(handler_info->acpi_param_buffer_address);
} while (++cur_handler < tm->handler_count && (handler_info = get_next_handler(handler_info)));
Expand Down
2 changes: 2 additions & 0 deletions drivers/firmware/efi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ config EFI_ESRT
config EFI_VARS_PSTORE
tristate "Register efivars backend for pstore"
depends on PSTORE
select UCS2_STRING
default y
help
Say Y here to enable use efivars as a backend to pstore. This
Expand Down Expand Up @@ -145,6 +146,7 @@ config EFI_GENERIC_STUB_INITRD_CMDLINE_LOADER

config EFI_BOOTLOADER_CONTROL
tristate "EFI Bootloader Control"
select UCS2_STRING
default n
help
This module installs a reboot hook, such that if reboot() is
Expand Down
1 change: 1 addition & 0 deletions drivers/firmware/efi/efi-init.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ void __init efi_init(void)
* And now, memblock is fully populated, it is time to do capping.
*/
early_init_dt_check_for_usable_mem_range();
efi_find_mirror();
efi_esrt_init();
efi_mokvar_table_init();

Expand Down
Loading

0 comments on commit 97a77ab

Please sign in to comment.