s390/pai_crypto: Add common pai_add() function

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.

Add a common usable function pai_add() for the event on a CPU.
Call this common pai_add() from paicrypt_add().

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>
This commit is contained in:
Thomas Richter 2025-11-05 15:38:55 +01:00 committed by Heiko Carstens
parent 6fe66b2157
commit a65a4d7e80

View File

@ -411,10 +411,11 @@ static void paicrypt_start(struct perf_event *event, int flags)
pai_start(event, flags, paicrypt_getall);
}
static int paicrypt_add(struct perf_event *event, int flags)
static int pai_add(struct perf_event *event, int flags)
{
struct pai_mapptr *mp = this_cpu_ptr(pai_root.mapptr);
struct pai_map *cpump = mp->mapptr;
int idx = PAI_PMU_IDX(event);
unsigned long ccd;
if (++cpump->active_events == 1) {
@ -423,11 +424,16 @@ static int paicrypt_add(struct perf_event *event, int flags)
local_ctl_set_bit(0, CR0_CRYPTOGRAPHY_COUNTER_BIT);
}
if (flags & PERF_EF_START)
paicrypt_start(event, PERF_EF_RELOAD);
pai_pmu[idx].pmu->start(event, PERF_EF_RELOAD);
event->hw.state = 0;
return 0;
}
static int paicrypt_add(struct perf_event *event, int flags)
{
return pai_add(event, flags);
}
static void pai_have_sample(struct perf_event *, struct pai_map *);
static void paicrypt_stop(struct perf_event *event, int flags)
{