mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 12:17:12 +09:00
UPSTREAM: coresight: etm4x: Add support for handling errors
(Upstream commit e006d89abe).
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: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bug: 140266694
Change-Id: I8a54186df77720d2d4d573e269ed961695593a4f
Signed-off-by: Yabin Cui <yabinc@google.com>
This commit is contained in:
committed by
Yabin Cui
parent
a1cca3695d
commit
3ec81bf2b3
@@ -79,10 +79,14 @@ static int etm4_trace_id(struct coresight_device *csdev)
|
||||
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;
|
||||
struct etmv4_drvdata *drvdata = info;
|
||||
struct etmv4_config *config = &drvdata->config;
|
||||
|
||||
CS_UNLOCK(drvdata->base);
|
||||
@@ -185,6 +189,16 @@ static void etm4_enable_hw(void *info)
|
||||
CS_LOCK(drvdata->base);
|
||||
|
||||
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,
|
||||
@@ -250,7 +264,7 @@ static int etm4_enable_perf(struct coresight_device *csdev,
|
||||
if (ret)
|
||||
goto out;
|
||||
/* And enable it */
|
||||
etm4_enable_hw(drvdata);
|
||||
ret = etm4_enable_hw(drvdata);
|
||||
|
||||
out:
|
||||
return ret;
|
||||
@@ -259,6 +273,7 @@ out:
|
||||
static int etm4_enable_sysfs(struct coresight_device *csdev)
|
||||
{
|
||||
struct etmv4_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
|
||||
struct etm4_enable_arg arg = { 0 };
|
||||
int ret;
|
||||
|
||||
spin_lock(&drvdata->spinlock);
|
||||
@@ -267,19 +282,17 @@ static int etm4_enable_sysfs(struct coresight_device *csdev)
|
||||
* Executing etm4_enable_hw on the cpu whose ETM is being enabled
|
||||
* ensures that register writes occur when cpu is powered.
|
||||
*/
|
||||
arg.drvdata = drvdata;
|
||||
ret = smp_call_function_single(drvdata->cpu,
|
||||
etm4_enable_hw, drvdata, 1);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
drvdata->sticky_enable = true;
|
||||
etm4_enable_hw_smp_call, &arg, 1);
|
||||
if (!ret)
|
||||
ret = arg.rc;
|
||||
if (!ret)
|
||||
drvdata->sticky_enable = true;
|
||||
spin_unlock(&drvdata->spinlock);
|
||||
|
||||
dev_dbg(drvdata->dev, "ETM tracing enabled\n");
|
||||
return 0;
|
||||
|
||||
err:
|
||||
spin_unlock(&drvdata->spinlock);
|
||||
if (!ret)
|
||||
dev_dbg(drvdata->dev, "ETM tracing enabled\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user