summaryrefslogtreecommitdiffstats
path: root/arch/x86/include/asm
diff options
context:
space:
mode:
authorPaolo Bonzini2017-08-23 23:14:38 +0200
committerPaolo Bonzini2017-08-25 09:28:28 +0200
commitb9dd21e104bcd45e124acfe978a79df71259e59b (patch)
tree5a38e9036b388cee6f72f861df7adf9ddeafd158 /arch/x86/include/asm
parentKVM: x86: block guest protection keys unless the host has them enabled (diff)
downloadkernel-qcow2-linux-b9dd21e104bcd45e124acfe978a79df71259e59b.tar.gz
kernel-qcow2-linux-b9dd21e104bcd45e124acfe978a79df71259e59b.tar.xz
kernel-qcow2-linux-b9dd21e104bcd45e124acfe978a79df71259e59b.zip
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: 1be0e61c1f255faaeab04a390e00c8b9b9042870 Cc: stable@vger.kernel.org Reviewed-by: David Hildenbrand <david@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/include/asm')
-rw-r--r--arch/x86/include/asm/kvm_host.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 87ac4fba6d8e..f4d120a3e22e 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -492,6 +492,7 @@ struct kvm_vcpu_arch {
unsigned long cr4;
unsigned long cr4_guest_owned_bits;
unsigned long cr8;
+ u32 pkru;
u32 hflags;
u64 efer;
u64 apic_base;