target/ppc: enable PMU counter overflow with cycle events
commit1474ba6d100179c248fed6c67756814a6fa89432
authorDaniel Henrique Barboza <danielhb413@gmail.com>
Fri, 17 Dec 2021 16:57:18 +0000 (17 17:57 +0100)
committerCédric Le Goater <clg@kaod.org>
Fri, 17 Dec 2021 16:57:18 +0000 (17 17:57 +0100)
treea2b8fd65eb3d47243bf6fc8c36a4a2669e577b53
parenta6f91249e064a2ee935c900529b03f949ad89e6c
target/ppc: enable PMU counter overflow with cycle events

The PowerISA v3.1 defines that if the proper bits are set (MMCR0_PMC1CE
for PMC1 and MMCR0_PMCjCE for the remaining PMCs), counter negative
conditions are enabled. This means that if the counter value overflows
(i.e. exceeds 0x80000000) a performance monitor alert will occur. This alert
can trigger an event-based exception (to be implemented in the next patches)
if the MMCR0_EBE bit is set.

For now, overflowing the counter when the PMC is counting cycles will
just trigger a performance monitor alert. This is done by starting the
overflow timer to expire in the moment the overflow would be occuring. The
timer will call fire_PMC_interrupt() (via cpu_ppc_pmu_timer_cb) which will
trigger the PMU alert and, if the conditions are met, an EBB exception.

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Message-Id: <20211201151734.654994-6-danielhb413@gmail.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
target/ppc/cpu.h
target/ppc/power8-pmu.c