]> xenbits.xensource.com Git - xen.git/commit
EFI: preserve the System Resource Table for dom0
authorDemi Marie Obenour <demi@invisiblethingslab.com>
Tue, 5 Jul 2022 11:10:46 +0000 (13:10 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 5 Jul 2022 11:10:46 +0000 (13:10 +0200)
commit8d410ac2c178e1dd1001cadddbe9ca75a9738c95
tree45997052ccbfcee2242a68c9e3d62cf348b28965
parent4df2e99d731402da48afb19dc970ccab5a0814d6
EFI: preserve the System Resource Table for dom0

The EFI System Resource Table (ESRT) is necessary for fwupd to identify
firmware updates to install.  According to the UEFI specification ยง23.4,
the ESRT shall be stored in memory of type EfiBootServicesData.  However,
memory of type EfiBootServicesData is considered general-purpose memory
by Xen, so the ESRT needs to be moved somewhere where Xen will not
overwrite it.  Copy the ESRT to memory of type EfiRuntimeServicesData,
which Xen will not reuse.  dom0 can use the ESRT if (and only if) it is
in memory of type EfiRuntimeServicesData.

Earlier versions of this patch reserved the memory in which the ESRT was
located.  This created awkward alignment problems, and required either
splitting the E820 table or wasting memory.  It also would have required
a new platform op for dom0 to use to indicate if the ESRT is reserved.
By copying the ESRT into EfiRuntimeServicesData memory, the E820 table
does not need to be modified, and dom0 can just check the type of the
memory region containing the ESRT.  The copy is only done if the ESRT is
not already in EfiRuntimeServicesData memory, avoiding memory leaks on
repeated kexec.

See https://lore.kernel.org/xen-devel/20200818184018.GN1679@mail-itl/T/
for details.

Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/common/efi/boot.c