xen: tolerate ACPI NVS memory overlapping with Xen allocated memory
authorJuergen Gross <jgross@suse.com>
Fri, 2 Aug 2024 18:14:22 +0000 (20:14 +0200)
committerJuergen Gross <jgross@suse.com>
Thu, 12 Sep 2024 06:25:12 +0000 (08:25 +0200)
commitbe35d91c8880650404f3bf813573222dfb106935
treefe131b8a6338569ab53a1e8b310147f13e183ea5
parent9221222c717dbddac1e3c49906525475d87a3a44
xen: tolerate ACPI NVS memory overlapping with Xen allocated memory

In order to minimize required special handling for running as Xen PV
dom0, the memory layout is modified to match that of the host. This
requires to have only RAM at the locations where Xen allocated memory
is living. Unfortunately there seem to be some machines, where ACPI
NVS is located at 64 MB, resulting in a conflict with the loaded
kernel or the initial page tables built by Xen.

Avoid this conflict by swapping the ACPI NVS area in the memory map
with unused RAM. This is possible via modification of the dom0 P2M map.
Accesses to the ACPI NVS area are done either for saving and restoring
it across suspend operations (this will work the same way as before),
or by ACPI code when NVS memory is referenced from other ACPI tables.
The latter case is handled by a Xen specific indirection of
acpi_os_ioremap().

While the E820 map can (and should) be modified right away, the P2M
map can be updated only after memory allocation is working, as the P2M
map might need to be extended.

Fixes: 808fdb71936c ("xen: check for kernel memory conflicting with memory layout")
Signed-off-by: Juergen Gross <jgross@suse.com>
Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
arch/x86/xen/setup.c