[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 3/4] x86/cpuid: Effectively remove domain_cpuid()
The only callers of domain_cpuid() are the legacy cpuid path via {pv,hvm}_cpuid(). Move domain_cpuid() to being private in cpuid.c, with an adjusted API to use struct cpuid_leaf rather than individual pointers. The ITSC clobbering logic is dropped. It is no longer necessary now that the logic has moved into recalculate_cpuid_policy() Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- CC: Jan Beulich <JBeulich@xxxxxxxx> --- xen/arch/x86/cpuid.c | 24 ++++++++++++++++++++++-- xen/arch/x86/domain.c | 40 ---------------------------------------- xen/include/asm-x86/domain.h | 8 -------- 3 files changed, 22 insertions(+), 50 deletions(-) diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c index b685874..e173ff7 100644 --- a/xen/arch/x86/cpuid.c +++ b/xen/arch/x86/cpuid.c @@ -350,6 +350,26 @@ int init_domain_cpuid_policy(struct domain *d) return 0; } +static void domain_cpuid(const struct domain *d, uint32_t leaf, + uint32_t subleaf, struct cpuid_leaf *res) +{ + unsigned int i; + + for ( i = 0; i < MAX_CPUID_INPUT; i++ ) + { + cpuid_input_t *cpuid = &d->arch.cpuids[i]; + + if ( (cpuid->input[0] == leaf) && + ((cpuid->input[1] == XEN_CPUID_INPUT_UNUSED) || + (cpuid->input[1] == subleaf)) ) + { + *res = (struct cpuid_leaf){ cpuid->eax, cpuid->ebx, + cpuid->ecx, cpuid->edx }; + return; + } + } +} + static void pv_cpuid(uint32_t leaf, uint32_t subleaf, struct cpuid_leaf *res) { struct vcpu *curr = current; @@ -357,7 +377,7 @@ static void pv_cpuid(uint32_t leaf, uint32_t subleaf, struct cpuid_leaf *res) const struct cpuid_policy *p = currd->arch.cpuid; if ( !is_control_domain(currd) && !is_hardware_domain(currd) ) - domain_cpuid(currd, leaf, subleaf, &res->a, &res->b, &res->c, &res->d); + domain_cpuid(currd, leaf, subleaf, res); else cpuid_count_leaf(leaf, subleaf, res); @@ -620,7 +640,7 @@ static void hvm_cpuid(uint32_t leaf, uint32_t subleaf, struct cpuid_leaf *res) struct domain *d = v->domain; const struct cpuid_policy *p = d->arch.cpuid; - domain_cpuid(d, leaf, subleaf, &res->a, &res->b, &res->c, &res->d); + domain_cpuid(d, leaf, subleaf, res); switch ( leaf ) { diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 319cc8a..6fc1242 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -2622,46 +2622,6 @@ void arch_dump_vcpu_info(struct vcpu *v) vpmu_dump(v); } -void domain_cpuid( - const struct domain *d, - unsigned int input, - unsigned int sub_input, - unsigned int *eax, - unsigned int *ebx, - unsigned int *ecx, - unsigned int *edx) -{ - cpuid_input_t *cpuid; - int i; - - for ( i = 0; i < MAX_CPUID_INPUT; i++ ) - { - cpuid = &d->arch.cpuids[i]; - - if ( (cpuid->input[0] == input) && - ((cpuid->input[1] == XEN_CPUID_INPUT_UNUSED) || - (cpuid->input[1] == sub_input)) ) - { - *eax = cpuid->eax; - *ebx = cpuid->ebx; - *ecx = cpuid->ecx; - *edx = cpuid->edx; - - /* - * Do not advertise host's invariant TSC unless the TSC is - * emulated, or the domain cannot migrate to other hosts. - */ - if ( (input == 0x80000007) && /* Advanced Power Management */ - !d->disable_migrate && !d->arch.vtsc ) - *edx &= ~cpufeat_mask(X86_FEATURE_ITSC); - - return; - } - } - - *eax = *ebx = *ecx = *edx = 0; -} - void vcpu_kick(struct vcpu *v) { /* diff --git a/xen/include/asm-x86/domain.h b/xen/include/asm-x86/domain.h index 896e78d..9e3a07b 100644 --- a/xen/include/asm-x86/domain.h +++ b/xen/include/asm-x86/domain.h @@ -617,14 +617,6 @@ unsigned long pv_guest_cr4_fixup(const struct vcpu *, unsigned long guest_cr4); X86_CR4_OSXSAVE | X86_CR4_SMEP | \ X86_CR4_FSGSBASE | X86_CR4_SMAP)) -void domain_cpuid(const struct domain *d, - unsigned int input, - unsigned int sub_input, - unsigned int *eax, - unsigned int *ebx, - unsigned int *ecx, - unsigned int *edx); - #define domain_max_vcpus(d) (is_hvm_domain(d) ? HVM_MAX_VCPUS : MAX_VIRT_CPUS) static inline struct vcpu_guest_context *alloc_vcpu_guest_context(void) -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |