Blame SOURCES/kvm-target-ppc-Add-stub-implementation-of-the-PSSCR.patch

76daa3
From ad017413736e51417a4b67e965ad1e968518a957 Mon Sep 17 00:00:00 2001
76daa3
From: David Gibson <dgibson@redhat.com>
76daa3
Date: Fri, 11 Aug 2017 06:09:09 +0200
76daa3
Subject: [PATCH 2/3] target/ppc: Add stub implementation of the PSSCR
76daa3
MIME-Version: 1.0
76daa3
Content-Type: text/plain; charset=UTF-8
76daa3
Content-Transfer-Encoding: 8bit
76daa3
76daa3
RH-Author: David Gibson <dgibson@redhat.com>
76daa3
Message-id: <20170811060909.31369-3-dgibson@redhat.com>
76daa3
Patchwork-id: 75934
76daa3
O-Subject: [RHEL-7.4-ALT qemu-kvm PATCH 2/2] target/ppc: Add stub implementation of the PSSCR
76daa3
Bugzilla: 1478822
76daa3
RH-Acked-by: Thomas Huth <thuth@redhat.com>
76daa3
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
76daa3
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
76daa3
76daa3
From: David Gibson <david@gibson.dropbear.id.au>
76daa3
76daa3
The PSSCR register added in POWER9 controls certain power saving mode
76daa3
behaviours.  Mostly, it's not relevant to TCG, however because qemu
76daa3
doesn't know about it yet, it doesn't synchronize the state with KVM,
76daa3
and thus it doesn't get migrated.
76daa3
76daa3
To fix that, this adds a minimal stub implementation of the register.
76daa3
This isn't complete, even to the extent that an implementation is
76daa3
possible in TCG, just enough to get migration working.  We need to
76daa3
come back later and at least properly filter the various fields in the
76daa3
register based on privilege level.
76daa3
76daa3
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
76daa3
Reviewed-by: Cédric Le Goater <clg@kaod.org>
76daa3
Reviewed-by: Greg Kurz <groug@kaod.org>
76daa3
Reviewed-by: Thomas Huth <thuth@redhat.com>
76daa3
(cherry picked from commit b8af5b2d5f67b0e1b274f8532f42a47bfe46ea3b)
76daa3
76daa3
Signed-off-by: David Gibson <dgibson@redhat.com>
76daa3
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
76daa3
---
76daa3
 target/ppc/cpu.h            | 1 +
76daa3
 target/ppc/translate_init.c | 5 +++++
76daa3
 2 files changed, 6 insertions(+)
76daa3
76daa3
diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
76daa3
index a2d7b6f..5fc8eca 100644
76daa3
--- a/target/ppc/cpu.h
76daa3
+++ b/target/ppc/cpu.h
76daa3
@@ -1764,6 +1764,7 @@ int ppc_compat_max_threads(PowerPCCPU *cpu);
76daa3
 #define SPR_IC                (0x350)
76daa3
 #define SPR_VTB               (0x351)
76daa3
 #define SPR_MMCRC             (0x353)
76daa3
+#define SPR_PSSCR             (0x357)
76daa3
 #define SPR_440_INV0          (0x370)
76daa3
 #define SPR_440_INV1          (0x371)
76daa3
 #define SPR_440_INV2          (0x372)
76daa3
diff --git a/target/ppc/translate_init.c b/target/ppc/translate_init.c
76daa3
index 624bc1c..968717d 100644
76daa3
--- a/target/ppc/translate_init.c
76daa3
+++ b/target/ppc/translate_init.c
76daa3
@@ -8842,6 +8842,11 @@ static void init_proc_POWER9(CPUPPCState *env)
76daa3
                      spr_read_generic, spr_write_generic,
76daa3
                      KVM_REG_PPC_TIDR, 0);
76daa3
 
76daa3
+    /* FIXME: Filter fields properly based on privilege level */
76daa3
+    spr_register_kvm_hv(env, SPR_PSSCR, "PSSCR", NULL, NULL, NULL, NULL,
76daa3
+                        spr_read_generic, spr_write_generic,
76daa3
+                        KVM_REG_PPC_PSSCR, 0);
76daa3
+
76daa3
     /* env variables */
76daa3
 #if !defined(CONFIG_USER_ONLY)
76daa3
     env->slb_nr = 32;
76daa3
-- 
76daa3
1.8.3.1
76daa3