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

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