From: Tao Zhang <taozha(a)qti.qualcomm.com>
Introduction of TPDM DSB subunit
DSB subunit is responsible for creating a dataset element, and is also
optionally responsible for packing it to fit multiple elements on a
single ATB transfer if possible in the configuration. The TPDM Core
Datapath requests timestamps be stored by the TPDA and then delivering
ATB sized data (depending on ATB width and element size, this could
be smaller or larger than a dataset element) to the ATB Mast FSM.
The DSB subunit must be configured prior to enablement. This series
adds support for TPDM to configure the configure DSB subunit.
Once this series patches are applied properly, the new tpdm nodes for
should be observed at the tpdm path /sys/bus/coresight/devices/tpdm*
which supports DSB subunit.
e.g.
/sys/devices/platform/soc(a)0/69d0000.tpdm/tpdm0#ls -l | grep dsb
-rw-r--r-- 1 root root 4096 Jan 1 00:01 dsb_edge_ctrl
-rw-r--r-- 1 root root 4096 Jan 1 00:01 dsb_edge_ctrl_mask
-rw-r--r-- 1 root root 4096 Jan 1 00:01 dsb_mode
-rw-r--r-- 1 root root 4096 Jan 1 00:01 dsb_patt_mask
-rw-r--r-- 1 root root 4096 Jan 1 00:01 dsb_patt_ts
-rw-r--r-- 1 root root 4096 Jan 1 00:01 dsb_patt_type
-rw-r--r-- 1 root root 4096 Jan 1 00:01 dsb_patt_val
-rw-r--r-- 1 root root 4096 Jan 1 00:01 dsb_trig_patt_mask
-rw-r--r-- 1 root root 4096 Jan 1 00:01 dsb_trig_patt_val
-rw-r--r-- 1 root root 4096 Jan 1 00:01 dsb_trig_ts
-rw-r--r-- 1 root root 4096 Jan 1 00:01 dsb_trig_type
We can use the commands are similar to the below to configure the
TPDMs which support DSB subunit. Enable coresight sink first.
echo 1 > /sys/bus/coresight/devices/tmc_etf0/enable_sink
echo 1 > /sys/bus/coresight/devices/tpdm0/reset
echo 0x3 0x3 0x1 > /sys/bus/coresight/devices/tpdm0/dsb_edge_ctrl_mask
echo 0x6d 0x6d 0 > /sys/bus/coresight/devices/tpdm0/dsb_edge_ctrl
echo 1 > /sys/bus/coresight/devices/tpdm0/dsb_patt_ts
echo 1 > /sys/bus/coresight/devices/tpdm0/dsb_patt_type
echo 0 > /sys/bus/coresight/devices/tpdm0/dsb_trig_ts
echo 0 0xFFFFFFFF > /sys/bus/coresight/devices/tpdm0/dsb_patt_mask
echo 0 0xFFFFFFFF > /sys/bus/coresight/devices/tpdm0/dsb_trig_patt_val
This patch series depends on patch series "[v17,0/9] Coresight: Add
support for TPDM and TPDA"
https://patchwork.kernel.org/project/linux-arm-msm/cover/20230117145708.167…
TPDM_DSB commit tree:
https://git.codelinaro.org/clo/linux-kernel/coresight/-/tree/tpdm-dsb-v2https://git.codelinaro.org/clo/linux-kernel/coresight/-/commits/tpdm-dsb-v2
Changes in V2:
1. Change the name of the property "qcom,dsb-elem-size" to
"qcom,dsb-element-size" -- Suzuki K Poulose
2. Update the TPDA yaml file for the item "qcom,dsb-elem-size".
-- Krzysztof Kozlowski
3. Add the full name of DSB in the description of the item
"qcom,dsb-elem-size". -- Rob Herring
Changes in V1:
1. Change the definition of the property "qcom,dsb-elem-size" from
"uint32-array" to "uint32-matrix". -- Krzysztof Kozlowski
2. Add the full name of DSB. -- Rob Herring
3. Deal with 2 entries in an iteration in TPDA driver. -- Suzuki K Poulose
4. Divide the function "tpdm_datasets_alloc" into two functions,
"tpdm_datasets_setup" and "tpdm_datasets_alloc".
5. Detecte the input string with the conventional semantics automatically,
and constrain the size of the input value. -- Suzuki K Poulose
6. Use the hook function "is_visible()" to hide the DSB related knobs if
the data sets are missing. -- Suzuki K Poulose
7. Use the macros "FIELD_GET" and "FIELD_PREP" to set the values.
-- Suzuki K Poulose
8. Update the definition of the macros in TPDM driver.
9. Update the comments of the values for the nodes which are for DSB
element creation and onfigure pattern match output. -- Suzuki K Poulose
10. Use API "sysfs_emit" to "replace scnprintf". -- Suzuki K Poulose
Tao Zhang (9):
dt-bindings: arm: Add support for DSB element
coresight-tpda: Add DSB dataset support
coresight-tpdm: Initialize DSB subunit configuration
coresight-tpdm: Add reset node to TPDM node
coresight-tpdm: Add nodes to set trigger timestamp and type
coresight-tpdm: Add node to set dsb programming mode
coresight-tpdm: Add nodes for dsb element creation
coresight-tpdm: Add nodes to configure pattern match output
coresight-tpdm: Add nodes for timestamp request
.../bindings/arm/qcom,coresight-tpda.yaml | 22 +
drivers/hwtracing/coresight/coresight-tpda.c | 62 ++
drivers/hwtracing/coresight/coresight-tpda.h | 4 +
drivers/hwtracing/coresight/coresight-tpdm.c | 630 ++++++++++++++++++++-
drivers/hwtracing/coresight/coresight-tpdm.h | 65 +++
5 files changed, 778 insertions(+), 5 deletions(-)
--
2.7.4
Hi,
On Mon, 27 Feb 2023 at 06:20, Tao Zhang <quic_taozha(a)quicinc.com> wrote:
>
> Hi Mike,
>
> 在 2/24/2023 11:43 PM, Tao Zhang 写道:
> > Hi Mike,
> >
> >
> > I have a question about the following code you promoted.
> >
> > Patch - coresight: cti: Add device tree support for v8 arch CTI
> >
> > You set the following mask variables in the function
> > "cti_plat_create_v8_connections".
> >
> > tc->con_in->used_mask = 0x3; /* sigs <0 1> */
> >
> > tc->con_out->used_mask = 0x7; /* sigs <0 1 2 > */
> >
> > Could you tell us why they should be set to 0x3 and 0x7 here?
> >
> > Is there any particular reason for this design?
> >
> Add more background on this question below.
>
> The CPU CTIs we use based on the CTI v8 architecture that support more
> trigger number for the trigger in and trigger out.
>
> If we configured "arm,coresight-cti-v8-arch" for CPU CTIs in the device
> tree, it will causes the trigger number to be unavailable.
>
CTI's in v8 attached to the CPU have an architecturally mandated set
of triggers - this is the set that is defined with this compatible.
This is designed to save effort in describing the elements in the device tree.
> Is there any way to solve the problem we have now?
>
> Is it possible to change the trigger number supported by CPU CTIs by
> configuring device tree?
For custom CTIs use the arm,coresight-cti compatible, and describe
your CTI as shown in
./Documentation/devicetree/bindings/arm/arm.coresight-cti.yaml
This has an example of custom CTI bindings
Regards
Mike
>
> >
> > Best,
> >
> > Tao
> >
> Best,
>
> Tao
>
--
Mike Leach
Principal Engineer, ARM Ltd.
Manchester Design Centre. UK
On 2/23/2023 9:38 PM, Alexander Shishkin wrote:
> Jinlong Mao <quic_jinlmao(a)quicinc.com> writes:
>
>> On PC tool, it can show the logs from ETR in real time.
>>
>> When one small packet send from STM to ETR, it can be stuck between STM
>> and ETR.
>> When the packet stuck happens, it will be flushed to ETR only when some
>> other packets
>> generated from STM source or CTI flush commands are sent. If the time is
>> too long to wait
>> for next packets coming, user will consider that issue happens with
>> previous small packet.
>> And user's requirement is that packet from STM can be flushed to ETR
>> automatically instead
>> of sending commands manually.
>>
>> Is it appropriate to add a sysfs node for STM to generate the trigger
>> packet periodically for such case ?
> There's stm_heartbeat that will send a string via STM on a timer. It
> will come on its own channel, so your PC tool should be able to ignore
> it. Would that help?
Hi Alex,
It helps with my case.
How to implement it ?
Thanks
Jinlong Mao
>
> Regards,
> --
> Alex
Hi all,
When there is some small packet sent from STM to ETR, the small packet
could be stuck between source
and sink even if manual flush is set when disable ETR.
So there is requirement that flush the STM trace periodically after
enabling STM to ETR.
STM can generate TRIG_TS packet by writing to offset 0xF0 of the driver
STM stimulus port.
ETR has ability to initiate a flush on seeing a TRIG_TS packet.
For this requirement, I want to create a sysfs node like trig_ts for STM.
When writing 1 to this sysfs node, a timer with 1 second periodicity in
STM will start to generate the trig_ts packet to ETR.
Once ETR receive the TRIG_TS packet, it will initiate a flush.
Could you please help to provide your comments on this requirement ?
Thanks
Jinlong Mao
On 21/02/2023 18:38, Yabin Cui wrote:
> Ping for review?
>
> On Fri, Feb 10, 2023 at 11:43 PM Yabin Cui <yabinc(a)google.com> wrote:
>>
>> It's similar to what we did in tmc_read_unprepare_etb.
>>
>> Signed-off-by: Yabin Cui <yabinc(a)google.com>
>> ---
Thanks Yabin for the patch, will queue this at rc1
Suzuki
>> drivers/hwtracing/coresight/coresight-tmc-etr.c | 7 ++++++-
>> 1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c
>> index 918d461fcf4a..b04f12079efd 100644
>> --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c
>> +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c
>> @@ -1763,6 +1763,7 @@ int tmc_read_unprepare_etr(struct tmc_drvdata *drvdata)
>> {
>> unsigned long flags;
>> struct etr_buf *sysfs_buf = NULL;
>> + int rc = 0;
>>
>> /* config types are set a boot time and never change */
>> if (WARN_ON_ONCE(drvdata->config_type != TMC_CONFIG_TYPE_ETR))
>> @@ -1777,7 +1778,11 @@ int tmc_read_unprepare_etr(struct tmc_drvdata *drvdata)
>> * buffer. Since the tracer is still enabled drvdata::buf can't
>> * be NULL.
>> */
>> - __tmc_etr_enable_hw(drvdata);
>> + rc = __tmc_etr_enable_hw(drvdata);
>> + if (rc) {
>> + spin_unlock_irqrestore(&drvdata->spinlock, flags);
>> + return rc;
>> + }
>> } else {
>> /*
>> * The ETR is not tracing and the buffer was just read.
>> --
>> 2.39.1.581.gbfd45094c4-goog
>>
Recent issues with trying to debug TMC timeouts and flush issues shows
a general lack of logging and context around the possible errors
Patchset addresses that.
Signed-off-by: Mike Leach <mike.leach(a)linaro.org>
Mike Leach (3):
coresight: Update timeout functions to allow return of test register
value
coresight: tmc: Update error logging in tmc common functions
coresight: etf: etr: Update logging around flush_and_stop() errors
drivers/hwtracing/coresight/coresight-core.c | 50 +++++++++++++++----
.../hwtracing/coresight/coresight-tmc-core.c | 37 +++++++++++---
.../hwtracing/coresight/coresight-tmc-etf.c | 12 +++--
.../hwtracing/coresight/coresight-tmc-etr.c | 8 ++-
drivers/hwtracing/coresight/coresight-tmc.h | 2 +-
include/linux/coresight.h | 10 +++-
6 files changed, 93 insertions(+), 26 deletions(-)
--
2.17.1