Skip to content

Commit e6412f9

Browse files
committed
Merge tag 'efi-core-2020-10-12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull EFI changes from Ingo Molnar: - Preliminary RISC-V enablement - the bulk of it will arrive via the RISCV tree. - Relax decompressed image placement rules for 32-bit ARM - Add support for passing MOK certificate table contents via a config table rather than a EFI variable. - Add support for 18 bit DIMM row IDs in the CPER records. - Work around broken Dell firmware that passes the entire Boot#### variable contents as the command line - Add definition of the EFI_MEMORY_CPU_CRYPTO memory attribute so we can identify it in the memory map listings. - Don't abort the boot on arm64 if the EFI RNG protocol is available but returns with an error - Replace slashes with exclamation marks in efivarfs file names - Split efi-pstore from the deprecated efivars sysfs code, so we can disable the latter on !x86. - Misc fixes, cleanups and updates. * tag 'efi-core-2020-10-12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (26 commits) efi: mokvar: add missing include of asm/early_ioremap.h efi: efivars: limit availability to X86 builds efi: remove some false dependencies on CONFIG_EFI_VARS efi: gsmi: fix false dependency on CONFIG_EFI_VARS efi: efivars: un-export efivars_sysfs_init() efi: pstore: move workqueue handling out of efivars efi: pstore: disentangle from deprecated efivars module efi: mokvar-table: fix some issues in new code efi/arm64: libstub: Deal gracefully with EFI_RNG_PROTOCOL failure efivarfs: Replace invalid slashes with exclamation marks in dentries. efi: Delete deprecated parameter comments efi/libstub: Fix missing-prototypes in string.c efi: Add definition of EFI_MEMORY_CPU_CRYPTO and ability to report it cper,edac,efi: Memory Error Record: bank group/address and chip id edac,ghes,cper: Add Row Extension to Memory Error Record efi/x86: Add a quirk to support command line arguments on Dell EFI firmware efi/libstub: Add efi_warn and *_once logging helpers integrity: Load certs from the EFI MOK config table integrity: Move import of MokListRT certs to a separate routine efi: Support for MOK variable config table ...
2 parents ed016af + 4d0a438 commit e6412f9

32 files changed

Lines changed: 871 additions & 366 deletions

File tree

Documentation/arm/uefi.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ makes it possible for the kernel to support additional features:
2323
For actually enabling [U]EFI support, enable:
2424

2525
- CONFIG_EFI=y
26-
- CONFIG_EFI_VARS=y or m
26+
- CONFIG_EFIVAR_FS=y or m
2727

2828
The implementation depends on receiving information about the UEFI environment
2929
in a Flattened Device Tree (FDT) - so is only available with CONFIG_OF.

arch/arm/include/asm/efi.h

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,25 +66,24 @@ static inline void efifb_setup_from_dmi(struct screen_info *si, const char *opt)
6666
#define MAX_UNCOMP_KERNEL_SIZE SZ_32M
6767

6868
/*
69-
* The kernel zImage should preferably be located between 32 MB and 128 MB
70-
* from the base of DRAM. The min address leaves space for a maximal size
71-
* uncompressed image, and the max address is due to how the zImage decompressor
72-
* picks a destination address.
69+
* phys-to-virt patching requires that the physical to virtual offset fits
70+
* into the immediate field of an add/sub instruction, which comes down to the
71+
* 24 least significant bits being zero, and so the offset should be a multiple
72+
* of 16 MB. Since PAGE_OFFSET itself is a multiple of 16 MB, the physical
73+
* base should be aligned to 16 MB as well.
7374
*/
74-
#define ZIMAGE_OFFSET_LIMIT SZ_128M
75-
#define MIN_ZIMAGE_OFFSET MAX_UNCOMP_KERNEL_SIZE
75+
#define EFI_PHYS_ALIGN SZ_16M
7676

77-
/* on ARM, the FDT should be located in the first 128 MB of RAM */
78-
static inline unsigned long efi_get_max_fdt_addr(unsigned long dram_base)
77+
/* on ARM, the FDT should be located in a lowmem region */
78+
static inline unsigned long efi_get_max_fdt_addr(unsigned long image_addr)
7979
{
80-
return dram_base + ZIMAGE_OFFSET_LIMIT;
80+
return round_down(image_addr, EFI_PHYS_ALIGN) + SZ_512M;
8181
}
8282

8383
/* on ARM, the initrd should be loaded in a lowmem region */
84-
static inline unsigned long efi_get_max_initrd_addr(unsigned long dram_base,
85-
unsigned long image_addr)
84+
static inline unsigned long efi_get_max_initrd_addr(unsigned long image_addr)
8685
{
87-
return dram_base + SZ_512M;
86+
return round_down(image_addr, EFI_PHYS_ALIGN) + SZ_512M;
8887
}
8988

