diff options
author | Mathieu Poirier <mathieu.poirier@linaro.org> | 2016-08-25 17:19:10 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-08-31 07:05:43 -0400 |
commit | 68905d73df5d51ba1318a0ad3f3c5a65c4e646a2 (patch) | |
tree | d262c0ae8279903506a10881222a83cde7c91e81 /drivers/hwtracing | |
parent | 3224dcc5a6ce919ddef2a387dcb4c47666480ed0 (diff) |
coresight: etm-perf: pass struct perf_event to source::enable/disable()
With this commit [1] address range filter information is now found
in the struct hw_perf_event::addr_filters. As such pass the event
itself to the coresight_source::enable/disable() functions so that
both event attribute and filter can be accessible for configuration.
[1] 'commit 375637bc5249 ("perf/core: Introduce address range filtering")'
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hwtracing')
-rw-r--r-- | drivers/hwtracing/coresight/coresight-etm-perf.c | 4 | ||||
-rw-r--r-- | drivers/hwtracing/coresight/coresight-etm3x.c | 14 | ||||
-rw-r--r-- | drivers/hwtracing/coresight/coresight-etm4x.c | 19 | ||||
-rw-r--r-- | drivers/hwtracing/coresight/coresight-stm.c | 7 | ||||
-rw-r--r-- | drivers/hwtracing/coresight/coresight.c | 2 |
5 files changed, 26 insertions, 20 deletions
diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c index 755125f7917f..e4754e8e6906 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c | |||
@@ -258,7 +258,7 @@ static void etm_event_start(struct perf_event *event, int flags) | |||
258 | event->hw.state = 0; | 258 | event->hw.state = 0; |
259 | 259 | ||
260 | /* Finally enable the tracer */ | 260 | /* Finally enable the tracer */ |
261 | if (source_ops(csdev)->enable(csdev, &event->attr, CS_MODE_PERF)) | 261 | if (source_ops(csdev)->enable(csdev, event, CS_MODE_PERF)) |
262 | goto fail_end_stop; | 262 | goto fail_end_stop; |
263 | 263 | ||
264 | out: | 264 | out: |
@@ -291,7 +291,7 @@ static void etm_event_stop(struct perf_event *event, int mode) | |||
291 | return; | 291 | return; |
292 | 292 | ||
293 | /* stop tracer */ | 293 | /* stop tracer */ |
294 | source_ops(csdev)->disable(csdev); | 294 | source_ops(csdev)->disable(csdev, event); |
295 | 295 | ||
296 | /* tell the core */ | 296 | /* tell the core */ |
297 | event->hw.state = PERF_HES_STOPPED; | 297 | event->hw.state = PERF_HES_STOPPED; |
diff --git a/drivers/hwtracing/coresight/coresight-etm3x.c b/drivers/hwtracing/coresight/coresight-etm3x.c index 326afe49251a..3fe368b23d15 100644 --- a/drivers/hwtracing/coresight/coresight-etm3x.c +++ b/drivers/hwtracing/coresight/coresight-etm3x.c | |||
@@ -311,9 +311,10 @@ void etm_config_trace_mode(struct etm_config *config) | |||
311 | #define ETM3X_SUPPORTED_OPTIONS (ETMCR_CYC_ACC | ETMCR_TIMESTAMP_EN) | 311 | #define ETM3X_SUPPORTED_OPTIONS (ETMCR_CYC_ACC | ETMCR_TIMESTAMP_EN) |
312 | 312 | ||
313 | static int etm_parse_event_config(struct etm_drvdata *drvdata, | 313 | static int etm_parse_event_config(struct etm_drvdata *drvdata, |
314 | struct perf_event_attr *attr) | 314 | struct perf_event *event) |
315 | { | 315 | { |
316 | struct etm_config *config = &drvdata->config; | 316 | struct etm_config *config = &drvdata->config; |
317 | struct perf_event_attr *attr = &event->attr; | ||
317 | 318 | ||
318 | if (!attr) | 319 | if (!attr) |
319 | return -EINVAL; | 320 | return -EINVAL; |
@@ -459,7 +460,7 @@ static int etm_trace_id(struct coresight_device *csdev) | |||
459 | } | 460 | } |
460 | 461 | ||
461 | static int etm_enable_perf(struct coresight_device *csdev, | 462 | static int etm_enable_perf(struct coresight_device *csdev, |
462 | struct perf_event_attr *attr) | 463 | struct perf_event *event) |
463 | { | 464 | { |
464 | struct etm_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); | 465 | struct etm_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); |
465 | 466 | ||
@@ -467,7 +468,7 @@ static int etm_enable_perf(struct coresight_device *csdev, | |||
467 | return -EINVAL; | 468 | return -EINVAL; |
468 | 469 | ||
469 | /* Configure the tracer based on the session's specifics */ | 470 | /* Configure the tracer based on the session's specifics */ |
470 | etm_parse_event_config(drvdata, attr); | 471 | etm_parse_event_config(drvdata, event); |
471 | /* And enable it */ | 472 | /* And enable it */ |
472 | etm_enable_hw(drvdata); | 473 | etm_enable_hw(drvdata); |
473 | 474 | ||
@@ -504,7 +505,7 @@ err: | |||
504 | } | 505 | } |
505 | 506 | ||
506 | static int etm_enable(struct coresight_device *csdev, | 507 | static int etm_enable(struct coresight_device *csdev, |
507 | struct perf_event_attr *attr, u32 mode) | 508 | struct perf_event *event, u32 mode) |
508 | { | 509 | { |
509 | int ret; | 510 | int ret; |
510 | u32 val; | 511 | u32 val; |
@@ -521,7 +522,7 @@ static int etm_enable(struct coresight_device *csdev, | |||
521 | ret = etm_enable_sysfs(csdev); | 522 | ret = etm_enable_sysfs(csdev); |
522 | break; | 523 | break; |
523 | case CS_MODE_PERF: | 524 | case CS_MODE_PERF: |
524 | ret = etm_enable_perf(csdev, attr); | 525 | ret = etm_enable_perf(csdev, event); |
525 | break; | 526 | break; |
526 | default: | 527 | default: |
527 | ret = -EINVAL; | 528 | ret = -EINVAL; |
@@ -601,7 +602,8 @@ static void etm_disable_sysfs(struct coresight_device *csdev) | |||
601 | dev_info(drvdata->dev, "ETM tracing disabled\n"); | 602 | dev_info(drvdata->dev, "ETM tracing disabled\n"); |
602 | } | 603 | } |
603 | 604 | ||
604 | static void etm_disable(struct coresight_device *csdev) | 605 | static void etm_disable(struct coresight_device *csdev, |
606 | struct perf_event *event) | ||
605 | { | 607 | { |
606 | u32 mode; | 608 | u32 mode; |
607 | struct etm_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); | 609 | struct etm_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); |
diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c index c8c7829f7046..b9e26d4f6b84 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x.c | |||
@@ -185,9 +185,10 @@ static void etm4_enable_hw(void *info) | |||
185 | } | 185 | } |
186 | 186 | ||
187 | static int etm4_parse_event_config(struct etmv4_drvdata *drvdata, | 187 | static int etm4_parse_event_config(struct etmv4_drvdata *drvdata, |
188 | struct perf_event_attr *attr) | 188 | struct perf_event *event) |
189 | { | 189 | { |
190 | struct etmv4_config *config = &drvdata->config; | 190 | struct etmv4_config *config = &drvdata->config; |
191 | struct perf_event_attr *attr = &event->attr; | ||
191 | 192 | ||
192 | if (!attr) | 193 | if (!attr) |
193 | return -EINVAL; | 194 | return -EINVAL; |
@@ -221,7 +222,7 @@ static int etm4_parse_event_config(struct etmv4_drvdata *drvdata, | |||
221 | } | 222 | } |
222 | 223 | ||
223 | static int etm4_enable_perf(struct coresight_device *csdev, | 224 | static int etm4_enable_perf(struct coresight_device *csdev, |
224 | struct perf_event_attr *attr) | 225 | struct perf_event *event) |
225 | { | 226 | { |
226 | struct etmv4_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); | 227 | struct etmv4_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); |
227 | 228 | ||
@@ -229,7 +230,7 @@ static int etm4_enable_perf(struct coresight_device *csdev, | |||
229 | return -EINVAL; | 230 | return -EINVAL; |
230 | 231 | ||
231 | /* Configure the tracer based on the session's specifics */ | 232 | /* Configure the tracer based on the session's specifics */ |
232 | etm4_parse_event_config(drvdata, attr); | 233 | etm4_parse_event_config(drvdata, event); |
233 | /* And enable it */ | 234 | /* And enable it */ |
234 | etm4_enable_hw(drvdata); | 235 | etm4_enable_hw(drvdata); |
235 | 236 | ||
@@ -264,7 +265,7 @@ err: | |||
264 | } | 265 | } |
265 | 266 | ||
266 | static int etm4_enable(struct coresight_device *csdev, | 267 | static int etm4_enable(struct coresight_device *csdev, |
267 | struct perf_event_attr *attr, u32 mode) | 268 | struct perf_event *event, u32 mode) |
268 | { | 269 | { |
269 | int ret; | 270 | int ret; |
270 | u32 val; | 271 | u32 val; |
@@ -281,7 +282,7 @@ static int etm4_enable(struct coresight_device *csdev, | |||
281 | ret = etm4_enable_sysfs(csdev); | 282 | ret = etm4_enable_sysfs(csdev); |
282 | break; | 283 | break; |
283 | case CS_MODE_PERF: | 284 | case CS_MODE_PERF: |
284 | ret = etm4_enable_perf(csdev, attr); | 285 | ret = etm4_enable_perf(csdev, event); |
285 | break; | 286 | break; |
286 | default: | 287 | default: |
287 | ret = -EINVAL; | 288 | ret = -EINVAL; |
@@ -321,7 +322,8 @@ static void etm4_disable_hw(void *info) | |||
321 | dev_dbg(drvdata->dev, "cpu: %d disable smp call done\n", drvdata->cpu); | 322 | dev_dbg(drvdata->dev, "cpu: %d disable smp call done\n", drvdata->cpu); |
322 | } | 323 | } |
323 | 324 | ||
324 | static int etm4_disable_perf(struct coresight_device *csdev) | 325 | static int etm4_disable_perf(struct coresight_device *csdev, |
326 | struct perf_event *event) | ||
325 | { | 327 | { |
326 | struct etmv4_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); | 328 | struct etmv4_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); |
327 | 329 | ||
@@ -357,7 +359,8 @@ static void etm4_disable_sysfs(struct coresight_device *csdev) | |||
357 | dev_info(drvdata->dev, "ETM tracing disabled\n"); | 359 | dev_info(drvdata->dev, "ETM tracing disabled\n"); |
358 | } | 360 | } |
359 | 361 | ||
360 | static void etm4_disable(struct coresight_device *csdev) | 362 | static void etm4_disable(struct coresight_device *csdev, |
363 | struct perf_event *event) | ||
361 | { | 364 | { |
362 | u32 mode; | 365 | u32 mode; |
363 | struct etmv4_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); | 366 | struct etmv4_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); |
@@ -376,7 +379,7 @@ static void etm4_disable(struct coresight_device *csdev) | |||
376 | etm4_disable_sysfs(csdev); | 379 | etm4_disable_sysfs(csdev); |
377 | break; | 380 | break; |
378 | case CS_MODE_PERF: | 381 | case CS_MODE_PERF: |
379 | etm4_disable_perf(csdev); | 382 | etm4_disable_perf(csdev, event); |
380 | break; | 383 | break; |
381 | } | 384 | } |
382 | 385 | ||
diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracing/coresight/coresight-stm.c index 7949f0f6744a..49e0f1b925a5 100644 --- a/drivers/hwtracing/coresight/coresight-stm.c +++ b/drivers/hwtracing/coresight/coresight-stm.c | |||
@@ -198,7 +198,7 @@ static void stm_enable_hw(struct stm_drvdata *drvdata) | |||
198 | } | 198 | } |
199 | 199 | ||
200 | static int stm_enable(struct coresight_device *csdev, | 200 | static int stm_enable(struct coresight_device *csdev, |
201 | struct perf_event_attr *attr, u32 mode) | 201 | struct perf_event *event, u32 mode) |
202 | { | 202 | { |
203 | u32 val; | 203 | u32 val; |
204 | struct stm_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); | 204 | struct stm_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); |
@@ -260,7 +260,8 @@ static void stm_disable_hw(struct stm_drvdata *drvdata) | |||
260 | stm_hwevent_disable_hw(drvdata); | 260 | stm_hwevent_disable_hw(drvdata); |
261 | } | 261 | } |
262 | 262 | ||
263 | static void stm_disable(struct coresight_device *csdev) | 263 | static void stm_disable(struct coresight_device *csdev, |
264 | struct perf_event *event) | ||
264 | { | 265 | { |
265 | struct stm_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); | 266 | struct stm_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); |
266 | 267 | ||
@@ -355,7 +356,7 @@ static void stm_generic_unlink(struct stm_data *stm_data, | |||
355 | if (!drvdata || !drvdata->csdev) | 356 | if (!drvdata || !drvdata->csdev) |
356 | return; | 357 | return; |
357 | 358 | ||
358 | stm_disable(drvdata->csdev); | 359 | stm_disable(drvdata->csdev, NULL); |
359 | } | 360 | } |
360 | 361 | ||
361 | static phys_addr_t | 362 | static phys_addr_t |
diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index bb20ee9747e1..fcbedd3905e3 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c | |||
@@ -257,7 +257,7 @@ static void coresight_disable_source(struct coresight_device *csdev) | |||
257 | { | 257 | { |
258 | if (atomic_dec_return(csdev->refcnt) == 0) { | 258 | if (atomic_dec_return(csdev->refcnt) == 0) { |
259 | if (source_ops(csdev)->disable) { | 259 | if (source_ops(csdev)->disable) { |
260 | source_ops(csdev)->disable(csdev); | 260 | source_ops(csdev)->disable(csdev, NULL); |
261 | csdev->enable = false; | 261 | csdev->enable = false; |
262 | } | 262 | } |
263 | } | 263 | } |