Commit e006d89a authored by Suzuki K Poulose's avatar Suzuki K Poulose Committed by Greg Kroah-Hartman

coresight: etm4x: Add support for handling errors

Add support for handling errors in enabling the component.
The ETM is enabled via cross call to owner CPU. Make
necessary changes to report the error back from the cross
call.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1d364034
...@@ -78,10 +78,14 @@ static int etm4_trace_id(struct coresight_device *csdev) ...@@ -78,10 +78,14 @@ static int etm4_trace_id(struct coresight_device *csdev)
return drvdata->trcid; return drvdata->trcid;
} }
static void etm4_enable_hw(void *info) struct etm4_enable_arg {
struct etmv4_drvdata *drvdata;
int rc;
};
static int etm4_enable_hw(struct etmv4_drvdata *drvdata)
{ {
int i; int i;
struct etmv4_drvdata *drvdata = info;
struct etmv4_config *config = &drvdata->config; struct etmv4_config *config = &drvdata->config;
CS_UNLOCK(drvdata->base); CS_UNLOCK(drvdata->base);
...@@ -178,6 +182,16 @@ static void etm4_enable_hw(void *info) ...@@ -178,6 +182,16 @@ static void etm4_enable_hw(void *info)
CS_LOCK(drvdata->base); CS_LOCK(drvdata->base);
dev_dbg(drvdata->dev, "cpu: %d enable smp call done\n", drvdata->cpu); dev_dbg(drvdata->dev, "cpu: %d enable smp call done\n", drvdata->cpu);
return 0;
}
static void etm4_enable_hw_smp_call(void *info)
{
struct etm4_enable_arg *arg = info;
if (WARN_ON(!arg))
return;
arg->rc = etm4_enable_hw(arg->drvdata);
} }
static int etm4_parse_event_config(struct etmv4_drvdata *drvdata, static int etm4_parse_event_config(struct etmv4_drvdata *drvdata,
...@@ -243,7 +257,7 @@ static int etm4_enable_perf(struct coresight_device *csdev, ...@@ -243,7 +257,7 @@ static int etm4_enable_perf(struct coresight_device *csdev,
if (ret) if (ret)
goto out; goto out;
/* And enable it */ /* And enable it */
etm4_enable_hw(drvdata); ret = etm4_enable_hw(drvdata);
out: out:
return ret; return ret;
...@@ -252,6 +266,7 @@ static int etm4_enable_perf(struct coresight_device *csdev, ...@@ -252,6 +266,7 @@ static int etm4_enable_perf(struct coresight_device *csdev,
static int etm4_enable_sysfs(struct coresight_device *csdev) static int etm4_enable_sysfs(struct coresight_device *csdev)
{ {
struct etmv4_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); struct etmv4_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
struct etm4_enable_arg arg = { 0 };
int ret; int ret;
spin_lock(&drvdata->spinlock); spin_lock(&drvdata->spinlock);
...@@ -260,19 +275,17 @@ static int etm4_enable_sysfs(struct coresight_device *csdev) ...@@ -260,19 +275,17 @@ static int etm4_enable_sysfs(struct coresight_device *csdev)
* Executing etm4_enable_hw on the cpu whose ETM is being enabled * Executing etm4_enable_hw on the cpu whose ETM is being enabled
* ensures that register writes occur when cpu is powered. * ensures that register writes occur when cpu is powered.
*/ */
arg.drvdata = drvdata;
ret = smp_call_function_single(drvdata->cpu, ret = smp_call_function_single(drvdata->cpu,
etm4_enable_hw, drvdata, 1); etm4_enable_hw_smp_call, &arg, 1);
if (ret) if (!ret)
goto err; ret = arg.rc;
if (!ret)
drvdata->sticky_enable = true; drvdata->sticky_enable = true;
spin_unlock(&drvdata->spinlock); spin_unlock(&drvdata->spinlock);
if (!ret)
dev_dbg(drvdata->dev, "ETM tracing enabled\n"); dev_dbg(drvdata->dev, "ETM tracing enabled\n");
return 0;
err:
spin_unlock(&drvdata->spinlock);
return ret; return ret;
} }
......
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