ETMv4 hardware information and configuration needs to be saved as metadata and the metadata finally can be used by kdump for tracing data decoding.
This patch saves ETMv4 metadata for registers TRCIDR{0, 1, 2, 8}. The decoder needs to use another two extra configuration and control registers TRCCONFIGR and TRCTRACEIDR, which are dynamically configured and their values are recorded during tracer enabling phase; their value are separately saved in 'etmv4_config::cfg' and 'etmv4_drvdata::trcid' so we don't need to add new fields for them.
Signed-off-by: Leo Yan leo.yan@linaro.org --- drivers/hwtracing/coresight/coresight-etm4x.c | 7 +++++++ drivers/hwtracing/coresight/coresight-etm4x.h | 8 ++++++++ 2 files changed, 15 insertions(+)
diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c index b7379e9..e84fbb0 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x.c @@ -282,6 +282,7 @@ static int etm4_enable(struct coresight_device *csdev, int ret; u32 val; struct etmv4_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); + struct etmv4_config *config = &drvdata->config;
val = local_cmpxchg(&drvdata->mode, CS_MODE_DISABLED, mode);
@@ -300,6 +301,12 @@ static int etm4_enable(struct coresight_device *csdev, ret = -EINVAL; }
+ /* Save idr registers for kdump */ + config->idr0 = readl_relaxed(drvdata->base + TRCIDR0); + config->idr1 = readl_relaxed(drvdata->base + TRCIDR1); + config->idr2 = readl_relaxed(drvdata->base + TRCIDR2); + config->idr8 = readl_relaxed(drvdata->base + TRCIDR8); + /* The tracer didn't start */ if (ret) local_set(&drvdata->mode, CS_MODE_DISABLED); diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtracing/coresight/coresight-etm4x.h index 52786e9..3fa08cc 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.h +++ b/drivers/hwtracing/coresight/coresight-etm4x.h @@ -237,6 +237,10 @@ * @vmid_mask0: VM ID comparator mask for comparator 0-3. * @vmid_mask1: VM ID comparator mask for comparator 4-7. * @ext_inp: External input selection. + * @idr0: Value of ID Register 0. + * @idr1: Value of ID Register 1. + * @idr2: Value of ID Register 2. + * @idr8: Value of ID Register 8. */ struct etmv4_config { u32 mode; @@ -279,6 +283,10 @@ struct etmv4_config { u32 vmid_mask0; u32 vmid_mask1; u32 ext_inp; + u32 idr0; + u32 idr1; + u32 idr2; + u32 idr8; };
/**