Commit eaeff841 authored by Marek Marczykowski-Górecki's avatar Marek Marczykowski-Górecki Committed by Ard Biesheuvel
Browse files

efi: Enable BGRT loading under Xen



The BGRT table can be parsed if EFI_PARAVIRT is enabled, even if
EFI_MEMMAP is not. Xen will take care of preserving the image even if
EfiBootServicesData memory is reclaimed already, or invalidate the table
if it didn't preserve it - in both cases accesing the table itself under
virt is safe. Also allow the ESRT to be in reclaimable memory, as that
is where future Xen versions will put it.
This is similar approach as was taken for ESRT table in 01de145d
"efi: Actually enable the ESRT under Xen".

Signed-off-by: default avatarMarek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
parent 80e80a70
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -29,11 +29,12 @@ void __init efi_bgrt_init(struct acpi_table_header *table)
	void *image;
	struct bmp_header bmp_header;
	struct acpi_table_bgrt *bgrt = &bgrt_tab;
	int mem_type;

	if (acpi_disabled)
		return;

	if (!efi_enabled(EFI_MEMMAP))
	if (!efi_enabled(EFI_MEMMAP) && !efi_enabled(EFI_PARAVIRT))
		return;

	if (table->length < sizeof(bgrt_tab)) {
@@ -62,7 +63,9 @@ void __init efi_bgrt_init(struct acpi_table_header *table)
		goto out;
	}

	if (efi_mem_type(bgrt->image_address) != EFI_BOOT_SERVICES_DATA) {
	mem_type = efi_mem_type(bgrt->image_address);
	if (mem_type != EFI_BOOT_SERVICES_DATA &&
	    mem_type != EFI_ACPI_RECLAIM_MEMORY) {
		pr_notice("Ignoring BGRT: invalid image address\n");
		goto out;
	}