lkml.org 
[lkml]   [2020]   [Feb]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 00/61] KVM: x86: Introduce KVM cpu caps
On Tue, Feb 25, 2020 at 04:18:38PM +0100, Vitaly Kuznetsov wrote:
> Sean Christopherson <sean.j.christopherson@intel.com> writes:
>
> >
> > 7. Profit!
>
> Would it be better or worse if we eliminate set_supported_cpuid() hook
> completely by doing an ugly hack like (completely untested):
>
> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> index a2a091d328c6..5ad291d48e1b 100644
> --- a/arch/x86/include/asm/kvm_host.h
> +++ b/arch/x86/include/asm/kvm_host.h
> @@ -1145,8 +1145,6 @@ struct kvm_x86_ops {
>
> void (*set_tdp_cr3)(struct kvm_vcpu *vcpu, unsigned long cr3);
>
> - void (*set_supported_cpuid)(struct kvm_cpuid_entry2 *entry);
> -
> bool (*has_wbinvd_exit)(void);
>
> u64 (*read_l1_tsc_offset)(struct kvm_vcpu *vcpu);
> diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
> index e8beb1e542a8..88431fc02797 100644
> --- a/arch/x86/kvm/cpuid.c
> +++ b/arch/x86/kvm/cpuid.c
> @@ -749,6 +749,16 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function)
> cpuid_entry_override(entry, CPUID_8000_0008_EBX);
> break;
> }
> + case 0x8000000A:
> + if (boot_cpu_has(X86_FEATURE_SVM)) {
> + entry->eax = 1; /* SVM revision 1 */
> + entry->ebx = 8; /* Lets support 8 ASIDs in case we add proper
> + ASID emulation to nested SVM */
> + entry->ecx = 0; /* Reserved */
> + entry->edx = 0; /* Per default do not support any
> + additional features */

Lucky thing that you suggested this change, patch ("KVM: SVM: Convert
feature updates from CPUID to KVM cpu caps") was buggy in that clearing
entry->edx here would wipe out all X86_FEATURE_NRIPS and X86_FEATURE_NPT.
Only noticed it when moving this code.

\
 
 \ /
  Last update: 2020-02-29 19:33    [W:0.329 / U:6.720 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site