mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 00:53:34 +02:00
s390/pai_crypto: Add common pai_start() 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_start() to the event on a CPU. The function expects a PAI PMU specific read function as second parameter to read out the start value for an event. 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
8f6116fd49
commit
6fe66b2157
|
|
@ -382,17 +382,20 @@ static void paicrypt_read(struct perf_event *event)
|
|||
pai_read(event, paicrypt_getall);
|
||||
}
|
||||
|
||||
static void paicrypt_start(struct perf_event *event, int flags)
|
||||
static void pai_start(struct perf_event *event, int flags,
|
||||
u64 (*fct)(struct perf_event *event))
|
||||
{
|
||||
int idx = PAI_PMU_IDX(event);
|
||||
struct pai_pmu *pp = &pai_pmu[idx];
|
||||
struct pai_mapptr *mp = this_cpu_ptr(pai_root.mapptr);
|
||||
struct pai_map *cpump = mp->mapptr;
|
||||
u64 sum;
|
||||
|
||||
if (!event->attr.sample_period) { /* Counting */
|
||||
sum = paicrypt_getall(event); /* Get current value */
|
||||
sum = fct(event); /* Get current value */
|
||||
local64_set(&event->hw.prev_count, sum);
|
||||
} else { /* Sampling */
|
||||
memcpy((void *)PAI_SAVE_AREA(event), cpump->area, PAGE_SIZE);
|
||||
memcpy((void *)PAI_SAVE_AREA(event), cpump->area, pp->area_size);
|
||||
/* Enable context switch callback for system-wide sampling */
|
||||
if (!(event->attach_state & PERF_ATTACH_TASK)) {
|
||||
list_add_tail(PAI_SWLIST(event), &cpump->syswide_list);
|
||||
|
|
@ -403,6 +406,11 @@ static void paicrypt_start(struct perf_event *event, int flags)
|
|||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
struct pai_mapptr *mp = this_cpu_ptr(pai_root.mapptr);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user