diff options
author | Michael Ellerman <mpe@ellerman.id.au> | 2014-07-23 07:12:37 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2014-07-28 00:30:47 -0400 |
commit | 8abd818fc76705065f3699a753ad2df594dafe86 (patch) | |
tree | 637f4dd5007249d03f8ce82b7ccf582646a1736c | |
parent | 79a4cb28a07c4e24103d00741a3dc2618532efe6 (diff) |
powerpc/perf: Pass the struct perf_events down to compute_mmcr()
To support per-event exclude settings on Power8 we need access to the
struct perf_events in compute_mmcr().
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r-- | arch/powerpc/include/asm/perf_event_server.h | 5 | ||||
-rw-r--r-- | arch/powerpc/perf/core-book3s.c | 2 | ||||
-rw-r--r-- | arch/powerpc/perf/mpc7450-pmu.c | 5 | ||||
-rw-r--r-- | arch/powerpc/perf/power4-pmu.c | 2 | ||||
-rw-r--r-- | arch/powerpc/perf/power5+-pmu.c | 2 | ||||
-rw-r--r-- | arch/powerpc/perf/power5-pmu.c | 2 | ||||
-rw-r--r-- | arch/powerpc/perf/power6-pmu.c | 2 | ||||
-rw-r--r-- | arch/powerpc/perf/power7-pmu.c | 2 | ||||
-rw-r--r-- | arch/powerpc/perf/power8-pmu.c | 3 | ||||
-rw-r--r-- | arch/powerpc/perf/ppc970-pmu.c | 2 |
10 files changed, 16 insertions, 11 deletions
diff --git a/arch/powerpc/include/asm/perf_event_server.h b/arch/powerpc/include/asm/perf_event_server.h index b3e936027b26..814622146d5a 100644 --- a/arch/powerpc/include/asm/perf_event_server.h +++ b/arch/powerpc/include/asm/perf_event_server.h | |||
@@ -19,6 +19,8 @@ | |||
19 | #define MAX_EVENT_ALTERNATIVES 8 | 19 | #define MAX_EVENT_ALTERNATIVES 8 |
20 | #define MAX_LIMITED_HWCOUNTERS 2 | 20 | #define MAX_LIMITED_HWCOUNTERS 2 |
21 | 21 | ||
22 | struct perf_event; | ||
23 | |||
22 | /* | 24 | /* |
23 | * This struct provides the constants and functions needed to | 25 | * This struct provides the constants and functions needed to |
24 | * describe the PMU on a particular POWER-family CPU. | 26 | * describe the PMU on a particular POWER-family CPU. |
@@ -30,7 +32,8 @@ struct power_pmu { | |||
30 | unsigned long add_fields; | 32 | unsigned long add_fields; |
31 | unsigned long test_adder; | 33 | unsigned long test_adder; |
32 | int (*compute_mmcr)(u64 events[], int n_ev, | 34 | int (*compute_mmcr)(u64 events[], int n_ev, |
33 | unsigned int hwc[], unsigned long mmcr[]); | 35 | unsigned int hwc[], unsigned long mmcr[], |
36 | struct perf_event *pevents[]); | ||
34 | int (*get_constraint)(u64 event_id, unsigned long *mskp, | 37 | int (*get_constraint)(u64 event_id, unsigned long *mskp, |
35 | unsigned long *valp); | 38 | unsigned long *valp); |
36 | int (*get_alternatives)(u64 event_id, unsigned int flags, | 39 | int (*get_alternatives)(u64 event_id, unsigned int flags, |
diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c index f82c0973866f..01b30238d7d1 100644 --- a/arch/powerpc/perf/core-book3s.c +++ b/arch/powerpc/perf/core-book3s.c | |||
@@ -1224,7 +1224,7 @@ static void power_pmu_enable(struct pmu *pmu) | |||
1224 | memset(cpuhw->mmcr, 0, sizeof(cpuhw->mmcr)); | 1224 | memset(cpuhw->mmcr, 0, sizeof(cpuhw->mmcr)); |
1225 | 1225 | ||
1226 | if (ppmu->compute_mmcr(cpuhw->events, cpuhw->n_events, hwc_index, | 1226 | if (ppmu->compute_mmcr(cpuhw->events, cpuhw->n_events, hwc_index, |
1227 | cpuhw->mmcr)) { | 1227 | cpuhw->mmcr, cpuhw->event)) { |
1228 | /* shouldn't ever get here */ | 1228 | /* shouldn't ever get here */ |
1229 | printk(KERN_ERR "oops compute_mmcr failed\n"); | 1229 | printk(KERN_ERR "oops compute_mmcr failed\n"); |
1230 | goto out; | 1230 | goto out; |
diff --git a/arch/powerpc/perf/mpc7450-pmu.c b/arch/powerpc/perf/mpc7450-pmu.c index fe21b515ca44..d115c5635bf3 100644 --- a/arch/powerpc/perf/mpc7450-pmu.c +++ b/arch/powerpc/perf/mpc7450-pmu.c | |||
@@ -260,8 +260,9 @@ static const u32 pmcsel_mask[N_COUNTER] = { | |||
260 | /* | 260 | /* |
261 | * Compute MMCR0/1/2 values for a set of events. | 261 | * Compute MMCR0/1/2 values for a set of events. |
262 | */ | 262 | */ |
263 | static int mpc7450_compute_mmcr(u64 event[], int n_ev, | 263 | static int mpc7450_compute_mmcr(u64 event[], int n_ev, unsigned int hwc[], |
264 | unsigned int hwc[], unsigned long mmcr[]) | 264 | unsigned long mmcr[], |
265 | struct perf_event *pevents[]) | ||
265 | { | 266 | { |
266 | u8 event_index[N_CLASSES][N_COUNTER]; | 267 | u8 event_index[N_CLASSES][N_COUNTER]; |
267 | int n_classevent[N_CLASSES]; | 268 | int n_classevent[N_CLASSES]; |
diff --git a/arch/powerpc/perf/power4-pmu.c b/arch/powerpc/perf/power4-pmu.c index 9103a1de864d..ce6072fa481b 100644 --- a/arch/powerpc/perf/power4-pmu.c +++ b/arch/powerpc/perf/power4-pmu.c | |||
@@ -356,7 +356,7 @@ static int p4_get_alternatives(u64 event, unsigned int flags, u64 alt[]) | |||
356 | } | 356 | } |
357 | 357 | ||
358 | static int p4_compute_mmcr(u64 event[], int n_ev, | 358 | static int p4_compute_mmcr(u64 event[], int n_ev, |
359 | unsigned int hwc[], unsigned long mmcr[]) | 359 | unsigned int hwc[], unsigned long mmcr[], struct perf_event *pevents[]) |
360 | { | 360 | { |
361 | unsigned long mmcr0 = 0, mmcr1 = 0, mmcra = 0; | 361 | unsigned long mmcr0 = 0, mmcr1 = 0, mmcra = 0; |
362 | unsigned int pmc, unit, byte, psel, lower; | 362 | unsigned int pmc, unit, byte, psel, lower; |
diff --git a/arch/powerpc/perf/power5+-pmu.c b/arch/powerpc/perf/power5+-pmu.c index b03b6dc0172d..0526dac66007 100644 --- a/arch/powerpc/perf/power5+-pmu.c +++ b/arch/powerpc/perf/power5+-pmu.c | |||
@@ -452,7 +452,7 @@ static int power5p_marked_instr_event(u64 event) | |||
452 | } | 452 | } |
453 | 453 | ||
454 | static int power5p_compute_mmcr(u64 event[], int n_ev, | 454 | static int power5p_compute_mmcr(u64 event[], int n_ev, |
455 | unsigned int hwc[], unsigned long mmcr[]) | 455 | unsigned int hwc[], unsigned long mmcr[], struct perf_event *pevents[]) |
456 | { | 456 | { |
457 | unsigned long mmcr1 = 0; | 457 | unsigned long mmcr1 = 0; |
458 | unsigned long mmcra = 0; | 458 | unsigned long mmcra = 0; |
diff --git a/arch/powerpc/perf/power5-pmu.c b/arch/powerpc/perf/power5-pmu.c index 1e8ce423c3af..4dc99f9f7962 100644 --- a/arch/powerpc/perf/power5-pmu.c +++ b/arch/powerpc/perf/power5-pmu.c | |||
@@ -383,7 +383,7 @@ static int power5_marked_instr_event(u64 event) | |||
383 | } | 383 | } |
384 | 384 | ||
385 | static int power5_compute_mmcr(u64 event[], int n_ev, | 385 | static int power5_compute_mmcr(u64 event[], int n_ev, |
386 | unsigned int hwc[], unsigned long mmcr[]) | 386 | unsigned int hwc[], unsigned long mmcr[], struct perf_event *pevents[]) |
387 | { | 387 | { |
388 | unsigned long mmcr1 = 0; | 388 | unsigned long mmcr1 = 0; |
389 | unsigned long mmcra = MMCRA_SDAR_DCACHE_MISS | MMCRA_SDAR_ERAT_MISS; | 389 | unsigned long mmcra = MMCRA_SDAR_DCACHE_MISS | MMCRA_SDAR_ERAT_MISS; |
diff --git a/arch/powerpc/perf/power6-pmu.c b/arch/powerpc/perf/power6-pmu.c index 31128e086fed..9c9d646b68a1 100644 --- a/arch/powerpc/perf/power6-pmu.c +++ b/arch/powerpc/perf/power6-pmu.c | |||
@@ -175,7 +175,7 @@ static int power6_marked_instr_event(u64 event) | |||
175 | * Assign PMC numbers and compute MMCR1 value for a set of events | 175 | * Assign PMC numbers and compute MMCR1 value for a set of events |
176 | */ | 176 | */ |
177 | static int p6_compute_mmcr(u64 event[], int n_ev, | 177 | static int p6_compute_mmcr(u64 event[], int n_ev, |
178 | unsigned int hwc[], unsigned long mmcr[]) | 178 | unsigned int hwc[], unsigned long mmcr[], struct perf_event *pevents[]) |
179 | { | 179 | { |
180 | unsigned long mmcr1 = 0; | 180 | unsigned long mmcr1 = 0; |
181 | unsigned long mmcra = MMCRA_SDAR_DCACHE_MISS | MMCRA_SDAR_ERAT_MISS; | 181 | unsigned long mmcra = MMCRA_SDAR_DCACHE_MISS | MMCRA_SDAR_ERAT_MISS; |
diff --git a/arch/powerpc/perf/power7-pmu.c b/arch/powerpc/perf/power7-pmu.c index 56c67bca2f75..5b62f2389290 100644 --- a/arch/powerpc/perf/power7-pmu.c +++ b/arch/powerpc/perf/power7-pmu.c | |||
@@ -245,7 +245,7 @@ static int power7_marked_instr_event(u64 event) | |||
245 | } | 245 | } |
246 | 246 | ||
247 | static int power7_compute_mmcr(u64 event[], int n_ev, | 247 | static int power7_compute_mmcr(u64 event[], int n_ev, |
248 | unsigned int hwc[], unsigned long mmcr[]) | 248 | unsigned int hwc[], unsigned long mmcr[], struct perf_event *pevents[]) |
249 | { | 249 | { |
250 | unsigned long mmcr1 = 0; | 250 | unsigned long mmcr1 = 0; |
251 | unsigned long mmcra = MMCRA_SDAR_DCACHE_MISS | MMCRA_SDAR_ERAT_MISS; | 251 | unsigned long mmcra = MMCRA_SDAR_DCACHE_MISS | MMCRA_SDAR_ERAT_MISS; |
diff --git a/arch/powerpc/perf/power8-pmu.c b/arch/powerpc/perf/power8-pmu.c index 639cd9156585..19bbddf495dd 100644 --- a/arch/powerpc/perf/power8-pmu.c +++ b/arch/powerpc/perf/power8-pmu.c | |||
@@ -393,7 +393,8 @@ static int power8_get_constraint(u64 event, unsigned long *maskp, unsigned long | |||
393 | } | 393 | } |
394 | 394 | ||
395 | static int power8_compute_mmcr(u64 event[], int n_ev, | 395 | static int power8_compute_mmcr(u64 event[], int n_ev, |
396 | unsigned int hwc[], unsigned long mmcr[]) | 396 | unsigned int hwc[], unsigned long mmcr[], |
397 | struct perf_event *pevents[]) | ||
397 | { | 398 | { |
398 | unsigned long mmcra, mmcr1, unit, combine, psel, cache, val; | 399 | unsigned long mmcra, mmcr1, unit, combine, psel, cache, val; |
399 | unsigned int pmc, pmc_inuse; | 400 | unsigned int pmc, pmc_inuse; |
diff --git a/arch/powerpc/perf/ppc970-pmu.c b/arch/powerpc/perf/ppc970-pmu.c index 20139ceeacf6..8b6a8a36fa38 100644 --- a/arch/powerpc/perf/ppc970-pmu.c +++ b/arch/powerpc/perf/ppc970-pmu.c | |||
@@ -257,7 +257,7 @@ static int p970_get_alternatives(u64 event, unsigned int flags, u64 alt[]) | |||
257 | } | 257 | } |
258 | 258 | ||
259 | static int p970_compute_mmcr(u64 event[], int n_ev, | 259 | static int p970_compute_mmcr(u64 event[], int n_ev, |
260 | unsigned int hwc[], unsigned long mmcr[]) | 260 | unsigned int hwc[], unsigned long mmcr[], struct perf_event *pevents[]) |
261 | { | 261 | { |
262 | unsigned long mmcr0 = 0, mmcr1 = 0, mmcra = 0; | 262 | unsigned long mmcr0 = 0, mmcr1 = 0, mmcra = 0; |
263 | unsigned int pmc, unit, byte, psel; | 263 | unsigned int pmc, unit, byte, psel; |