Skip to content

Commit a65a4d7

Browse files
Thomas Richterhcahca
authored andcommitted
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>
1 parent 6fe66b2 commit a65a4d7

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

arch/s390/kernel/perf_pai_crypto.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,10 +411,11 @@ static void paicrypt_start(struct perf_event *event, int flags)
411411
pai_start(event, flags, paicrypt_getall);
412412
}
413413

414-
static int paicrypt_add(struct perf_event *event, int flags)
414+
static int pai_add(struct perf_event *event, int flags)
415415
{
416416
struct pai_mapptr *mp = this_cpu_ptr(pai_root.mapptr);
417417
struct pai_map *cpump = mp->mapptr;
418+
int idx = PAI_PMU_IDX(event);
418419
unsigned long ccd;
419420

420421
if (++cpump->active_events == 1) {
@@ -423,11 +424,16 @@ static int paicrypt_add(struct perf_event *event, int flags)
423424
local_ctl_set_bit(0, CR0_CRYPTOGRAPHY_COUNTER_BIT);
424425
}
425426
if (flags & PERF_EF_START)
426-
paicrypt_start(event, PERF_EF_RELOAD);
427+
pai_pmu[idx].pmu->start(event, PERF_EF_RELOAD);
427428
event->hw.state = 0;
428429
return 0;
429430
}
430431

432+
static int paicrypt_add(struct perf_event *event, int flags)
433+
{
434+
return pai_add(event, flags);
435+
}
436+
431437
static void pai_have_sample(struct perf_event *, struct pai_map *);
432438
static void paicrypt_stop(struct perf_event *event, int flags)
433439
{

0 commit comments

Comments
 (0)