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