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