EFI fixes for v5.14-rc2:

- Ensure that memblock reservations and IO reserved resources remain in
 sync when using the EFI memreserve feature.
 - Don't complain about invalid TPM final event log table if it is
 missing altogether.
 - Comment header fix for the stub.
 - Avoid a spurious warning when attempting to reserve firmware memory
 that is already reserved in the first place.
 -----BEGIN PGP SIGNATURE-----
 
 iQGzBAABCgAdFiEE+9lifEBpyUIVN1cpw08iOZLZjyQFAmD2eyoACgkQw08iOZLZ
 jyRBaAv7BiERvRoBno0Np6jTf/YmC7Q6NG2Q6qqmL03bHb6FLgZXrYIdWnCv/gnO
 XKUKDDF0qoeuTB547GjXqSkOHbdwLD/crtxXNnjbpS/JQwdIkDtcR1QjRGTT0PIC
 YrYFXBvggvWFtNdCcVua5vWia11dsPsqlfUgPo+sG2oYtL7iL04XbxoKD2uSg7HF
 jt2uGu28zhHmqmHJhUUcTByhVjXWL5wzBmPtbxYWcCjnonBaaLxfjCW4tZVO1q18
 do+8/x/yC1uG4dadFEFL7kpHxIrvv54qV2GrUSuZAG1qmSDU7+aB6OyQ3ZOZ1lDr
 GnLueewUuIzS1tdJLF+drEnEjo3QS2LW4YukkwXbcj8VP898kLLHkWGQQmu7FPtn
 pgbwm4bnkGUS4om5l9N/ddf3r84Yco05pOKWLBAtUCFt8sDPAub0knuMlHaYyJsb
 CKpx7hbrSjCBeaEVxe/Wb9GmAVr/Qc2Dun7g/LYEdbPSELkz2/pxcLCSN5XgfUxA
 2Lpc44yL
 =ExSm
 -----END PGP SIGNATURE-----

Merge tag 'efi-urgent-for-v5.14-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi into efi/urgent

Pull EFI fixes for v5.14-rc2 from Ard Biesheuvel:

" - Ensure that memblock reservations and IO reserved resources remain in
    sync when using the EFI memreserve feature.

  - Don't complain about invalid TPM final event log table if it is
    missing altogether.

  - Comment header fix for the stub.

  - Avoid a spurious warning when attempting to reserve firmware memory
    that is already reserved in the first place."

Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
Ingo Molnar 2021-07-20 13:30:14 +02:00
commit ddab1e71d2
4 changed files with 23 additions and 7 deletions

View file

@ -896,6 +896,7 @@ static int __init efi_memreserve_map_root(void)
static int efi_mem_reserve_iomem(phys_addr_t addr, u64 size)
{
struct resource *res, *parent;
int ret;
res = kzalloc(sizeof(struct resource), GFP_ATOMIC);
if (!res)
@ -908,7 +909,17 @@ static int efi_mem_reserve_iomem(phys_addr_t addr, u64 size)
/* we expect a conflict with a 'System RAM' region */
parent = request_resource_conflict(&iomem_resource, res);
return parent ? request_resource(parent, res) : 0;
ret = parent ? request_resource(parent, res) : 0;
/*
* Given that efi_mem_reserve_iomem() can be called at any
* time, only call memblock_reserve() if the architecture
* keeps the infrastructure around.
*/
if (IS_ENABLED(CONFIG_ARCH_KEEP_MEMBLOCK) && !ret)
memblock_reserve(addr, size);
return ret;
}
int __ref efi_mem_reserve_persistent(phys_addr_t addr, u64 size)

View file

@ -630,8 +630,8 @@ efi_status_t efi_load_initrd_cmdline(efi_loaded_image_t *image,
* @image: EFI loaded image protocol
* @load_addr: pointer to loaded initrd
* @load_size: size of loaded initrd
* @soft_limit: preferred size of allocated memory for loading the initrd
* @hard_limit: minimum size of allocated memory
* @soft_limit: preferred address for loading the initrd
* @hard_limit: upper limit address for loading the initrd
*
* Return: status code
*/

View file

@ -180,7 +180,10 @@ void __init efi_mokvar_table_init(void)
pr_err("EFI MOKvar config table is not valid\n");
return;
}
efi_mem_reserve(efi.mokvar_table, map_size_needed);
if (md.type == EFI_BOOT_SERVICES_DATA)
efi_mem_reserve(efi.mokvar_table, map_size_needed);
efi_mokvar_table_size = map_size_needed;
}

View file

@ -62,9 +62,11 @@ int __init efi_tpm_eventlog_init(void)
tbl_size = sizeof(*log_tbl) + log_tbl->size;
memblock_reserve(efi.tpm_log, tbl_size);
if (efi.tpm_final_log == EFI_INVALID_TABLE_ADDR ||
log_tbl->version != EFI_TCG2_EVENT_LOG_FORMAT_TCG_2) {
pr_warn(FW_BUG "TPM Final Events table missing or invalid\n");
if (efi.tpm_final_log == EFI_INVALID_TABLE_ADDR) {
pr_info("TPM Final Events table not present\n");
goto out;
} else if (log_tbl->version != EFI_TCG2_EVENT_LOG_FORMAT_TCG_2) {
pr_warn(FW_BUG "TPM Final Events table invalid\n");
goto out;
}