File 5a4fd893-4-x86-introduce-cpuid_policy_updated.patch of Package xen.6649
# Commit b357546b43ab87dfb10d740ae637a685134d5e32
# Date 2018-01-05 19:57:07 +0000
# Author Andrew Cooper <andrew.cooper3@citrix.com>
# Committer Andrew Cooper <andrew.cooper3@citrix.com>
x86: Introduce a common cpuid_policy_updated()
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>
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -486,6 +486,8 @@ int vcpu_initialise(struct vcpu *v)
if ( is_pv_domain(d) )
xfree(v->arch.pv_vcpu.trap_ctxt);
}
+ else if ( !is_idle_domain(v->domain) )
+ cpuid_policy_updated(v);
return rc;
}
@@ -2629,6 +2631,16 @@ int domain_relinquish_resources(struct 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);
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -231,12 +231,12 @@ static void update_domain_cpuid_info(str
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);
}
}
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1565,8 +1565,6 @@ int hvm_vcpu_initialise(struct vcpu *v)
hvm_set_guest_tsc(v, 0);
}
- hvm_cpuid_policy_changed(v);
-
return 0;
fail6:
--- a/xen/include/asm-x86/domain.h
+++ b/xen/include/asm-x86/domain.h
@@ -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).