s390/pai: rework paixxxx_getctr interface

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>
This commit is contained in:
Thomas Richter 2023-11-14 10:53:22 +01:00 committed by Alexander Gordeev
parent ba69655fff
commit 8d0e8a8aa3
2 changed files with 12 additions and 11 deletions

View 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;

View 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;