aboutsummaryrefslogtreecommitdiff
path: root/target-i386/machine.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/machine.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/machine.c')
-rw-r--r--target-i386/machine.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/target-i386/machine.c b/target-i386/machine.c
index 0d381ac0c0..6be73413cb 100644
--- a/target-i386/machine.c
+++ b/target-i386/machine.c
@@ -848,6 +848,27 @@ static const VMStateDescription vmstate_xss = {
}
};
+#ifdef TARGET_X86_64
+static bool pkru_needed(void *opaque)
+{
+ X86CPU *cpu = opaque;
+ CPUX86State *env = &cpu->env;
+
+ return env->pkru != 0;
+}
+
+static const VMStateDescription vmstate_pkru = {
+ .name = "cpu/pkru",
+ .version_id = 1,
+ .minimum_version_id = 1,
+ .needed = pkru_needed,
+ .fields = (VMStateField[]){
+ VMSTATE_UINT32(env.pkru, X86CPU),
+ VMSTATE_END_OF_LIST()
+ }
+};
+#endif
+
static bool tsc_khz_needed(void *opaque)
{
X86CPU *cpu = opaque;
@@ -991,6 +1012,9 @@ VMStateDescription vmstate_x86_cpu = {
&vmstate_avx512,
&vmstate_xss,
&vmstate_tsc_khz,
+#ifdef TARGET_X86_64
+ &vmstate_pkru,
+#endif
NULL
}
};