mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-10 12:57:06 +09:00
UPSTREAM: coresight: etm3: Add support for handling errors
(Upstream commit e2a1551a88).
Add support for reporting errors back from the SMP cross
function call for enabling ETM.
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: Iec7569e4199469e7304c79be7b7eef123458d310
Signed-off-by: Yabin Cui <yabinc@google.com>
This commit is contained in:
committed by
Yabin Cui
parent
3ec81bf2b3
commit
a3266c2141
@@ -355,11 +355,10 @@ static int etm_parse_event_config(struct etm_drvdata *drvdata,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void etm_enable_hw(void *info)
|
||||
static int etm_enable_hw(struct etm_drvdata *drvdata)
|
||||
{
|
||||
int i;
|
||||
u32 etmcr;
|
||||
struct etm_drvdata *drvdata = info;
|
||||
struct etm_config *config = &drvdata->config;
|
||||
|
||||
CS_UNLOCK(drvdata->base);
|
||||
@@ -421,6 +420,21 @@ static void etm_enable_hw(void *info)
|
||||
CS_LOCK(drvdata->base);
|
||||
|
||||
dev_dbg(drvdata->dev, "cpu: %d enable smp call done\n", drvdata->cpu);
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct etm_enable_arg {
|
||||
struct etm_drvdata *drvdata;
|
||||
int rc;
|
||||
};
|
||||
|
||||
static void etm_enable_hw_smp_call(void *info)
|
||||
{
|
||||
struct etm_enable_arg *arg = info;
|
||||
|
||||
if (WARN_ON(!arg))
|
||||
return;
|
||||
arg->rc = etm_enable_hw(arg->drvdata);
|
||||
}
|
||||
|
||||
static int etm_cpu_id(struct coresight_device *csdev)
|
||||
@@ -475,14 +489,13 @@ static int etm_enable_perf(struct coresight_device *csdev,
|
||||
/* Configure the tracer based on the session's specifics */
|
||||
etm_parse_event_config(drvdata, event);
|
||||
/* And enable it */
|
||||
etm_enable_hw(drvdata);
|
||||
|
||||
return 0;
|
||||
return etm_enable_hw(drvdata);
|
||||
}
|
||||
|
||||
static int etm_enable_sysfs(struct coresight_device *csdev)
|
||||
{
|
||||
struct etm_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
|
||||
struct etm_enable_arg arg = { 0 };
|
||||
int ret;
|
||||
|
||||
spin_lock(&drvdata->spinlock);
|
||||
@@ -492,20 +505,21 @@ static int etm_enable_sysfs(struct coresight_device *csdev)
|
||||
* hw configuration will take place on the local CPU during bring up.
|
||||
*/
|
||||
if (cpu_online(drvdata->cpu)) {
|
||||
arg.drvdata = drvdata;
|
||||
ret = smp_call_function_single(drvdata->cpu,
|
||||
etm_enable_hw, drvdata, 1);
|
||||
if (ret)
|
||||
goto err;
|
||||
etm_enable_hw_smp_call, &arg, 1);
|
||||
if (!ret)
|
||||
ret = arg.rc;
|
||||
if (!ret)
|
||||
drvdata->sticky_enable = true;
|
||||
} else {
|
||||
ret = -ENODEV;
|
||||
}
|
||||
|
||||
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