Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -258,7 +258,7 @@ static void etm_event_start(struct perf_event *event, int flags)
	event->hw.state = 0;

	/* 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;

out:
@@ -291,7 +291,7 @@ static void etm_event_stop(struct perf_event *event, int mode)
		return;

	/* stop tracer */
	source_ops(csdev)->disable(csdev);
	source_ops(csdev)->disable(csdev, event);

	/* tell the core */
	event->hw.state = PERF_HES_STOPPED;
+8 −6
Original line number Diff line number Diff line
@@ -311,9 +311,10 @@ void etm_config_trace_mode(struct etm_config *config)
#define ETM3X_SUPPORTED_OPTIONS (ETMCR_CYC_ACC | ETMCR_TIMESTAMP_EN)

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 perf_event_attr *attr = &event->attr;

	if (!attr)
		return -EINVAL;
@@ -459,7 +460,7 @@ static int etm_trace_id(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);

@@ -467,7 +468,7 @@ static int etm_enable_perf(struct coresight_device *csdev,
		return -EINVAL;

	/* Configure the tracer based on the session's specifics */
	etm_parse_event_config(drvdata, attr);
	etm_parse_event_config(drvdata, event);
	/* And enable it */
	etm_enable_hw(drvdata);

@@ -504,7 +505,7 @@ static int etm_enable_sysfs(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;
	u32 val;
@@ -521,7 +522,7 @@ static int etm_enable(struct coresight_device *csdev,
		ret = etm_enable_sysfs(csdev);
		break;
	case CS_MODE_PERF:
		ret = etm_enable_perf(csdev, attr);
		ret = etm_enable_perf(csdev, event);
		break;
	default:
		ret = -EINVAL;
@@ -601,7 +602,8 @@ static void etm_disable_sysfs(struct coresight_device *csdev)
	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;
	struct etm_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
+11 −8
Original line number Diff line number Diff line
@@ -185,9 +185,10 @@ static void etm4_enable_hw(void *info)
}

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 perf_event_attr *attr = &event->attr;

	if (!attr)
		return -EINVAL;
@@ -221,7 +222,7 @@ static int etm4_parse_event_config(struct etmv4_drvdata *drvdata,
}

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);

@@ -229,7 +230,7 @@ static int etm4_enable_perf(struct coresight_device *csdev,
		return -EINVAL;

	/* Configure the tracer based on the session's specifics */
	etm4_parse_event_config(drvdata, attr);
	etm4_parse_event_config(drvdata, event);
	/* And enable it */
	etm4_enable_hw(drvdata);

@@ -264,7 +265,7 @@ static int etm4_enable_sysfs(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;
	u32 val;
@@ -281,7 +282,7 @@ static int etm4_enable(struct coresight_device *csdev,
		ret = etm4_enable_sysfs(csdev);
		break;
	case CS_MODE_PERF:
		ret = etm4_enable_perf(csdev, attr);
		ret = etm4_enable_perf(csdev, event);
		break;
	default:
		ret = -EINVAL;
@@ -321,7 +322,8 @@ static void etm4_disable_hw(void *info)
	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);

@@ -357,7 +359,8 @@ static void etm4_disable_sysfs(struct coresight_device *csdev)
	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;
	struct etmv4_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
@@ -376,7 +379,7 @@ static void etm4_disable(struct coresight_device *csdev)
		etm4_disable_sysfs(csdev);
		break;
	case CS_MODE_PERF:
		etm4_disable_perf(csdev);
		etm4_disable_perf(csdev, event);
		break;
	}

+4 −3
Original line number Diff line number Diff line
@@ -198,7 +198,7 @@ static void stm_enable_hw(struct stm_drvdata *drvdata)
}

static int stm_enable(struct coresight_device *csdev,
		      struct perf_event_attr *attr, u32 mode)
		      struct perf_event *event, u32 mode)
{
	u32 val;
	struct stm_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
@@ -260,7 +260,8 @@ static void stm_disable_hw(struct stm_drvdata *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);

@@ -355,7 +356,7 @@ static void stm_generic_unlink(struct stm_data *stm_data,
	if (!drvdata || !drvdata->csdev)
		return;

	stm_disable(drvdata->csdev);
	stm_disable(drvdata->csdev, NULL);
}

static phys_addr_t
+1 −1
Original line number Diff line number Diff line
@@ -257,7 +257,7 @@ static void coresight_disable_source(struct coresight_device *csdev)
{
	if (atomic_dec_return(csdev->refcnt) == 0) {
		if (source_ops(csdev)->disable) {
			source_ops(csdev)->disable(csdev);
			source_ops(csdev)->disable(csdev, NULL);
			csdev->enable = false;
		}
	}
Loading