thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
218e99
From c437843790b9b21a90a41b6d96b2b6db3be3d33a Mon Sep 17 00:00:00 2001
218e99
From: Eduardo Habkost <ehabkost@redhat.com>
218e99
Date: Wed, 16 Oct 2013 20:00:44 +0200
218e99
Subject: [PATCH 18/18] target-i386: support loading of "cpu/xsave" subsection
218e99
218e99
RH-Author: Eduardo Habkost <ehabkost@redhat.com>
218e99
Message-id: <1381953644-6411-1-git-send-email-ehabkost@redhat.com>
218e99
Patchwork-id: 54966
218e99
O-Subject: [qemu-kvm RHEL7 PATCH] target-i386: support loading of "cpu/xsave" subsection
218e99
Bugzilla: 1004743
218e99
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
218e99
RH-Acked-by: Juan Quintela <quintela@redhat.com>
218e99
RH-Acked-by: Orit Wasserman <owasserm@redhat.com>
218e99
218e99
Bugzilla: 1004743
218e99
Scratch build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=6429524
218e99
Upstream status: not applicable
218e99
  (We could try to make upstream accept the subsection, but I don't
218e99
  think it will be accepted because there's no real benefit)
218e99
218e99
This is a kind of forward-port of RHEL-6 commits ceee3a15c8 and 7f468b80fd, so
218e99
the "cpu/xsave" subsection can be loaded when migrating from RHEL-6.
218e99
218e99
The differences between the RHEL-6 patches and this one are:
218e99
 * The xsave state is not being removed from the main "cpu" section,
218e99
   so we keep using the same format/version used upstream
218e99
 * The subsection is always reported as optional, because the xsave
218e99
   state is kept in the main "cpu" section
218e99
218e99
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
218e99
---
218e99
 target-i386/machine.c | 24 +++++++++++++++++++++++-
218e99
 1 file changed, 23 insertions(+), 1 deletion(-)
218e99
218e99
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
---
218e99
 target-i386/machine.c |   24 +++++++++++++++++++++++-
218e99
 1 files changed, 23 insertions(+), 1 deletions(-)
218e99
218e99
diff --git a/target-i386/machine.c b/target-i386/machine.c
218e99
index 8faea62..4f30347 100644
218e99
--- a/target-i386/machine.c
218e99
+++ b/target-i386/machine.c
218e99
@@ -446,6 +446,25 @@ static const VMStateDescription vmstate_msr_ia32_misc_enable = {
218e99
     }
218e99
 };
218e99
 
218e99
+static bool vmstate_xsave_needed(void *opaque)
218e99
+{
218e99
+    /* The xsave state is already on the main "cpu" section */
218e99
+    return false;
218e99
+}
218e99
+
218e99
+static const VMStateDescription vmstate_xsave ={
218e99
+    .name = "cpu/xsave",
218e99
+    .version_id = 1,
218e99
+    .minimum_version_id = 1,
218e99
+    .minimum_version_id_old = 1,
218e99
+    .fields      = (VMStateField []) {
218e99
+    VMSTATE_UINT64_V(env.xcr0, X86CPU, 1),
218e99
+    VMSTATE_UINT64_V(env.xstate_bv, X86CPU, 1),
218e99
+    VMSTATE_YMMH_REGS_VARS(env.ymmh_regs, X86CPU, CPU_NB_REGS, 1),
218e99
+    VMSTATE_END_OF_LIST()
218e99
+    }
218e99
+};
218e99
+
218e99
 const VMStateDescription vmstate_x86_cpu = {
218e99
     .name = "cpu",
218e99
     .version_id = 12,
218e99
@@ -571,7 +590,10 @@ const VMStateDescription vmstate_x86_cpu = {
218e99
         }, {
218e99
             .vmsd = &vmstate_msr_ia32_misc_enable,
218e99
             .needed = misc_enable_needed,
218e99
-        } , {
218e99
+        }, {
218e99
+            .vmsd = &vmstate_xsave,
218e99
+            .needed = vmstate_xsave_needed,
218e99
+        }, {
218e99
             /* empty */
218e99
         }
218e99
     }
218e99
-- 
218e99
1.7.1
218e99