Skip to content
Commit b9dd21e1 authored by Paolo Bonzini's avatar Paolo Bonzini
Browse files

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: default avatarYang Zhang <zy107165@alibaba-inc.com>
Fixes: 1be0e61c


Cc: stable@vger.kernel.org
Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent c469268c
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment