]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
s390/pai_crypto: Rename paicrypt_getdata() to pai_getdata()
authorThomas Richter <tmricht@linux.ibm.com>
Wed, 5 Nov 2025 14:38:49 +0000 (15:38 +0100)
committerHeiko Carstens <hca@linux.ibm.com>
Fri, 14 Nov 2025 10:30:05 +0000 (11:30 +0100)
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 <tmricht@linux.ibm.com>
Reviewed-by: Jan Polensky <japo@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/kernel/perf_pai_crypto.c

index 4b4c22bf61718fc6bc7fff8435f46e8d378a25ee..8b3f6c624e818a0759837c5e8434f1f323f28e3e 100644 (file)
@@ -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;
 }