coresight: next v4.13-rc3
Subsystems (6)
cover coresight: next v4.13-rc3
Good morning Grep,
These are the patches I'd like you to consider for inclusion in the v4.14 cycle. Please have a look when you get the chance. As usual I made sure things apply on your char-misc-next branch (24a81a2c2581).
Thanks,
Mathieu
Arvind Yadav (1):
hwtracing: coresight: constify attribute_group structures.
Mathieu Poirier (5):
coresight: Correct buffer lost increment
coresight: etb10: Remove useless conversion to LE
coresight: Add barrier packet for synchronisation
coresight: etb10: Move etb_disable_hw() outside of lock
coresight: etm3x: Set synchronisation frequencty to TRM default
Mike Leach (4):
coresight: pmu: Adds return stack option to perf coresight pmu
coresight: ptm: Adds trace return stack option programming for PTM.
coresight: etm4x: Adds trace return stack option programming for
ETMv4.
perf: cs-etm: Fix ETMv4 CONFIGR entry in perf.data file
Stephen Boyd (1):
coresight: STM: Clean up __iomem type usage
Suzuki K Poulose (15):
coresight replicator: Cleanup programmable replicator naming
coresight: Add support for reading 64bit registers
coresight: Use the new helper for defining registers coresight tmc: Add helpers for accessing 64bit registers coresight tmc: Expose DBA and AXICTL
coresight replicator: Expose replicator management registers coresight tmc: Handle configuration types properly coresight tmc etr: Add capabilitiy information coresight tmc: Detect support for scatter gather coresight tmc etr: Detect address width at runtime coresight tmc etr: Cleanup AXICTL register handling coresight tmc etr: Setup AXI cache encoding for read transfers coresight tmc: Support for save-restore in ETR coresight tmc: Add support for Coresight SoC 600 TMC
coresight: Add support for Coresight SoC 600 components
.../devicetree/bindings/arm/coresight.txt | 4 +-
drivers/hwtracing/coresight/Kconfig | 10 +-
drivers/hwtracing/coresight/Makefile | 2 +-
...cator-qcom.c => coresight-dynamic-replicator.c} | 32 ++++++-
drivers/hwtracing/coresight/coresight-etb10.c | 68 ++++++++-----
drivers/hwtracing/coresight/coresight-etm-perf.c | 4 +-
drivers/hwtracing/coresight/coresight-etm.h | 1 +
.../hwtracing/coresight/coresight-etm3x-sysfs.c | 26 ++---
drivers/hwtracing/coresight/coresight-etm3x.c | 20 +++-
.../hwtracing/coresight/coresight-etm4x-sysfs.c | 24 ++---
drivers/hwtracing/coresight/coresight-etm4x.c | 4 +
drivers/hwtracing/coresight/coresight-funnel.c | 5 +
drivers/hwtracing/coresight/coresight-priv.h | 39 +++++++-
drivers/hwtracing/coresight/coresight-stm.c | 47 ++++-----
drivers/hwtracing/coresight/coresight-tmc-etf.c | 42 ++++++--
drivers/hwtracing/coresight/coresight-tmc-etr.c | 49 +++++++---
drivers/hwtracing/coresight/coresight-tmc.c | 106 ++++++++++++++++-----
drivers/hwtracing/coresight/coresight-tmc.h | 85 ++++++++++++++++-
drivers/hwtracing/coresight/coresight-tpiu.c | 5 +
drivers/hwtracing/coresight/coresight.c | 8 ++
include/linux/coresight-pmu.h | 6 ++
tools/include/linux/coresight-pmu.h | 6 ++
tools/perf/arch/arm/util/cs-etm.c | 28 +++++-
23 files changed, 485 insertions(+), 136 deletions(-)
rename drivers/hwtracing/coresight/{coresight-replicator-qcom.c => coresight-dynamic-replicator.c} (87%)Signature · 1 line
2.7.4
PATCH 1/26 coresight: Correct buffer lost increment
Many conditions may cause synchronisation to be lost when updating the perf ring buffer but the end result is still the same: synchronisation is lost. As such there is no need to increment the lost count for each condition, just once will suffice.
--- drivers/hwtracing/coresight/coresight-etb10.c | 10 +++++++--- drivers/hwtracing/coresight/coresight-tmc-etf.c | 8 ++++++-- 2 files changed, 13 insertions(+), 5 deletions(-)
drivers/hwtracing/coresight/coresight-etb10.c +7 -3
@@ -353,6 +353,7 @@ static void etb_update_buffer(struct coresight_device *csdev,struct perf_output_handle *handle, void *sink_config) { + bool lost = false;int i, cur;u8 *buf_ptr;u32 read_ptr, write_ptr, capacity;
@@ -384,7 +385,7 @@ static void etb_update_buffer(struct coresight_device *csdev, (unsigned long)write_ptr); write_ptr &= ~(ETB_FRAME_SIZE_WORDS -1 ); -perf_aux_output_flag (handle,PERF_AUX_FLAG_TRUNCATED ); + lost = true; }/*
@@ -395,7 +396,7 @@ static void etb_update_buffer(struct coresight_device *csdev,*/ status =readl_relaxed (drvdata->base +ETB_STATUS_REG );if (status &ETB_STATUS_RAM_FULL ) { -perf_aux_output_flag (handle,PERF_AUX_FLAG_TRUNCATED ); + lost = true; to_read = capacity; read_ptr = write_ptr; }else {
@@ -428,9 +429,12 @@ static void etb_update_buffer(struct coresight_device *csdev,if (read_ptr > (drvdata->buffer_depth -1 )) read_ptr -= drvdata->buffer_depth;/* let the decoder know we've skipped ahead */ -perf_aux_output_flag (handle,PERF_AUX_FLAG_TRUNCATED ); + lost = true; } +if (lost) +perf_aux_output_flag (handle,PERF_AUX_FLAG_TRUNCATED ); +/* finally tell HW where we want to start reading from */ writel_relaxed (read_ptr, drvdata->base +ETB_RAM_READ_POINTER );
drivers/hwtracing/coresight/coresight-tmc-etf.c +6 -2
@@ -369,6 +369,7 @@ static void tmc_update_etf_buffer(struct coresight_device *csdev,struct perf_output_handle *handle, void *sink_config) { + bool lost = false;int i, cur;u32 *buf_ptr;u32 read_ptr, write_ptr;
@@ -397,7 +398,7 @@ static void tmc_update_etf_buffer(struct coresight_device *csdev,*/ status =readl_relaxed (drvdata->base +TMC_STS );if (status &TMC_STS_FULL ) { -perf_aux_output_flag (handle,PERF_AUX_FLAG_TRUNCATED ); + lost = true; to_read = drvdata->size; }else { to_read =CIRC_CNT (write_ptr, read_ptr, drvdata->size);
@@ -442,9 +443,12 @@ static void tmc_update_etf_buffer(struct coresight_device *csdev, read_ptr -= drvdata->size;/* Tell the HW */ writel_relaxed (read_ptr, drvdata->base +TMC_RRP ); -perf_aux_output_flag (handle,PERF_AUX_FLAG_TRUNCATED ); + lost = true; } +if (lost) +perf_aux_output_flag (handle,PERF_AUX_FLAG_TRUNCATED ); + cur = buf->cur; offset = buf->offset;
Signature · 1 line
2.7.4
PATCH 2/26 coresight: etb10: Remove useless conversion to LE
In reply to Mathieu PoirierInternal CoreSight components are rendering trace data in little-endian format. As such there is no need to convert the data once more, hence removing the extra step.
--- drivers/hwtracing/coresight/coresight-etb10.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/hwtracing/coresight/coresight-etb10.c +4 -8
@@ -233,10 +233,8 @@ static void etb_dump_hw(struct etb_drvdata *drvdata)for (i =0 ; i < depth; i++) { read_data =readl_relaxed (drvdata->base +ETB_RAM_READ_DATA_REG ); - *buf_ptr++ = read_data >>0 ; - *buf_ptr++ = read_data >>8 ; - *buf_ptr++ = read_data >>16 ; - *buf_ptr++ = read_data >>24 ; + *(u32 *)buf_ptr = read_data; + buf_ptr +=4 ; }if (frame_off) {
@@ -444,10 +442,8 @@ static void etb_update_buffer(struct coresight_device *csdev, buf_ptr = buf->data_pages[cur] + offset; read_data =readl_relaxed (drvdata->base +ETB_RAM_READ_DATA_REG ); - *buf_ptr++ = read_data >>0 ; - *buf_ptr++ = read_data >>8 ; - *buf_ptr++ = read_data >>16 ; - *buf_ptr++ = read_data >>24 ; + *(u32 *)buf_ptr = read_data; + buf_ptr +=4 ; offset +=4 ;if (offset >=PAGE_SIZE ) {
Signature · 1 line
2.7.4
PATCH 3/26 coresight: Add barrier packet for synchronisation
In reply to Mathieu PoirierWhen a buffer overflow happens the synchronisation patckets usually present at the beginning of the buffer are lost, a situation that prevents the decoder from knowing the context of the traces being decoded.
This patch adds a barrier packet to be used by sink IPs when a buffer overflow condition is detected. These barrier packets are then used by the decoding library as markers to force re-synchronisation.
--- drivers/hwtracing/coresight/coresight-etb10.c | 22 +++++++++++++++++++-- drivers/hwtracing/coresight/coresight-priv.h | 2 ++ drivers/hwtracing/coresight/coresight-tmc-etf.c | 26 ++++++++++++++++++++++++- drivers/hwtracing/coresight/coresight-tmc-etr.c | 12 ++++++++++++ drivers/hwtracing/coresight/coresight.c | 8 ++++++++ 5 files changed, 67 insertions(+), 3 deletions(-)
drivers/hwtracing/coresight/coresight-etb10.c +20 -2
@@ -200,8 +200,10 @@ static void etb_disable_hw(struct etb_drvdata *drvdata)static void etb_dump_hw (struct etb_drvdata *drvdata) { +bool lost = false;int i;u8 *buf_ptr; +const u32 *barrier;u32 read_data, depth;u32 read_ptr, write_ptr;u32 frame_off, frame_endoff;
@@ -223,16 +225,24 @@ static void etb_dump_hw(struct etb_drvdata *drvdata) }if ((readl_relaxed (drvdata->base +ETB_STATUS_REG ) - &ETB_STATUS_RAM_FULL ) ==0 ) + &ETB_STATUS_RAM_FULL ) ==0 ) {writel_relaxed (0x0 , drvdata->base +ETB_RAM_READ_POINTER ); -else + }else {writel_relaxed (write_ptr, drvdata->base +ETB_RAM_READ_POINTER ); + lost = true; + } depth = drvdata->buffer_depth; buf_ptr = drvdata->buf; + barrier = barrier_pkt;for (i =0 ; i < depth; i++) { read_data =readl_relaxed (drvdata->base +ETB_RAM_READ_DATA_REG ); +if (lost && *barrier) { + read_data = *barrier; + barrier++; + } + *(u32 *)buf_ptr = read_data; buf_ptr +=4 ; }
@@ -354,6 +364,7 @@ static void etb_update_buffer(struct coresight_device *csdev,bool lost = false;int i, cur;u8 *buf_ptr; +const u32 *barrier;u32 read_ptr, write_ptr, capacity;u32 status, read_data, to_read;unsigned long offset;
@@ -438,10 +449,17 @@ static void etb_update_buffer(struct coresight_device *csdev, cur = buf->cur; offset = buf->offset; + barrier = barrier_pkt; +for (i =0 ; i < to_read; i +=4 ) { buf_ptr = buf->data_pages[cur] + offset; read_data =readl_relaxed (drvdata->base +ETB_RAM_READ_DATA_REG ); +if (lost && *barrier) { + read_data = *barrier; + barrier++; + } + *(u32 *)buf_ptr = read_data; buf_ptr +=4 ;
drivers/hwtracing/coresight/coresight-priv.h +2 -0
@@ -56,6 +56,8 @@ static ssize_t name##_show(struct device *_dev, \ } \static DEVICE_ATTR_RO (name) +extern const u32 barrier_pkt[5]; +enum etm_addr_type {ETM_ADDR_TYPE_NONE ,ETM_ADDR_TYPE_SINGLE ,
drivers/hwtracing/coresight/coresight-tmc-etf.c +25 -1
@@ -43,17 +43,34 @@ static void tmc_etb_enable_hw(struct tmc_drvdata *drvdata)static void tmc_etb_dump_hw (struct tmc_drvdata *drvdata) { +bool lost = false;char *bufp; -u32 read_data; +const u32 *barrier; +u32 read_data, status;int i; +/* +* Get a hold of the status register and see if a wrap around +* has occurred. +*/ + status =readl_relaxed (drvdata->base +TMC_STS ); +if (status &TMC_STS_FULL ) + lost = true; + bufp = drvdata->buf; drvdata->len =0 ; + barrier = barrier_pkt;while (1 ) {for (i =0 ; i < drvdata->memwidth; i++) { read_data =readl_relaxed (drvdata->base +TMC_RRD );if (read_data ==0xFFFFFFFF )return ; + +if (lost && *barrier) { + read_data = *barrier; + barrier++; + } +memcpy (bufp, &read_data,4 ); bufp +=4 ; drvdata->len +=4 ;
@@ -371,6 +388,7 @@ static void tmc_update_etf_buffer(struct coresight_device *csdev, {bool lost = false;int i, cur; +const u32 *barrier;u32 *buf_ptr;u32 read_ptr, write_ptr;u32 status, to_read;
@@ -451,12 +469,18 @@ static void tmc_update_etf_buffer(struct coresight_device *csdev, cur = buf->cur; offset = buf->offset; + barrier = barrier_pkt;/* for every byte to read */ for (i =0 ; i < to_read; i +=4 ) { buf_ptr = buf->data_pages[cur] + offset; *buf_ptr =readl_relaxed (drvdata->base +TMC_RRD ); +if (lost && *barrier) { + *buf_ptr = *barrier; + barrier++; + } + offset +=4 ;if (offset >=PAGE_SIZE ) { offset =0 ;
drivers/hwtracing/coresight/coresight-tmc-etr.c +12 -0
@@ -59,6 +59,8 @@ static void tmc_etr_enable_hw(struct tmc_drvdata *drvdata)static void tmc_etr_dump_hw (struct tmc_drvdata *drvdata) { +const u32 *barrier; +u32 *temp;u32 rwp, val; rwp =readl_relaxed (drvdata->base +TMC_RWP );
@@ -71,6 +73,16 @@ static void tmc_etr_dump_hw(struct tmc_drvdata *drvdata)if (val &TMC_STS_FULL ) { drvdata->buf = drvdata->vaddr + rwp - drvdata->paddr; drvdata->len = drvdata->size; + + barrier = barrier_pkt; + temp = (u32 *)drvdata->buf; + +while (*barrier) { + *temp = *barrier; + temp++; + barrier++; + } + }else { drvdata->buf = drvdata->vaddr; drvdata->len = rwp - drvdata->paddr;
drivers/hwtracing/coresight/coresight.c +8 -0
@@ -53,6 +53,14 @@ static DEFINE_PER_CPU(struct list_head *, tracer_path);*/ static struct list_head *stm_path; +/* +* When losing synchronisation a new barrier packet needs to be inserted at the +* beginning of the data collected in a buffer. That way the decoder knows that +* it needs to look for another sync sequence. +*/ +const u32 barrier_pkt[5 ] = {0x7fffffff ,0x7fffffff , +0x7fffffff ,0x7fffffff ,0x0 }; +static int coresight_id_match (struct device *dev,void *data) {int trace_id, i_trace_id;
Signature · 1 line
2.7.4
PATCH 4/26 coresight: etb10: Move etb_disable_hw() outside of lock
In reply to Mathieu PoirierFunction etb_disable_hw() is already taking care of unlocking and locking the coresight access register and as such doesn't need to be placed within the unlock/lock of function etb_update_buffer().
--- drivers/hwtracing/coresight/coresight-etb10.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwtracing/coresight/coresight-etb10.c +1 -1
@@ -376,8 +376,8 @@ static void etb_update_buffer(struct coresight_device *csdev, capacity = drvdata->buffer_depth *ETB_FRAME_SIZE_WORDS ; -CS_UNLOCK (drvdata->base);etb_disable_hw (drvdata); +CS_UNLOCK (drvdata->base);/* unit is in words, not bytes */ read_ptr =readl_relaxed (drvdata->base +ETB_RAM_READ_POINTER );
Signature · 1 line
2.7.4
PATCH 5/26 coresight: etm3x: Set synchronisation frequencty to TRM default
In reply to Mathieu PoirierRegister ETMSYNCFR holds the number of by that need to be generated before periodic synchronisation packets are inserted in the trace stream. By zeroing out the config structure, the current code effectively disable periodic synchronization.
This patch simply initialise the recommended value for this register as specified in the technical reference manual.
--- drivers/hwtracing/coresight/coresight-etm3x.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/hwtracing/coresight/coresight-etm3x.c +2 -0
@@ -243,6 +243,8 @@ void etm_set_default(struct etm_config *config) } config->ctxid_mask =0x0 ; +/* Setting default to 1024 as per TRM recommendation */ + config->sync_freq =0x400 ; }void etm_config_trace_mode (struct etm_config *config)
Signature · 1 line
2.7.4
PATCH 6/26 hwtracing: coresight: constify attribute_group structures.
In reply to Mathieu PoirierFrom: Arvind Yadav <[email protected]>
attribute_groups are not supposed to change at runtime. All functions working with attribute_groups provided by <linux/sysfs.h> work with const attribute_group. So mark the non-const structs as const.
File size before:
text data bss dec hex filename
2573 288 296 3157 c55 coresight-etm-perf.o
File size After adding 'const':
text data bss dec hex filename 2613 224 296 3133 c3d coresight-etm-perf.o
--- drivers/hwtracing/coresight/coresight-etm-perf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwtracing/coresight/coresight-etm-perf.c +1 -1
@@ -60,7 +60,7 @@ static struct attribute *etm_config_formats_attr[] = { NULL, }; -static struct attribute_group etm_pmu_format_group = { +static const struct attribute_group etm_pmu_format_group = { .name ="format" , .attrs = etm_config_formats_attr, };
Signature · 1 line
2.7.4
PATCH 7/26 coresight: pmu: Adds return stack option to perf coresight pmu
In reply to Mathieu PoirierFrom: Mike Leach <[email protected]>
Return stack is a programmable option on some ETM and PTM hardware. Adds the option flags to enable this from the perf event command line.
--- drivers/hwtracing/coresight/coresight-etm-perf.c | 2 ++ include/linux/coresight-pmu.h | 1 + tools/include/linux/coresight-pmu.h | 1 + 3 files changed, 4 insertions(+)
drivers/hwtracing/coresight/coresight-etm-perf.c +2 -0
@@ -53,10 +53,12 @@ static DEFINE_PER_CPU(struct coresight_device *, csdev_src);/* ETMv3.5/PTM's ETMCR is 'config' */ PMU_FORMAT_ATTR (cycacc,"config:" __stringify(ETM_OPT_CYCACC ));PMU_FORMAT_ATTR (timestamp,"config:" __stringify(ETM_OPT_TS )); +PMU_FORMAT_ATTR (retstack,"config:" __stringify(ETM_OPT_RETSTK ));static struct attribute *etm_config_formats_attr[] = { &format_attr_cycacc.attr, &format_attr_timestamp.attr, + &format_attr_retstack.attr,NULL , };
include/linux/coresight-pmu.h +1 -0
@@ -24,6 +24,7 @@/* ETMv3.5/PTM's ETMCR config bit */ #define ETM_OPT_CYCACC 12#define ETM_OPT_TS 28 +#define ETM_OPT_RETSTK 29static inline int coresight_get_trace_id (int cpu) {
tools/include/linux/coresight-pmu.h +1 -0
@@ -24,6 +24,7 @@/* ETMv3.5/PTM's ETMCR config bit */ #define ETM_OPT_CYCACC 12#define ETM_OPT_TS 28 +#define ETM_OPT_RETSTK 29static inline int coresight_get_trace_id (int cpu) {
Signature · 1 line
2.7.4
PATCH 8/26 coresight: ptm: Adds trace return stack option programming for PTM.
In reply to Mathieu PoirierFrom: Mike Leach <[email protected]>
Adds handling to program the return stack option into PTM hardware if specified in the perf command line.
If option is not supported by the hardware then it will be ignored. This allows capture to move between core/ETM combinations that have the hardware support to those that do not.
--- drivers/hwtracing/coresight/coresight-etm.h | 1 + drivers/hwtracing/coresight/coresight-etm3x.c | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-)
drivers/hwtracing/coresight/coresight-etm.h +1 -0
@@ -106,6 +106,7 @@#define ETMTECR1_START_STOP BIT(25)/* ETMCCER - 0x1E8 */ #define ETMCCER_TIMESTAMP BIT(22) +#define ETMCCER_RETSTACK BIT(23)#define ETM_MODE_EXCLUDE BIT(0)#define ETM_MODE_CYCACC BIT(1)
drivers/hwtracing/coresight/coresight-etm3x.c +15 -3
@@ -310,7 +310,9 @@ void etm_config_trace_mode(struct etm_config *config) config->addr_type[1 ] =ETM_ADDR_TYPE_RANGE ; } -#define ETM3X_SUPPORTED_OPTIONS (ETMCR_CYC_ACC | ETMCR_TIMESTAMP_EN) +#define ETM3X_SUPPORTED_OPTIONS (ETMCR_CYC_ACC | \ + ETMCR_TIMESTAMP_EN | \ + ETMCR_RETURN_STACK)static int etm_parse_event_config (struct etm_drvdata *drvdata,struct perf_event *event)
@@ -341,14 +343,24 @@ static int etm_parse_event_config(struct etm_drvdata *drvdata,etm_config_trace_mode (config);/* -* At this time only cycle accurate and timestamp options are -* available. +* At this time only cycle accurate, return stack and timestamp +* options are available. */ if (attr->config & ~ETM3X_SUPPORTED_OPTIONS )return -EINVAL ; config->ctrl = attr->config; +/* +* Possible to have cores with PTM (supports ret stack) and ETM +* (never has ret stack) on the same SoC. So if we have a request +* for return stack that can't be honoured on this core then +* clear the bit - trace will still continue normally +*/ +if ((config->ctrl &ETMCR_RETURN_STACK ) && + !(drvdata->etmccer &ETMCCER_RETSTACK )) + config->ctrl &= ~ETMCR_RETURN_STACK ; +return 0 ; }
Signature · 1 line
2.7.4
PATCH 9/26 coresight: etm4x: Adds trace return stack option programming for ETMv4.
In reply to Mathieu PoirierFrom: Mike Leach <[email protected]>
Adds handling to program the return stack option into ETMv4 hardware if specified in the perf command line.
If option is not supported by the hardware then it will be ignored. This allows capture to move between core/ETM combinations that have the hardware support to those that do not.
--- drivers/hwtracing/coresight/coresight-etm4x.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/hwtracing/coresight/coresight-etm4x.c +4 -0
@@ -224,6 +224,10 @@ static int etm4_parse_event_config(struct etmv4_drvdata *drvdata,if (attr->config &BIT (ETM_OPT_TS ))/* bit[11], Global timestamp tracing bit */ config->cfg |=BIT (11 ); +/* return stack - enable if selected and supported */ +if ((attr->config &BIT (ETM_OPT_RETSTK )) && drvdata->retstack) +/* bit[12], Return stack enable bit */ + config->cfg |=BIT (12 ); out:return ret;
Signature · 1 line
2.7.4
PATCH 10/26 coresight replicator: Cleanup programmable replicator naming
In reply to Mathieu PoirierFrom: Suzuki K Poulose <[email protected]>
The Linux coresight drivers define the programmable ATB replicator as Qualcomm replicator, while this is designed by ARM. This can cause confusion to a user selecting the driver. Cleanup all references to make it explicitly clear. This patch :
1) Replace the compatible string for the replicator :
qcom,coresight-replicator1x => arm,coresight-dynamic-replicator
2) Changes the Kconfig symbol (since this is not part of any defconfigs) CORESIGHT_QCOM_REPLICATOR => CORESIGHT_DYNAMIC_REPLICATOR
3) Improves the help message in the Kconfig.
4) Changes the name of the driver and the file :
coresight-replicator-qcom => coresight-dynamic-replicator
---
Documentation/devicetree/bindings/arm/coresight.txt | 4 ++--
drivers/hwtracing/coresight/Kconfig | 10 +++++-----
drivers/hwtracing/coresight/Makefile | 2 +-
...esight-replicator-qcom.c => coresight-dynamic-replicator.c} | 4 +---
4 files changed, 9 insertions(+), 11 deletions(-)
rename drivers/hwtracing/coresight/{coresight-replicator-qcom.c => coresight-dynamic-replicator.c} (97%)Documentation/devicetree/bindings/arm/coresight.txt +2 -2
@@ -34,8 +34,8 @@ its hardware characteristcs. - Embedded Trace Macrocell (version 4.x): "arm,coresight-etm4x", "arm,primecell"; - - Qualcomm Configurable Replicator (version 1.x): - "qcom,coresight-replicator1x", "arm,primecell"; + - Coresight programmable Replicator : + "arm,coresight-dynamic-replicator", "arm,primecell"; - System Trace Macrocell: "arm,coresight-stm", "arm,primecell"; [1]
drivers/hwtracing/coresight/Kconfig +5 -5
@@ -70,13 +70,13 @@ config CORESIGHT_SOURCE_ETM4X for instruction level tracing. Depending on the implemented version data tracing may also be available. -config CORESIGHT_QCOM_REPLICATOR - bool "Qualcomm CoreSight Replicator driver" +config CORESIGHT_DYNAMIC_REPLICATOR + bool "CoreSight Programmable Replicator driver" depends on CORESIGHT_LINKS_AND_SINKS help - This enables support for Qualcomm CoreSight link driver. The - programmable ATB replicator sends the ATB trace stream from the - ETB/ETF to the TPIUi and ETR. + This enables support for dynamic CoreSight replicator link driver. + The programmable ATB replicator allows independent filtering of the + trace data based on the traceid. config CORESIGHT_STM bool "CoreSight System Trace Macrocell driver"
drivers/hwtracing/coresight/Makefile +1 -1
@@ -14,6 +14,6 @@ obj-$(CONFIG_CORESIGHT_SOURCE_ETM3X) += coresight-etm3x.o coresight-etm-cp14.o \ coresight-etm3x-sysfs.o obj-$(CONFIG_CORESIGHT_SOURCE_ETM4X) += coresight-etm4x.o \ coresight-etm4x-sysfs.o -obj-$(CONFIG_CORESIGHT_QCOM_REPLICATOR) += coresight-replicator-qcom.o +obj-$(CONFIG_CORESIGHT_DYNAMIC_REPLICATOR) += coresight-dynamic-replicator.o obj-$(CONFIG_CORESIGHT_STM) += coresight-stm.o obj-$(CONFIG_CORESIGHT_CPU_DEBUG) += coresight-cpu-debug.o
drivers/hwtracing/coresight/coresight-dynamic-replicator.c renamed from drivers/hwtracing/coresight/coresight-replicator-qcom.c +1 -3
@@ -143,7 +143,6 @@ static int replicator_probe(struct amba_device *adev, const struct amba_id *id)if (IS_ERR (drvdata->csdev))return PTR_ERR (drvdata->csdev); -dev_info (dev,"%s initialized\n" , (char *)id->data);return 0 ; }
@@ -179,14 +178,13 @@ static struct amba_id replicator_ids[] = { { .id = 0x0003b909, .mask = 0x0003ffff, - .data = "REPLICATOR 1.0", }, { 0, 0 }, }; static struct amba_driver replicator_driver = { .drv = { - .name = "coresight-replicator-qcom", + .name = "coresight-dynamic-replicator", .pm = &replicator_dev_pm_ops, .suppress_bind_attrs = true, },
Signature · 1 line
2.7.4
PATCH 11/26 coresight: Add support for reading 64bit registers
In reply to Mathieu PoirierFrom: Suzuki K Poulose <[email protected]>
Add support for reading a lower and upper 32bits of a register as a single 64bit register. Also add simplified macros for direct register accesses.
--- drivers/hwtracing/coresight/coresight-priv.h | 29 +++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-)
drivers/hwtracing/coresight/coresight-priv.h +24 -5
@@ -39,23 +39,31 @@#define ETM_MODE_EXCL_USER BIT(31)typedef u32 (*coresight_read_fn )(const struct device *,u32 offset); -#define coresight_simple_func (type, func, name, offset) \ +#define __coresight_simple_func (type, func, name, lo_off, hi_off) \ static ssize_t name##_show(struct device *_dev, \ struct device_attribute *attr, char *buf) \ { \ type *drvdata = dev_get_drvdata(_dev->parent); \ coresight_read_fn fn = func; \ - u32 val; \ + u64 val; \ pm_runtime_get_sync(_dev->parent); \ if (fn) \ - val = fn(_dev->parent, offset); \ + val = (u64)fn(_dev->parent, lo_off); \ else \ - val = readl_relaxed(drvdata->base + offset); \ + val = coresight_read_reg_pair(drvdata->base, \ + lo_off, hi_off); \ pm_runtime_put_sync(_dev->parent); \ - return scnprintf(buf, PAGE_SIZE, "0x%x\n", val); \ + return scnprintf(buf, PAGE_SIZE, "0x%llx\n", val); \ } \ static DEVICE_ATTR_RO(name) +#define coresight_simple_func (type, func, name, offset) \ + __coresight_simple_func(type, func, name, offset, -1) +#define coresight_simple_reg32 (type, name, offset) \ + __coresight_simple_func(type, NULL, name, offset, -1) +#define coresight_simple_reg64 (type, name, lo_off, hi_off) \ + __coresight_simple_func(type, NULL, name, lo_off, hi_off) +extern const u32 barrier_pkt[5 ];enum etm_addr_type {
@@ -108,6 +116,17 @@ static inline void CS_UNLOCK(void __iomem *addr) }while (0 ); } +static inline u64 +coresight_read_reg_pair (void __iomem *addr,s32 lo_offset,s32 hi_offset) +{ +u64 val; + + val =readl_relaxed (addr + lo_offset); + val |= (hi_offset <0 ) ?0 : + (u64 )readl_relaxed (addr + hi_offset) <<32 ; +return val; +} +void coresight_disable_path (struct list_head *path);int coresight_enable_path (struct list_head *path,u32 mode);struct coresight_device *coresight_get_sink (struct list_head *path);
Signature · 1 line
2.7.4
PATCH 12/26 coresight: Use the new helper for defining registers
In reply to Mathieu PoirierFrom: Suzuki K Poulose <[email protected]>
Use the new helpers for exposing coresight component registers, choosing the 64bit variants for appropriate registers.
--- drivers/hwtracing/coresight/coresight-etb10.c | 22 ++++++++-------- .../hwtracing/coresight/coresight-etm3x-sysfs.c | 26 +++++++++---------- .../hwtracing/coresight/coresight-etm4x-sysfs.c | 24 ++++++++--------- drivers/hwtracing/coresight/coresight-stm.c | 30 +++++++++++----------- drivers/hwtracing/coresight/coresight-tmc.c | 30 ++++++++++++---------- 5 files changed, 67 insertions(+), 65 deletions(-)
drivers/hwtracing/coresight/coresight-etb10.c +11 -11
@@ -575,17 +575,17 @@ static const struct file_operations etb_fops = { .llseek = no_llseek, }; -#define coresight_etb10_simple_func (name, offset) \ - coresight_simple_func(struct etb_drvdata, NULL, name, offset) - -coresight_etb10_simple_func (rdp,ETB_RAM_DEPTH_REG ); -coresight_etb10_simple_func (sts,ETB_STATUS_REG ); -coresight_etb10_simple_func (rrp,ETB_RAM_READ_POINTER ); -coresight_etb10_simple_func (rwp,ETB_RAM_WRITE_POINTER ); -coresight_etb10_simple_func (trg,ETB_TRG ); -coresight_etb10_simple_func (ctl,ETB_CTL_REG ); -coresight_etb10_simple_func (ffsr,ETB_FFSR ); -coresight_etb10_simple_func (ffcr,ETB_FFCR ); +#define coresight_etb10_reg (name, offset) \ + coresight_simple_reg32(struct etb_drvdata, name, offset) + +coresight_etb10_reg (rdp,ETB_RAM_DEPTH_REG ); +coresight_etb10_reg (sts,ETB_STATUS_REG ); +coresight_etb10_reg (rrp,ETB_RAM_READ_POINTER ); +coresight_etb10_reg (rwp,ETB_RAM_WRITE_POINTER ); +coresight_etb10_reg (trg,ETB_TRG ); +coresight_etb10_reg (ctl,ETB_CTL_REG ); +coresight_etb10_reg (ffsr,ETB_FFSR ); +coresight_etb10_reg (ffcr,ETB_FFCR );static struct attribute *coresight_etb_mgmt_attrs[] = { &dev_attr_rdp.attr,
drivers/hwtracing/coresight/coresight-etm3x-sysfs.c +13 -13
@@ -1232,19 +1232,19 @@ static struct attribute *coresight_etm_attrs[] = { NULL, }; -#define coresight_etm3x_simple_func (name, offset) \ - coresight_simple_func(struct etm_drvdata, NULL, name, offset) - -coresight_etm3x_simple_func (etmccr,ETMCCR ); -coresight_etm3x_simple_func (etmccer,ETMCCER ); -coresight_etm3x_simple_func (etmscr,ETMSCR ); -coresight_etm3x_simple_func (etmidr,ETMIDR ); -coresight_etm3x_simple_func (etmcr,ETMCR ); -coresight_etm3x_simple_func (etmtraceidr,ETMTRACEIDR ); -coresight_etm3x_simple_func (etmteevr,ETMTEEVR ); -coresight_etm3x_simple_func (etmtssvr,ETMTSSCR ); -coresight_etm3x_simple_func (etmtecr1,ETMTECR1 ); -coresight_etm3x_simple_func (etmtecr2,ETMTECR2 ); +#define coresight_etm3x_reg (name, offset) \ + coresight_simple_reg32(struct etm_drvdata, name, offset) + +coresight_etm3x_reg (etmccr,ETMCCR ); +coresight_etm3x_reg (etmccer,ETMCCER ); +coresight_etm3x_reg (etmscr,ETMSCR ); +coresight_etm3x_reg (etmidr,ETMIDR ); +coresight_etm3x_reg (etmcr,ETMCR ); +coresight_etm3x_reg (etmtraceidr,ETMTRACEIDR ); +coresight_etm3x_reg (etmteevr,ETMTEEVR ); +coresight_etm3x_reg (etmtssvr,ETMTSSCR ); +coresight_etm3x_reg (etmtecr1,ETMTECR1 ); +coresight_etm3x_reg (etmtecr2,ETMTECR2 );static struct attribute *coresight_etm_mgmt_attrs[] = { &dev_attr_etmccr.attr,
drivers/hwtracing/coresight/coresight-etm4x-sysfs.c +12 -12
@@ -2066,23 +2066,23 @@ static u32 etmv4_cross_read(const struct device *dev, u32 offset)return reg.data; } -#define coresight_etm4x_simple_func (name, offset) \ - coresight_simple_func(struct etmv4_drvdata, NULL, name, offset) +#define coresight_etm4x_reg (name, offset) \ + coresight_simple_reg32(struct etmv4_drvdata, name, offset)#define coresight_etm4x_cross_read (name, offset) \ coresight_simple_func(struct etmv4_drvdata, etmv4_cross_read, \ name, offset) -coresight_etm4x_simple_func (trcpdcr,TRCPDCR ); -coresight_etm4x_simple_func (trcpdsr,TRCPDSR ); -coresight_etm4x_simple_func (trclsr,TRCLSR ); -coresight_etm4x_simple_func (trcauthstatus,TRCAUTHSTATUS ); -coresight_etm4x_simple_func (trcdevid,TRCDEVID ); -coresight_etm4x_simple_func (trcdevtype,TRCDEVTYPE ); -coresight_etm4x_simple_func (trcpidr0,TRCPIDR0 ); -coresight_etm4x_simple_func (trcpidr1,TRCPIDR1 ); -coresight_etm4x_simple_func (trcpidr2,TRCPIDR2 ); -coresight_etm4x_simple_func (trcpidr3,TRCPIDR3 ); +coresight_etm4x_reg (trcpdcr,TRCPDCR ); +coresight_etm4x_reg (trcpdsr,TRCPDSR ); +coresight_etm4x_reg (trclsr,TRCLSR ); +coresight_etm4x_reg (trcauthstatus,TRCAUTHSTATUS ); +coresight_etm4x_reg (trcdevid,TRCDEVID ); +coresight_etm4x_reg (trcdevtype,TRCDEVTYPE ); +coresight_etm4x_reg (trcpidr0,TRCPIDR0 ); +coresight_etm4x_reg (trcpidr1,TRCPIDR1 ); +coresight_etm4x_reg (trcpidr2,TRCPIDR2 ); +coresight_etm4x_reg (trcpidr3,TRCPIDR3 );coresight_etm4x_cross_read (trcoslsr,TRCOSLSR );coresight_etm4x_cross_read (trcconfig,TRCCONFIGR );coresight_etm4x_cross_read (trctraceid,TRCTRACEIDR );
drivers/hwtracing/coresight/coresight-stm.c +15 -15
@@ -635,21 +635,21 @@ static ssize_t traceid_store(struct device *dev, }static DEVICE_ATTR_RW (traceid); -#define coresight_stm_simple_func (name, offset) \ - coresight_simple_func(struct stm_drvdata, NULL, name, offset) - -coresight_stm_simple_func (tcsr,STMTCSR ); -coresight_stm_simple_func (tsfreqr,STMTSFREQR ); -coresight_stm_simple_func (syncr,STMSYNCR ); -coresight_stm_simple_func (sper,STMSPER ); -coresight_stm_simple_func (spter,STMSPTER ); -coresight_stm_simple_func (privmaskr,STMPRIVMASKR ); -coresight_stm_simple_func (spscr,STMSPSCR ); -coresight_stm_simple_func (spmscr,STMSPMSCR ); -coresight_stm_simple_func (spfeat1r,STMSPFEAT1R ); -coresight_stm_simple_func (spfeat2r,STMSPFEAT2R ); -coresight_stm_simple_func (spfeat3r,STMSPFEAT3R ); -coresight_stm_simple_func (devid,CORESIGHT_DEVID ); +#define coresight_stm_reg (name, offset) \ + coresight_simple_reg32(struct stm_drvdata, name, offset) + +coresight_stm_reg (tcsr,STMTCSR ); +coresight_stm_reg (tsfreqr,STMTSFREQR ); +coresight_stm_reg (syncr,STMSYNCR ); +coresight_stm_reg (sper,STMSPER ); +coresight_stm_reg (spter,STMSPTER ); +coresight_stm_reg (privmaskr,STMPRIVMASKR ); +coresight_stm_reg (spscr,STMSPSCR ); +coresight_stm_reg (spmscr,STMSPMSCR ); +coresight_stm_reg (spfeat1r,STMSPFEAT1R ); +coresight_stm_reg (spfeat2r,STMSPFEAT2R ); +coresight_stm_reg (spfeat3r,STMSPFEAT3R ); +coresight_stm_reg (devid,CORESIGHT_DEVID );static struct attribute *coresight_stm_attrs[] = { &dev_attr_hwevent_enable.attr,
drivers/hwtracing/coresight/coresight-tmc.c +16 -14
@@ -217,20 +217,22 @@ static enum tmc_mem_intf_width tmc_get_memwidth(u32 devid)return memwidth; } -#define coresight_tmc_simple_func (name, offset) \ - coresight_simple_func(struct tmc_drvdata, NULL, name, offset) - -coresight_tmc_simple_func (rsz,TMC_RSZ ); -coresight_tmc_simple_func (sts,TMC_STS ); -coresight_tmc_simple_func (rrp,TMC_RRP ); -coresight_tmc_simple_func (rwp,TMC_RWP ); -coresight_tmc_simple_func (trg,TMC_TRG ); -coresight_tmc_simple_func (ctl,TMC_CTL ); -coresight_tmc_simple_func (ffsr,TMC_FFSR ); -coresight_tmc_simple_func (ffcr,TMC_FFCR ); -coresight_tmc_simple_func (mode,TMC_MODE ); -coresight_tmc_simple_func (pscr,TMC_PSCR ); -coresight_tmc_simple_func (devid,CORESIGHT_DEVID ); +#define coresight_tmc_reg (name, offset) \ + coresight_simple_reg32(struct tmc_drvdata, name, offset) +#define coresight_tmc_reg64 (name, lo_off, hi_off) \ + coresight_simple_reg64(struct tmc_drvdata, name, lo_off, hi_off) + +coresight_tmc_reg (rsz,TMC_RSZ ); +coresight_tmc_reg (sts,TMC_STS ); +coresight_tmc_reg (trg,TMC_TRG ); +coresight_tmc_reg (ctl,TMC_CTL ); +coresight_tmc_reg (ffsr,TMC_FFSR ); +coresight_tmc_reg (ffcr,TMC_FFCR ); +coresight_tmc_reg (mode,TMC_MODE ); +coresight_tmc_reg (pscr,TMC_PSCR ); +coresight_tmc_reg (devid,CORESIGHT_DEVID ); +coresight_tmc_reg64 (rrp,TMC_RRP ,TMC_RRPHI ); +coresight_tmc_reg64 (rwp,TMC_RWP ,TMC_RWPHI );static struct attribute *coresight_tmc_mgmt_attrs[] = { &dev_attr_rsz.attr,
Signature · 1 line
2.7.4
PATCH 13/26 coresight tmc: Add helpers for accessing 64bit registers
In reply to Mathieu PoirierFrom: Suzuki K Poulose <[email protected]>
Coresight TMC splits 64bit registers into a pair of 32bit registers (e.g DBA, RRP, RWP). Provide helpers to read/write to these registers.
--- drivers/hwtracing/coresight/coresight-priv.h | 8 ++++++++ drivers/hwtracing/coresight/coresight-tmc-etf.c | 8 ++++---- drivers/hwtracing/coresight/coresight-tmc-etr.c | 8 ++++---- drivers/hwtracing/coresight/coresight-tmc.h | 18 ++++++++++++++++++ 4 files changed, 34 insertions(+), 8 deletions(-)
drivers/hwtracing/coresight/coresight-priv.h +8 -0
@@ -127,6 +127,14 @@ coresight_read_reg_pair(void __iomem *addr, s32 lo_offset, s32 hi_offset)return val; } +static inline void coresight_write_reg_pair (void __iomem *addr,u64 val, +s32 lo_offset,s32 hi_offset) +{ +writel_relaxed ((u32 )val, addr + lo_offset); +if (hi_offset >=0 ) +writel_relaxed ((u32)(val >>32 ), addr + hi_offset); +} +void coresight_disable_path (struct list_head *path);int coresight_enable_path (struct list_head *path,u32 mode);struct coresight_device *coresight_get_sink (struct list_head *path);
drivers/hwtracing/coresight/coresight-tmc-etf.c +4 -4
@@ -390,7 +390,7 @@ static void tmc_update_etf_buffer(struct coresight_device *csdev,int i, cur;const u32 *barrier;u32 *buf_ptr; -u32 read_ptr, write_ptr; +u64 read_ptr, write_ptr;u32 status, to_read;unsigned long offset;struct cs_buffers *buf = sink_config;
@@ -407,8 +407,8 @@ static void tmc_update_etf_buffer(struct coresight_device *csdev,tmc_flush_and_stop (drvdata); - read_ptr =readl_relaxed (drvdata->base +TMC_RRP ); - write_ptr =readl_relaxed (drvdata->base +TMC_RWP ); + read_ptr =tmc_read_rrp (drvdata); + write_ptr =tmc_read_rwp (drvdata);/* * Get a hold of the status register and see if a wrap around
@@ -460,7 +460,7 @@ static void tmc_update_etf_buffer(struct coresight_device *csdev,if (read_ptr > (drvdata->size -1 )) read_ptr -= drvdata->size;/* Tell the HW */ -writel_relaxed (read_ptr, drvdata->base +TMC_RRP ); +tmc_write_rrp (drvdata, read_ptr); lost = true; }
drivers/hwtracing/coresight/coresight-tmc-etr.c +4 -4
@@ -44,9 +44,8 @@ static void tmc_etr_enable_hw(struct tmc_drvdata *drvdata) ~(TMC_AXICTL_PROT_CTL_B0 | TMC_AXICTL_PROT_CTL_B1)) |TMC_AXICTL_PROT_CTL_B1 ;writel_relaxed (axictl, drvdata->base +TMC_AXICTL ); +tmc_write_dba (drvdata, drvdata->paddr); -writel_relaxed (drvdata->paddr, drvdata->base +TMC_DBALO ); -writel_relaxed (0x0 , drvdata->base +TMC_DBAHI ); writel_relaxed(TMC_FFCR_EN_FMT | TMC_FFCR_EN_TI | TMC_FFCR_FON_FLIN | TMC_FFCR_FON_TRIG_EVT | TMC_FFCR_TRIGON_TRIGIN,
@@ -60,10 +59,11 @@ static void tmc_etr_enable_hw(struct tmc_drvdata *drvdata)static void tmc_etr_dump_hw (struct tmc_drvdata *drvdata) {const u32 *barrier; +u32 val;u32 *temp; -u32 rwp, val; +u64 rwp; - rwp =readl_relaxed (drvdata->base +TMC_RWP ); + rwp =tmc_read_rwp (drvdata); val =readl_relaxed (drvdata->base +TMC_STS );/*
drivers/hwtracing/coresight/coresight-tmc.h +18 -0
@@ -139,4 +139,22 @@ extern const struct coresight_ops tmc_etf_cs_ops;int tmc_read_prepare_etr (struct tmc_drvdata *drvdata);int tmc_read_unprepare_etr (struct tmc_drvdata *drvdata);extern const struct coresight_ops tmc_etr_cs_ops; + + +#define TMC_REG_PAIR (name, lo_off, hi_off) \ +static inline u64 \ +tmc_read_##name(struct tmc_drvdata *drvdata) \ +{ \ + return coresight_read_reg_pair(drvdata->base, lo_off, hi_off); \ +} \ +static inline void \ +tmc_write_##name(struct tmc_drvdata *drvdata, u64 val) \ +{ \ + coresight_write_reg_pair(drvdata->base, val, lo_off, hi_off); \ +} + +TMC_REG_PAIR(rrp, TMC_RRP, TMC_RRPHI) +TMC_REG_PAIR(rwp, TMC_RWP, TMC_RWPHI) +TMC_REG_PAIR(dba, TMC_DBALO, TMC_DBAHI) +#endif
Signature · 1 line
2.7.4
PATCH 14/26 coresight tmc: Expose DBA and AXICTL
In reply to Mathieu PoirierFrom: Suzuki K Poulose <[email protected]>
Expose DBALO,DBAHI and AXICTL registers
--- drivers/hwtracing/coresight/coresight-tmc.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/hwtracing/coresight/coresight-tmc.c +4 -0
@@ -230,9 +230,11 @@ coresight_tmc_reg(ffsr, TMC_FFSR);coresight_tmc_reg (ffcr,TMC_FFCR );coresight_tmc_reg (mode,TMC_MODE );coresight_tmc_reg (pscr,TMC_PSCR ); +coresight_tmc_reg (axictl,TMC_AXICTL );coresight_tmc_reg (devid,CORESIGHT_DEVID );coresight_tmc_reg64 (rrp,TMC_RRP ,TMC_RRPHI );coresight_tmc_reg64 (rwp,TMC_RWP ,TMC_RWPHI ); +coresight_tmc_reg64 (dba,TMC_DBALO ,TMC_DBAHI );static struct attribute *coresight_tmc_mgmt_attrs[] = { &dev_attr_rsz.attr,
@@ -246,6 +248,8 @@ static struct attribute *coresight_tmc_mgmt_attrs[] = { &dev_attr_mode.attr, &dev_attr_pscr.attr, &dev_attr_devid.attr, + &dev_attr_dba.attr, + &dev_attr_axictl.attr, NULL, };
Signature · 1 line
2.7.4
PATCH 15/26 coresight replicator: Expose replicator management registers
In reply to Mathieu PoirierFrom: Suzuki K Poulose <[email protected]>
Expose the idfilter* registers of the programmable replicator.
--- .../coresight/coresight-dynamic-replicator.c | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+)
drivers/hwtracing/coresight/coresight-dynamic-replicator.c +23 -0
@@ -95,6 +95,28 @@ static const struct coresight_ops replicator_cs_ops = { .link_ops = &replicator_link_ops, }; +#define coresight_replicator_reg (name, offset) \ + coresight_simple_reg32(struct replicator_state, name, offset) + +coresight_replicator_reg (idfilter0,REPLICATOR_IDFILTER0 ); +coresight_replicator_reg (idfilter1,REPLICATOR_IDFILTER1 ); + +static struct attribute *replicator_mgmt_attrs[] = { + &dev_attr_idfilter0.attr, + &dev_attr_idfilter1.attr, +NULL , +}; + +static const struct attribute_group replicator_mgmt_group = { + .attrs = replicator_mgmt_attrs, + .name ="mgmt" , +}; + +static const struct attribute_group *replicator_groups[] = { + &replicator_mgmt_group, +NULL , +}; +static int replicator_probe (struct amba_device *adev,const struct amba_id *id) {int ret;
@@ -139,6 +161,7 @@ static int replicator_probe(struct amba_device *adev, const struct amba_id *id) desc.ops = &replicator_cs_ops; desc.pdata = adev->dev.platform_data; desc.dev = &adev->dev; + desc.groups = replicator_groups; drvdata->csdev =coresight_register (&desc);if (IS_ERR (drvdata->csdev))return PTR_ERR (drvdata->csdev);
Signature · 1 line
2.7.4
PATCH 16/26 coresight tmc: Handle configuration types properly
In reply to Mathieu PoirierFrom: Suzuki K Poulose <[email protected]>
Coresight SoC 600 defines a new configuration for TMC, Embedded Trace Streamer (ETS), indicated by 0x3 in MODE:CONFIG_TYPE. This would break the existing driver which will treat anything other than ETR/ETB as an ETF. Fix the driver to check the configuration type properly and also add a warning if we encounter an unsupported configuration (ETS).
--- drivers/hwtracing/coresight/coresight-tmc.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/hwtracing/coresight/coresight-tmc.c +11 -3
@@ -360,11 +360,13 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) desc.dev = dev; desc.groups = coresight_tmc_groups; -if (drvdata->config_type ==TMC_CONFIG_TYPE_ETB ) { +switch (drvdata->config_type) { +case TMC_CONFIG_TYPE_ETB : desc.type =CORESIGHT_DEV_TYPE_SINK ; desc.subtype.sink_subtype =CORESIGHT_DEV_SUBTYPE_SINK_BUFFER ; desc.ops = &tmc_etb_cs_ops; - }else if (drvdata->config_type ==TMC_CONFIG_TYPE_ETR ) { +break ; +case TMC_CONFIG_TYPE_ETR : desc.type =CORESIGHT_DEV_TYPE_SINK ; desc.subtype.sink_subtype =CORESIGHT_DEV_SUBTYPE_SINK_BUFFER ; desc.ops = &tmc_etr_cs_ops;
@@ -375,10 +377,16 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) ret =dma_set_mask_and_coherent (dev,DMA_BIT_MASK (40 ));if (ret) goto out; - }else { +break ; +case TMC_CONFIG_TYPE_ETF : desc.type =CORESIGHT_DEV_TYPE_LINKSINK ; desc.subtype.link_subtype =CORESIGHT_DEV_SUBTYPE_LINK_FIFO ; desc.ops = &tmc_etf_cs_ops; +break ; +default : +pr_err ("%s: Unsupported TMC config\n" , pdata->name); + ret = -EINVAL ; + goto out; } drvdata->csdev =coresight_register (&desc);
Signature · 1 line
2.7.4
PATCH 17/26 coresight tmc etr: Add capabilitiy information
In reply to Mathieu PoirierFrom: Suzuki K Poulose <[email protected]>
With new version of TMC ETR, there are differing set of features supported by the TMC. Add the capability of a given TMC ETR for making safer decisions at runtime.
The device configuration register of the TMC (DEVID) lists some of the capabilities. So, we can detect some of them at probe. However, some of the features (or changes in behavior) are not advertised and we have to depend on the PID to infer the features. So we use a static description of the "unadvertised" capabilities attached to the PID. Combining both, the static and the dynamic capabilities, we maintain a bitmask of the available features which can be later checked to take appropriate actions.
--- drivers/hwtracing/coresight/coresight-tmc.c | 20 +++++++++++++++----- drivers/hwtracing/coresight/coresight-tmc.h | 20 ++++++++++++++++++++ 2 files changed, 35 insertions(+), 5 deletions(-)
drivers/hwtracing/coresight/coresight-tmc.c +15 -5
@@ -299,6 +299,20 @@ const struct attribute_group *coresight_tmc_groups[] = { NULL, }; +/* Detect and initialise the capabilities of a TMC ETR */ +static int tmc_etr_setup_caps (struct tmc_drvdata *drvdata, +u32 devid,void *dev_caps) +{ +/* Set the unadvertised capabilities */ +tmc_etr_init_caps (drvdata, (u32 )(unsigned long )dev_caps); + +/* +* ETR configuration uses a 40-bit AXI master in place of +* the embedded SRAM of ETB/ETF. +*/ +return dma_set_mask_and_coherent (drvdata->dev,DMA_BIT_MASK (40 )); +} +static int tmc_probe (struct amba_device *adev,const struct amba_id *id) {int ret =0 ;
@@ -370,11 +384,7 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) desc.type =CORESIGHT_DEV_TYPE_SINK ; desc.subtype.sink_subtype =CORESIGHT_DEV_SUBTYPE_SINK_BUFFER ; desc.ops = &tmc_etr_cs_ops; -/* -* ETR configuration uses a 40-bit AXI master in place of -* the embedded SRAM of ETB/ETF. -*/ - ret =dma_set_mask_and_coherent (dev,DMA_BIT_MASK (40 )); + ret =tmc_etr_setup_caps (drvdata, devid, id->data);if (ret) goto out;break ;
drivers/hwtracing/coresight/coresight-tmc.h +20 -0
@@ -104,6 +104,8 @@ enum tmc_mem_intf_width {* @config_type: TMC variant, must be of type @tmc_config_type. * @memwidth: width of the memory interface databus, in bytes. * @trigger_cntr: amount of words to store after a trigger. +* @etr_caps: Bitmask of capabilities of the TMC ETR, inferred from the +* device configuration register (DEVID) */ struct tmc_drvdata {void __iomem *base;
@@ -121,6 +123,7 @@ struct tmc_drvdata {enum tmc_config_type config_type;enum tmc_mem_intf_width memwidth;u32 trigger_cntr; +u32 etr_caps; };/* Generic functions */
@@ -157,4 +160,21 @@ TMC_REG_PAIR(rrp, TMC_RRP, TMC_RRPHI) TMC_REG_PAIR(rwp, TMC_RWP, TMC_RWPHI)TMC_REG_PAIR (dba,TMC_DBALO ,TMC_DBAHI ) +/* Initialise the caps from unadvertised static capabilities of the device */ +static inline void tmc_etr_init_caps (struct tmc_drvdata *drvdata,u32 dev_caps) +{ +WARN_ON (drvdata->etr_caps); + drvdata->etr_caps = dev_caps; +} + +static inline void tmc_etr_set_cap (struct tmc_drvdata *drvdata,u32 cap) +{ + drvdata->etr_caps |= cap; +} + +static inline bool tmc_etr_has_cap (struct tmc_drvdata *drvdata,u32 cap) +{ +return !!(drvdata->etr_caps & cap); +} +#endif
Signature · 1 line
2.7.4
PATCH 18/26 coresight tmc: Detect support for scatter gather
In reply to Mathieu PoirierFrom: Suzuki K Poulose <[email protected]>
The SG unit in the TMC has been removed in Coresight SoC-600. This is however advertised by DEVID:Bit 24 = 0b1. On the previous generation, the bit is RES0, hence we can rely on the DEVID to detect the support.
--- drivers/hwtracing/coresight/coresight-tmc.c | 2 ++ drivers/hwtracing/coresight/coresight-tmc.h | 5 +++++ 2 files changed, 7 insertions(+)
drivers/hwtracing/coresight/coresight-tmc.c +2 -0
@@ -306,6 +306,8 @@ static int tmc_etr_setup_caps(struct tmc_drvdata *drvdata,/* Set the unadvertised capabilities */ tmc_etr_init_caps (drvdata, (u32 )(unsigned long )dev_caps); +if (!(devid &TMC_DEVID_NOSCAT )) +tmc_etr_set_cap (drvdata,TMC_ETR_SG );/* * ETR configuration uses a 40-bit AXI master in place of * the embedded SRAM of ETB/ETF.
drivers/hwtracing/coresight/coresight-tmc.h +5 -0
@@ -69,6 +69,8 @@#define TMC_FFCR_STOP_ON_FLUSH BIT(12) +#define TMC_DEVID_NOSCAT BIT(24) +enum tmc_config_type {TMC_CONFIG_TYPE_ETB ,TMC_CONFIG_TYPE_ETR ,
@@ -88,6 +90,9 @@ enum tmc_mem_intf_width { TMC_MEM_INTF_WIDTH_256BITS = 8, }; +/* TMC ETR Capability bit definitions */ +#define TMC_ETR_SG (0x1U << 0) +/** * struct tmc_drvdata - specifics associated to an TMC component * @base: memory mapped base address for this component.
Signature · 1 line
2.7.4
PATCH 19/26 coresight tmc etr: Detect address width at runtime
In reply to Mathieu PoirierFrom: Suzuki K Poulose <[email protected]>
TMC in Coresight SoC-600 advertises the AXI address width in the device configuration register.
Bit 16 - AXIAW_VALID
0 - AXI Address Width not valid
1 - Valid AXI Address width in Bits[23-17]
Bits [23-17] - AXIAW. If AXIAW_VALID = b01 then
0x20 - 32bit AXI address bus
0x28 - 40bit AXI address bus
0x2c - 44bit AXI address bus
0x30 - 48bit AXI address bus
0x34 - 52bit AXI address bus
Use the address bits from the device configuration register, if available. Otherwise, default to 40bit.
--- drivers/hwtracing/coresight/coresight-tmc.c | 26 +++++++++++++++++++++++--- drivers/hwtracing/coresight/coresight-tmc.h | 4 ++++ 2 files changed, 27 insertions(+), 3 deletions(-)
drivers/hwtracing/coresight/coresight-tmc.c +23 -3
@@ -303,16 +303,36 @@ const struct attribute_group *coresight_tmc_groups[] = {static int tmc_etr_setup_caps (struct tmc_drvdata *drvdata,u32 devid,void *dev_caps) { +u32 dma_mask =0 ; +/* Set the unadvertised capabilities */ tmc_etr_init_caps (drvdata, (u32 )(unsigned long )dev_caps);if (!(devid &TMC_DEVID_NOSCAT ))tmc_etr_set_cap (drvdata,TMC_ETR_SG ); + +/* Check if the AXI address width is available */ +if (devid &TMC_DEVID_AXIAW_VALID ) + dma_mask = ((devid >>TMC_DEVID_AXIAW_SHIFT ) & +TMC_DEVID_AXIAW_MASK ); +/* -* ETR configuration uses a 40-bit AXI master in place of -* the embedded SRAM of ETB/ETF. +* Unless specified in the device configuration, ETR uses a 40-bit +* AXI master in place of the embedded SRAM of ETB/ETF. */ -return dma_set_mask_and_coherent (drvdata->dev,DMA_BIT_MASK (40 )); +switch (dma_mask) { +case 32 : +case 40 : +case 44 : +case 48 : +case 52 : +dev_info (drvdata->dev,"Detected dma mask %dbits\n" , dma_mask); +break ; +default : + dma_mask =40 ; + } + +return dma_set_mask_and_coherent (drvdata->dev,DMA_BIT_MASK (dma_mask)); }static int tmc_probe (struct amba_device *adev,const struct amba_id *id)
drivers/hwtracing/coresight/coresight-tmc.h +4 -0
@@ -71,6 +71,10 @@#define TMC_DEVID_NOSCAT BIT(24) +#define TMC_DEVID_AXIAW_VALID BIT(16) +#define TMC_DEVID_AXIAW_SHIFT 17 +#define TMC_DEVID_AXIAW_MASK 0x7f +enum tmc_config_type {TMC_CONFIG_TYPE_ETB ,TMC_CONFIG_TYPE_ETR ,
Signature · 1 line
2.7.4
PATCH 20/26 coresight tmc etr: Cleanup AXICTL register handling
In reply to Mathieu PoirierFrom: Suzuki K Poulose <[email protected]>
This patch cleans up how we setup the AXICTL register on TMC ETR. At the moment we don't set the CacheCtrl bits, which drives the arcache and awcache bits on AXI bus specifying the cacheablitiy. Set this to Write-back Read and Write-allocate.
--- drivers/hwtracing/coresight/coresight-tmc-etr.c | 10 +++------- drivers/hwtracing/coresight/coresight-tmc.h | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 8 deletions(-)
drivers/hwtracing/coresight/coresight-tmc-etr.c +3 -7
@@ -36,13 +36,9 @@ static void tmc_etr_enable_hw(struct tmc_drvdata *drvdata)writel_relaxed (TMC_MODE_CIRCULAR_BUFFER , drvdata->base +TMC_MODE ); axictl =readl_relaxed (drvdata->base +TMC_AXICTL ); - axictl |=TMC_AXICTL_WR_BURST_16 ; -writel_relaxed (axictl, drvdata->base +TMC_AXICTL ); - axictl &= ~TMC_AXICTL_SCT_GAT_MODE ; -writel_relaxed (axictl, drvdata->base +TMC_AXICTL ); - axictl = (axictl & - ~(TMC_AXICTL_PROT_CTL_B0 |TMC_AXICTL_PROT_CTL_B1 )) | -TMC_AXICTL_PROT_CTL_B1 ; + axictl &= ~TMC_AXICTL_CLEAR_MASK ; + axictl |= (TMC_AXICTL_PROT_CTL_B1 |TMC_AXICTL_WR_BURST_16 ); + axictl |=TMC_AXICTL_AXCACHE_OS ;writel_relaxed (axictl, drvdata->base +TMC_AXICTL );tmc_write_dba (drvdata, drvdata->paddr);
drivers/hwtracing/coresight/coresight-tmc.h +16 -1
@@ -54,11 +54,26 @@#define TMC_STS_TMCREADY_BIT 2#define TMC_STS_FULL BIT(0)#define TMC_STS_TRIGGERED BIT(1) -/* TMC_AXICTL - 0x110 */ +/* +* TMC_AXICTL - 0x110 +* +* TMC AXICTL format for SoC-400 +* Bits [0-1] : ProtCtrlBit0-1 +* Bits [2-5] : CacheCtrlBits 0-3 (AxCACHE) +* Bit 6 : Reserved +* Bit 7 : ScatterGatherMode +* Bits [8-11] : WrBurstLen +* Bits [12-31] : Reserved. +*/ +#define TMC_AXICTL_CLEAR_MASK 0xfbf +#define TMC_AXICTL_PROT_CTL_B0 BIT(0)#define TMC_AXICTL_PROT_CTL_B1 BIT(1)#define TMC_AXICTL_SCT_GAT_MODE BIT(7)#define TMC_AXICTL_WR_BURST_16 0xF00 +/* Write-back Read and Write-allocate */ +#define TMC_AXICTL_AXCACHE_OS (0xf << 2) +/* TMC_FFCR - 0x304 */ #define TMC_FFCR_FLUSHMAN_BIT 6#define TMC_FFCR_EN_FMT BIT(0)
Signature · 1 line
2.7.4
PATCH 21/26 coresight tmc etr: Setup AXI cache encoding for read transfers
In reply to Mathieu PoirierFrom: Suzuki K Poulose <[email protected]>
If the ETR supports split cache encoding (i.e, separate bits for read and write transfers) unlike the older version (where read and write transfers use the same encoding in AXICTL[2-5]). This feature is not advertised and has to be described by the static mask associated with the device id.
--- drivers/hwtracing/coresight/coresight-tmc-etr.c | 6 ++++++ drivers/hwtracing/coresight/coresight-tmc.h | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletion(-)
drivers/hwtracing/coresight/coresight-tmc-etr.c +6 -0
@@ -39,6 +39,12 @@ static void tmc_etr_enable_hw(struct tmc_drvdata *drvdata) axictl &= ~TMC_AXICTL_CLEAR_MASK ; axictl |= (TMC_AXICTL_PROT_CTL_B1 |TMC_AXICTL_WR_BURST_16 ); axictl |=TMC_AXICTL_AXCACHE_OS ; + +if (tmc_etr_has_cap (drvdata,TMC_ETR_AXI_ARCACHE )) { + axictl &= ~TMC_AXICTL_ARCACHE_MASK ; + axictl |=TMC_AXICTL_ARCACHE_OS ; + } +writel_relaxed (axictl, drvdata->base +TMC_AXICTL );tmc_write_dba (drvdata, drvdata->paddr);
drivers/hwtracing/coresight/coresight-tmc.h +9 -1
@@ -59,13 +59,18 @@* * TMC AXICTL format for SoC-400 * Bits [0-1] : ProtCtrlBit0-1 -* Bits [2-5] : CacheCtrlBits 0-3 (AxCACHE) +* Bits [2-5] : CacheCtrlBits 0-3 (AXCACHE) * Bit 6 : Reserved * Bit 7 : ScatterGatherMode * Bits [8-11] : WrBurstLen * Bits [12-31] : Reserved. +* TMC AXICTL format for SoC-600, as above except: +* Bits [2-5] : AXI WCACHE +* Bits [16-19] : AXI RCACHE +* Bits [20-31] : Reserved */ #define TMC_AXICTL_CLEAR_MASK 0xfbf +#define TMC_AXICTL_ARCACHE_MASK (0xf << 16)#define TMC_AXICTL_PROT_CTL_B0 BIT(0)#define TMC_AXICTL_PROT_CTL_B1 BIT(1)
@@ -73,6 +78,7 @@#define TMC_AXICTL_WR_BURST_16 0xF00/* Write-back Read and Write-allocate */ #define TMC_AXICTL_AXCACHE_OS (0xf << 2) +#define TMC_AXICTL_ARCACHE_OS (0xf << 16)/* TMC_FFCR - 0x304 */ #define TMC_FFCR_FLUSHMAN_BIT 6
@@ -111,6 +117,8 @@ enum tmc_mem_intf_width {/* TMC ETR Capability bit definitions */ #define TMC_ETR_SG (0x1U << 0) +/* ETR has separate read/write cache encodings */ +#define TMC_ETR_AXI_ARCACHE (0x1U << 1)/** * struct tmc_drvdata - specifics associated to an TMC component
Signature · 1 line
2.7.4
PATCH 22/26 coresight tmc: Support for save-restore in ETR
In reply to Mathieu PoirierFrom: Suzuki K Poulose <[email protected]>
The Coresight SoC 600 TMC ETR supports save-restore feature, where the values of the RRP/RWP and STS.Full are retained when it leaves the Disabled state. Hence, we must program the RRP/RWP and STS.Full to a proper value. For now, set the RRP/RWP to the base address of the buffer and clear the STS.Full register. This can be later exploited for proper save-restore of ETR trace contexts (e.g, perf).
--- drivers/hwtracing/coresight/coresight-tmc-etr.c | 13 ++++++++++++- drivers/hwtracing/coresight/coresight-tmc.h | 9 +++++++++ 2 files changed, 21 insertions(+), 1 deletion(-)
drivers/hwtracing/coresight/coresight-tmc-etr.c +12 -1
@@ -22,7 +22,7 @@static void tmc_etr_enable_hw (struct tmc_drvdata *drvdata) { -u32 axictl; +u32 axictl, sts;/* Zero out the memory to help with debug */ memset (drvdata->vaddr,0 , drvdata->size);
@@ -47,6 +47,17 @@ static void tmc_etr_enable_hw(struct tmc_drvdata *drvdata)writel_relaxed (axictl, drvdata->base +TMC_AXICTL );tmc_write_dba (drvdata, drvdata->paddr); +/* +* If the TMC pointers must be programmed before the session, +* we have to set it properly (i.e, RRP/RWP to base address and +* STS to "not full"). +*/ +if (tmc_etr_has_cap (drvdata,TMC_ETR_SAVE_RESTORE )) { +tmc_write_rrp (drvdata, drvdata->paddr); +tmc_write_rwp (drvdata, drvdata->paddr); + sts =readl_relaxed (drvdata->base +TMC_STS ) & ~TMC_STS_FULL ; +writel_relaxed (sts, drvdata->base +TMC_STS ); + } writel_relaxed(TMC_FFCR_EN_FMT | TMC_FFCR_EN_TI | TMC_FFCR_FON_FLIN | TMC_FFCR_FON_TRIG_EVT |
drivers/hwtracing/coresight/coresight-tmc.h +9 -0
@@ -119,6 +119,15 @@ enum tmc_mem_intf_width {#define TMC_ETR_SG (0x1U << 0)/* ETR has separate read/write cache encodings */ #define TMC_ETR_AXI_ARCACHE (0x1U << 1) +/* +* TMC_ETR_SAVE_RESTORE - Values of RRP/RWP/STS.Full are +* retained when TMC leaves Disabled state, allowing us to continue +* the tracing from a point where we stopped. This also implies that +* the RRP/RWP/STS.Full should always be programmed to the correct +* value. Unfortunately this is not advertised by the hardware, +* so we have to rely on PID of the IP to detect the functionality. +*/ +#define TMC_ETR_SAVE_RESTORE (0x1U << 2)/** * struct tmc_drvdata - specifics associated to an TMC component
Signature · 1 line
2.7.4
PATCH 23/26 coresight tmc: Add support for Coresight SoC 600 TMC
In reply to Mathieu PoirierFrom: Suzuki K Poulose <[email protected]>
The coresight SoC 600 supports ETR save-restore which allows us to restore a trace session by retaining the RRP/RWP/STS.Full values when the TMC leaves the Disabled state. However, the TMC doesn't have a scatter-gather unit in built.
Also, TMCs have different PIDs in different configurations (ETF, ETB & ETR), unlike the previous generation.
While the DEVID exposes some of the features/changes in the TMC, it doesn't explicitly advertises the new save-restore feature as described above.
--- drivers/hwtracing/coresight/coresight-tmc.c | 16 ++++++++++++++++ drivers/hwtracing/coresight/coresight-tmc.h | 4 ++++ 2 files changed, 20 insertions(+)
drivers/hwtracing/coresight/coresight-tmc.c +16 -0
@@ -442,6 +442,22 @@ static struct amba_id tmc_ids[] = { .id = 0x0003b961, .mask = 0x0003ffff, }, + { + /* Coresight SoC 600 TMC-ETR/ETS */ + .id = 0x000bb9e8, + .mask = 0x000fffff, + .data = (void *)(unsigned long)CORESIGHT_SOC_600_ETR_CAPS, + }, + { + /* Coresight SoC 600 TMC-ETB */ + .id = 0x000bb9e9, + .mask = 0x000fffff, + }, + { + /* Coresight SoC 600 TMC-ETF */ + .id = 0x000bb9ea, + .mask = 0x000fffff, + }, { 0, 0}, };
drivers/hwtracing/coresight/coresight-tmc.h +4 -0
@@ -129,6 +129,10 @@ enum tmc_mem_intf_width {*/ #define TMC_ETR_SAVE_RESTORE (0x1U << 2) +/* Coresight SoC-600 TMC-ETR unadvertised capabilities */ +#define CORESIGHT_SOC_600_ETR_CAPS \ + (TMC_ETR_SAVE_RESTORE | TMC_ETR_AXI_ARCACHE) +/** * struct tmc_drvdata - specifics associated to an TMC component * @base: memory mapped base address for this component.
Signature · 1 line
2.7.4
PATCH 24/26 coresight: Add support for Coresight SoC 600 components
In reply to Mathieu PoirierFrom: Suzuki K Poulose <[email protected]>
Add the peripheral ids for the Coresight SoC 600 TPIU, replicator and funnel.
--- drivers/hwtracing/coresight/coresight-dynamic-replicator.c | 5 +++++ drivers/hwtracing/coresight/coresight-funnel.c | 5 +++++ drivers/hwtracing/coresight/coresight-tpiu.c | 5 +++++ 3 files changed, 15 insertions(+)
drivers/hwtracing/coresight/coresight-dynamic-replicator.c +5 -0
@@ -202,6 +202,11 @@ static struct amba_id replicator_ids[] = { .id = 0x0003b909, .mask = 0x0003ffff, }, + { + /* Coresight SoC-600 */ + .id = 0x000bb9ec, + .mask = 0x000fffff, + }, { 0, 0 }, };
drivers/hwtracing/coresight/coresight-funnel.c +5 -0
@@ -251,6 +251,11 @@ static struct amba_id funnel_ids[] = { .id = 0x0003b908, .mask = 0x0003ffff, }, + { + /* Coresight SoC-600 */ + .id = 0x000bb9eb, + .mask = 0x000fffff, + }, { 0, 0}, };
drivers/hwtracing/coresight/coresight-tpiu.c +5 -0
@@ -201,6 +201,11 @@ static struct amba_id tpiu_ids[] = { .id = 0x0004b912, .mask = 0x0007ffff, }, + { + /* Coresight SoC-600 */ + .id = 0x000bb9e7, + .mask = 0x000fffff, + }, { 0, 0}, };
Signature · 1 line
2.7.4
PATCH 25/26 perf: cs-etm: Fix ETMv4 CONFIGR entry in perf.data file
In reply to Mathieu PoirierFrom: Mike Leach <[email protected]>
The value passed into the perf.data file for the CONFIGR register in ETMv4 was incorrectly being set to the command line options/ETMv3 value.
Adds bit definitions and function to remap this value to the correct ETMv4 CONFIGR bit values for all selected options.
--- include/linux/coresight-pmu.h | 5 +++++ tools/include/linux/coresight-pmu.h | 5 +++++ tools/perf/arch/arm/util/cs-etm.c | 28 +++++++++++++++++++++++++++- 3 files changed, 37 insertions(+), 1 deletion(-)
include/linux/coresight-pmu.h +5 -0
@@ -26,6 +26,11 @@#define ETM_OPT_TS 28#define ETM_OPT_RETSTK 29 +/* ETMv4 CONFIGR programming bits for the ETM OPTs */ +#define ETM4_CFG_BIT_CYCACC 4 +#define ETM4_CFG_BIT_TS 11 +#define ETM4_CFG_BIT_RETSTK 12 +static inline int coresight_get_trace_id (int cpu) {/*
tools/include/linux/coresight-pmu.h +5 -0
@@ -26,6 +26,11 @@#define ETM_OPT_TS 28#define ETM_OPT_RETSTK 29 +/* ETMv4 CONFIGR programming bits for the ETM OPTs */ +#define ETM4_CFG_BIT_CYCACC 4 +#define ETM4_CFG_BIT_TS 11 +#define ETM4_CFG_BIT_RETSTK 12 +static inline int coresight_get_trace_id (int cpu) {/*
tools/perf/arch/arm/util/cs-etm.c +27 -1
@@ -266,6 +266,32 @@ static u64 cs_etm_get_config(struct auxtrace_record *itr)return config; } +#ifndef BIT +#define BIT (N ) (1UL << (N)) +#endif + +static u64 cs_etmv4_get_config (struct auxtrace_record *itr) +{ +u64 config =0 ; +u64 config_opts =0 ; + +/* +* The perf event variable config bits represent both +* the command line options and register programming +* bits in ETMv3/PTM. For ETMv4 we must remap options +* to real bits +*/ + config_opts =cs_etm_get_config (itr); +if (config_opts &BIT (ETM_OPT_CYCACC )) + config |=BIT (ETM4_CFG_BIT_CYCACC ); +if (config_opts &BIT (ETM_OPT_TS )) + config |=BIT (ETM4_CFG_BIT_TS ); +if (config_opts &BIT (ETM_OPT_RETSTK )) + config |=BIT (ETM4_CFG_BIT_RETSTK ); + +return config; +} +static size_t cs_etm_info_priv_size (struct auxtrace_record *itr__maybe_unused ,struct perf_evlist *evlist__maybe_unused )
@@ -363,7 +389,7 @@ static void cs_etm_get_metadata(int cpu, u32 *offset, magic = __perf_cs_etmv4_magic;/* Get trace configuration register */ info->priv[*offset +CS_ETMV4_TRCCONFIGR ] = -cs_etm_get_config (itr); +cs_etmv4_get_config (itr);/* Get traceID from the framework */ info->priv[*offset +CS_ETMV4_TRCTRACEIDR ] =coresight_get_trace_id (cpu);
Signature · 1 line
2.7.4
PATCH 26/26 coresight: STM: Clean up __iomem type usage
In reply to Mathieu PoirierFrom: Stephen Boyd <[email protected]>
The casting and other things here is odd, and causes sparse to complain:
drivers/hwtracing/coresight/coresight-stm.c:279:35: warning: incorrect type in argument 1 (different address spaces)drivers/hwtracing/coresight/coresight-stm.c:279:35: expected void [noderef] <asn:2>*addrdrivers/hwtracing/coresight/coresight-stm.c:279:35: got struct stm_drvdata *drvdatadrivers/hwtracing/coresight/coresight-stm.c:327:17: warning: incorrect type in argument 2 (different address spaces)drivers/hwtracing/coresight/coresight-stm.c:327:17: expected void volatile [noderef] <asn:2>*addrdrivers/hwtracing/coresight/coresight-stm.c:327:17: got void *addrdrivers/hwtracing/coresight/coresight-stm.c:330:17: warning: incorrect type in argument 2 (different address spaces)drivers/hwtracing/coresight/coresight-stm.c:330:17: expected void volatile [noderef] <asn:2>*addrdrivers/hwtracing/coresight/coresight-stm.c:330:17: got void *addrdrivers/hwtracing/coresight/coresight-stm.c:333:17: warning: incorrect type in argument 2 (different address spaces)drivers/hwtracing/coresight/coresight-stm.c:333:17: expected void volatile [noderef] <asn:2>*addrdrivers/hwtracing/coresight/coresight-stm.c:333:17: got void *addr
Quoted 1 line
From what I can tell, we don't really need to treat
ch_addras
anything besides a pointer, and we can just do pointer math instead of ORing in the bits of the offset and achieve the same thing.
Also, we were passing a drvdata pointer to the coresight_timeout() function, but we really wanted to pass the address of the register base. Luckily the base is the first member of the structure, so everything works out, but this is quite unsafe if we ever change the structure layout. Clean this all up so sparse stops complaining on this code.
--- drivers/hwtracing/coresight/coresight-stm.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/hwtracing/coresight/coresight-stm.c +9 -8
@@ -276,7 +276,7 @@ static void stm_disable(struct coresight_device *csdev,spin_unlock (&drvdata->spinlock);/* Wait until the engine has completely stopped */ -coresight_timeout (drvdata,STMTCSR ,STMTCSR_BUSY_BIT ,0 ); +coresight_timeout (drvdata->base,STMTCSR ,STMTCSR_BUSY_BIT ,0 );pm_runtime_put (drvdata->dev);
@@ -307,7 +307,8 @@ static inline bool stm_addr_unaligned(const void *addr, u8 write_bytes)return ((unsigned long )addr & (write_bytes -1 )); } -static void stm_send (void *addr,const void *data,u32 size,u8 write_bytes) +static void stm_send (void __iomem *addr,const void *data, +u32 size,u8 write_bytes) {u8 paload[8 ];
@@ -414,7 +415,7 @@ static ssize_t notrace stm_generic_packet(struct stm_data *stm_data,unsigned int size, const unsigned char *payload) { - unsigned long ch_addr; + void __iomem *ch_addr;struct stm_drvdata *drvdata =container_of (stm_data, struct stm_drvdata, stm);
@@ -424,7 +425,7 @@ static ssize_t notrace stm_generic_packet(struct stm_data *stm_data,if (channel >= drvdata->numsp)return -EINVAL ; - ch_addr = (unsigned long )stm_channel_addr (drvdata, channel); + ch_addr =stm_channel_addr (drvdata, channel); flags = (flags ==STP_PACKET_TIMESTAMPED ) ?STM_FLAG_TIMESTAMPED :0 ; flags |= test_bit(channel, drvdata->chs.guaranteed) ?
@@ -437,20 +438,20 @@ static ssize_t notrace stm_generic_packet(struct stm_data *stm_data,switch (packet) {case STP_PACKET_FLAG : - ch_addr |=stm_channel_off (STM_PKT_TYPE_FLAG , flags); + ch_addr +=stm_channel_off (STM_PKT_TYPE_FLAG , flags);/* * The generic STM core sets a size of '0' on flag packets. * As such send a flag packet of size '1' and tell the * core we did so. */ -stm_send ((void *)ch_addr, payload,1 , drvdata->write_bytes); +stm_send (ch_addr, payload,1 , drvdata->write_bytes); size =1 ;break ;case STP_PACKET_DATA : - ch_addr |=stm_channel_off (STM_PKT_TYPE_DATA , flags); -stm_send ((void *)ch_addr, payload, size, + ch_addr +=stm_channel_off (STM_PKT_TYPE_DATA , flags); +stm_send (ch_addr, payload, size, drvdata->write_bytes);break ;
Signature · 1 line
2.7.4
cover coresight: next v4.13-rc3
In reply to Mathieu PoirierQuoted 1 line · Mathieu Poirier
Good morning Grep,
"Grep"? :)
Sorry for the delay, all now applied.
greg k-h