]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: simplify handling of PKRU
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 23 Aug 2017 21:14:38 +0000 (23:14 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 25 Aug 2017 07:28:28 +0000 (09:28 +0200)
commitd5b38a050b2cbf1e5a83ae6c14400408c9f354bf
tree5a38e9036b388cee6f72f861df7adf9ddeafd158
parent87a106951e505adc8ec8ab1ecee967209f4120a0
KVM: x86: simplify handling of PKRU

Move it to struct kvm_arch_vcpu, replacing guest_pkru_valid with a
simple comparison against the host value of the register.  The write of
PKRU in addition can be skipped if the guest has not enabled the feature.
Once we do this, we need not test OSPKE in the host anymore, because
guest_CR4.PKE=1 implies host_CR4.PKE=1.

The static PKU test is kept to elide the code on older CPUs.

Suggested-by: Yang Zhang <zy107165@alibaba-inc.com>
Fixes: 668887bbe4fe1a6cc11eaad8d459821e9075eb92
Cc: stable@vger.kernel.org
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/kvm_cache_regs.h
arch/x86/kvm/mmu.h
arch/x86/kvm/svm.c
arch/x86/kvm/vmx.c