s390/pai: rework paixxxx_getctr interface
authorThomas Richter <tmricht@linux.ibm.com>
Tue, 14 Nov 2023 09:53:22 +0000 (10:53 +0100)
committerAlexander Gordeev <agordeev@linux.ibm.com>
Fri, 12 Jan 2024 13:23:26 +0000 (14:23 +0100)
Simplify the interface for functions paicrypt_getctr() and
paiext_getctr(). Change the first parameter from a pointer to a
structure to a pointer to a structure member. The other members
of the structure are not needed.
No functional change.

Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Acked-by: Mete Durlu <meted@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
arch/s390/kernel/perf_pai_crypto.c
arch/s390/kernel/perf_pai_ext.c

index 39a91b00438a7f6ba48fb541d8f24b51070391d2..92156e14fc6f4767ae5cbc093c609ede3dcccaa1 100644 (file)
@@ -111,11 +111,11 @@ static void paicrypt_event_destroy(struct perf_event *event)
        mutex_unlock(&pai_reserve_mutex);
 }
 
-static u64 paicrypt_getctr(struct paicrypt_map *cpump, int nr, bool kernel)
+static u64 paicrypt_getctr(unsigned long *page, int nr, bool kernel)
 {
        if (kernel)
                nr += PAI_CRYPTO_MAXCTR;
-       return cpump->page[nr];
+       return page[nr];
 }
 
 /* Read the counter values. Return value from location in CMP. For event
@@ -129,13 +129,13 @@ static u64 paicrypt_getdata(struct perf_event *event, bool kernel)
        int i;
 
        if (event->attr.config != PAI_CRYPTO_BASE) {
-               return paicrypt_getctr(cpump,
+               return paicrypt_getctr(cpump->page,
                                       event->attr.config - PAI_CRYPTO_BASE,
                                       kernel);
        }
 
        for (i = 1; i <= paicrypt_cnt; i++) {
-               u64 val = paicrypt_getctr(cpump, i, kernel);
+               u64 val = paicrypt_getctr(cpump->page, i, kernel);
 
                if (!val)
                        continue;
@@ -383,9 +383,9 @@ static size_t paicrypt_copy(struct pai_userdata *userdata,
                u64 val = 0;
 
                if (!exclude_kernel)
-                       val += paicrypt_getctr(cpump, i, true);
+                       val += paicrypt_getctr(cpump->page, i, true);
                if (!exclude_user)
-                       val += paicrypt_getctr(cpump, i, false);
+                       val += paicrypt_getctr(cpump->page, i, false);
                if (val) {
                        userdata[outidx].num = i;
                        userdata[outidx].value = val;
index e7013a2e8960508566083cfa9344e6daa60638fb..9452205e6febc6a1d38819cda82aff405647d6c3 100644 (file)
@@ -276,9 +276,9 @@ static int paiext_event_init(struct perf_event *event)
        return 0;
 }
 
-static u64 paiext_getctr(struct paiext_map *cpump, int nr)
+static u64 paiext_getctr(unsigned long *area, int nr)
 {
-       return cpump->area[nr];
+       return area[nr];
 }
 
 /* Read the counter values. Return value from location in buffer. For event
@@ -292,10 +292,11 @@ static u64 paiext_getdata(struct perf_event *event)
        int i;
 
        if (event->attr.config != PAI_NNPA_BASE)
-               return paiext_getctr(cpump, event->attr.config - PAI_NNPA_BASE);
+               return paiext_getctr(cpump->area,
+                                    event->attr.config - PAI_NNPA_BASE);
 
        for (i = 1; i <= paiext_cnt; i++)
-               sum += paiext_getctr(cpump, i);
+               sum += paiext_getctr(cpump->area, i);
 
        return sum;
 }
@@ -392,7 +393,7 @@ static size_t paiext_copy(struct paiext_map *cpump)
        int i, outidx = 0;
 
        for (i = 1; i <= paiext_cnt; i++) {
-               u64 val = paiext_getctr(cpump, i);
+               u64 val = paiext_getctr(cpump->area, i);
 
                if (val) {
                        userdata[outidx].num = i;