aboutsummaryrefslogtreecommitdiff
path: root/target-i386/kvm.c
diff options
context:
space:
mode:
authorHuaitong Han <huaitong.han@intel.com>2015-11-18 10:20:15 +0800
committerEduardo Habkost <ehabkost@redhat.com>2016-01-21 12:47:16 -0200
commitf74eefe0b98cd7e13825de8e8d9f32e22aed102c (patch)
treeaa58c207fc0650945406ad62579d4eedd6bbc858 /target-i386/kvm.c
parent36f96c4b6bd25f43000c317518ff3df10202bc75 (diff)
target-i386: Add PKU and and OSPKE support
Add PKU and OSPKE CPUID features, including xsave state and migration support. Signed-off-by: Huaitong Han <huaitong.han@intel.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> [ehabkost: squashed 3 patches together, edited patch description] Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'target-i386/kvm.c')
-rw-r--r--target-i386/kvm.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 419bb18bb3..d6f5355aa9 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -1299,6 +1299,7 @@ static int kvm_put_fpu(X86CPU *cpu)
#define XSAVE_OPMASK 272
#define XSAVE_ZMM_Hi256 288
#define XSAVE_Hi16_ZMM 416
+#define XSAVE_PKRU 672
static int kvm_put_xsave(X86CPU *cpu)
{
@@ -1352,6 +1353,7 @@ static int kvm_put_xsave(X86CPU *cpu)
#ifdef TARGET_X86_64
memcpy(&xsave->region[XSAVE_Hi16_ZMM], &env->xmm_regs[16],
16 * sizeof env->xmm_regs[16]);
+ memcpy(&xsave->region[XSAVE_PKRU], &env->pkru, sizeof env->pkru);
#endif
r = kvm_vcpu_ioctl(CPU(cpu), KVM_SET_XSAVE, xsave);
return r;
@@ -1770,6 +1772,7 @@ static int kvm_get_xsave(X86CPU *cpu)
#ifdef TARGET_X86_64
memcpy(&env->xmm_regs[16], &xsave->region[XSAVE_Hi16_ZMM],
16 * sizeof env->xmm_regs[16]);
+ memcpy(&env->pkru, &xsave->region[XSAVE_PKRU], sizeof env->pkru);
#endif
return 0;
}