x86: Introduce a common cpuid_policy_updated()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 16 Nov 2017 15:42:24 +0000 (15:42 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 5 Jan 2018 19:57:07 +0000 (19:57 +0000)
No practical change at the moment, but future changes will need to react
irrespective of guest type.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/domain.c
xen/arch/x86/domctl.c
xen/arch/x86/hvm/hvm.c
xen/include/asm-x86/domain.h

index 0ae715dbb25a8cc1197212ed7a87cab81ab72137..da1bf1a97b5882cf0e9ff8080e801aadfa409ac9 100644 (file)
@@ -363,6 +363,8 @@ int vcpu_initialise(struct vcpu *v)
 
         if ( (rc = init_vcpu_msr_policy(v)) )
             goto fail;
+
+        cpuid_policy_updated(v);
     }
 
     return rc;
@@ -2022,6 +2024,16 @@ int domain_relinquish_resources(struct domain *d)
     return 0;
 }
 
+/*
+ * Called during vcpu construction, and each time the toolstack changes the
+ * CPUID configuration for the domain.
+ */
+void cpuid_policy_updated(struct vcpu *v)
+{
+    if ( is_hvm_vcpu(v) )
+        hvm_cpuid_policy_changed(v);
+}
+
 void arch_dump_domain_info(struct domain *d)
 {
     paging_dump_domain_info(d);
index cc7f433669a4d664a07e03dffc9fd5444d274724..5973d9fdaa27d11cb5c6e1d86b09222bd2c20cf6 100644 (file)
@@ -294,12 +294,12 @@ static int update_domain_cpuid_info(struct domain *d,
         break;
     }
 
-    if ( is_hvm_domain(d) && call_policy_changed )
+    if ( call_policy_changed )
     {
         struct vcpu *v;
 
         for_each_vcpu( d, v )
-            hvm_cpuid_policy_changed(v);
+            cpuid_policy_updated(v);
     }
 
     return 0;
index 8fd7eed42988f5ffedc6baba17521afd9489b365..db282b55d94aa2fd8836ff341dbd61102c17185c 100644 (file)
@@ -1555,8 +1555,6 @@ int hvm_vcpu_initialise(struct vcpu *v)
         hvm_set_guest_tsc(v, 0);
     }
 
-    hvm_cpuid_policy_changed(v);
-
     return 0;
 
  fail6:
index f69911918eec38c558e60442189c281550d1e53c..4679d5477d665b6136d777329773ad8d62e1286f 100644 (file)
@@ -79,6 +79,8 @@ void toggle_guest_mode(struct vcpu *);
 /* x86/64: toggle guest page tables between kernel and user modes. */
 void toggle_guest_pt(struct vcpu *);
 
+void cpuid_policy_updated(struct vcpu *v);
+
 /*
  * Initialise a hypercall-transfer page. The given pointer must be mapped
  * in Xen virtual address space (accesses are not validated or checked).