Skip to content

Commit 5f41a37

Browse files
jsmattsonjrbonzini
authored andcommitted
kvm: x86: Use AMD CPUID semantics for AMD vCPUs
When the guest CPUID information represents an AMD vCPU, return all zeroes for queries of undefined CPUID leaves, whether or not they are in range. Signed-off-by: Jim Mattson <[email protected]> Fixes: bd22f5c ("KVM: move and fix substitue search for missing CPUID entries") Reviewed-by: Marc Orr <[email protected]> Reviewed-by: Peter Shier <[email protected]> Reviewed-by: Jacob Xu <[email protected]> Cc: Sean Christopherson <[email protected]> Cc: Paolo Bonzini <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 4356112 commit 5f41a37

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

arch/x86/kvm/cpuid.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -998,9 +998,11 @@ bool kvm_cpuid(struct kvm_vcpu *vcpu, u32 *eax, u32 *ebx,
998998
/*
999999
* Intel CPUID semantics treats any query for an out-of-range
10001000
* leaf as if the highest basic leaf (i.e. CPUID.0H:EAX) were
1001-
* requested.
1001+
* requested. AMD CPUID semantics returns all zeroes for any
1002+
* undefined leaf, whether or not the leaf is in range.
10021003
*/
1003-
if (!entry && check_limit && !cpuid_function_in_range(vcpu, function)) {
1004+
if (!entry && check_limit && !guest_cpuid_is_amd(vcpu) &&
1005+
!cpuid_function_in_range(vcpu, function)) {
10041006
max = kvm_find_cpuid_entry(vcpu, 0, 0);
10051007
if (max) {
10061008
function = max->eax;

0 commit comments

Comments
 (0)