9089
struct efi_arm_entry_state {

arch/arm64/include/asm/efi.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ efi_status_t __efi_rt_asm_wrapper(void *, const char *, ...);
6565
(SEGMENT_ALIGN > THREAD_ALIGN ? SEGMENT_ALIGN : THREAD_ALIGN)
6666

6767
/* on arm64, the FDT may be located anywhere in system RAM */
68-
static inline unsigned long efi_get_max_fdt_addr(unsigned long dram_base)
68+
static inline unsigned long efi_get_max_fdt_addr(unsigned long image_addr)
6969
{
7070
return ULONG_MAX;
7171
}
@@ -80,8 +80,7 @@ static inline unsigned long efi_get_max_fdt_addr(unsigned long dram_base)
8080
* apply to other bootloaders, and are required for some kernel
8181
* configurations.
8282
*/
83-
static inline unsigned long efi_get_max_initrd_addr(unsigned long dram_base,
84-
unsigned long image_addr)
83+
static inline unsigned long efi_get_max_initrd_addr(unsigned long image_addr)
8584
{
8685
return (image_addr & ~(SZ_1G - 1UL)) + (1UL << (VA_BITS_MIN - 1));
8786
}

arch/x86/kernel/setup.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,6 +1077,7 @@ void __init setup_arch(char **cmdline_p)
10771077
efi_fake_memmap();
10781078
efi_find_mirror();
10791079
efi_esrt_init();
1080+
efi_mokvar_table_init();
10801081

10811082
/*
10821083
* The EFI specification says that boot service code won't be

arch/x86/platform/efi/efi.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ static const unsigned long * const efi_tables[] = {
9090
&efi.tpm_log,
9191
&efi.tpm_final_log,
9292
&efi_rng_seed,
93+
#ifdef CONFIG_LOAD_UEFI_KEYS
94+
&efi.mokvar_table,
95+
#endif
9396
};
9497

9598
u64 efi_setup; /* efi setup_data physical address */

drivers/edac/ghes_edac.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,18 @@ void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err)
372372
p += sprintf(p, "rank:%d ", mem_err->rank);
373373
if (mem_err->validation_bits & CPER_MEM_VALID_BANK)
374374
p += sprintf(p, "bank:%d ", mem_err->bank);
375-
if (mem_err->validation_bits & CPER_MEM_VALID_ROW)
376-
p += sprintf(p, "row:%d ", mem_err->row);
375+
if (mem_err->validation_bits & CPER_MEM_VALID_BANK_GROUP)
376+
p += sprintf(p, "bank_group:%d ",
377+
mem_err->bank >> CPER_MEM_BANK_GROUP_SHIFT);
378+
if (mem_err->validation_bits & CPER_MEM_VALID_BANK_ADDRESS)
379+
p += sprintf(p, "bank_address:%d ",
380+
mem_err->bank & CPER_MEM_BANK_ADDRESS_MASK);
381+
if (mem_err->validation_bits & (CPER_MEM_VALID_ROW | CPER_MEM_VALID_ROW_EXT)) {
382+
u32 row = mem_err->row;
383+
384+
row |= cper_get_mem_extension(mem_err->validation_bits, mem_err->extended);
385+
p += sprintf(p, "row:%d ", row);
386+
}
377387
if (mem_err->validation_bits & CPER_MEM_VALID_COLUMN)
378388
p += sprintf(p, "col:%d ", mem_err->column);
379389
if (mem_err->validation_bits & CPER_MEM_VALID_BIT_POSITION)
@@ -395,6 +405,9 @@ void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err)
395405
strcpy(e->label, dimm->label);
396406
}
397407
}
408+
if (mem_err->validation_bits & CPER_MEM_VALID_CHIP_ID)
409+
p += sprintf(p, "chipID: %d ",
410+
mem_err->extended >> CPER_MEM_CHIP_ID_SHIFT);
398411
if (p > e->location)
399412
*(p - 1) = '\0';
400413

drivers/firmware/efi/Kconfig

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,15 @@ menu "EFI (Extensible Firmware Interface) Support"
44

55
config EFI_VARS
66
tristate "EFI Variable Support via sysfs"
7-
depends on EFI
7+
depends on EFI && (X86 || IA64)
88
default n
99
help
1010
If you say Y here, you are able to get EFI (Extensible Firmware
1111
Interface) variable information via sysfs. You may read,
1212
write, create, and destroy EFI variables through this interface.
13-
14-
Note that using this driver in concert with efibootmgr requires
15-
at least test release version 0.5.0-test3 or later, which is
16-
available from:
17-
<http://linux.dell.com/efibootmgr/testing/efibootmgr-0.5.0-test3.tar.gz>
18-
19-
Subsequent efibootmgr releases may be found at:
20-
<http://github.com/vathpela/efibootmgr>
13+
Note that this driver is only retained for compatibility with
14+
legacy users: new users should use the efivarfs filesystem
15+
instead.
2116

2217
config EFI_ESRT
2318
bool
@@ -26,7 +21,7 @@ config EFI_ESRT
2621

2722
config EFI_VARS_PSTORE
2823
tristate "Register efivars backend for pstore"
29-
depends on EFI_VARS && PSTORE
24+
depends on PSTORE
3025
default y
3126
help
3227
Say Y here to enable use efivars as a backend to pstore. This
@@ -137,7 +132,6 @@ config EFI_GENERIC_STUB_INITRD_CMDLINE_LOADER
137132

