Add support for UltraSoc System Memory Buffer.
Change since v4:
- Add a simple document of SMB driver according to Suzuki's comment.
- Address the comments from Suzuki.
- https://lore.kernel.org/linux-arm-kernel/20220128061755.31909-1-liuqi115@hu…
Change since v3:
- Modify the file header according to community specifications.
- Address the comments from Mathieu.
- Link:https://lore.kernel.org/linux-arm-kernel/20211118110016.40398-1-liuqi1…
Change since v2:
- Move ultrasoc driver to drivers/hwtracing/coresight.
- Link:https://lists.linaro.org/pipermail/coresight/2021-November/007310.html
Change since v1:
- Drop the document of UltraSoc according to Mathieu's comment.
- Add comments to explain some private hardware settings.
- Address the comments from Mathieu.
- Link: https://lists.linaro.org/pipermail/coresight/2021-August/006842.html
Change since RFC:
- Move driver to drivers/hwtracing/coresight/ultrasoc.
- Remove ultrasoc-axi-com.c, as AXI-COM doesn't need to be configured in
basic tracing function.
- Remove ultrasoc.c as SMB does not need to register with the ultrasoc core.
- Address the comments from Mathieu and Suzuki.
- Link: https://lists.linaro.org/pipermail/coresight/2021-June/006535.html
Qi Liu (2):
drivers/coresight: Add UltraSoc System Memory Buffer driver
Documentation: Add document for UltraSoc SMB drivers
.../trace/coresight/ultrasoc-smb.rst | 79 +++
drivers/hwtracing/coresight/Kconfig | 10 +
drivers/hwtracing/coresight/Makefile | 1 +
drivers/hwtracing/coresight/ultrasoc-smb.c | 643 ++++++++++++++++++
drivers/hwtracing/coresight/ultrasoc-smb.h | 106 +++
5 files changed, 839 insertions(+)
create mode 100644 Documentation/trace/coresight/ultrasoc-smb.rst
create mode 100644 drivers/hwtracing/coresight/ultrasoc-smb.c
create mode 100644 drivers/hwtracing/coresight/ultrasoc-smb.h
--
2.24.0
Hi Jinlong
On 09/03/2022 14:22, Mao Jinlong wrote:
> It is possibe that probe failure issue happens when the device
> and its child_device's probe happens at the same time.
> In coresight_make_links, has_conns_grp is true for parent, but
> has_conns_grp is false for child device as has_conns_grp is set
> to true in coresight_create_conns_sysfs_group. The probe of parent
> device will fail at this condition. Add has_conns_grp check for
> child device before make the links and make the process from
> device_register to connection_create be atomic to avoid this
> probe failure issue.
>
> Suggested-by: Suzuki K Poulose <suzuki.poulose(a)arm.com>
> Suggested-by: Mike Leach <mike.leach(a)linaro.org>
> Signed-off-by: Mao Jinlong <quic_jinlmao(a)quicinc.com>
Thanks for the rework. The patch looks good to me.
Suzuki
This allows enabling branch broadcast for Perf hosted sessions (the option
is currently only available for the sysfs interface). Hopefully this could
be useful for testing the decode in perf, for example does a determinisitic
run with branch broadcast enabled look the same as with it disabled? It
could also be used for scenarios like OpenJ9's support for JIT code:
java -Xjit:perfTool hello.java
Currently this is not working and you get the usual errors of a missing
DSO, but branch broadcast would have to be enabled anyway before working
through this next issue:
CS ETM Trace: Debug data not found for address 0xffff7b94b058 in /tmp/perf-29360.map
Address range support in Perf for branch broadcast has also not been added
here, but could be added later.
The documentation has been refactored slightly to allow updates to be made
that link the Perf format arguments with the existing documentation.
For Suzuki's comment, I will do it as a separate change that converts all
the other hard coded values to a more consistent sysreg.h style:
nit: While at this, please could you change the hard coded value
to ETM4_CFG_BIT_RETSTK ?
Changes since v1:
* Added Leo's reviewed by on patch 3
* Fix bracket styling
* Add documentation
Applies on top of coresight/next efa56eddf5d5c. But this docs fix is also
required to get the links to work:
https://marc.info/?l=linux-doc&m=164139331923986&w=2
Also available at: https://gitlab.arm.com/linux-arm/linux-jc/-/tree/james-branch-broadcast-v2
James Clark (6):
coresight: Add config flag to enable branch broadcast
coresight: Fail to open with return stacks if they are unavailable
perf cs-etm: Update deduction of TRCCONFIGR register for branch
broadcast
Documentation: coresight: Turn numbered subsections into real
subsections
Documentation: coresight: Link config options to existing
documentation
Documentation: coresight: Expand branch broadcast documentation
.../coresight/coresight-etm4x-reference.rst | 14 ++++-
Documentation/trace/coresight/coresight.rst | 56 +++++++++++++++++--
.../hwtracing/coresight/coresight-etm-perf.c | 2 +
.../coresight/coresight-etm4x-core.c | 23 ++++++--
include/linux/coresight-pmu.h | 2 +
tools/include/linux/coresight-pmu.h | 2 +
tools/perf/arch/arm/util/cs-etm.c | 3 +
7 files changed, 92 insertions(+), 10 deletions(-)
--
2.28.0
Hi,
I'm Sending this sysfs addition to the etm4x driver in order to expose
the timestamp source of the trace (given by the TRFCR_ELx.TS register).
As mentioned in [1/2], having this information is useful for assigning
Kernel times to the perf samples.
Thanks,
German
German Gomez (3):
coresight: etm4x: Expose default timestamp source in sysfs
coresight: etm4x: docs: Add documentation for 'ts_source' sysfs
interface
perf cs_etm: Store ts_source in AUXTRACE_INFO fields
.../testing/sysfs-bus-coresight-devices-etm4x | 8 +++
.../coresight/coresight-etm4x-reference.rst | 14 ++++
arch/arm64/include/asm/sysreg.h | 1 +
.../coresight/coresight-etm4x-sysfs.c | 34 ++++++++++
tools/perf/arch/arm/util/cs-etm.c | 64 +++++++++++++++++--
tools/perf/util/cs-etm.c | 61 +++++++++---------
tools/perf/util/cs-etm.h | 13 +++-
7 files changed, 159 insertions(+), 36 deletions(-)
--
2.25.1
Hi Mike,
We would like to know if the perf decode script (cs-trace-disasm.py) mentioned
in the OpenCSD HOWTO page is hosted anywhere ?
https://github.com/Linaro/OpenCSD/blob/master/HOWTO.md#trace-decoding-with-…
Also, does the script support generating instruction trace for both user space
and kernel space ?
With Regards,
Tanmay
On Sun, Apr 24, 2022 at 02:57:24PM +0800, Shile Zhang wrote:
>
>
> On 2022/4/22 23:45, Mathieu Poirier wrote:
> > On Fri, Apr 22, 2022 at 10:02:39AM +0800, Shile Zhang wrote:
> > > The function etm4_remove_dev() always return 0, and the former function
> > > etm4_remove has been changed to void in commit 3fd269e74f2fe ("amba: Make
> > > the remove callback return void"). But now its changed back to int type
> > > for some reason, which is different to the stable branch linux-5.10.y.
> >
> > Please spend time understanding why function etm4_remove_dev()'s return value
> > has been changed back to an "int". From there you will likely come to the
> > conclusion that adding the above to the changelog doesn't make sense.
>
> Sorry, I means "some reason" here actually I cannot find out why.
>
> 1. From the git log of the file
> `drivers/hwtracing/coresight/coresight-etm4x-core.c', only log of
> etm4_remove changes to void in commit 3fd269e74f2fe. no any log record when
> it change back to int.
> 2. from the commit 'git log --pretty="%h %ci %cn %s"
> drivers/hwtracing/coresight/coresight-etm4x-core.c'
> ...
> b8336ad947e19 2021-02-04 17:00:32 +0100 Greg Kroah-Hartman coresight: etm4x:
> add AMBA id for Cortex-A55 and Cortex-A75
> 3fd269e74f2fe 2021-02-02 14:25:50 +0100 Uwe Kleine-König amba: Make the
> remove callback return void
> ...
>
> The commit 'b8336ad947e19' does not change the etm4_remove:
> https://github.com/torvalds/linux/commit/b8336ad947e1913b9bb5cdf4f54b687654…
>
> But the different between the commit 'b8336ad947e19' and '3fd269e74f2fe'
> contains the changes of etm4_remove back to int, as following:
> ---
> ...
> diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c
> b/drivers/hwtracing/coresight/coresight-etm4x-core.c
> index 82787cba537d3..8c4b0c46c8f32 100644
> --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
> +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c
> @@ -1680,7 +1680,7 @@ static void clear_etmdrvdata(void *info)
> etmdrvdata[cpu] = NULL;
> }
>
> -static void etm4_remove(struct amba_device *adev)
> +static int etm4_remove(struct amba_device *adev)
> {
> struct etmv4_drvdata *drvdata = dev_get_drvdata(&adev->dev);
>
> @@ -1703,6 +1703,8 @@ static void etm4_remove(struct amba_device *adev)
> cpus_read_unlock();
>
> coresight_unregister(drvdata->csdev);
> +
> + return 0;
> }
>
> static const struct amba_id etm4_ids[] = {
> @@ -1711,6 +1713,8 @@ static const struct amba_id etm4_ids[] = {
> CS_AMBA_ID(0x000bb95a), /* Cortex-A72 */
> CS_AMBA_ID(0x000bb959), /* Cortex-A73 */
> CS_AMBA_UCI_ID(0x000bb9da, uci_id_etm4),/* Cortex-A35 */
> + CS_AMBA_UCI_ID(0x000bbd05, uci_id_etm4),/* Cortex-A55 */
> + CS_AMBA_UCI_ID(0x000bbd0a, uci_id_etm4),/* Cortex-A75 */
> CS_AMBA_UCI_ID(0x000bbd0c, uci_id_etm4),/* Neoverse N1 */
> CS_AMBA_UCI_ID(0x000f0205, uci_id_etm4),/* Qualcomm Kryo */
> CS_AMBA_UCI_ID(0x000f0211, uci_id_etm4),/* Qualcomm Kryo */
> ...
> ---
>
> I really don't know how to check which commit change it back.
> Could you please help to give me some guidance?
Have a look at "git blame" - it is really useful to know what commit introduced a
change. In this case, and using coresight next (c86dd9869128), the command
would be:
$ git blame -L 2059,2059 drivers/hwtracing/coresight/coresight-etm4x-core.c
That will tell you how function etm4_remove_dev() got to return an 'int' again.
But this is really about understanding the current code rather than trying to
understand the history of it. With commit 3fd269e74f2fe, Uwe was making amba
remove callback functions return a 'void'. And this is what we see here[1] in
v5.10.112. Note that etm4_remove() is the callback to the amba driver.
In the mainline code, the amba callback function is now etm4_remove_amba() and
still returns a 'void'. Function etm4_remove() is now etm4_remove_dev() and is
called by both etm4_remove_amba() and etm4_remove_platform_dev(), to avoid code
duplication.
The conclusion is that because etm4_remove_dev() no longer interfaces with the
amba subsystem, its return value can be 'int'. But in this case the return
value is not used and as such can be changed to a 'void', regardless of commit
3fd269e74f2fe.
Mathieu
[1]. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drive…
>
> Thanks!
>
>
> >
> > >
> > > Just let it return void and return 0 directly in it's caller function
> > > etm4_remove_platform_dev.
> >
> > The only rational for this patch is that etm4_remove_dev() always returns '0'.
> > And even if it was to return anything else, the return value it not checked.
> > And even if the return value was checked, there is nothing to do about an error
> > condition since the driver is being removed.
> >
> > >
> > > Signed-off-by: Shile Zhang <shile.zhang(a)linux.alibaba.com>
> > > ---
> > > v2: re-work the commit log from Mathieu's suggestion.
> > > v1: https://lore.kernel.org/linux-arm-kernel/20220421164217.GB1596562@p14s/T/
> > > ---
> > > drivers/hwtracing/coresight/coresight-etm4x-core.c | 11 +++++------
> > > 1 file changed, 5 insertions(+), 6 deletions(-)
> > >
> > > diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c
> > > index 7f416a12000eb..141f8209a152a 100644
> > > --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
> > > +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c
> > > @@ -2104,7 +2104,7 @@ static void clear_etmdrvdata(void *info)
> > > etmdrvdata[cpu] = NULL;
> > > }
> > > -static int __exit etm4_remove_dev(struct etmv4_drvdata *drvdata)
> > > +static void __exit etm4_remove_dev(struct etmv4_drvdata *drvdata)
> > > {
> > > etm_perf_symlink(drvdata->csdev, false);
> > > /*
> > > @@ -2125,8 +2125,6 @@ static int __exit etm4_remove_dev(struct etmv4_drvdata *drvdata)
> > > cscfg_unregister_csdev(drvdata->csdev);
> > > coresight_unregister(drvdata->csdev);
> > > -
> > > - return 0;
> > > }
> > > static void __exit etm4_remove_amba(struct amba_device *adev)
> > > @@ -2139,13 +2137,14 @@ static void __exit etm4_remove_amba(struct amba_device *adev)
> > > static int __exit etm4_remove_platform_dev(struct platform_device *pdev)
> > > {
> > > - int ret = 0;
> > > struct etmv4_drvdata *drvdata = dev_get_drvdata(&pdev->dev);
> > > if (drvdata)
> > > - ret = etm4_remove_dev(drvdata);
> > > + etm4_remove_dev(drvdata);
> > > +
> > > pm_runtime_disable(&pdev->dev);
> > > - return ret;
> > > +
> > > + return 0;
> > > }
> > > static const struct amba_id etm4_ids[] = {
> > > --
> > > 2.33.0.rc2
> > >
This series adds support for the trace performance monitoring and
diagnostics hardware (TPDM and TPDA). It is composed of two major
elements.
a) Changes for original coresight framework to support for TPDM and TPDA.
b) Add driver code for TPDM and TPDA.
Introduction of changes for original coresight framework
Support TPDM as new coresight source.
Since only STM and ETM are supported as coresight source originally.
TPDM is a newly added coresight source. We need to change
the original way of saving coresight path to support more types source
for coresight driver.
The following patch is to add support more coresight sources.
coresight: core: Use IDR for non-cpu bound sources' paths.
Introduction of TPDM and TPDA
TPDM - The trace performance monitoring and diagnostics monitor or TPDM in
short serves as data collection component for various dataset types
specified in the QPMDA(Qualcomm performance monitoring and diagnostics
architecture) spec. The primary use case of the TPDM is to collect data
from different data sources and send it to a TPDA for packetization,
timestamping and funneling.
Coresight: Add coresight TPDM source driver
dt-bindings: arm: Adds CoreSight TPDM hardware definitions
coresight-tpdm: Add DSB dataset support
coresight-tpdm: Add integration test support
docs: sysfs: coresight: Add sysfs ABI documentation for TPDM
TPDA - The trace performance monitoring and diagnostics aggregator or
TPDA in short serves as an arbitration and packetization engine for the
performance monitoring and diagnostics network as specified in the QPMDA
(Qualcomm performance monitoring and diagnostics architecture)
specification. The primary use case of the TPDA is to provide
packetization, funneling and timestamping of Monitor data as specified
in the QPMDA specification.
The following patch is to add driver for TPDA.
Coresight: Add TPDA link driver
dt-bindings: arm: Adds CoreSight TPDA hardware definitions
The last patch of this series is a device tree modification, which add
the TPDM and TPDA configuration to device tree for validating.
ARM: dts: msm: Add coresight components for SM8250
ARM: dts: msm: Add tpdm mm/prng for sm8250
Once this series patches are applied properly, the tpdm and tpda nodes
should be observed at the coresight path /sys/bus/coresight/devices
e.g.
/sys/bus/coresight/devices # ls -l | grep tpd
tpda0 -> ../../../devices/platform/soc(a)0/6004000.tpda/tpda0
tpdm0 -> ../../../devices/platform/soc(a)0/6c08000.mm.tpdm/tpdm0
We can use the commands are similar to the below to validate TPDMs.
Enable coresight sink first.
echo 1 > /sys/bus/coresight/devices/tmc_etf0/enable_sink
echo 1 > /sys/bus/coresight/devices/tpdm0/enable_source
echo 1 > /sys/bus/coresight/devices/tpdm0/integration_test
echo 2 > /sys/bus/coresight/devices/tpdm0/integration_test
The test data will be collected in the coresight sink which is enabled.
If rwp register of the sink is keeping updating when do
integration_test (by cat tmc_etf0/mgmt/rwp), it means there is data
generated from TPDM to sink.
There must be a tpda between tpdm and the sink. When there are some
other trace event hw components in the same HW block with tpdm, tpdm
and these hw components will connect to the coresight funnel. When
there is only tpdm trace hw in the HW block, tpdm will connect to
tpda directly.
+---------------+ +-------------+
| tpdm@6c08000 | |tpdm@684C000 |
+-------|-------+ +------|------+
| |
+-------|-------+ |
| funnel@6c0b000| |
+-------|-------+ |
| |
+-------|-------+ |
|funnel@6c2d000 | |
+-------|-------+ |
| |
| +---------------+ |
+----- tpda@6004000 -----------+
+-------|-------+
|
+-------|-------+
|funnel@6005000 |
+---------------+
This patch series depends on patch series
"coresight: Add new API to allocate trace source ID values".
https://patchwork.kernel.org/project/linux-arm-kernel/cover/20220308205000.…
Changes from V5:
1. Update maintainers in tpdm/tpda yaml file. -- Mike Leach <mike.leach(a)linaro.org>
2. Set the .remove function pointer in the amba_driver structure
of tpdm/tpda driver. Add tpda_remove function for tpda driver. -- Mike Leach <mike.leach(a)linaro.org>
3. Define datasets of tpdm as unsigned long. -- Mike Leach <mike.leach(a)linaro.org>
4. Move all coresight nodes to sm8250.dtsi.
-- Mike Leach <mike.leach(a)linaro.org>;Konrad Dybcio <konrad.dybcio(a)somainline.org>
5. Remove CORESIGHT_TPDM_INTEGRATION_TEST config. -- Mike Leach <mike.leach(a)linaro.org>
Mao Jinlong (10):
coresight: core: Use IDR for non-cpu bound sources' paths.
Coresight: Add coresight TPDM source driver
dt-bindings: arm: Adds CoreSight TPDM hardware definitions
coresight-tpdm: Add DSB dataset support
coresight-tpdm: Add integration test support
docs: sysfs: coresight: Add sysfs ABI documentation for TPDM
Coresight: Add TPDA link driver
dt-bindings: arm: Adds CoreSight TPDA hardware definitions
ARM: dts: msm: Add coresight components for SM8250
ARM: dts: msm: Add tpdm mm/prng for sm8250
.../testing/sysfs-bus-coresight-devices-tpdm | 13 +
.../bindings/arm/coresight-tpda.yaml | 119 ++++
.../bindings/arm/coresight-tpdm.yaml | 99 +++
.../devicetree/bindings/arm/coresight.txt | 7 +
MAINTAINERS | 1 +
arch/arm64/boot/dts/qcom/sm8250.dtsi | 658 ++++++++++++++++++
drivers/hwtracing/coresight/Kconfig | 24 +
drivers/hwtracing/coresight/Makefile | 2 +
drivers/hwtracing/coresight/coresight-core.c | 42 +-
drivers/hwtracing/coresight/coresight-tpda.c | 201 ++++++
drivers/hwtracing/coresight/coresight-tpda.h | 33 +
drivers/hwtracing/coresight/coresight-tpdm.c | 258 +++++++
drivers/hwtracing/coresight/coresight-tpdm.h | 63 ++
include/linux/coresight.h | 1 +
14 files changed, 1509 insertions(+), 12 deletions(-)
create mode 100644 Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm
create mode 100644 Documentation/devicetree/bindings/arm/coresight-tpda.yaml
create mode 100644 Documentation/devicetree/bindings/arm/coresight-tpdm.yaml
create mode 100644 drivers/hwtracing/coresight/coresight-tpda.c
create mode 100644 drivers/hwtracing/coresight/coresight-tpda.h
create mode 100644 drivers/hwtracing/coresight/coresight-tpdm.c
create mode 100644 drivers/hwtracing/coresight/coresight-tpdm.h
--
2.17.1