KVM: Add cpuid_update() callback to kvm_x86_ops
Sometime, we need to adjust some state in order to reflect guest CPUID setting, e.g. if we don't expose rdtscp to guest, we won't want to enable it on hardware. cpuid_update() is introduced for this purpose. Also export kvm_find_cpuid_entry() for later use. Signed-off-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
This commit is contained in:
committed by
Marcelo Tosatti
parent
be43f83dad
commit
0e85188049
@@ -1574,6 +1574,7 @@ static int kvm_vcpu_ioctl_set_cpuid(struct kvm_vcpu *vcpu,
|
||||
cpuid_fix_nx_cap(vcpu);
|
||||
r = 0;
|
||||
kvm_apic_set_version(vcpu);
|
||||
kvm_x86_ops->cpuid_update(vcpu);
|
||||
|
||||
out_free:
|
||||
vfree(cpuid_entries);
|
||||
@@ -1596,6 +1597,7 @@ static int kvm_vcpu_ioctl_set_cpuid2(struct kvm_vcpu *vcpu,
|
||||
goto out;
|
||||
vcpu->arch.cpuid_nent = cpuid->nent;
|
||||
kvm_apic_set_version(vcpu);
|
||||
kvm_x86_ops->cpuid_update(vcpu);
|
||||
return 0;
|
||||
|
||||
out:
|
||||
@@ -3733,6 +3735,7 @@ struct kvm_cpuid_entry2 *kvm_find_cpuid_entry(struct kvm_vcpu *vcpu,
|
||||
}
|
||||
return best;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(kvm_find_cpuid_entry);
|
||||
|
||||
int cpuid_maxphyaddr(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
|
Reference in New Issue
Block a user