lkml.org 
[lkml]   [2020]   [May]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 2/2] KVM: SVM: Add support for MPK feature on AMD
From
Date
On 07/05/20 00:26, Sean Christopherson wrote:
>> + /* Load the guest pkru state */
>> + if (static_cpu_has(X86_FEATURE_PKU) &&
>> + kvm_read_cr4_bits(vcpu, X86_CR4_PKE) &&
>> + vcpu->arch.pkru != svm->host_pkru)
>> + __write_pkru(vcpu->arch.pkru);
> This and the restoration should be moved to common x86 helpers, at a glance
> they look identical.
>
> In short, pretty much all of this belongs in common x86.
>

We could stick this in kvm_load_guest_xsave_state
kvm_load_host_xsave_state. It's not a perfect match, after all the code
itself proves that PKRU can be loaded without XSAVE; but it's close
enough and it's exactly in the right point of vmx_vcpu_run and svm_vcpu_run.

Paolo

\
 
 \ /
  Last update: 2020-05-07 10:09    [W:0.054 / U:0.624 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site