Commit 68905d73 authored by Mathieu Poirier's avatar Mathieu Poirier Committed by Greg Kroah-Hartman

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 375637bc ("perf/core: Introduce address range filtering")'
Signed-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3224dcc5
...@@ -258,7 +258,7 @@ static void etm_event_start(struct perf_event *event, int flags) ...@@ -258,7 +258,7 @@ static void etm_event_start(struct perf_event *event, int flags)
event->hw.state = 0; event->hw.state = 0;
/* Finally enable the tracer */ /* Finally enable the tracer */
if (source_ops(csdev)->enable(csdev, &event->attr, CS_MODE_PERF)) if (source_ops(csdev)->enable(csdev, event, CS_MODE_PERF))
goto fail_end_stop; goto fail_end_stop;
out: out:
...@@ -291,7 +291,7 @@ static void etm_event_stop(struct perf_event *event, int mode) ...@@ -291,7 +291,7 @@ static void etm_event_stop(struct perf_event *event, int mode)
return; return;
/* stop tracer */ /* stop tracer */
source_ops(csdev)->disable(csdev); source_ops(csdev)->disable(csdev, event);
/* tell the core */ /* tell the core */
event->hw.state = PERF_HES_STOPPED; event->hw.state = PERF_HES_STOPPED;
......
...@@ -311,9 +311,10 @@ void etm_config_trace_mode(struct etm_config *config) ...@@ -311,9 +311,10 @@ void etm_config_trace_mode(struct etm_config *config)
#define ETM3X_SUPPORTED_OPTIONS (ETMCR_CYC_ACC | ETMCR_TIMESTAMP_EN) #define ETM3X_SUPPORTED_OPTIONS (ETMCR_CYC_ACC | ETMCR_TIMESTAMP_EN)
static int etm_parse_event_config(struct etm_drvdata *drvdata, static int etm_parse_event_config(struct etm_drvdata *drvdata,
struct perf_event_attr *attr) struct perf_event *event)
{ {
struct etm_config *config = &drvdata->config; struct etm_config *config = &drvdata->config;
struct perf_event_attr *attr = &event->attr;
if (!attr) if (!attr)
return -EINVAL; return -EINVAL;
...@@ -459,7 +460,7 @@ static int etm_trace_id(struct coresight_device *csdev) ...@@ -459,7 +460,7 @@ static int etm_trace_id(struct coresight_device *csdev)
} }
static int etm_enable_perf(struct coresight_device *csdev, static int etm_enable_perf(struct coresight_device *csdev,
struct perf_event_attr *attr) struct perf_event *event)
{ {
struct etm_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); struct etm_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
...@@ -467,7 +468,7 @@ static int etm_enable_perf(struct coresight_device *csdev, ...@@ -467,7 +468,7 @@ static int etm_enable_perf(struct coresight_device *csdev,
return -EINVAL; return -EINVAL;
/* Configure the tracer based on the session's specifics */ /* Configure the tracer based on the session's specifics */
etm_parse_event_config(drvdata, attr); etm_parse_event_config(drvdata, event);
/* And enable it */ /* And enable it */
etm_enable_hw(drvdata); etm_enable_hw(drvdata);
...@@ -504,7 +505,7 @@ static int etm_enable_sysfs(struct coresight_device *csdev) ...@@ -504,7 +505,7 @@ static int etm_enable_sysfs(struct coresight_device *csdev)
} }
static int etm_enable(struct coresight_device *csdev, static int etm_enable(struct coresight_device *csdev,
struct perf_event_attr *attr, u32 mode) struct perf_event *event, u32 mode)
{ {
int ret; int ret;
u32 val; u32 val;
...@@ -521,7 +522,7 @@ static int etm_enable(struct coresight_device *csdev, ...@@ -521,7 +522,7 @@ static int etm_enable(struct coresight_device *csdev,
ret = etm_enable_sysfs(csdev); ret = etm_enable_sysfs(csdev);
break; break;
case CS_MODE_PERF: case CS_MODE_PERF:
ret = etm_enable_perf(csdev, attr); ret = etm_enable_perf(csdev, event);
break; break;
default: default:
ret = -EINVAL; ret = -EINVAL;
...@@ -601,7 +602,8 @@ static void etm_disable_sysfs(struct coresight_device *csdev) ...@@ -601,7 +602,8 @@ static void etm_disable_sysfs(struct coresight_device *csdev)
dev_info(drvdata->dev, "ETM tracing disabled\n"); dev_info(drvdata->dev, "ETM tracing disabled\n");
} }
static void etm_disable(struct coresight_device *csdev) static void etm_disable(struct coresight_device *csdev,
struct perf_event *event)
{ {
u32 mode; u32 mode;
struct etm_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); struct etm_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
......
...@@ -185,9 +185,10 @@ static void etm4_enable_hw(void *info) ...@@ -185,9 +185,10 @@ static void etm4_enable_hw(void *info)
} }
static int etm4_parse_event_config(struct etmv4_drvdata *drvdata, static int etm4_parse_event_config(struct etmv4_drvdata *drvdata,
struct perf_event_attr *attr) struct perf_event *event)
{ {
struct etmv4_config *config = &drvdata->config; struct etmv4_config *config = &drvdata->config;
struct perf_event_attr *attr = &event->attr;
if (!attr) if (!attr)
return -EINVAL; return -EINVAL;
...@@ -221,7 +222,7 @@ static int etm4_parse_event_config(struct etmv4_drvdata *drvdata, ...@@ -221,7 +222,7 @@ static int etm4_parse_event_config(struct etmv4_drvdata *drvdata,
} }
static int etm4_enable_perf(struct coresight_device *csdev, static int etm4_enable_perf(struct coresight_device *csdev,
struct perf_event_attr *attr) struct perf_event *event)
{ {
struct etmv4_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); struct etmv4_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
...@@ -229,7 +230,7 @@ static int etm4_enable_perf(struct coresight_device *csdev, ...@@ -229,7 +230,7 @@ static int etm4_enable_perf(struct coresight_device *csdev,
return -EINVAL; return -EINVAL;
/* Configure the tracer based on the session's specifics */ /* Configure the tracer based on the session's specifics */
etm4_parse_event_config(drvdata, attr); etm4_parse_event_config(drvdata, event);
/* And enable it */ /* And enable it */
etm4_enable_hw(drvdata); etm4_enable_hw(drvdata);
...@@ -264,7 +265,7 @@ static int etm4_enable_sysfs(struct coresight_device *csdev) ...@@ -264,7 +265,7 @@ static int etm4_enable_sysfs(struct coresight_device *csdev)
} }
static int etm4_enable(struct coresight_device *csdev, static int etm4_enable(struct coresight_device *csdev,
struct perf_event_attr *attr, u32 mode) struct perf_event *event, u32 mode)
{ {
int ret; int ret;
u32 val; u32 val;
...@@ -281,7 +282,7 @@ static int etm4_enable(struct coresight_device *csdev, ...@@ -281,7 +282,7 @@ static int etm4_enable(struct coresight_device *csdev,
ret = etm4_enable_sysfs(csdev); ret = etm4_enable_sysfs(csdev);
break; break;
case CS_MODE_PERF: case CS_MODE_PERF:
ret = etm4_enable_perf(csdev, attr); ret = etm4_enable_perf(csdev, event);
break; break;
default: default:
ret = -EINVAL; ret = -EINVAL;
...@@ -321,7 +322,8 @@ static void etm4_disable_hw(void *info) ...@@ -321,7 +322,8 @@ static void etm4_disable_hw(void *info)
dev_dbg(drvdata->dev, "cpu: %d disable smp call done\n", drvdata->cpu); dev_dbg(drvdata->dev, "cpu: %d disable smp call done\n", drvdata->cpu);
} }
static int etm4_disable_perf(struct coresight_device *csdev) static int etm4_disable_perf(struct coresight_device *csdev,
struct perf_event *event)
{ {
struct etmv4_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); struct etmv4_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
...@@ -357,7 +359,8 @@ static void etm4_disable_sysfs(struct coresight_device *csdev) ...@@ -357,7 +359,8 @@ static void etm4_disable_sysfs(struct coresight_device *csdev)
dev_info(drvdata->dev, "ETM tracing disabled\n"); dev_info(drvdata->dev, "ETM tracing disabled\n");
} }
static void etm4_disable(struct coresight_device *csdev) static void etm4_disable(struct coresight_device *csdev,
struct perf_event *event)
{ {
u32 mode; u32 mode;
struct etmv4_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); struct etmv4_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
...@@ -376,7 +379,7 @@ static void etm4_disable(struct coresight_device *csdev) ...@@ -376,7 +379,7 @@ static void etm4_disable(struct coresight_device *csdev)
etm4_disable_sysfs(csdev); etm4_disable_sysfs(csdev);
break; break;
case CS_MODE_PERF: case CS_MODE_PERF:
etm4_disable_perf(csdev); etm4_disable_perf(csdev, event);
break; break;
} }
......
...@@ -198,7 +198,7 @@ static void stm_enable_hw(struct stm_drvdata *drvdata) ...@@ -198,7 +198,7 @@ static void stm_enable_hw(struct stm_drvdata *drvdata)
} }
static int stm_enable(struct coresight_device *csdev, static int stm_enable(struct coresight_device *csdev,
struct perf_event_attr *attr, u32 mode) struct perf_event *event, u32 mode)
{ {
u32 val; u32 val;
struct stm_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); struct stm_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
...@@ -260,7 +260,8 @@ static void stm_disable_hw(struct stm_drvdata *drvdata) ...@@ -260,7 +260,8 @@ static void stm_disable_hw(struct stm_drvdata *drvdata)
stm_hwevent_disable_hw(drvdata); stm_hwevent_disable_hw(drvdata);
} }
static void stm_disable(struct coresight_device *csdev) static void stm_disable(struct coresight_device *csdev,
struct perf_event *event)
{ {
struct stm_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); struct stm_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
...@@ -355,7 +356,7 @@ static void stm_generic_unlink(struct stm_data *stm_data, ...@@ -355,7 +356,7 @@ static void stm_generic_unlink(struct stm_data *stm_data,
if (!drvdata || !drvdata->csdev) if (!drvdata || !drvdata->csdev)
return; return;
stm_disable(drvdata->csdev); stm_disable(drvdata->csdev, NULL);
} }
static phys_addr_t static phys_addr_t
......
...@@ -257,7 +257,7 @@ static void coresight_disable_source(struct coresight_device *csdev) ...@@ -257,7 +257,7 @@ static void coresight_disable_source(struct coresight_device *csdev)
{ {
if (atomic_dec_return(csdev->refcnt) == 0) { if (atomic_dec_return(csdev->refcnt) == 0) {
if (source_ops(csdev)->disable) { if (source_ops(csdev)->disable) {
source_ops(csdev)->disable(csdev); source_ops(csdev)->disable(csdev, NULL);
csdev->enable = false; csdev->enable = false;
} }
} }
......
...@@ -232,8 +232,9 @@ struct coresight_ops_source { ...@@ -232,8 +232,9 @@ struct coresight_ops_source {
int (*cpu_id)(struct coresight_device *csdev); int (*cpu_id)(struct coresight_device *csdev);
int (*trace_id)(struct coresight_device *csdev); int (*trace_id)(struct coresight_device *csdev);
int (*enable)(struct coresight_device *csdev, int (*enable)(struct coresight_device *csdev,
struct perf_event_attr *attr, u32 mode); struct perf_event *event, u32 mode);
void (*disable)(struct coresight_device *csdev); void (*disable)(struct coresight_device *csdev,
struct perf_event *event);
}; };
struct coresight_ops { struct coresight_ops {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment