Commit ddab1e71 authored by Ingo Molnar's avatar Ingo Molnar
Browse files

Merge tag 'efi-urgent-for-v5.14-rc2' of...

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: default avatarIngo Molnar <mingo@kernel.org>
parents 2734d6c1 47e1e233
Loading
Loading
Loading
Loading
+12 −1
Original line number Original line Diff line number Diff line
@@ -896,6 +896,7 @@ static int __init efi_memreserve_map_root(void)
static int efi_mem_reserve_iomem(phys_addr_t addr, u64 size)
static int efi_mem_reserve_iomem(phys_addr_t addr, u64 size)
{
{
	struct resource *res, *parent;
	struct resource *res, *parent;
	int ret;


	res = kzalloc(sizeof(struct resource), GFP_ATOMIC);
	res = kzalloc(sizeof(struct resource), GFP_ATOMIC);
	if (!res)
	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 */
	/* we expect a conflict with a 'System RAM' region */
	parent = request_resource_conflict(&iomem_resource, res);
	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)
int __ref efi_mem_reserve_persistent(phys_addr_t addr, u64 size)
+2 −2
Original line number Original line Diff line number Diff line
@@ -630,8 +630,8 @@ efi_status_t efi_load_initrd_cmdline(efi_loaded_image_t *image,
 * @image:	EFI loaded image protocol
 * @image:	EFI loaded image protocol
 * @load_addr:	pointer to loaded initrd
 * @load_addr:	pointer to loaded initrd
 * @load_size:	size of loaded initrd
 * @load_size:	size of loaded initrd
 * @soft_limit:	preferred size of allocated memory for loading the initrd
 * @soft_limit:	preferred address for loading the initrd
 * @hard_limit:	minimum size of allocated memory
 * @hard_limit:	upper limit address for loading the initrd
 *
 *
 * Return:	status code
 * Return:	status code
 */
 */
+4 −1
Original line number Original line Diff line number Diff line
@@ -180,7 +180,10 @@ void __init efi_mokvar_table_init(void)
		pr_err("EFI MOKvar config table is not valid\n");
		pr_err("EFI MOKvar config table is not valid\n");
		return;
		return;
	}
	}

	if (md.type == EFI_BOOT_SERVICES_DATA)
		efi_mem_reserve(efi.mokvar_table, map_size_needed);
		efi_mem_reserve(efi.mokvar_table, map_size_needed);

	efi_mokvar_table_size = map_size_needed;
	efi_mokvar_table_size = map_size_needed;
}
}


+5 −3
Original line number Original line Diff line number Diff line
@@ -62,9 +62,11 @@ int __init efi_tpm_eventlog_init(void)
	tbl_size = sizeof(*log_tbl) + log_tbl->size;
	tbl_size = sizeof(*log_tbl) + log_tbl->size;
	memblock_reserve(efi.tpm_log, tbl_size);
	memblock_reserve(efi.tpm_log, tbl_size);


	if (efi.tpm_final_log == EFI_INVALID_TABLE_ADDR ||
	if (efi.tpm_final_log == EFI_INVALID_TABLE_ADDR) {
	    log_tbl->version != EFI_TCG2_EVENT_LOG_FORMAT_TCG_2) {
		pr_info("TPM Final Events table not present\n");
		pr_warn(FW_BUG "TPM Final Events table missing or invalid\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;
		goto out;
	}
	}