Commit 160b486f authored by Sean Christopherson's avatar Sean Christopherson Committed by Paolo Bonzini

KVM: x86: Drop explicit @func param from ->set_supported_cpuid()

Drop the explicit @func param from ->set_supported_cpuid() and instead
pull the CPUID function from the relevant entry.  This sets the stage
for hardening guest CPUID updates in future patches, e.g. allows adding
run-time assertions that the CPUID feature being changed is actually
a bit in the referenced CPUID entry.

No functional change intended.
Reviewed-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: default avatarSean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 7392079c
...@@ -1161,7 +1161,7 @@ struct kvm_x86_ops { ...@@ -1161,7 +1161,7 @@ struct kvm_x86_ops {
void (*set_tdp_cr3)(struct kvm_vcpu *vcpu, unsigned long cr3); void (*set_tdp_cr3)(struct kvm_vcpu *vcpu, unsigned long cr3);
void (*set_supported_cpuid)(u32 func, struct kvm_cpuid_entry2 *entry); void (*set_supported_cpuid)(struct kvm_cpuid_entry2 *entry);
bool (*has_wbinvd_exit)(void); bool (*has_wbinvd_exit)(void);
......
...@@ -784,7 +784,7 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function) ...@@ -784,7 +784,7 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function)
break; break;
} }
kvm_x86_ops->set_supported_cpuid(function, entry); kvm_x86_ops->set_supported_cpuid(entry);
r = 0; r = 0;
......
...@@ -6035,9 +6035,9 @@ static void svm_cpuid_update(struct kvm_vcpu *vcpu) ...@@ -6035,9 +6035,9 @@ static void svm_cpuid_update(struct kvm_vcpu *vcpu)
#define F feature_bit #define F feature_bit
static void svm_set_supported_cpuid(u32 func, struct kvm_cpuid_entry2 *entry) static void svm_set_supported_cpuid(struct kvm_cpuid_entry2 *entry)
{ {
switch (func) { switch (entry->function) {
case 0x80000001: case 0x80000001:
if (nested) if (nested)
entry->ecx |= (1 << 2); /* Set SVM bit */ entry->ecx |= (1 << 2); /* Set SVM bit */
......
...@@ -7128,9 +7128,9 @@ static void vmx_cpuid_update(struct kvm_vcpu *vcpu) ...@@ -7128,9 +7128,9 @@ static void vmx_cpuid_update(struct kvm_vcpu *vcpu)
} }
} }
static void vmx_set_supported_cpuid(u32 func, struct kvm_cpuid_entry2 *entry) static void vmx_set_supported_cpuid(struct kvm_cpuid_entry2 *entry)
{ {
if (func == 1 && nested) if (entry->function == 1 && nested)
entry->ecx |= feature_bit(VMX); entry->ecx |= feature_bit(VMX);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment