x86-64: enable MMCONFIG on AMD Fam10 systems even if the BIOS didn't
PATCH 1/1 x86-64: enable MMCONFIG on AMD Fam10 systems even if the BIOS didn't
Code for this has been in Linux since 2.6.26, and since Xen itself wants to use the MMCONFIG access method when possible, clone it (fixing some rather obvious bugs in that code at once).
Signed-off-by Jan Beulich <[email protected]>
xen/arch/x86/cpu/amd.c +8 -0
@@ -607,6 +607,14 @@ static void __devinit init_amd(struct cp#ifdef __x86_64__/* AMD CPUs do not support SYSENTER outside of legacy mode. */ clear_bit (X86_FEATURE_SEP , c->x86_capability); + +if (c->x86 ==0x10 ) { +/* do this for boot cpu */ +if (c == &boot_cpu_data) +check_enable_amd_mmconf_dmi (); + +fam10h_check_enable_mmcfg (); + }#endif /* Prevent TSC drift in non single-processor, single-core platforms. */
xen/arch/x86/x86_64/Makefile +1 -0
@@ -7,6 +7,7 @@ obj-y += traps.o obj-y += machine_kexec.o obj-y += pci.o obj-y += acpi_mmcfg.o +obj-y += mmconf-fam10h.o obj-y += mmconfig_64.o obj-y += mmconfig-shared.o obj-y += compat.o
xen/arch/x86/x86_64/mmconf-fam10h.c new file +210 -0
210 lines not on this page · raw message
xen/arch/x86/x86_64/mmconfig-shared.c +1 -1
@@ -26,7 +26,7 @@#include "mmconfig.h" static int __initdata known_bridge; -static unsigned int pci_probe =PCI_PROBE_CONF1 |PCI_PROBE_MMCONF ; +unsigned int __cpuinitdata pci_probe =PCI_PROBE_CONF1 |PCI_PROBE_MMCONF ;static void __init parse_mmcfg (char *s) {
xen/arch/x86/x86_64/mmconfig.h +2 -0
@@ -34,6 +34,8 @@#define PCI_VENDOR_ID_NVIDIA 0x10de +extern unsigned int pci_probe; +/* * AMD Fam10h CPUs are buggy, and cannot access MMIO config space * on their northbrige except through the * %eax register. As such, you MUST
xen/include/asm-x86/amd.h +7 -0
@@ -134,5 +134,12 @@AMD_OSVW_ERRATUM (3 ,AMD_MODEL_RANGE (0x10 ,0x2 ,0x1 ,0xff ,0xf ), \ AMD_MODEL_RANGE(0x12, 0x0, 0x0, 0x1, 0x0)) +struct cpuinfo_x86 ;int cpu_has_amd_erratum (const struct cpuinfo_x86 *,int , ...); + +#ifdef __x86_64__ +void fam10h_check_enable_mmcfg (void ); +void check_enable_amd_mmconf_dmi (void ); +#endif +#endif /* __AMD_H__ */
Code for this has been in Linux since 2.6.26, and since Xen itself wants to use the MMCONFIG access method when possible, clone it (fixing some rather obvious bugs in that code at once).
Signed-off-by Jan Beulich <[email protected]>
xen/arch/x86/cpu/amd.c +8 -0
@@ -607,6 +607,14 @@ static void __devinit init_amd(struct cp#ifdef __x86_64__/* AMD CPUs do not support SYSENTER outside of legacy mode. */ clear_bit (X86_FEATURE_SEP , c->x86_capability); + +if (c->x86 ==0x10 ) { +/* do this for boot cpu */ +if (c == &boot_cpu_data) +check_enable_amd_mmconf_dmi (); + +fam10h_check_enable_mmcfg (); + }#endif /* Prevent TSC drift in non single-processor, single-core platforms. */
xen/arch/x86/x86_64/Makefile +1 -0
@@ -7,6 +7,7 @@ obj-y += traps.o obj-y += machine_kexec.o obj-y += pci.o obj-y += acpi_mmcfg.o +obj-y += mmconf-fam10h.o obj-y += mmconfig_64.o obj-y += mmconfig-shared.o obj-y += compat.o
xen/arch/x86/x86_64/mmconf-fam10h.c new file +210 -0
210 lines not on this page · raw message
xen/arch/x86/x86_64/mmconfig-shared.c +1 -1
@@ -26,7 +26,7 @@#include "mmconfig.h" static int __initdata known_bridge; -static unsigned int pci_probe =PCI_PROBE_CONF1 |PCI_PROBE_MMCONF ; +unsigned int __cpuinitdata pci_probe =PCI_PROBE_CONF1 |PCI_PROBE_MMCONF ;static void __init parse_mmcfg (char *s) {
xen/arch/x86/x86_64/mmconfig.h +2 -0
@@ -34,6 +34,8 @@#define PCI_VENDOR_ID_NVIDIA 0x10de +extern unsigned int pci_probe; +/* * AMD Fam10h CPUs are buggy, and cannot access MMIO config space * on their northbrige except through the * %eax register. As such, you MUST
xen/include/asm-x86/amd.h +7 -0
@@ -134,5 +134,12 @@AMD_OSVW_ERRATUM (3 ,AMD_MODEL_RANGE (0x10 ,0x2 ,0x1 ,0xff ,0xf ), \ AMD_MODEL_RANGE(0x12, 0x0, 0x0, 0x1, 0x0)) +struct cpuinfo_x86 ;int cpu_has_amd_erratum (const struct cpuinfo_x86 *,int , ...); + +#ifdef __x86_64__ +void fam10h_check_enable_mmcfg (void ); +void check_enable_amd_mmconf_dmi (void ); +#endif +#endif /* __AMD_H__ */
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel