mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 00:53:34 +02:00
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>
This commit is contained in:
parent
74466e87e7
commit
8f6116fd49
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user