]> git.ipfire.org Git - thirdparty/qemu.git/commit
target/ppc: Fix PMU hflags calculation
authorNicholas Piggin <npiggin@gmail.com>
Tue, 30 May 2023 13:04:47 +0000 (23:04 +1000)
committerMichael Tokarev <mjt@tls.msk.ru>
Sun, 11 Jun 2023 08:15:29 +0000 (11:15 +0300)
commite7d265340efb6b0ec7b1a4b8613de858e9deebb3
treea29bd1c3b49f636e69db2c1fded739fdbfb9d58a
parent1de8291e29cefd5949dc81bb9083daa389fda696
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: 8b3d1c49a9f0 ("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>
(cherry picked from commit 6494d2c1fd4ebc37b575130399a97a1fcfff1afc)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
target/ppc/cpu_init.c
target/ppc/helper_regs.c
target/ppc/helper_regs.h
target/ppc/machine.c
target/ppc/power8-pmu.c
target/ppc/power8-pmu.h