efi: xen: Implement memory descriptor lookup based on hypercall
authorDemi Marie Obenour <demi@invisiblethingslab.com>
Thu, 19 Jan 2023 19:03:57 +0000 (14:03 -0500)
committerArd Biesheuvel <ardb@kernel.org>
Sun, 22 Jan 2023 09:14:15 +0000 (10:14 +0100)
commitaca1d27ac38a61d7db4b56418386992cb96b63f0
treede5f4428831e9caf2ff8a1cbacb3753f59d083b9
parentab03e91e60ce457a90e6aa2c97ca2fa139b73f55
efi: xen: Implement memory descriptor lookup based on hypercall

Xen on x86 boots dom0 in EFI mode but without providing a memory map.
This means that some consistency checks we would like to perform on
configuration tables or other data structures in memory are not
currently possible.  Xen does, however, expose EFI memory descriptor
info via a Xen hypercall, so let's wire that up instead.  It turns out
that the returned information is not identical to what Linux's
efi_mem_desc_lookup would return: the address returned is the address
passed to the hypercall, and the size returned is the number of bytes
remaining in the configuration table.  However, none of the callers of
efi_mem_desc_lookup() currently care about this.  In the future, Xen may
gain a hypercall that returns the actual start address, which can be
used instead.

Co-developed-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
drivers/firmware/efi/efi.c
drivers/xen/efi.c
include/linux/efi.h