aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorBoris Ostrovsky <boris.ostrovsky@oracle.com>2015-05-04 11:02:15 -0400
committerDavid Vrabel <david.vrabel@citrix.com>2015-05-05 13:27:43 -0400
commita71dbdaa8ca2933391b08e0ae5567083e3af0892 (patch)
treeca33c267fb1d81c9f2207e29be17fc4f82235407 /arch/x86
parent16e6bd5970c88a2ac018b84a5f1dd5c2ff1fdf2c (diff)
hypervisor/x86/xen: Unset X86_BUG_SYSRET_SS_ATTRS on Xen PV guests
Commit 61f01dd941ba ("x86_64, asm: Work around AMD SYSRET SS descriptor attribute issue") makes AMD processors set SS to __KERNEL_DS in __switch_to() to deal with cases when SS is NULL. This breaks Xen PV guests who do not want to load SS with__KERNEL_DS. Since the problem that the commit is trying to address would have to be fixed in the hypervisor (if it in fact exists under Xen) there is no reason to set X86_BUG_SYSRET_SS_ATTRS flag for PV VPCUs here. This can be easily achieved by adding x86_hyper_xen_hvm.set_cpu_features op which will clear this flag. (And since this structure is no longer HVM-specific we should do some renaming). Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Reported-by: Sander Eikelenboom <linux@eikelenboom.it> Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/include/asm/hypervisor.h2
-rw-r--r--arch/x86/kernel/cpu/hypervisor.c4
-rw-r--r--arch/x86/xen/enlighten.c27
3 files changed, 21 insertions, 12 deletions
diff --git a/arch/x86/include/asm/hypervisor.h b/arch/x86/include/asm/hypervisor.h
index e42f758a0fbd..055ea9941dd5 100644
--- a/arch/x86/include/asm/hypervisor.h
+++ b/arch/x86/include/asm/hypervisor.h
@@ -50,7 +50,7 @@ extern const struct hypervisor_x86 *x86_hyper;
50/* Recognized hypervisors */ 50/* Recognized hypervisors */
51extern const struct hypervisor_x86 x86_hyper_vmware; 51extern const struct hypervisor_x86 x86_hyper_vmware;
52extern const struct hypervisor_x86 x86_hyper_ms_hyperv; 52extern const struct hypervisor_x86 x86_hyper_ms_hyperv;
53extern const struct hypervisor_x86 x86_hyper_xen_hvm; 53extern const struct hypervisor_x86 x86_hyper_xen;
54extern const struct hypervisor_x86 x86_hyper_kvm; 54extern const struct hypervisor_x86 x86_hyper_kvm;
55 55
56extern void init_hypervisor(struct cpuinfo_x86 *c); 56extern void init_hypervisor(struct cpuinfo_x86 *c);
diff --git a/arch/x86/kernel/cpu/hypervisor.c b/arch/x86/kernel/cpu/hypervisor.c
index 36ce402a3fa5..d820d8eae96b 100644
--- a/arch/x86/kernel/cpu/hypervisor.c
+++ b/arch/x86/kernel/cpu/hypervisor.c
@@ -27,8 +27,8 @@
27 27
28static const __initconst struct hypervisor_x86 * const hypervisors[] = 28static const __initconst struct hypervisor_x86 * const hypervisors[] =
29{ 29{
30#ifdef CONFIG_XEN_PVHVM 30#ifdef CONFIG_XEN
31 &x86_hyper_xen_hvm, 31 &x86_hyper_xen,
32#endif 32#endif
33 &x86_hyper_vmware, 33 &x86_hyper_vmware,
34 &x86_hyper_ms_hyperv, 34 &x86_hyper_ms_hyperv,
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 94578efd3067..46957ead3060 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1760,6 +1760,9 @@ static struct notifier_block xen_hvm_cpu_notifier = {
1760 1760
1761static void __init xen_hvm_guest_init(void) 1761static void __init xen_hvm_guest_init(void)
1762{ 1762{
1763 if (xen_pv_domain())
1764 return;
1765
1763 init_hvm_pv_info(); 1766 init_hvm_pv_info();
1764 1767
1765 xen_hvm_init_shared_info(); 1768 xen_hvm_init_shared_info();
@@ -1775,6 +1778,7 @@ static void __init xen_hvm_guest_init(void)
1775 xen_hvm_init_time_ops(); 1778 xen_hvm_init_time_ops();
1776 xen_hvm_init_mmu_ops(); 1779 xen_hvm_init_mmu_ops();
1777} 1780}
1781#endif
1778 1782
1779static bool xen_nopv = false; 1783static bool xen_nopv = false;
1780static __init int xen_parse_nopv(char *arg) 1784static __init int xen_parse_nopv(char *arg)
@@ -1784,14 +1788,11 @@ static __init int xen_parse_nopv(char *arg)
1784} 1788}
1785early_param("xen_nopv", xen_parse_nopv); 1789early_param("xen_nopv", xen_parse_nopv);
1786 1790
1787static uint32_t __init xen_hvm_platform(void) 1791static uint32_t __init xen_platform(void)
1788{ 1792{
1789 if (xen_nopv) 1793 if (xen_nopv)
1790 return 0; 1794 return 0;
1791 1795
1792 if (xen_pv_domain())
1793 return 0;
1794
1795 return xen_cpuid_base(); 1796 return xen_cpuid_base();
1796} 1797}
1797 1798
@@ -1809,11 +1810,19 @@ bool xen_hvm_need_lapic(void)
1809} 1810}
1810EXPORT_SYMBOL_GPL(xen_hvm_need_lapic); 1811EXPORT_SYMBOL_GPL(xen_hvm_need_lapic);
1811 1812
1812const struct hypervisor_x86 x86_hyper_xen_hvm __refconst = { 1813static void xen_set_cpu_features(struct cpuinfo_x86 *c)
1813 .name = "Xen HVM", 1814{
1814 .detect = xen_hvm_platform, 1815 if (xen_pv_domain())
1816 clear_cpu_bug(c, X86_BUG_SYSRET_SS_ATTRS);
1817}
1818
1819const struct hypervisor_x86 x86_hyper_xen = {
1820 .name = "Xen",
1821 .detect = xen_platform,
1822#ifdef CONFIG_XEN_PVHVM
1815 .init_platform = xen_hvm_guest_init, 1823 .init_platform = xen_hvm_guest_init,
1824#endif
1816 .x2apic_available = xen_x2apic_para_available, 1825 .x2apic_available = xen_x2apic_para_available,
1826 .set_cpu_features = xen_set_cpu_features,
1817}; 1827};
1818EXPORT_SYMBOL(x86_hyper_xen_hvm); 1828EXPORT_SYMBOL(x86_hyper_xen);
1819#endif