[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d573551a-29cb-3cb8-b807-200b5e462a01@redhat.com>
Date: Thu, 7 May 2020 10:07:46 +0200
From: Paolo Bonzini <pbonzini@...hat.com>
To: Sean Christopherson <sean.j.christopherson@...el.com>,
Babu Moger <babu.moger@....com>
Cc: corbet@....net, tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
hpa@...or.com, x86@...nel.org, vkuznets@...hat.com,
wanpengli@...cent.com, jmattson@...gle.com, joro@...tes.org,
dave.hansen@...ux.intel.com, luto@...nel.org, peterz@...radead.org,
mchehab+samsung@...nel.org, changbin.du@...el.com,
namit@...are.com, bigeasy@...utronix.de,
yang.shi@...ux.alibaba.com, asteinhauser@...gle.com,
anshuman.khandual@....com, jan.kiszka@...mens.com,
akpm@...ux-foundation.org, steven.price@....com,
rppt@...ux.vnet.ibm.com, peterx@...hat.com,
dan.j.williams@...el.com, arjunroy@...gle.com, logang@...tatee.com,
thellstrom@...are.com, aarcange@...hat.com, justin.he@....com,
robin.murphy@....com, ira.weiny@...el.com, keescook@...omium.org,
jgross@...e.com, andrew.cooper3@...rix.com,
pawan.kumar.gupta@...ux.intel.com, fenghua.yu@...el.com,
vineela.tummalapalli@...el.com, yamada.masahiro@...ionext.com,
sam@...nborg.org, acme@...hat.com, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, kvm@...r.kernel.org
Subject: Re: [PATCH 2/2] KVM: SVM: Add support for MPK feature on AMD
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
Powered by blists - more mailing lists