]> www.infradead.org Git - users/jedix/linux-maple.git/commit
powerpc/kvm-hv-pmu: Add perf-events for Hostwide counters
authorVaibhav Jain <vaibhav@linux.ibm.com>
Wed, 16 Apr 2025 16:27:36 +0000 (21:57 +0530)
committerMadhavan Srinivasan <maddy@linux.ibm.com>
Wed, 16 Apr 2025 16:46:10 +0000 (22:16 +0530)
commit02a1324b08af3239dce5bcf52e09153e1f8a4bbd
tree79eb86505a289de8c73377f038a3b333f5f1862e
parentf0c9c49c50678385c406e805e377965e853828fa
powerpc/kvm-hv-pmu: Add perf-events for Hostwide counters

Update 'kvm-hv-pmu.c' to add five new perf-events mapped to the five
Hostwide counters. Since these newly introduced perf events are at system
wide scope and can be read from any L1-Lpar CPU, 'kvmppc_pmu' scope and
capabilities are updated appropriately.

Also introduce two new helpers. First is kvmppc_update_l0_stats() that uses
the infrastructure introduced in previous patches to issues the
H_GUEST_GET_STATE hcall L0-PowerVM to fetch guest-state-buffer holding the
latest values of these counters which is then parsed and 'l0_stats'
variable updated.

Second helper is kvmppc_pmu_event_update() which is called from
'kvmppv_pmu' callbacks and uses kvmppc_update_l0_stats() to update
'l0_stats' and the update the 'struct perf_event's event-counter.

Some minor updates to kvmppc_pmu_{add, del, read}() to remove some debug
scaffolding code.

Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
Reviewed-by: Athira Rajeev <atrajeev@linux.ibm.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20250416162740.93143-7-vaibhav@linux.ibm.com
arch/powerpc/perf/kvm-hv-pmu.c