138133
config EFI_BOOTLOADER_CONTROL
139134
tristate "EFI Bootloader Control"
140-
depends on EFI_VARS
141135
default n
142136
help
143137
This module installs a reboot hook, such that if reboot() is
@@ -281,7 +275,7 @@ config EFI_EARLYCON
281275

282276
config EFI_CUSTOM_SSDT_OVERLAYS
283277
bool "Load custom ACPI SSDT overlay from an EFI variable"
284-
depends on EFI_VARS && ACPI
278+
depends on EFI && ACPI
285279
default ACPI_TABLE_UPGRADE
286280
help
287281
Allow loading of an ACPI SSDT overlay from an EFI variable specified

drivers/firmware/efi/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@ obj-$(CONFIG_EFI_DEV_PATH_PARSER) += dev-path-parser.o
2828
obj-$(CONFIG_APPLE_PROPERTIES) += apple-properties.o
2929
obj-$(CONFIG_EFI_RCI2_TABLE) += rci2-table.o
3030
obj-$(CONFIG_EFI_EMBEDDED_FIRMWARE) += embedded-firmware.o
31+
obj-$(CONFIG_LOAD_UEFI_KEYS) += mokvar-table.o
3132

3233
fake_map-y += fake_mem.o
3334
fake_map-$(CONFIG_X86) += x86_fake_mem.o
3435

35-
arm-obj-$(CONFIG_EFI) := arm-init.o arm-runtime.o
36+
arm-obj-$(CONFIG_EFI) := efi-init.o arm-runtime.o
3637
obj-$(CONFIG_ARM) += $(arm-obj-y)
3738
obj-$(CONFIG_ARM64) += $(arm-obj-y)
3839
obj-$(CONFIG_EFI_CAPSULE_LOADER) += capsule-loader.o

drivers/firmware/efi/cper.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,10 +232,20 @@ static int cper_mem_err_location(struct cper_mem_err_compact *mem, char *msg)
232232
n += scnprintf(msg + n, len - n, "rank: %d ", mem->rank);
233233
if (mem->validation_bits & CPER_MEM_VALID_BANK)
234234
n += scnprintf(msg + n, len - n, "bank: %d ", mem->bank);
235+
if (mem->validation_bits & CPER_MEM_VALID_BANK_GROUP)
236+
n += scnprintf(msg + n, len - n, "bank_group: %d ",
237+
mem->bank >> CPER_MEM_BANK_GROUP_SHIFT);
238+
if (mem->validation_bits & CPER_MEM_VALID_BANK_ADDRESS)
239+
n += scnprintf(msg + n, len - n, "bank_address: %d ",
240+
mem->bank & CPER_MEM_BANK_ADDRESS_MASK);
235241
if (mem->validation_bits & CPER_MEM_VALID_DEVICE)
236242
n += scnprintf(msg + n, len - n, "device: %d ", mem->device);
237-
if (mem->validation_bits & CPER_MEM_VALID_ROW)
238-
n += scnprintf(msg + n, len - n, "row: %d ", mem->row);
243+
if (mem->validation_bits & (CPER_MEM_VALID_ROW | CPER_MEM_VALID_ROW_EXT)) {
244+
u32 row = mem->row;
245+
246+
row |= cper_get_mem_extension(mem->validation_bits, mem->extended);
247+
n += scnprintf(msg + n, len - n, "row: %d ", row);
248+
}
239249
if (mem->validation_bits & CPER_MEM_VALID_COLUMN)
240250
n += scnprintf(msg + n, len - n, "column: %d ", mem->column);
241251
if (mem->validation_bits & CPER_MEM_VALID_BIT_POSITION)
@@ -250,6 +260,9 @@ static int cper_mem_err_location(struct cper_mem_err_compact *mem, char *msg)
250260
if (mem->validation_bits & CPER_MEM_VALID_TARGET_ID)
251261
scnprintf(msg + n, len - n, "target_id: 0x%016llx ",
252262
mem->target_id);
263+
if (mem->validation_bits & CPER_MEM_VALID_CHIP_ID)
264+
scnprintf(msg + n, len - n, "chip_id: %d ",
265+
mem->extended >> CPER_MEM_CHIP_ID_SHIFT);
253266

254267
msg[n] = '\0';
255268
return n;
@@ -292,6 +305,7 @@ void cper_mem_err_pack(const struct cper_sec_mem_err *mem,
292305
cmem->requestor_id = mem->requestor_id;
293306
cmem->responder_id = mem->responder_id;
294307
cmem->target_id = mem->target_id;
308+
cmem->extended = mem->extended;
295309
cmem->rank = mem->rank;
296310
cmem->mem_array_handle = mem->mem_array_handle;
297311
cmem->mem_dev_handle = mem->mem_dev_handle;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ void __init efi_init(void)
236236

237237
reserve_regions();
238238
efi_esrt_init();
239+
efi_mokvar_table_init();
239240

240241
memblock_reserve(data.phys_map & PAGE_MASK,
241242
PAGE_ALIGN(data.size + (data.phys_map & ~PAGE_MASK)));

0 commit comments

Comments
 (0)