Commit a71dbdaa authored by Boris Ostrovsky's avatar Boris Ostrovsky Committed by David Vrabel
Browse files

hypervisor/x86/xen: Unset X86_BUG_SYSRET_SS_ATTRS on Xen PV guests

Commit 61f01dd9

 ("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: default avatarBoris Ostrovsky <>
Reported-by: default avatarSander Eikelenboom <>
Signed-off-by: default avatarDavid Vrabel <>
parent 16e6bd59
......@@ -50,7 +50,7 @@ extern const struct hypervisor_x86 *x86_hyper;
/* Recognized hypervisors */
extern const struct hypervisor_x86 x86_hyper_vmware;
extern const struct hypervisor_x86 x86_hyper_ms_hyperv;
extern const struct hypervisor_x86 x86_hyper_xen_hvm;
extern const struct hypervisor_x86 x86_hyper_xen;
extern const struct hypervisor_x86 x86_hyper_kvm;
extern void init_hypervisor(struct cpuinfo_x86 *c);
......@@ -27,8 +27,8 @@
static const __initconst struct hypervisor_x86 * const hypervisors[] =
......@@ -1760,6 +1760,9 @@ static struct notifier_block xen_hvm_cpu_notifier = {
static void __init xen_hvm_guest_init(void)
if (xen_pv_domain())
......@@ -1775,6 +1778,7 @@ static void __init xen_hvm_guest_init(void)
static bool xen_nopv = false;
static __init int xen_parse_nopv(char *arg)
......@@ -1784,14 +1788,11 @@ static __init int xen_parse_nopv(char *arg)
early_param("xen_nopv", xen_parse_nopv);
static uint32_t __init xen_hvm_platform(void)
static uint32_t __init xen_platform(void)
if (xen_nopv)
return 0;
if (xen_pv_domain())
return 0;
return xen_cpuid_base();
......@@ -1809,11 +1810,19 @@ bool xen_hvm_need_lapic(void)
const struct hypervisor_x86 x86_hyper_xen_hvm __refconst = {
.name = "Xen HVM",
.detect = xen_hvm_platform,
static void xen_set_cpu_features(struct cpuinfo_x86 *c)
if (xen_pv_domain())
clear_cpu_bug(c, X86_BUG_SYSRET_SS_ATTRS);
const struct hypervisor_x86 x86_hyper_xen = {
.name = "Xen",
.detect = xen_platform,
.init_platform = xen_hvm_guest_init,
.x2apic_available = xen_x2apic_para_available,
.set_cpu_features = xen_set_cpu_features,
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment