Commit 3f7973aa authored by Juergen Gross's avatar Juergen Gross Committed by Wen Zhiwei
Browse files

xen: allow mapping ACPI data using a different physical address

stable inclusion
from stable-v6.6.54
commit adbb44539b56f15dc94701a43aa21ded41635c99
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IAZ3K2

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=adbb44539b56f15dc94701a43aa21ded41635c99



--------------------------------

commit 9221222c717dbddac1e3c49906525475d87a3a44 upstream.

When running as a Xen PV dom0 the system needs to map ACPI data of the
host using host physical addresses, while those addresses can conflict
with the guest physical addresses of the loaded linux kernel. The same
problem might apply in case a PV guest is configured to use the host
memory map.

This conflict can be solved by mapping the ACPI data to a different
guest physical address, but mapping the data via acpi_os_ioremap()
must still be possible using the host physical address, as this
address might be generated by AML when referencing some of the ACPI
data.

When configured to support running as a Xen PV domain, have an
implementation of acpi_os_ioremap() being aware of the possibility to
need above mentioned translation of a host physical address to the
guest physical address.

This modification requires to #include linux/acpi.h in some sources
which need to include asm/acpi.h directly.

Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
Reviewed-by: default avatarJan Beulich <jbeulich@suse.com>
Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Conflicts:
 arch/x86/include/asm/acpi.h
 arch/x86/kernel/acpi/boot.c
 arch/x86/kernel/jailhouse.c
 arch/x86/kernel/mmconf-fam10h_64.c
 arch/x86/kernel/smpboot.c
 arch/x86/kernel/x86_init.c
 arch/x86/xen/p2m.c
 arch/x86/xen/setup.c
Signed-off-by: default avatarWen Zhiwei <wenzhiwei@kylinos.cn>
parent 17f3f0be
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -166,6 +166,14 @@ void acpi_generic_reduced_hw_init(void);
void x86_default_set_root_pointer(u64 addr);
u64 x86_default_get_root_pointer(void);

#ifdef CONFIG_XEN_PV
/* A Xen PV domain needs a special acpi_os_ioremap() handling. */
extern void __iomem * (*acpi_os_ioremap)(acpi_physical_address phys,
                                        acpi_size size);
void __iomem *x86_acpi_os_ioremap(acpi_physical_address phys, acpi_size size);
#define acpi_os_ioremap acpi_os_ioremap
#endif

#else /* !CONFIG_ACPI */

#define acpi_lapic 0
+11 −0
Original line number Diff line number Diff line
@@ -1901,3 +1901,14 @@ u64 x86_default_get_root_pointer(void)
{
	return boot_params.acpi_rsdp_addr;
}

#ifdef CONFIG_XEN_PV
void __iomem *x86_acpi_os_ioremap(acpi_physical_address phys, acpi_size size)
{
       return ioremap_cache(phys, size);
}

void __iomem * (*acpi_os_ioremap)(acpi_physical_address phys, acpi_size size) =
       x86_acpi_os_ioremap;
EXPORT_SYMBOL_GPL(acpi_os_ioremap);
#endif
+1 −0
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@
#include <linux/kernel.h>
#include <linux/reboot.h>
#include <linux/serial_8250.h>
#include <linux/acpi.h>
#include <asm/apic.h>
#include <asm/io_apic.h>
#include <asm/acpi.h>
+1 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@
#include <linux/pci.h>
#include <linux/dmi.h>
#include <linux/range.h>
#include <linux/acpi.h>

#include <asm/pci-direct.h>
#include <linux/sort.h>
+1 −0
Original line number Diff line number Diff line
@@ -60,6 +60,7 @@
#include <linux/stackprotector.h>
#include <linux/cpuhotplug.h>
#include <linux/mc146818rtc.h>
#include <linux/acpi.h>
#include <linux/cpuset.h>

#include <asm/acpi.h>
Loading