Re: [PATCH v2 64/66] KVM: nSVM: Expose SVM features to L1 iff nested is enabled

From: Jim Mattson
Date: Tue Mar 03 2020 - 13:37:28 EST


On Mon, Mar 2, 2020 at 3:57 PM Sean Christopherson
<sean.j.christopherson@xxxxxxxxx> wrote:
>
> Set SVM feature bits in KVM capabilities if and only if nested=true, KVM
> shouldn't advertise features that realistically can't be used. Use
> kvm_cpu_cap_has(X86_FEATURE_SVM) to indirectly query "nested" in
> svm_set_supported_cpuid() in anticipation of moving CPUID 0x8000000A
> adjustments into common x86 code.

Why not go ahead and report the SVM feature bits regardless of
"nested," and lock SVM off in VM_CR when nested=false? That would be
more like hardware behavior.