diff options
| author | Thomas Richter <tmricht@linux.ibm.com> | 2025-11-05 15:38:53 +0100 |
|---|---|---|
| committer | Heiko Carstens <hca@linux.ibm.com> | 2025-11-14 11:30:06 +0100 |
| commit | 8f6116fd4940ad60adbfaca3525567b087054b5b (patch) | |
| tree | 55d1c28c6ab7d7f3916d7f23e92ce74dc71e586c | |
| parent | 74466e87e7fae1e5d746037a3d0484fd0afb03b2 (diff) | |
s390/pai_crypto: Add common pai_read() 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_read() to read counter values.
The function expects a PAI PMU specific read function as second
parameter.
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>
| -rw-r--r-- | arch/s390/kernel/perf_pai_crypto.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/arch/s390/kernel/perf_pai_crypto.c b/arch/s390/kernel/perf_pai_crypto.c index 59b18f86b8ae..4eb1a09c36bd 100644 --- a/arch/s390/kernel/perf_pai_crypto.c +++ b/arch/s390/kernel/perf_pai_crypto.c @@ -365,18 +365,23 @@ static int paicrypt_event_init(struct perf_event *event) return rc; } -static void paicrypt_read(struct perf_event *event) +static void pai_read(struct perf_event *event, + u64 (*fct)(struct perf_event *event)) { u64 prev, new, delta; prev = local64_read(&event->hw.prev_count); - new = paicrypt_getall(event); + new = fct(event); local64_set(&event->hw.prev_count, new); - delta = (prev <= new) ? new - prev - : (-1ULL - prev) + new + 1; /* overflow */ + delta = (prev <= new) ? new - prev : (-1ULL - prev) + new + 1; local64_add(delta, &event->count); } +static void paicrypt_read(struct perf_event *event) +{ + pai_read(event, paicrypt_getall); +} + static void paicrypt_start(struct perf_event *event, int flags) { struct pai_mapptr *mp = this_cpu_ptr(pai_root.mapptr); |
