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
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.
>
> 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
>
Hi Shile,
On Wed, Apr 20, 2022 at 01:28:31PM +0800, Shile Zhang wrote:
> The etm4_remove function (now it's rename to etm4_remove_dev) always
> return 0, and it has been changed to void in commit 4fd269e74f2f
> ("amba: Make the remove callback return void"). But its weird that the
> changes is gone in mainline. which is remained in 5.10.y branch.
Commit 4fd269e74f2f is not valid upstream. Changes that don't have a critical
impact on user experience or fix a bug aren't backported to longterm kernels.
>
> Just backport the changes of etm4_remove_dev and return 0 directly in it's
> caller function etm4_remove_platform_dev.
I'm not sure why the work "backport" is used here since this patch is destine
for mainline.
>
> Signed-off-by: Shile Zhang <shile.zhang(a)linux.alibaba.com>
> ---
> 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 7f416a12000e..141f8209a152 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;
I'm fine with the code but the changelog needs to be re-worked. The only
rational for this patch is that the return value for function etm4_remove_dev()
is never used and as such being removed.
Thanks,
Mathieu
> }
>
> 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 V4:
1. Keep the ETM source paths per-CPU and use IDR for other sources'
paths. (Suzuki K Poulose <suzuki.poulose(a)arm.com>)
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 +
.../arm64/boot/dts/qcom/sm8250-coresight.dtsi | 708 ++++++++++++++++++
arch/arm64/boot/dts/qcom/sm8250.dtsi | 2 +
drivers/hwtracing/coresight/Kconfig | 33 +
drivers/hwtracing/coresight/Makefile | 2 +
drivers/hwtracing/coresight/coresight-core.c | 42 +-
drivers/hwtracing/coresight/coresight-tpda.c | 192 +++++
drivers/hwtracing/coresight/coresight-tpda.h | 32 +
drivers/hwtracing/coresight/coresight-tpdm.c | 270 +++++++
drivers/hwtracing/coresight/coresight-tpdm.h | 61 ++
include/linux/coresight.h | 1 +
15 files changed, 1570 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 arch/arm64/boot/dts/qcom/sm8250-coresight.dtsi
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
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