Skip to content

Commit ddab1e7

Browse files
author
Ingo Molnar
committed
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 <[email protected]>
2 parents 2734d6c + 47e1e23 commit ddab1e7

File tree

4 files changed

+23
-7
lines changed

4 files changed

+23
-7
lines changed

drivers/firmware/efi/efi.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,7 @@ static int __init efi_memreserve_map_root(void)
896896
static int efi_mem_reserve_iomem(phys_addr_t addr, u64 size)
897897
{
898898
struct resource *res, *parent;
899+
int ret;
899900

900901
res = kzalloc(sizeof(struct resource), GFP_ATOMIC);
901902
if (!res)
@@ -908,7 +909,17 @@ static int efi_mem_reserve_iomem(phys_addr_t addr, u64 size)
908909

909910
/* we expect a conflict with a 'System RAM' region */
910911
parent = request_resource_conflict(&iomem_resource, res);
911-
return parent ? request_resource(parent, res) : 0;
912+
ret = parent ? request_resource(parent, res) : 0;
913+
914+
/*
915+
* Given that efi_mem_reserve_iomem() can be called at any
916+
* time, only call memblock_reserve() if the architecture
917+
* keeps the infrastructure around.
918+
*/
919+
if (IS_ENABLED(CONFIG_ARCH_KEEP_MEMBLOCK) && !ret)
920+
memblock_reserve(addr, size);
921+
922+
return ret;
912923
}
913924

914925
int __ref efi_mem_reserve_persistent(phys_addr_t addr, u64 size)

drivers/firmware/efi/libstub/efi-stub-helper.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -630,8 +630,8 @@ efi_status_t efi_load_initrd_cmdline(efi_loaded_image_t *image,
630630
* @image: EFI loaded image protocol
631631
* @load_addr: pointer to loaded initrd
632632
* @load_size: size of loaded initrd
633-
* @soft_limit: preferred size of allocated memory for loading the initrd
634-
* @hard_limit: minimum size of allocated memory
633+
* @soft_limit: preferred address for loading the initrd
634+
* @hard_limit: upper limit address for loading the initrd
635635
*
636636
* Return: status code
637637
*/

drivers/firmware/efi/mokvar-table.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,10 @@ void __init efi_mokvar_table_init(void)
180180
pr_err("EFI MOKvar config table is not valid\n");
181181
return;
182182
}
183-
efi_mem_reserve(efi.mokvar_table, map_size_needed);
183+
184+
if (md.type == EFI_BOOT_SERVICES_DATA)
185+
efi_mem_reserve(efi.mokvar_table, map_size_needed);
186+
184187
efi_mokvar_table_size = map_size_needed;
185188
}
186189

drivers/firmware/efi/tpm.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,11 @@ int __init efi_tpm_eventlog_init(void)
6262
tbl_size = sizeof(*log_tbl) + log_tbl->size;
6363
memblock_reserve(efi.tpm_log, tbl_size);
6464

65-
if (efi.tpm_final_log == EFI_INVALID_TABLE_ADDR ||
66-
log_tbl->version != EFI_TCG2_EVENT_LOG_FORMAT_TCG_2) {
67-
pr_warn(FW_BUG "TPM Final Events table missing or invalid\n");
65+
if (efi.tpm_final_log == EFI_INVALID_TABLE_ADDR) {
66+
pr_info("TPM Final Events table not present\n");
67+
goto out;
68+
} else if (log_tbl->version != EFI_TCG2_EVENT_LOG_FORMAT_TCG_2) {
69+
pr_warn(FW_BUG "TPM Final Events table invalid\n");
6870
goto out;
6971
}
7072

0 commit comments

Comments
 (0)