Skip to content

Commit eaeff84

Browse files
marmarekardbiesheuvel
authored andcommitted
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 01de145 "efi: Actually enable the ESRT under Xen". Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
1 parent 80e80a7 commit eaeff84

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

drivers/firmware/efi/efi-bgrt.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,12 @@ void __init efi_bgrt_init(struct acpi_table_header *table)
2929
void *image;
3030
struct bmp_header bmp_header;
3131
struct acpi_table_bgrt *bgrt = &bgrt_tab;
32+
int mem_type;
3233

3334
if (acpi_disabled)
3435
return;
3536

36-
if (!efi_enabled(EFI_MEMMAP))
37+
if (!efi_enabled(EFI_MEMMAP) && !efi_enabled(EFI_PARAVIRT))
3738
return;
3839

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

65-
if (efi_mem_type(bgrt->image_address) != EFI_BOOT_SERVICES_DATA) {
66+
mem_type = efi_mem_type(bgrt->image_address);
67+
if (mem_type != EFI_BOOT_SERVICES_DATA &&
68+
mem_type != EFI_ACPI_RECLAIM_MEMORY) {
6669
pr_notice("Ignoring BGRT: invalid image address\n");
6770
goto out;
6871
}

0 commit comments

Comments
 (0)