thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-target-i386-support-loading-of-cpu-xsave-subsection.patch

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