]> 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)
commit7296b27b95848f615b6b197316f21ad52564d0c4
tree5a38e9036b388cee6f72f861df7adf9ddeafd158
parente3fde2b4d5e3a2c7bac65d4b310160a9358517c8
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: 2e207fd9671b95fbc2ce770e7a38efedd745a5b1
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