Changes since v2:
* Implement Mike's suggestion of not having _SHIFT and using the existing
FIELD_GET and FIELD_PREP methods.
* Dropped the change to add the new REG_VAL macro because of the above.
* FIELD_PREP could be used in some trivial cases, but in some cases the
shift is still required but can be calculated with __bf_shf
* Improved the commit messages.
* The change is still binary equivalent, but requires an extra step
mentioned at the end of this cover letter.
Applies to coresight/next 3619ee28488
Also available at https://gitlab.arm.com/linux-arm/linux-jc/-/tree/james-cs-register-refactor…
To check for binary equivalence follow the same steps in the cover letter
of v2, but apply the following change to coresight-priv.h. This is because
the existing version of the macros wrap the expression in a new scope {}
that flips something in the compiler:
#undef FIELD_GET
#define FIELD_GET(_mask, _reg) (((_reg) & (_mask)) >> __bf_shf(_mask))
#undef FIELD_PREP
#define FIELD_PREP(_mask, _val) (((_val) << __bf_shf(_mask)) & (_mask))
Thanks
James
James Clark (15):
coresight: etm4x: Cleanup TRCIDR0 register accesses
coresight: etm4x: Cleanup TRCIDR2 register accesses
coresight: etm4x: Cleanup TRCIDR3 register accesses
coresight: etm4x: Cleanup TRCIDR4 register accesses
coresight: etm4x: Cleanup TRCIDR5 register accesses
coresight: etm4x: Cleanup TRCCONFIGR register accesses
coresight: etm4x: Cleanup TRCEVENTCTL1R register accesses
coresight: etm4x: Cleanup TRCSTALLCTLR register accesses
coresight: etm4x: Cleanup TRCVICTLR register accesses
coresight: etm3x: Cleanup ETMTECR1 register accesses
coresight: etm4x: Cleanup TRCACATRn register accesses
coresight: etm4x: Cleanup TRCSSCCRn and TRCSSCSRn register accesses
coresight: etm4x: Cleanup TRCSSPCICRn register accesses
coresight: etm4x: Cleanup TRCBBCTLR register accesses
coresight: etm4x: Cleanup TRCRSCTLRn register accesses
.../coresight/coresight-etm3x-core.c | 2 +-
.../coresight/coresight-etm3x-sysfs.c | 2 +-
.../coresight/coresight-etm4x-core.c | 136 +++++--------
.../coresight/coresight-etm4x-sysfs.c | 180 +++++++++---------
drivers/hwtracing/coresight/coresight-etm4x.h | 122 ++++++++++--
5 files changed, 244 insertions(+), 198 deletions(-)
--
2.28.0
Hi Mike and Al,
Any suggestions for a reference platform that we could start some OpenCSD and CSAL investigative engineering working on?
Ideally:
- Multi-core with SoC-600 and ELA-600 CoreSight
- SoC-600 trace streaming interface between host and target using USB3.1 (i.e. no debug probe necessary)
- Linux/Android
Would appreciate your inputs
Thanks
Hugh
-----Original Message-----
From: Al Grant <Al.Grant(a)arm.com>
Sent: Monday 28 March 2022 16:25
To: Mike Leach <mike.leach(a)linaro.org>; Hugh O'Keeffe <hugh.okeeffe(a)ashling.com>
Cc: coresight(a)lists.linaro.org
Subject: RE: CoreSight ELA-600 Embedded Logic Analyzer
> -----Original Message-----
> From: Mike Leach <mike.leach(a)linaro.org<mailto:mike.leach@linaro.org>>
> Sent: 28 March 2022 12:44
> To: Hugh O'Keeffe <hugh.okeeffe(a)ashling.com<mailto:hugh.okeeffe@ashling.com>>
> Cc: Al Grant <Al.Grant(a)arm.com<mailto:Al.Grant@arm.com>>; coresight(a)lists.linaro.org<mailto:coresight@lists.linaro.org>
> Subject: Re: CoreSight ELA-600 Embedded Logic Analyzer
>
> Hi Hugh,
>
> On Mon, 28 Mar 2022 at 11:41, Hugh O'Keeffe <hugh.okeeffe(a)ashling.com<mailto:hugh.okeeffe@ashling.com>>
> wrote:
> >
> > Hi Al and Mike,
> >
> > Appreciate your response. It seems that OpenCSD and CSAL are very
> similar. Are they two different approaches to solving the same problem
> OR in fact are they inherently different? I note that OpenCSD appears
> to actually decode trace as well (which CSAL does not appear to support).
> >
>
> CSAL primarily configures and programs CoreSight components using the
> memory interface. Either bare metal, or under linux if the correct
> memory access is allowed by the kernel configuration. It also has a
> bunch of example programs demonstrating usage of the library, and
> extracting trace on certain platforms.
>
> OpenCSD decodes any collected trace. It does not do any configuration
> - but requires certain trace configuration values to be provided in
> order to do the decode - alongside memory images if full CPU
> instruction trace decode is required.
> It does not do any data presentation or correlation - that is for any
> client application to do - though it does have packet printing
> routines that will give a human readable version of the decoded packets.
>
> OpenCSD is used by perf in linux to do all the decode for this tool.
>
> OpenCSD does come with its own standalone test program trc_pkt_lister
> - which will decode trace snapshots and output packets in the readable
> format mentioned above. These snapshots consist of trace data buffers
> + a set of .ini type files that contain the configuration of the
> hardware, and the memory images needed for full decode. If packet
> decode only is required then the memory images can be omitted. The
> specification for trace snapshots is provided in the OpenCSD github
> repository, and example snapshots are also in the repository.
>
> There is no current ELA600 driver in the kernel - and I am unsure if
> there is one in development.
> If your ELA600 is configured to output to the Coresight trace bus -
> then configuring using CSAL / decoding using OpenCSD would be a possible path.
> If it is configured to use its own internal RAMs then OpenCSD will not help.
>
> As Al mentions, the actual format of any given ELA data is SoC
> specific - so interpretation will have to be customized.
>
> Assuming you configure and get the device to trace into an ETR / ETF
> then this data will be multiplexed into the CoreSight frame format -
> on an ATID basis.
> OpenCSD could help here in that the front end will demultiplex the
> data to produce a byte stream input for a decoder based on the ATID.
> OpenCSD contains an API that allows custom decoders to be registered
> with the library.
> Thus an ELA decoder can be registered, then an instance attached to
> the ATID being used for the ELA600 and the library would feed the
> demultiplexed stream to the decoder. Alternatively, it should be
> relatively easy to write a simple program using the library demux
> components to take in a formatted buffer and output a binary file of raw data for a given ATID.
>
> Regards
>
> Mike
>
> > Would appreciate any pointers or comments as to how they compare and
> what would be my best starting point.
Further to Mike's excellent summary, CSAL is really a few different things:
- a pure C library for CoreSight configuration, suitable for embedding in firmware, RTOS, boot code etc. It can run over Linux /dev/mem, but this is more for general testing than expectation anyone would want to run it this way, especially now that Linux has its own drivers for ETM. In theory this could be combined with OpenCSD, i.e. use CSAL to configure a trace device and OpenCSD to decode it. I don't know that anyone has done that as CSAL's really designed for more limited targets where you’d likely decode the trace offline.
- in coresight-tools (csscan.py and some kernel modules): tools for CoreSight device and topology discovery, and status reporting.
The discovery phase is usally something that you'd only do once when you get a new target, as it may leave the target in odd states. Status reporting is harmless though and may be useful when diagnosing issues with kernel drivers, or even external debug. These Python tools can write to the CoreSight devices. This is required for topology discovery, but any kind of programming is possible if you know the register offsets and values.
- for testing, there's a daemon (devmemd) which can run on a target to do the low-level register access, allowing all the complicated stuff done by CSAL and csscan.py to be run on your development machine where it may be easier to experiment with it.
We also have some Python modules for decoding trace but these currentlly aren't upstream - you wouldn't want to use these for a production tool (you should use OpenCSD) but they may be useful when experimenting - I will look at getting them upstream.
Al
> >
> > Thanks
> > Hugh
> >
> >
> >
> >
> >
> >
> >
> > -----Original Message-----
> > From: Al Grant <Al.Grant(a)arm.com<mailto:Al.Grant@arm.com>>
> > Sent: Friday 25 March 2022 09:49
> > To: Mike Leach <mike.leach(a)linaro.org<mailto:mike.leach@linaro.org>>; Hugh O'Keeffe
> > <hugh.okeeffe(a)ashling.com<mailto:hugh.okeeffe@ashling.com>>
> > Cc: coresight(a)lists.linaro.org<mailto:coresight@lists.linaro.org>
> > Subject: RE: CoreSight ELA-600 Embedded Logic Analyzer
> >
> > > On Thu, 24 Mar 2022 at 17:47, Hugh O'Keeffe
> > > <hugh.okeeffe(a)ashling.com<mailto:hugh.okeeffe@ashling.com>>
> > > wrote:
> > > >
> > > > Hi All,
> > > >
> > > > Couple of questions:
> > > >
> > > > 1. Does anyone know of any other software options other than
> > > > DS-5 for
> > > configuring, capturing and viewing data using the ELA-600 ?
> >
> > In https://github.com/ARM-software/CSAL, the csscan.py script has
> > some
> basic support for reading the ELA config and dumping its SRAM buffer.
> No support for decoding ELA capture out of a CoreSight trace stream
> though, as it was only tested on ELA-500.
> >
> > The assignment of input signals may be SoC-specific and there may
> > also be
> SoC-specific obfuscation applied to the data - this is one of those
> "ask your SoC vendor" situations. The scripts that have gone upstream
> don't reveal anything that is not already public.
> >
> > Al
> >
> >
> > > >
> > > > 2. I could roll my own but I don't think OpenCSD has support for
> > > > the
> > > > ELA-
> > > 600. Correct ?
> > > >
> > >
> > > As I maintain OpenCSD I can answer this second question....
> > >
> > > No - there is not an ELA specific decoder in OpenCSD. Nor are
> > > there plans to add one at present.
> > > That said the the OpenCSD infrastucture should allow a new decode
> > > module to be added easily.
> > >
> > > Regards
> > >
> > > Mike
> > >
> > >
> > > > Thanks in advance
> > > >
> > > > Hugh
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > -----Original Message-----
> > > > From: coresight-request(a)lists.linaro.org<mailto:coresight-request@lists.linaro.org>
> > > > <coresight-request(a)lists.linaro.org<mailto:coresight-request@lists.linaro.org>>
> > > > Sent: Thursday 24 March 2022 17:36
> > > > To: Hugh O'Keeffe <hugh.okeeffe(a)ashling.com<mailto:hugh.okeeffe@ashling.com>>
> > > > Subject: Welcome to the "CoreSight" mailing list
> > > >
> > > > Welcome to the "CoreSight" mailing list!
> > > >
> > > > To post to this list, send your message to:
> > > >
> > > > coresight(a)lists.linaro.org<mailto:coresight@lists.linaro.org>
> > > >
> > > > You can unsubscribe or make adjustments to your options via
> > > > email by
> > > sending a message to:
> > > >
> > > > coresight-request(a)lists.linaro.org<mailto:coresight-request@lists.linaro.org>
> > > >
> > > > with the word 'help' in the subject or body (don't include the
> > > > quotes), and
> > > you will get back a message with instructions. You will need your
> > > password to change your options, but for security purposes, this
> > > password is not included here. If you have forgotten your
> > > password you will need to reset it via the web UI.
> > > > _______________________________________________
> > > > CoreSight mailing list -- coresight(a)lists.linaro.org<mailto:coresight@lists.linaro.org> To
> > > > unsubscribe send an email to coresight-leave(a)lists.linaro.org<mailto:coresight-leave@lists.linaro.org>
> > >
> > >
> > >
> > > --
> > > Mike Leach
> > > Principal Engineer, ARM Ltd.
> > > Manchester Design Centre. UK
> > > _______________________________________________
> > > CoreSight mailing list -- coresight(a)lists.linaro.org<mailto:coresight@lists.linaro.org> To
> > > unsubscribe send an email to coresight-leave(a)lists.linaro.org<mailto:coresight-leave@lists.linaro.org>
>
>
>
> --
> Mike Leach
> Principal Engineer, ARM Ltd.
> Manchester Design Centre. UK
Hi Greg,
Thanks for your review.
On 3/24/2022 8:26 PM, Greg Kroah-Hartman wrote:
> On Thu, Mar 24, 2022 at 08:17:25PM +0800, Mao Jinlong wrote:
>> Use hash length of the source's device name to map to the pointer
>> of the enabled path. Using IDR will be more efficient than using
>> the list. And there could be other sources except STM and CPU etms
>> in the new HWs. It is better to maintain all the paths together.
>>
>> Signed-off-by: Mao Jinlong <quic_jinlmao(a)quicinc.com>
>> ---
>> drivers/hwtracing/coresight/coresight-core.c | 75 +++++++-------------
>> 1 file changed, 26 insertions(+), 49 deletions(-)
> Your subject line is odd. Please put back the driver subsystem in the
> subject line so that it makes more sense.
I will update the subject in next version.
>
> And how have you measured "more efficient"?
Using IDR would be better than doing a sequential search as there will
be much more device in future.
>
> thanks,
>
> greg k-h
Thanks
Jinlong Mao
Hi Greg,
On 3/25/2022 1:06 AM, Greg Kroah-Hartman wrote:
> On Thu, Mar 24, 2022 at 10:23:19PM +0800, Jinlong Mao wrote:
>> Hi Greg,
>>
>> Thanks for your review.
>>
>> On 3/24/2022 8:26 PM, Greg Kroah-Hartman wrote:
>>> On Thu, Mar 24, 2022 at 08:17:25PM +0800, Mao Jinlong wrote:
>>>> Use hash length of the source's device name to map to the pointer
>>>> of the enabled path. Using IDR will be more efficient than using
>>>> the list. And there could be other sources except STM and CPU etms
>>>> in the new HWs. It is better to maintain all the paths together.
>>>>
>>>> Signed-off-by: Mao Jinlong <quic_jinlmao(a)quicinc.com>
>>>> ---
>>>> drivers/hwtracing/coresight/coresight-core.c | 75 +++++++-------------
>>>> 1 file changed, 26 insertions(+), 49 deletions(-)
>>> Your subject line is odd. Please put back the driver subsystem in the
>>> subject line so that it makes more sense.
>> I will update the subject in next version.
>>> And how have you measured "more efficient"?
>> Using IDR would be better than doing a sequential search as there will be
>> much more device in future.
> How many "more"? Where does the trade off of speed for complexity help?
> How much faster is this really? You can't claim performance
> improvements without any proof :)
There is about 40 trace sources in our internal device. I believe there
will be more cpu cores, then
there will be more etm sources. IDR here is used to store the path of
both etm
sources and other sources which aren't associated with CPU. Use IDR is
not more complicated
than using list. It will also save the time of searching the path when
coresight_disable.
I tested in internal device. The test case is that enable all the
sources, disable the source one
by one to check the search time.
Use list to store paths:
sh-7687 [005] .... 342.113099: __coresight_disable:
====search path start==== source_0
sh-7687 [005] .... 342.113127: __coresight_disable:
====search path end==== source_0
sh-7693 [005] .... 342.542216: __coresight_disable:
====search path start==== source_1
sh-7693 [005] .... 342.542244: __coresight_disable:
====search path end==== source_1
sh-7699 [005] .... 342.929083: __coresight_disable:
====search path start==== source_2
sh-7699 [005] .... 342.929106: __coresight_disable:
====search path end==== source_2
sh-7711 [005] .... 343.760688: __coresight_disable:
====search path start==== source_3
sh-7711 [005] .... 343.760713: __coresight_disable:
====search path end==== source_3
sh-7717 [005] .... 344.172353: __coresight_disable:
====search path start==== source_4
sh-7717 [005] .... 344.172381: __coresight_disable:
====search path end==== source_4
Use IDR to store paths:
sh-7156 [006] .... 223.294228: __coresight_disable:
====search path start==== source_0
sh-7156 [006] .... 223.294237: __coresight_disable:
====search path end==== source_0
sh-7162 [006] .... 223.690153: __coresight_disable:
====search path start==== source_1
sh-7162 [006] .... 223.690163: __coresight_disable:
====search path end==== source_1
sh-7168 [006] .... 224.110670: __coresight_disable:
====search path start==== source_2
sh-7168 [006] .... 224.110679: __coresight_disable:
====search path end==== source_2
<...>-7180 [006] .... 224.929315: __coresight_disable:
====search path start==== source_3
<...>-7180 [006] .... 224.929324: __coresight_disable:
====search path end==== source_3
<...>-7186 [006] .... 225.343617: __coresight_disable:
====search path start==== source_4
<...>-7186 [006] .... 225.343626: __coresight_disable:
====search path end==== source_4
From the log, Searching the path from the IDR takes about 9us for each
source.
Searching the path from the list takes about 23 ~ 28us for the source.
Use IDR saves much time.
Thanks
Jinlong Mao
>
> thanks,
>
> greg k-h
Hi All,
Couple of questions:
1. Does anyone know of any other software options other than DS-5 for configuring, capturing and viewing data using the ELA-600 ?
2. I could roll my own but I don't think OpenCSD has support for the ELA-600. Correct ?
Thanks in advance
Hugh
-----Original Message-----
From: coresight-request(a)lists.linaro.org <coresight-request(a)lists.linaro.org>
Sent: Thursday 24 March 2022 17:36
To: Hugh O'Keeffe <hugh.okeeffe(a)ashling.com>
Subject: Welcome to the "CoreSight" mailing list
Welcome to the "CoreSight" mailing list!
To post to this list, send your message to:
coresight(a)lists.linaro.org
You can unsubscribe or make adjustments to your options via email by sending a message to:
coresight-request(a)lists.linaro.org
with the word 'help' in the subject or body (don't include the quotes), and you will get back a message with instructions. You will need your password to change your options, but for security purposes, this password is not included here. If you have forgotten your password you will need to reset it via the web UI.
On 3/24/2022 8:26 PM, Greg Kroah-Hartman wrote:
> On Thu, Mar 24, 2022 at 08:17:30PM +0800, Mao Jinlong wrote:
>> Add API usage document for sysfs API in TPDM driver.
>>
>> Signed-off-by: Mao Jinlong <quic_jinlmao(a)quicinc.com>
>> ---
>> Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm | 5 +++++
>> 1 file changed, 5 insertions(+)
>> create mode 100644 Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm
>>
>> diff --git a/Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm b/Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm
>> new file mode 100644
>> index 000000000000..1df2f9b9ade2
>> --- /dev/null
>> +++ b/Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm
>> @@ -0,0 +1,5 @@
>> +What: /sys/bus/coresight/devices/<tpdm-name>/integration_test
>> +Date: February 2022
> It is no longer February.
>
>> +KernelVersion 5.17
> 5.17 is long past.
>
>> +Contact: Jinlong Mao or Tao Zhang
> How do we contact these names?
>
>> +Description: (Write) Run integration test for tpdm.
> I do not understand this description at all. Please explain it much
> better.
>
> thanks,
>
> greg k-h
Thanks for the review. I will address your comments in next version.
Thanks
Jinlong Mao