Re: [PATCH 2/2] KVM: SVM: Add support for MPK feature on AMD

From: Dave Hansen
Date: Wed May 06 2020 - 18:36:24 EST


On 5/6/20 3:02 PM, Babu Moger wrote:
> --- a/arch/x86/kvm/svm/svm.c
> +++ b/arch/x86/kvm/svm/svm.c
> @@ -818,6 +818,10 @@ static __init void svm_set_cpu_caps(void)
> if (boot_cpu_has(X86_FEATURE_LS_CFG_SSBD) ||
> boot_cpu_has(X86_FEATURE_AMD_SSBD))
> kvm_cpu_cap_set(X86_FEATURE_VIRT_SSBD);
> +
> + /* PKU is not yet implemented for shadow paging. */
> + if (npt_enabled && boot_cpu_has(X86_FEATURE_OSPKE))
> + kvm_cpu_cap_check_and_set(X86_FEATURE_PKU);
> }

Reviewed-by: Dave Hansen <dave.hansen@xxxxxxxxx>

But, I'll also say that we probably shouldn't have put the other code
into arch/x86/kvm/vmx/vmx.c in the first place. It would be much nicer
if this refactored the current code into a common spot rather than
copying. But, I do understand the impulse to do it the way it was done.