KVM: x86/cpuid: Expose the true number of available ASIDs
PATCH 1/1 KVM: x86/cpuid: Expose the true number of available ASIDs
From: Like Xu <[email protected]>
The original fixed number "8" was first introduced 11 years ago. Time has passed and now let KVM report the true number of address space identifiers (ASIDs) that are supported by the processor returned in Fn8000_000A_EBX.
It helps user-space to make better decisions about guest values.
--- arch/x86/kvm/cpuid.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
arch/x86/kvm/cpuid.c +5 -2
@@ -967,8 +967,11 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function)break ; } entry->eax =1 ;/* SVM revision 1 */ - entry->ebx =8 ;/* Lets support 8 ASIDs in case we add proper -ASID emulation to nested SVM */ +/* +* Let's support at least 8 ASIDs in case we +* add proper ASID emulation to nested SVM. +*/ + entry->ebx = max_t(unsigned int, 8, entry->ebx); entry->ecx =0 ;/* Reserved */ cpuid_entry_override (entry,CPUID_8000_000A_EDX );break ;
Signature · 1 line
2.32.0
Paolo Bonzini
maintainerarch/x86/kvm/cpuid.c static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function) · line 971
Quoted 8 lines · Like Xu
The original fixed number "8" was first introduced 11 years ago. Time has passed and now let KVM report the true number of address space identifiers (ASIDs) that are supported by the processor returned in
Fn8000_000A_EBX.It helps user-space to make better decisions about guest values.
arch/x86/kvm/cpuid.c +0
-2- entry->ebx =8 ;/* Lets support 8 ASIDs in case we add proper -ASID emulation to nested SVM */
Why, since we don't have ASID emulation yet anyway?
Paolo
Quoted 5 lines · Paolo Bonzini
Quoted 4 lines · Like Xu
The original fixed number "8" was first introduced 11 years ago. Time has passed and now let KVM report the true number of address space identifiers (ASIDs) that are supported by the processor returned in
Fn8000_000A_EBX.
Quoted 8 lines
Quoted 4 lines
It helps user-space to make better decisions about guest values.
-
entry->ebx= 8; /* Lets support 8 ASIDs in case we add proper - ASID emulation to nested SVM */Why, since we don't have ASID emulation yet anyway?
Paolo
I suppose you're right on the current state.
But do we have an explanation as to why it is hard-coded as 8 and not zero or a real supported number?