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@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
Andrew Cooper committed 2017-01-13 13:16:57 +00:00
1 parent 9db5d75c91
commit d1bc8380e5
3 files changed
+22 -50

No files matched your search

+22 -2
View File
@@ -342,6 +342,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;
@@ -349,7 +369,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);
@@ -612,7 +632,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 )
{
-40
View File
@@ -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)
{
/*
-8
View File
@@ -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)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.