qemu/target/ppc
Nicholas Piggin 6494d2c1fd target/ppc: Fix PMU hflags calculation
Some of the PMU hflags bits can go out of synch, for example a store to
MMCR0 with PMCjCE=1 fails to update hflags correctly and results in
hflags mismatch:

  qemu: fatal: TCG hflags mismatch (current:0x2408003d rebuilt:0x240a003d)

This can be reproduced by running perf on a recent machine.

Some of the fragility here is the duplication of PMU hflags calculations.
This change consolidates that in a single place to update pmu-related
hflags, to be called after a well defined state changes.

The post-load PMU update is pulled out of the MSR update because it does
not depend on the MSR value.

Fixes: 8b3d1c49a9 ("target/ppc: Add new PMC HFLAGS")
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Message-Id: <20230530130447.372617-1-npiggin@gmail.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2023-06-10 10:19:24 -03:00
..
translate target/ppc: Inline gen_icount_io_start() 2023-06-05 12:04:29 -07:00
arch_dump.c dump: Replace opaque DumpState pointer with a typed one 2022-10-06 19:30:43 +04:00
compat.c powerpc tcg: Fix Lesser GPL version number 2020-11-15 16:38:50 +01:00
cpu_init.c target/ppc: Fix PMU hflags calculation 2023-06-10 10:19:24 -03:00
cpu-models.c target/ppc: Add POWER9 DD2.2 model 2023-05-28 13:25:11 -03:00
cpu-models.h target/ppc: Add POWER9 DD2.2 model 2023-05-28 13:25:11 -03:00
cpu-param.h target/ppc: Remove NB_MMU_MODES define 2023-03-13 06:44:37 -07:00
cpu-qom.h target/ppc: Restrict 'qapi-commands-machine.h' to system emulation 2023-03-02 07:51:33 +01:00
cpu.c ppc: spapr: cleanup cr get/set with helpers. 2023-05-05 12:34:22 -03:00
cpu.h tcg: Remove NO_CPU_IO_DEFS 2023-06-05 12:04:29 -07:00
dfp_helper.c target/ppc: Fix warning with clang-15 2023-02-27 22:29:01 +01:00
excp_helper.c target/ppc: Fix nested-hv HEAI delivery 2023-06-10 10:19:24 -03:00
fpu_helper.c target/ppc: Merge COMPUTE_CLASS and COMPUTE_FPRF 2023-05-28 07:13:54 -03:00
gdbstub.c ppc: spapr: cleanup cr get/set with helpers. 2023-05-05 12:34:22 -03:00
helper_regs.c target/ppc: Fix PMU hflags calculation 2023-06-10 10:19:24 -03:00
helper_regs.h target/ppc: Fix PMU hflags calculation 2023-06-10 10:19:24 -03:00
helper.h target/ppc: Use tcg_gen_qemu_{ld,st}_i128 for LQARX, LQ, STQ 2023-05-23 16:51:19 -07:00
insn32.decode target/ppc: Fix fallback to MFSS for MFFS* instructions on pre 3.0 ISAs 2023-05-27 08:25:19 -03:00
insn64.decode target/ppc: Implemented [pm]xvbf16ger2* 2022-05-26 17:11:33 -03:00
int_helper.c target/ppc: Move VABSDU[BHW] to decodetree and use gvec 2022-10-28 13:15:22 -03:00
internal.h target/ppc/internal: Restrict MMU declarations to sysemu 2023-02-27 22:29:01 +01:00
Kconfig meson: Introduce target-specific Kconfig 2021-07-09 18:21:34 +02:00
kvm_ppc.h spapr: Add SPAPR_CAP_AIL_MODE_3 for AIL mode 3 support for H_SET_MODE hcall 2023-05-28 07:13:54 -03:00
kvm-stub.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
kvm.c spapr: Add SPAPR_CAP_AIL_MODE_3 for AIL mode 3 support for H_SET_MODE hcall 2023-05-28 07:13:54 -03:00
machine.c target/ppc: Fix PMU hflags calculation 2023-06-10 10:19:24 -03:00
mem_helper.c target/ppc: Use tcg_gen_qemu_{ld,st}_i128 for LQARX, LQ, STQ 2023-05-23 16:51:19 -07:00
meson.build target/ppc: Restrict 'qapi-commands-machine.h' to system emulation 2023-03-02 07:51:33 +01:00
misc_helper.c target/ppc: Fix width of some 32-bit SPRs 2023-05-27 08:25:19 -03:00
mmu_common.c bulk: Rename TARGET_FMT_plx -> HWADDR_FMT_plx 2023-01-18 11:14:34 +01:00
mmu_helper.c bulk: Rename TARGET_FMT_plx -> HWADDR_FMT_plx 2023-01-18 11:14:34 +01:00
mmu-book3s-v3.c ppc: Check partition and process table alignment 2022-07-18 13:59:43 -03:00
mmu-book3s-v3.h target/ppc: Implement ISA 3.00 tlbie[l] 2022-07-18 13:59:43 -03:00
mmu-books.h target/ppc: introduce mmu-books.h 2021-07-09 10:38:19 +10:00
mmu-hash32.c bulk: Rename TARGET_FMT_plx -> HWADDR_FMT_plx 2023-01-18 11:14:34 +01:00
mmu-hash32.h target/ppc: Remove PowerPC 601 CPUs 2022-02-09 09:08:55 +01:00
mmu-hash64.c bulk: Rename TARGET_FMT_plx -> HWADDR_FMT_plx 2023-01-18 11:14:34 +01:00
mmu-hash64.h target/ppc: fix Hash64 MMU update of PTE bit R 2021-11-29 21:00:08 +01:00
mmu-radix64.c target/ppc: Fix regression in Radix MMU 2022-10-29 06:34:52 -03:00
mmu-radix64.h target/ppc: Check effective address validity 2022-01-04 07:55:34 +01:00
power8-pmu-regs.c.inc target/ppc: Inline gen_icount_io_start() 2023-06-05 12:04:29 -07:00
power8-pmu.c target/ppc: Fix PMU hflags calculation 2023-06-10 10:19:24 -03:00
power8-pmu.h target/ppc: Fix PMU hflags calculation 2023-06-10 10:19:24 -03:00
ppc-qmp-cmds.c ppc: spapr: cleanup cr get/set with helpers. 2023-05-05 12:34:22 -03:00
spr_common.h target/ppc: Fix width of some 32-bit SPRs 2023-05-27 08:25:19 -03:00
tcg-stub.c target/ppc: created tcg-stub.c file 2021-06-03 13:22:06 +10:00
timebase_helper.c target/ppc: fix exception error code in helper_{load, store}_dcr 2022-07-18 13:59:43 -03:00
trace-events target/ppc: Improve KVM hypercall trace 2022-04-20 18:00:30 -03:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00
translate.c target/ppc: Inline gen_icount_io_start() 2023-06-05 12:04:29 -07:00
user_only_helper.c target/ppc: Implement ppc_cpu_record_sigsegv 2021-11-02 07:00:52 -04:00