Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

xen: allow mapping ACPI data using a different physical address

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: Juergen Gross <jgross@suse.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>

+59 -1
+8
arch/x86/include/asm/acpi.h
··· 174 174 void x86_default_set_root_pointer(u64 addr); 175 175 u64 x86_default_get_root_pointer(void); 176 176 177 + #ifdef CONFIG_XEN_PV 178 + /* A Xen PV domain needs a special acpi_os_ioremap() handling. */ 179 + extern void __iomem * (*acpi_os_ioremap)(acpi_physical_address phys, 180 + acpi_size size); 181 + void __iomem *x86_acpi_os_ioremap(acpi_physical_address phys, acpi_size size); 182 + #define acpi_os_ioremap acpi_os_ioremap 183 + #endif 184 + 177 185 #else /* !CONFIG_ACPI */ 178 186 179 187 #define acpi_lapic 0
+11
arch/x86/kernel/acpi/boot.c
··· 1778 1778 { 1779 1779 return boot_params.acpi_rsdp_addr; 1780 1780 } 1781 + 1782 + #ifdef CONFIG_XEN_PV 1783 + void __iomem *x86_acpi_os_ioremap(acpi_physical_address phys, acpi_size size) 1784 + { 1785 + return ioremap_cache(phys, size); 1786 + } 1787 + 1788 + void __iomem * (*acpi_os_ioremap)(acpi_physical_address phys, acpi_size size) = 1789 + x86_acpi_os_ioremap; 1790 + EXPORT_SYMBOL_GPL(acpi_os_ioremap); 1791 + #endif
+1
arch/x86/kernel/jailhouse.c
··· 12 12 #include <linux/kernel.h> 13 13 #include <linux/reboot.h> 14 14 #include <linux/serial_8250.h> 15 + #include <linux/acpi.h> 15 16 #include <asm/apic.h> 16 17 #include <asm/io_apic.h> 17 18 #include <asm/acpi.h>
+1
arch/x86/kernel/mmconf-fam10h_64.c
··· 9 9 #include <linux/pci.h> 10 10 #include <linux/dmi.h> 11 11 #include <linux/range.h> 12 + #include <linux/acpi.h> 12 13 13 14 #include <asm/pci-direct.h> 14 15 #include <linux/sort.h>
+1
arch/x86/kernel/smpboot.c
··· 60 60 #include <linux/stackprotector.h> 61 61 #include <linux/cpuhotplug.h> 62 62 #include <linux/mc146818rtc.h> 63 + #include <linux/acpi.h> 63 64 64 65 #include <asm/acpi.h> 65 66 #include <asm/cacheinfo.h>
+1
arch/x86/kernel/x86_init.c
··· 8 8 #include <linux/ioport.h> 9 9 #include <linux/export.h> 10 10 #include <linux/pci.h> 11 + #include <linux/acpi.h> 11 12 12 13 #include <asm/acpi.h> 13 14 #include <asm/bios_ebda.h>
+35
arch/x86/xen/p2m.c
··· 70 70 #include <linux/memblock.h> 71 71 #include <linux/slab.h> 72 72 #include <linux/vmalloc.h> 73 + #include <linux/acpi.h> 73 74 74 75 #include <asm/cache.h> 75 76 #include <asm/setup.h> ··· 835 834 pr_info("Remapped %u non-RAM page(s)\n", remapped); 836 835 } 837 836 837 + #ifdef CONFIG_ACPI 838 + /* 839 + * Xen variant of acpi_os_ioremap() taking potentially remapped non-RAM 840 + * regions into account. 841 + * Any attempt to map an area crossing a remap boundary will produce a 842 + * WARN() splat. 843 + * phys is related to remap->maddr on input and will be rebased to remap->paddr. 844 + */ 845 + static void __iomem *xen_acpi_os_ioremap(acpi_physical_address phys, 846 + acpi_size size) 847 + { 848 + unsigned int i; 849 + const struct nonram_remap *remap = xen_nonram_remap; 850 + 851 + for (i = 0; i < nr_nonram_remap; i++) { 852 + if (phys + size > remap->maddr && 853 + phys < remap->maddr + remap->size) { 854 + WARN_ON(phys < remap->maddr || 855 + phys + size > remap->maddr + remap->size); 856 + phys += remap->paddr - remap->maddr; 857 + break; 858 + } 859 + } 860 + 861 + return x86_acpi_os_ioremap(phys, size); 862 + } 863 + #endif /* CONFIG_ACPI */ 864 + 838 865 /* 839 866 * Add a new non-RAM remap entry. 840 867 * In case of no free entry found, just crash the system. ··· 876 847 xen_raw_console_write("Number of required E820 entry remapping actions exceed maximum value\n"); 877 848 BUG(); 878 849 } 850 + 851 + #ifdef CONFIG_ACPI 852 + /* Switch to the Xen acpi_os_ioremap() variant. */ 853 + if (nr_nonram_remap == 0) 854 + acpi_os_ioremap = xen_acpi_os_ioremap; 855 + #endif 879 856 880 857 xen_nonram_remap[nr_nonram_remap].maddr = maddr; 881 858 xen_nonram_remap[nr_nonram_remap].paddr = paddr;
+1 -1
arch/x86/xen/setup.c
··· 15 15 #include <linux/cpuidle.h> 16 16 #include <linux/cpufreq.h> 17 17 #include <linux/memory_hotplug.h> 18 + #include <linux/acpi.h> 18 19 19 20 #include <asm/elf.h> 20 21 #include <asm/vdso.h> 21 22 #include <asm/e820/api.h> 22 23 #include <asm/setup.h> 23 - #include <asm/acpi.h> 24 24 #include <asm/numa.h> 25 25 #include <asm/idtentry.h> 26 26 #include <asm/xen/hypervisor.h>