Commit 8d0e8a8a authored by Thomas Richter's avatar Thomas Richter Committed by Alexander Gordeev

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: default avatarThomas Richter <tmricht@linux.ibm.com>
Acked-by: default avatarMete Durlu <meted@linux.ibm.com>
Signed-off-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
parent ba69655f
...@@ -111,11 +111,11 @@ static void paicrypt_event_destroy(struct perf_event *event) ...@@ -111,11 +111,11 @@ static void paicrypt_event_destroy(struct perf_event *event)
mutex_unlock(&pai_reserve_mutex); 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) if (kernel)
nr += PAI_CRYPTO_MAXCTR; nr += PAI_CRYPTO_MAXCTR;
return cpump->page[nr]; return page[nr];
} }
/* Read the counter values. Return value from location in CMP. For event /* 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) ...@@ -129,13 +129,13 @@ static u64 paicrypt_getdata(struct perf_event *event, bool kernel)
int i; int i;
if (event->attr.config != PAI_CRYPTO_BASE) { if (event->attr.config != PAI_CRYPTO_BASE) {
return paicrypt_getctr(cpump, return paicrypt_getctr(cpump->page,
event->attr.config - PAI_CRYPTO_BASE, event->attr.config - PAI_CRYPTO_BASE,
kernel); kernel);
} }
for (i = 1; i <= paicrypt_cnt; i++) { for (i = 1; i <= paicrypt_cnt; i++) {
u64 val = paicrypt_getctr(cpump, i, kernel); u64 val = paicrypt_getctr(cpump->page, i, kernel);
if (!val) if (!val)
continue; continue;
...@@ -383,9 +383,9 @@ static size_t paicrypt_copy(struct pai_userdata *userdata, ...@@ -383,9 +383,9 @@ static size_t paicrypt_copy(struct pai_userdata *userdata,
u64 val = 0; u64 val = 0;
if (!exclude_kernel) if (!exclude_kernel)
val += paicrypt_getctr(cpump, i, true); val += paicrypt_getctr(cpump->page, i, true);
if (!exclude_user) if (!exclude_user)
val += paicrypt_getctr(cpump, i, false); val += paicrypt_getctr(cpump->page, i, false);
if (val) { if (val) {
userdata[outidx].num = i; userdata[outidx].num = i;
userdata[outidx].value = val; userdata[outidx].value = val;
......
...@@ -276,9 +276,9 @@ static int paiext_event_init(struct perf_event *event) ...@@ -276,9 +276,9 @@ static int paiext_event_init(struct perf_event *event)
return 0; 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 /* Read the counter values. Return value from location in buffer. For event
...@@ -292,10 +292,11 @@ static u64 paiext_getdata(struct perf_event *event) ...@@ -292,10 +292,11 @@ static u64 paiext_getdata(struct perf_event *event)
int i; int i;
if (event->attr.config != PAI_NNPA_BASE) 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++) for (i = 1; i <= paiext_cnt; i++)
sum += paiext_getctr(cpump, i); sum += paiext_getctr(cpump->area, i);
return sum; return sum;
} }
...@@ -392,7 +393,7 @@ static size_t paiext_copy(struct paiext_map *cpump) ...@@ -392,7 +393,7 @@ static size_t paiext_copy(struct paiext_map *cpump)
int i, outidx = 0; int i, outidx = 0;
for (i = 1; i <= paiext_cnt; i++) { for (i = 1; i <= paiext_cnt; i++) {
u64 val = paiext_getctr(cpump, i); u64 val = paiext_getctr(cpump->area, i);
if (val) { if (val) {
userdata[outidx].num = i; userdata[outidx].num = i;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment