File x86-XPTI-no-idle-dom.patch of Package xen.openSUSE_Leap_42.3_Update

x86: don't enable XPTI on idle domain

While the involved code (in pv_domain_initialise()) sits behind an
!is_idle_domain() check already, we need to add one here.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
The further backport to 4.8 and older is going to look quite a bit
different; a one-liner looks to suffice there.

--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -714,20 +714,15 @@ int arch_domain_create(struct domain *d,
         if ( (rc = hvm_domain_initialise(d)) != 0 )
             goto fail;
     }
-    else
+    else if ( !is_idle_domain(d) )
     {
         static const struct arch_csw pv_csw = {
             .from = paravirt_ctxt_switch_from,
             .to   = paravirt_ctxt_switch_to,
             .tail = continue_nonidle_domain,
         };
-        static const struct arch_csw idle_csw = {
-            .from = paravirt_ctxt_switch_from,
-            .to   = paravirt_ctxt_switch_to,
-            .tail = continue_idle_domain,
-        };
 
-        d->arch.ctxt_switch = is_idle_domain(d) ? &idle_csw : &pv_csw;
+        d->arch.ctxt_switch = &pv_csw;
 
         /* 64-bit PV guest by default. */
         d->arch.is_32bit_pv = d->arch.has_32bit_shinfo = 0;
@@ -758,6 +753,16 @@ int arch_domain_create(struct domain *d,
                 break;
             }
     }
+    else
+    {
+        static const struct arch_csw idle_csw = {
+            .from = paravirt_ctxt_switch_from,
+            .to   = paravirt_ctxt_switch_to,
+            .tail = continue_idle_domain,
+        };
+
+        d->arch.ctxt_switch = &idle_csw;
+    }
 
     /* initialize default tsc behavior in case tools don't */
     tsc_set_info(d, TSC_MODE_DEFAULT, 0UL, 0, 0);
openSUSE Build Service is sponsored by