Blame SOURCES/kvm-target-ppc-Fix-setting-of-cpu-compat_pvr-on-incoming.patch

9bac43
From ae27b925a8cda59917f47b834492fc77d341d898 Mon Sep 17 00:00:00 2001
9bac43
From: Suraj Jitindar Singh <sursingh@redhat.com>
9bac43
Date: Tue, 5 Dec 2017 05:55:19 +0100
9bac43
Subject: [PATCH 14/21] target/ppc: Fix setting of cpu->compat_pvr on incoming
9bac43
 migration
9bac43
9bac43
RH-Author: Suraj Jitindar Singh <sursingh@redhat.com>
9bac43
Message-id: <1512453319-16676-3-git-send-email-sursingh@redhat.com>
9bac43
Patchwork-id: 78133
9bac43
O-Subject: [RHEL7.5 qemu-kvm-rhev PATCH 2/2] target/ppc: Fix setting of cpu->compat_pvr on incoming migration
9bac43
Bugzilla: 1517051
9bac43
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
9bac43
RH-Acked-by: David Gibson <dgibson@redhat.com>
9bac43
RH-Acked-by: Thomas Huth <thuth@redhat.com>
9bac43
9bac43
From: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
9bac43
9bac43
cpu->compat_pvr is used to store the current compat mode of the cpu.
9bac43
9bac43
On the receiving side during incoming migration we check compatibility
9bac43
with the compat mode by calling ppc_set_compat(). However we fail to set
9bac43
the compat mode with the hypervisor since the "new" compat mode doesn't
9bac43
differ from the current (due to a "cpu->compat_pvr != compat_pvr" check).
9bac43
This means that kvm runs the vcpus without a compat mode, which is the
9bac43
incorrect behaviour. The implication being that a compatibility mode
9bac43
will never be in effect after migration.
9bac43
9bac43
To fix this so that the compat mode is correctly set with the
9bac43
hypervisor, store the desired compat mode and reset cpu->compat_pvr to
9bac43
zero before calling ppc_set_compat().
9bac43
9bac43
Fixes: 5dfaa532 ("ppc: fix ppc_set_compat() with KVM PR")
9bac43
9bac43
Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
9bac43
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
9bac43
(cherry picked from commit e07cc1929515cfb808b5c2fcc60c079e6be110cf)
9bac43
9bac43
Signed-off-by: Suraj Jitindar Singh <sursingh@redhat.com>
9bac43
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9bac43
---
9bac43
 target/ppc/machine.c | 4 +++-
9bac43
 1 file changed, 3 insertions(+), 1 deletion(-)
9bac43
9bac43
diff --git a/target/ppc/machine.c b/target/ppc/machine.c
9bac43
index e36b710..760be64d 100644
9bac43
--- a/target/ppc/machine.c
9bac43
+++ b/target/ppc/machine.c
9bac43
@@ -235,9 +235,11 @@ static int cpu_post_load(void *opaque, int version_id)
9bac43
 
9bac43
 #if defined(TARGET_PPC64)
9bac43
     if (cpu->compat_pvr) {
9bac43
+        uint32_t compat_pvr = cpu->compat_pvr;
9bac43
         Error *local_err = NULL;
9bac43
 
9bac43
-        ppc_set_compat(cpu, cpu->compat_pvr, &local_err);
9bac43
+        cpu->compat_pvr = 0;
9bac43
+        ppc_set_compat(cpu, compat_pvr, &local_err);
9bac43
         if (local_err) {
9bac43
             error_report_err(local_err);
9bac43
             return -1;
9bac43
-- 
9bac43
1.8.3.1
9bac43