From 42cd0c82422775e34528b9d0df438e51150a4db9 Mon Sep 17 00:00:00 2001 From: Thomas Richter Date: Wed, 5 Nov 2025 15:38:49 +0100 Subject: [PATCH] s390/pai_crypto: Rename paicrypt_getdata() to pai_getdata() To support one common PAI PMU device driver which handles both PMUs pai_crypto and pai_ext, use a common naming scheme for structures and variables suitable for both device drivers. Rename paicrypt_getdata() to pai_getdata(). Use the PAI PMU characteristics in the pai_pmu table to determine the number of counters to be extracted. Signed-off-by: Thomas Richter Reviewed-by: Jan Polensky Signed-off-by: Heiko Carstens --- arch/s390/kernel/perf_pai_crypto.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/arch/s390/kernel/perf_pai_crypto.c b/arch/s390/kernel/perf_pai_crypto.c index 4b4c22bf61718..8b3f6c624e818 100644 --- a/arch/s390/kernel/perf_pai_crypto.c +++ b/arch/s390/kernel/perf_pai_crypto.c @@ -159,23 +159,25 @@ static u64 paicrypt_getctr(unsigned long *page, int nr, bool kernel) return page[nr]; } -/* Read the counter values. Return value from location in CMP. For event - * CRYPTO_ALL sum up all events. +/* Read the counter values. Return value from location in CMP. For base + * event xxx_ALL sum up all events. Returns counter value. */ -static u64 paicrypt_getdata(struct perf_event *event, bool kernel) +static u64 pai_getdata(struct perf_event *event, bool kernel) { struct pai_mapptr *mp = this_cpu_ptr(pai_root.mapptr); struct pai_map *cpump = mp->mapptr; + int idx = PAI_PMU_IDX(event); + struct pai_pmu *pp = &pai_pmu[idx]; + unsigned int i; u64 sum = 0; - int i; - if (event->attr.config != PAI_CRYPTO_BASE) { + if (event->attr.config != pp->base) { return paicrypt_getctr(cpump->area, - event->attr.config - PAI_CRYPTO_BASE, + event->attr.config - pp->base, kernel); } - for (i = 1; i <= paicrypt_cnt; i++) { + for (i = 1; i <= pp->num_avail; i++) { u64 val = paicrypt_getctr(cpump->area, i, kernel); if (!val) @@ -190,9 +192,9 @@ static u64 paicrypt_getall(struct perf_event *event) u64 sum = 0; if (!event->attr.exclude_kernel) - sum += paicrypt_getdata(event, true); + sum += pai_getdata(event, true); if (!event->attr.exclude_user) - sum += paicrypt_getdata(event, false); + sum += pai_getdata(event, false); return sum; } -- 2.47.3