* [PATCH v8 0/2] coresight: Add label sysfs node support
@ 2025-07-03 13:04 Mao Jinlong
2025-07-03 13:04 ` [PATCH v8 1/2] dt-bindings: arm: Add label in the coresight components Mao Jinlong
2025-07-03 13:04 ` [PATCH v8 2/2] coresight: Add label sysfs node support Mao Jinlong
0 siblings, 2 replies; 8+ messages in thread
From: Mao Jinlong @ 2025-07-03 13:04 UTC (permalink / raw)
To: Suzuki K Poulose, Mike Leach, James Clark, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Mathieu Poirier,
Bjorn Andersson, Konrad Dybcio
Cc: Mao Jinlong, coresight, linux-arm-kernel, devicetree,
linux-kernel, linux-arm-msm
Change since V7:
1. Update the conflict when apply to coresight next.
2. Update the Date and version in ABI file.
V7 link: https://patchwork.kernel.org/project/linux-arm-kernel/patch/20250226121926.2687497-3-quic_jinlmao@quicinc.com/
Change since V6:
1. Update the date and verison in ABI file.
Change since V5:
1. Update the kernel version of ABI files.
2. Add link of different patch versions.
V5 link: https://patchwork.kernel.org/project/linux-arm-msm/cover/20241210122253.31926-1-quic_jinlmao@quicinc.com/
Change since V4:
1. Add label in DT and add label sysfs node for each coresight device.
V4 link: https://patchwork.kernel.org/project/linux-arm-msm/cover/20240703122340.26864-1-quic_jinlmao@quicinc.com/
Change since V3:
1. Change device-name to arm,cs-dev-name.
2. Add arm,cs-dev-name to only CTI and sources' dt-binding.
V3 link: https://patchwork.kernel.org/project/linux-arm-msm/cover/20240131082628.6288-1-quic_jinlmao@quicinc.com/
Change since V2:
1. Fix the error in coresight core.
drivers/hwtracing/coresight/coresight-core.c:1775:7: error: assigning to 'char *' from 'const char *' discards qualifiers
2. Fix the warning when run dtbinding check.
Documentation/devicetree/bindings/arm/arm,coresight-cpu-debug.yaml: device-name: missing type definition
V2 link: https://patchwork.kernel.org/project/linux-arm-msm/cover/20240115164252.26510-1-quic_jinlmao@quicinc.com/
Change since V1:
1. Change coresight-name to device name.
2. Add the device-name in coresight dt bindings.
V1 link: https://patchwork.kernel.org/project/linux-arm-kernel/patch/20230208110716.18321-1-quic_jinlmao@quicinc.com/#25231737
Mao Jinlong (2):
dt-bindings: arm: Add label in the coresight components
coresight: Add label sysfs node support
.../testing/sysfs-bus-coresight-devices-cti | 6 ++++
.../sysfs-bus-coresight-devices-funnel | 6 ++++
.../testing/sysfs-bus-coresight-devices-tpdm | 6 ++++
.../bindings/arm/arm,coresight-cti.yaml | 6 ++++
.../arm/arm,coresight-dummy-sink.yaml | 6 ++++
.../arm/arm,coresight-dummy-source.yaml | 6 ++++
.../arm/arm,coresight-dynamic-funnel.yaml | 6 ++++
.../arm/arm,coresight-dynamic-replicator.yaml | 6 ++++
.../arm/arm,coresight-static-funnel.yaml | 6 ++++
.../arm/arm,coresight-static-replicator.yaml | 6 ++++
.../bindings/arm/arm,coresight-tmc.yaml | 6 ++++
.../bindings/arm/qcom,coresight-tpda.yaml | 6 ++++
.../bindings/arm/qcom,coresight-tpdm.yaml | 6 ++++
drivers/hwtracing/coresight/coresight-sysfs.c | 32 +++++++++++++++++++
14 files changed, 110 insertions(+)
--
2.17.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v8 1/2] dt-bindings: arm: Add label in the coresight components
2025-07-03 13:04 [PATCH v8 0/2] coresight: Add label sysfs node support Mao Jinlong
@ 2025-07-03 13:04 ` Mao Jinlong
2025-07-03 15:43 ` Rob Herring
2025-07-03 13:04 ` [PATCH v8 2/2] coresight: Add label sysfs node support Mao Jinlong
1 sibling, 1 reply; 8+ messages in thread
From: Mao Jinlong @ 2025-07-03 13:04 UTC (permalink / raw)
To: Suzuki K Poulose, Mike Leach, James Clark, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Mathieu Poirier,
Bjorn Andersson, Konrad Dybcio
Cc: Mao Jinlong, coresight, linux-arm-kernel, devicetree,
linux-kernel, linux-arm-msm
Current name of coresight component's folder consists of prefix of
the device and the id in the device list. When run 'ls' command,
we can get the register address of the device. Take CTI for example,
if we want to set the config for modem CTI, but we can't know which
CTI is modem CTI from all current information.
cti_sys0 -> ../../../devices/platform/soc@0/138f0000.cti/cti_sys0
cti_sys1 -> ../../../devices/platform/soc@0/13900000.cti/cti_sys1
Add label to show hardware context information of each coresight
device. There will be a sysfs node label in each device folder.
cat /sys/bus/coresight/devices/cti_sys0/label
Signed-off-by: Mao Jinlong <quic_jinlmao@quicinc.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Mike Leach <mike.leach@linaro.org>
---
.../devicetree/bindings/arm/arm,coresight-cti.yaml | 6 ++++++
.../devicetree/bindings/arm/arm,coresight-dummy-sink.yaml | 6 ++++++
.../devicetree/bindings/arm/arm,coresight-dummy-source.yaml | 6 ++++++
.../bindings/arm/arm,coresight-dynamic-funnel.yaml | 6 ++++++
.../bindings/arm/arm,coresight-dynamic-replicator.yaml | 6 ++++++
.../bindings/arm/arm,coresight-static-funnel.yaml | 6 ++++++
.../bindings/arm/arm,coresight-static-replicator.yaml | 6 ++++++
.../devicetree/bindings/arm/arm,coresight-tmc.yaml | 6 ++++++
.../devicetree/bindings/arm/qcom,coresight-tpda.yaml | 6 ++++++
.../devicetree/bindings/arm/qcom,coresight-tpdm.yaml | 6 ++++++
10 files changed, 60 insertions(+)
diff --git a/Documentation/devicetree/bindings/arm/arm,coresight-cti.yaml b/Documentation/devicetree/bindings/arm/arm,coresight-cti.yaml
index 2d5545a2b49c..5ca6d3d313a3 100644
--- a/Documentation/devicetree/bindings/arm/arm,coresight-cti.yaml
+++ b/Documentation/devicetree/bindings/arm/arm,coresight-cti.yaml
@@ -98,6 +98,12 @@ properties:
power-domains:
maxItems: 1
+ label:
+ $ref: /schemas/types.yaml#/definitions/string
+ description:
+ Define the label which can describe what kind of HW or system the
+ coresight device belongs to.
+
arm,cti-ctm-id:
$ref: /schemas/types.yaml#/definitions/uint32
description:
diff --git a/Documentation/devicetree/bindings/arm/arm,coresight-dummy-sink.yaml b/Documentation/devicetree/bindings/arm/arm,coresight-dummy-sink.yaml
index 08b89b62c505..bc82cd1f3595 100644
--- a/Documentation/devicetree/bindings/arm/arm,coresight-dummy-sink.yaml
+++ b/Documentation/devicetree/bindings/arm/arm,coresight-dummy-sink.yaml
@@ -39,6 +39,12 @@ properties:
enum:
- arm,coresight-dummy-sink
+ label:
+ $ref: /schemas/types.yaml#/definitions/string
+ description:
+ Define the label which can describe what kind of HW or system the
+ coresight device belongs to.
+
in-ports:
$ref: /schemas/graph.yaml#/properties/ports
diff --git a/Documentation/devicetree/bindings/arm/arm,coresight-dummy-source.yaml b/Documentation/devicetree/bindings/arm/arm,coresight-dummy-source.yaml
index 742dc4e25d3b..3010055d5ad6 100644
--- a/Documentation/devicetree/bindings/arm/arm,coresight-dummy-source.yaml
+++ b/Documentation/devicetree/bindings/arm/arm,coresight-dummy-source.yaml
@@ -38,6 +38,12 @@ properties:
enum:
- arm,coresight-dummy-source
+ label:
+ $ref: /schemas/types.yaml#/definitions/string
+ description:
+ Define the label which can describe what kind of HW or system the
+ coresight device belongs to.
+
arm,static-trace-id:
description: If dummy source needs static id support, use this to set trace id.
$ref: /schemas/types.yaml#/definitions/uint32
diff --git a/Documentation/devicetree/bindings/arm/arm,coresight-dynamic-funnel.yaml b/Documentation/devicetree/bindings/arm/arm,coresight-dynamic-funnel.yaml
index 44a1041cb0fc..30776610d4b4 100644
--- a/Documentation/devicetree/bindings/arm/arm,coresight-dynamic-funnel.yaml
+++ b/Documentation/devicetree/bindings/arm/arm,coresight-dynamic-funnel.yaml
@@ -57,6 +57,12 @@ properties:
power-domains:
maxItems: 1
+ label:
+ $ref: /schemas/types.yaml#/definitions/string
+ description:
+ Define the label which can describe what kind of HW or system the
+ coresight device belongs to.
+
in-ports:
$ref: /schemas/graph.yaml#/properties/ports
diff --git a/Documentation/devicetree/bindings/arm/arm,coresight-dynamic-replicator.yaml b/Documentation/devicetree/bindings/arm/arm,coresight-dynamic-replicator.yaml
index 03792e9bd97a..178a3861ee29 100644
--- a/Documentation/devicetree/bindings/arm/arm,coresight-dynamic-replicator.yaml
+++ b/Documentation/devicetree/bindings/arm/arm,coresight-dynamic-replicator.yaml
@@ -54,6 +54,12 @@ properties:
- const: apb_pclk
- const: atclk
+ label:
+ $ref: /schemas/types.yaml#/definitions/string
+ description:
+ Define the label which can describe what kind of HW or system the
+ coresight device belongs to.
+
power-domains:
maxItems: 1
diff --git a/Documentation/devicetree/bindings/arm/arm,coresight-static-funnel.yaml b/Documentation/devicetree/bindings/arm/arm,coresight-static-funnel.yaml
index cc8c3baa79b4..39b291909cc4 100644
--- a/Documentation/devicetree/bindings/arm/arm,coresight-static-funnel.yaml
+++ b/Documentation/devicetree/bindings/arm/arm,coresight-static-funnel.yaml
@@ -30,6 +30,12 @@ properties:
power-domains:
maxItems: 1
+ label:
+ $ref: /schemas/types.yaml#/definitions/string
+ description:
+ Define the label which can describe what kind of HW or system the
+ coresight device belongs to.
+
in-ports:
$ref: /schemas/graph.yaml#/properties/ports
diff --git a/Documentation/devicetree/bindings/arm/arm,coresight-static-replicator.yaml b/Documentation/devicetree/bindings/arm/arm,coresight-static-replicator.yaml
index 0c1017affbad..a3e8a105b2ae 100644
--- a/Documentation/devicetree/bindings/arm/arm,coresight-static-replicator.yaml
+++ b/Documentation/devicetree/bindings/arm/arm,coresight-static-replicator.yaml
@@ -43,6 +43,12 @@ properties:
- const: dbg_trc
- const: dbg_apb
+ label:
+ $ref: /schemas/types.yaml#/definitions/string
+ description:
+ Define the label which can describe what kind of HW or system the
+ coresight device belongs to.
+
in-ports:
$ref: /schemas/graph.yaml#/properties/ports
additionalProperties: false
diff --git a/Documentation/devicetree/bindings/arm/arm,coresight-tmc.yaml b/Documentation/devicetree/bindings/arm/arm,coresight-tmc.yaml
index 4787d7c6bac2..6a37ebaf474b 100644
--- a/Documentation/devicetree/bindings/arm/arm,coresight-tmc.yaml
+++ b/Documentation/devicetree/bindings/arm/arm,coresight-tmc.yaml
@@ -55,6 +55,12 @@ properties:
- const: apb_pclk
- const: atclk
+ label:
+ $ref: /schemas/types.yaml#/definitions/string
+ description:
+ Define the label which can describe what kind of HW or system the
+ coresight device belongs to.
+
iommus:
maxItems: 1
diff --git a/Documentation/devicetree/bindings/arm/qcom,coresight-tpda.yaml b/Documentation/devicetree/bindings/arm/qcom,coresight-tpda.yaml
index 5ed40f21b8eb..f42ecb4e8539 100644
--- a/Documentation/devicetree/bindings/arm/qcom,coresight-tpda.yaml
+++ b/Documentation/devicetree/bindings/arm/qcom,coresight-tpda.yaml
@@ -64,6 +64,12 @@ properties:
items:
- const: apb_pclk
+ label:
+ $ref: /schemas/types.yaml#/definitions/string
+ description:
+ Define the label which can describe what kind of HW or system the
+ coresight device belongs to.
+
in-ports:
description: |
Input connections from TPDM to TPDA
diff --git a/Documentation/devicetree/bindings/arm/qcom,coresight-tpdm.yaml b/Documentation/devicetree/bindings/arm/qcom,coresight-tpdm.yaml
index 07d21a3617f5..5e758476ad7f 100644
--- a/Documentation/devicetree/bindings/arm/qcom,coresight-tpdm.yaml
+++ b/Documentation/devicetree/bindings/arm/qcom,coresight-tpdm.yaml
@@ -76,6 +76,12 @@ properties:
minimum: 0
maximum: 32
+ label:
+ $ref: /schemas/types.yaml#/definitions/string
+ description:
+ Define the label which can describe what kind of HW or system the
+ coresight device belongs to.
+
clocks:
maxItems: 1
--
2.17.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v8 2/2] coresight: Add label sysfs node support
2025-07-03 13:04 [PATCH v8 0/2] coresight: Add label sysfs node support Mao Jinlong
2025-07-03 13:04 ` [PATCH v8 1/2] dt-bindings: arm: Add label in the coresight components Mao Jinlong
@ 2025-07-03 13:04 ` Mao Jinlong
2025-07-03 14:19 ` Leo Yan
1 sibling, 1 reply; 8+ messages in thread
From: Mao Jinlong @ 2025-07-03 13:04 UTC (permalink / raw)
To: Suzuki K Poulose, Mike Leach, James Clark, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Mathieu Poirier,
Bjorn Andersson, Konrad Dybcio
Cc: Mao Jinlong, coresight, linux-arm-kernel, devicetree,
linux-kernel, linux-arm-msm
For some coresight components like CTI and TPDM, there could be
numerous of them. From the node name, we can only get the type and
register address of the component. We can't identify the HW or the
system the component belongs to. Add label sysfs node support for
showing the intuitive name of the device.
Signed-off-by: Mao Jinlong <quic_jinlmao@quicinc.com>
Reviewed-by: Mike Leach <mike.leach@linaro.org>
---
.../testing/sysfs-bus-coresight-devices-cti | 6 ++++
.../sysfs-bus-coresight-devices-funnel | 6 ++++
.../testing/sysfs-bus-coresight-devices-tpdm | 6 ++++
drivers/hwtracing/coresight/coresight-sysfs.c | 32 +++++++++++++++++++
4 files changed, 50 insertions(+)
diff --git a/Documentation/ABI/testing/sysfs-bus-coresight-devices-cti b/Documentation/ABI/testing/sysfs-bus-coresight-devices-cti
index a97b70f588da..55367bbc696f 100644
--- a/Documentation/ABI/testing/sysfs-bus-coresight-devices-cti
+++ b/Documentation/ABI/testing/sysfs-bus-coresight-devices-cti
@@ -239,3 +239,9 @@ Date: March 2020
KernelVersion: 5.7
Contact: Mike Leach or Mathieu Poirier
Description: (Write) Clear all channel / trigger programming.
+
+What: /sys/bus/coresight/devices/<cti-name>/label
+Date: Jul 2025
+KernelVersion 6.17
+Contact: Mao Jinlong <quic_jinlmao@quicinc.com>
+Description: (Read) Show hardware context information of device.
diff --git a/Documentation/ABI/testing/sysfs-bus-coresight-devices-funnel b/Documentation/ABI/testing/sysfs-bus-coresight-devices-funnel
index d75acda5e1b3..5578fa5f6f02 100644
--- a/Documentation/ABI/testing/sysfs-bus-coresight-devices-funnel
+++ b/Documentation/ABI/testing/sysfs-bus-coresight-devices-funnel
@@ -10,3 +10,9 @@ Date: November 2014
KernelVersion: 3.19
Contact: Mathieu Poirier <mathieu.poirier@linaro.org>
Description: (RW) Defines input port priority order.
+
+What: /sys/bus/coresight/devices/<memory_map>.funnel/label
+Date: Jul 2025
+KernelVersion 6.17
+Contact: Mao Jinlong <quic_jinlmao@quicinc.com>
+Description: (Read) Show hardware context information of device.
diff --git a/Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm b/Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm
index a341b08ae70b..e6d935e83042 100644
--- a/Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm
+++ b/Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm
@@ -272,3 +272,9 @@ KernelVersion 6.15
Contact: Jinlong Mao (QUIC) <quic_jinlmao@quicinc.com>, Tao Zhang (QUIC) <quic_taozha@quicinc.com>
Description:
(RW) Set/Get the enablement of the individual lane.
+
+What: /sys/bus/coresight/devices/<tpdm-name>/label
+Date: Jul 2025
+KernelVersion 6.17
+Contact: Mao Jinlong <quic_jinlmao@quicinc.com>
+Description: (Read) Show hardware context information of device.
diff --git a/drivers/hwtracing/coresight/coresight-sysfs.c b/drivers/hwtracing/coresight/coresight-sysfs.c
index feadaf065b53..e3d21c49814d 100644
--- a/drivers/hwtracing/coresight/coresight-sysfs.c
+++ b/drivers/hwtracing/coresight/coresight-sysfs.c
@@ -7,6 +7,7 @@
#include <linux/device.h>
#include <linux/idr.h>
#include <linux/kernel.h>
+#include <linux/property.h>
#include "coresight-priv.h"
#include "coresight-trace-id.h"
@@ -371,18 +372,47 @@ static ssize_t enable_source_store(struct device *dev,
}
static DEVICE_ATTR_RW(enable_source);
+static ssize_t label_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+
+ const char *str;
+ int ret = 0;
+
+ ret = fwnode_property_read_string(dev_fwnode(dev), "label", &str);
+ if (ret == 0)
+ return scnprintf(buf, PAGE_SIZE, "%s\n", str);
+ else
+ return ret;
+}
+static DEVICE_ATTR_RO(label);
+
static struct attribute *coresight_sink_attrs[] = {
&dev_attr_enable_sink.attr,
+ &dev_attr_label.attr,
NULL,
};
ATTRIBUTE_GROUPS(coresight_sink);
static struct attribute *coresight_source_attrs[] = {
&dev_attr_enable_source.attr,
+ &dev_attr_label.attr,
NULL,
};
ATTRIBUTE_GROUPS(coresight_source);
+static struct attribute *coresight_link_attrs[] = {
+ &dev_attr_label.attr,
+ NULL,
+};
+ATTRIBUTE_GROUPS(coresight_link);
+
+static struct attribute *coresight_helper_attrs[] = {
+ &dev_attr_label.attr,
+ NULL,
+};
+ATTRIBUTE_GROUPS(coresight_helper);
+
const struct device_type coresight_dev_type[] = {
[CORESIGHT_DEV_TYPE_SINK] = {
.name = "sink",
@@ -390,6 +420,7 @@ const struct device_type coresight_dev_type[] = {
},
[CORESIGHT_DEV_TYPE_LINK] = {
.name = "link",
+ .groups = coresight_link_groups,
},
[CORESIGHT_DEV_TYPE_LINKSINK] = {
.name = "linksink",
@@ -401,6 +432,7 @@ const struct device_type coresight_dev_type[] = {
},
[CORESIGHT_DEV_TYPE_HELPER] = {
.name = "helper",
+ .groups = coresight_helper_groups,
}
};
/* Ensure the enum matches the names and groups */
--
2.17.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v8 2/2] coresight: Add label sysfs node support
2025-07-03 13:04 ` [PATCH v8 2/2] coresight: Add label sysfs node support Mao Jinlong
@ 2025-07-03 14:19 ` Leo Yan
2025-07-16 2:42 ` Jinlong Mao
0 siblings, 1 reply; 8+ messages in thread
From: Leo Yan @ 2025-07-03 14:19 UTC (permalink / raw)
To: Mao Jinlong
Cc: Suzuki K Poulose, Mike Leach, James Clark, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Mathieu Poirier,
Bjorn Andersson, Konrad Dybcio, coresight, linux-arm-kernel,
devicetree, linux-kernel, linux-arm-msm
On Thu, Jul 03, 2025 at 09:04:53PM +0800, Mao Jinlong wrote:
[...]
> +static ssize_t label_show(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> +
> + const char *str;
> + int ret = 0;
No need to init ret to 0.
> + ret = fwnode_property_read_string(dev_fwnode(dev), "label", &str);
> + if (ret == 0)
> + return scnprintf(buf, PAGE_SIZE, "%s\n", str);
> + else
> + return ret;
> +}
> +static DEVICE_ATTR_RO(label);
> +
> static struct attribute *coresight_sink_attrs[] = {
> &dev_attr_enable_sink.attr,
> + &dev_attr_label.attr,
> NULL,
> };
> ATTRIBUTE_GROUPS(coresight_sink);
>
> static struct attribute *coresight_source_attrs[] = {
> &dev_attr_enable_source.attr,
> + &dev_attr_label.attr,
> NULL,
> };
> ATTRIBUTE_GROUPS(coresight_source);
>
> +static struct attribute *coresight_link_attrs[] = {
> + &dev_attr_label.attr,
> + NULL,
> +};
> +ATTRIBUTE_GROUPS(coresight_link);
> +
> +static struct attribute *coresight_helper_attrs[] = {
> + &dev_attr_label.attr,
> + NULL,
> +};
> +ATTRIBUTE_GROUPS(coresight_helper);
> +
This change adds a 'label' entry for source, link, helper, and sink
components, but the documentation has only updated for three components:
CTI, funnel, and TPDM.
Should we also update the documentation for all relevant components,
such as ETM, ETR, etc.?
Additionally, patch 01 is missing the update to the ETM yaml file for
the new property. I checked patch v4 [1], which includes a change to
etm.yaml, but this change was dropped since v5. I briefly read the
v4 discussion thread and didn't see any mention of removing the ETM
related change. Did you see any particular issue when add label for
ETM devices?
Overall, this series is fine for me. Just please ensure that all
relevant components are covered for completeness.
Thanks,
Leo
[1] https://patchwork.kernel.org/project/linux-arm-msm/cover/20240703122340.26864-1-quic_jinlmao@quicinc.com/
> const struct device_type coresight_dev_type[] = {
> [CORESIGHT_DEV_TYPE_SINK] = {
> .name = "sink",
> @@ -390,6 +420,7 @@ const struct device_type coresight_dev_type[] = {
> },
> [CORESIGHT_DEV_TYPE_LINK] = {
> .name = "link",
> + .groups = coresight_link_groups,
> },
> [CORESIGHT_DEV_TYPE_LINKSINK] = {
> .name = "linksink",
> @@ -401,6 +432,7 @@ const struct device_type coresight_dev_type[] = {
> },
> [CORESIGHT_DEV_TYPE_HELPER] = {
> .name = "helper",
> + .groups = coresight_helper_groups,
> }
> };
> /* Ensure the enum matches the names and groups */
> --
> 2.17.1
>
> _______________________________________________
> CoreSight mailing list -- coresight@lists.linaro.org
> To unsubscribe send an email to coresight-leave@lists.linaro.org
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v8 1/2] dt-bindings: arm: Add label in the coresight components
2025-07-03 13:04 ` [PATCH v8 1/2] dt-bindings: arm: Add label in the coresight components Mao Jinlong
@ 2025-07-03 15:43 ` Rob Herring
0 siblings, 0 replies; 8+ messages in thread
From: Rob Herring @ 2025-07-03 15:43 UTC (permalink / raw)
To: Mao Jinlong
Cc: Suzuki K Poulose, Mike Leach, James Clark, Krzysztof Kozlowski,
Conor Dooley, Mathieu Poirier, Bjorn Andersson, Konrad Dybcio,
coresight, linux-arm-kernel, devicetree, linux-kernel,
linux-arm-msm
On Thu, Jul 03, 2025 at 09:04:52PM +0800, Mao Jinlong wrote:
> Current name of coresight component's folder consists of prefix of
> the device and the id in the device list. When run 'ls' command,
> we can get the register address of the device. Take CTI for example,
> if we want to set the config for modem CTI, but we can't know which
> CTI is modem CTI from all current information.
>
> cti_sys0 -> ../../../devices/platform/soc@0/138f0000.cti/cti_sys0
> cti_sys1 -> ../../../devices/platform/soc@0/13900000.cti/cti_sys1
>
> Add label to show hardware context information of each coresight
> device. There will be a sysfs node label in each device folder.
>
> cat /sys/bus/coresight/devices/cti_sys0/label
>
> Signed-off-by: Mao Jinlong <quic_jinlmao@quicinc.com>
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> Reviewed-by: Mike Leach <mike.leach@linaro.org>
> ---
> .../devicetree/bindings/arm/arm,coresight-cti.yaml | 6 ++++++
> .../devicetree/bindings/arm/arm,coresight-dummy-sink.yaml | 6 ++++++
> .../devicetree/bindings/arm/arm,coresight-dummy-source.yaml | 6 ++++++
> .../bindings/arm/arm,coresight-dynamic-funnel.yaml | 6 ++++++
> .../bindings/arm/arm,coresight-dynamic-replicator.yaml | 6 ++++++
> .../bindings/arm/arm,coresight-static-funnel.yaml | 6 ++++++
> .../bindings/arm/arm,coresight-static-replicator.yaml | 6 ++++++
> .../devicetree/bindings/arm/arm,coresight-tmc.yaml | 6 ++++++
> .../devicetree/bindings/arm/qcom,coresight-tpda.yaml | 6 ++++++
> .../devicetree/bindings/arm/qcom,coresight-tpdm.yaml | 6 ++++++
> 10 files changed, 60 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/arm/arm,coresight-cti.yaml b/Documentation/devicetree/bindings/arm/arm,coresight-cti.yaml
> index 2d5545a2b49c..5ca6d3d313a3 100644
> --- a/Documentation/devicetree/bindings/arm/arm,coresight-cti.yaml
> +++ b/Documentation/devicetree/bindings/arm/arm,coresight-cti.yaml
> @@ -98,6 +98,12 @@ properties:
> power-domains:
> maxItems: 1
>
> + label:
> + $ref: /schemas/types.yaml#/definitions/string
label already has a type. Drop.
> + description:
> + Define the label which can describe what kind of HW or system the
> + coresight device belongs to.
'compatible' tells us 'what kind of HW'.
> +
> arm,cti-ctm-id:
> $ref: /schemas/types.yaml#/definitions/uint32
> description:
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v8 2/2] coresight: Add label sysfs node support
2025-07-03 14:19 ` Leo Yan
@ 2025-07-16 2:42 ` Jinlong Mao
2025-07-16 10:45 ` Mike Leach
0 siblings, 1 reply; 8+ messages in thread
From: Jinlong Mao @ 2025-07-16 2:42 UTC (permalink / raw)
To: Leo Yan
Cc: Suzuki K Poulose, Mike Leach, James Clark, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Mathieu Poirier,
Bjorn Andersson, Konrad Dybcio, coresight, linux-arm-kernel,
devicetree, linux-kernel, linux-arm-msm
On 2025/7/3 22:19, Leo Yan wrote:
> On Thu, Jul 03, 2025 at 09:04:53PM +0800, Mao Jinlong wrote:
>
> [...]
>
>> +static ssize_t label_show(struct device *dev,
>> + struct device_attribute *attr, char *buf)
>> +{
>> +
>> + const char *str;
>> + int ret = 0;
>
> No need to init ret to 0.
>
>> + ret = fwnode_property_read_string(dev_fwnode(dev), "label", &str);
>> + if (ret == 0)
>> + return scnprintf(buf, PAGE_SIZE, "%s\n", str);
>> + else
>> + return ret;
>> +}
>> +static DEVICE_ATTR_RO(label);
>> +
>> static struct attribute *coresight_sink_attrs[] = {
>> &dev_attr_enable_sink.attr,
>> + &dev_attr_label.attr,
>> NULL,
>> };
>> ATTRIBUTE_GROUPS(coresight_sink);
>>
>> static struct attribute *coresight_source_attrs[] = {
>> &dev_attr_enable_source.attr,
>> + &dev_attr_label.attr,
>> NULL,
>> };
>> ATTRIBUTE_GROUPS(coresight_source);
>>
>> +static struct attribute *coresight_link_attrs[] = {
>> + &dev_attr_label.attr,
>> + NULL,
>> +};
>> +ATTRIBUTE_GROUPS(coresight_link);
>> +
>> +static struct attribute *coresight_helper_attrs[] = {
>> + &dev_attr_label.attr,
>> + NULL,
>> +};
>> +ATTRIBUTE_GROUPS(coresight_helper);
>> +
>
> This change adds a 'label' entry for source, link, helper, and sink
> components, but the documentation has only updated for three components:
> CTI, funnel, and TPDM.
>
> Should we also update the documentation for all relevant components,
> such as ETM, ETR, etc.?
>
> Additionally, patch 01 is missing the update to the ETM yaml file for
> the new property. I checked patch v4 [1], which includes a change to
> etm.yaml, but this change was dropped since v5. I briefly read the
> v4 discussion thread and didn't see any mention of removing the ETM
> related change. Did you see any particular issue when add label for
> ETM devices?
>
> Overall, this series is fine for me. Just please ensure that all
> relevant components are covered for completeness.
>
> Thanks,
> Leo
>
I will update all coresight docs.
Thanks
Jinlong Mao
> [1] https://patchwork.kernel.org/project/linux-arm-msm/cover/20240703122340.26864-1-quic_jinlmao@quicinc.com/
>
>> const struct device_type coresight_dev_type[] = {
>> [CORESIGHT_DEV_TYPE_SINK] = {
>> .name = "sink",
>> @@ -390,6 +420,7 @@ const struct device_type coresight_dev_type[] = {
>> },
>> [CORESIGHT_DEV_TYPE_LINK] = {
>> .name = "link",
>> + .groups = coresight_link_groups,
>> },
>> [CORESIGHT_DEV_TYPE_LINKSINK] = {
>> .name = "linksink",
>> @@ -401,6 +432,7 @@ const struct device_type coresight_dev_type[] = {
>> },
>> [CORESIGHT_DEV_TYPE_HELPER] = {
>> .name = "helper",
>> + .groups = coresight_helper_groups,
>> }
>> };
>> /* Ensure the enum matches the names and groups */
>> --
>> 2.17.1
>>
>> _______________________________________________
>> CoreSight mailing list -- coresight@lists.linaro.org
>> To unsubscribe send an email to coresight-leave@lists.linaro.org
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v8 2/2] coresight: Add label sysfs node support
2025-07-16 2:42 ` Jinlong Mao
@ 2025-07-16 10:45 ` Mike Leach
2025-07-17 3:03 ` Jinlong Mao
0 siblings, 1 reply; 8+ messages in thread
From: Mike Leach @ 2025-07-16 10:45 UTC (permalink / raw)
To: Jinlong Mao
Cc: Leo Yan, Suzuki K Poulose, James Clark, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Mathieu Poirier,
Bjorn Andersson, Konrad Dybcio, coresight, linux-arm-kernel,
devicetree, linux-kernel, linux-arm-msm
Hi,
On Wed, 16 Jul 2025 at 03:43, Jinlong Mao <quic_jinlmao@quicinc.com> wrote:
>
>
>
> On 2025/7/3 22:19, Leo Yan wrote:
> > On Thu, Jul 03, 2025 at 09:04:53PM +0800, Mao Jinlong wrote:
> >
> > [...]
> >
> >> +static ssize_t label_show(struct device *dev,
> >> + struct device_attribute *attr, char *buf)
> >> +{
> >> +
> >> + const char *str;
> >> + int ret = 0;
> >
> > No need to init ret to 0.
> >
> >> + ret = fwnode_property_read_string(dev_fwnode(dev), "label", &str);
> >> + if (ret == 0)
> >> + return scnprintf(buf, PAGE_SIZE, "%s\n", str);
> >> + else
> >> + return ret;
> >> +}
> >> +static DEVICE_ATTR_RO(label);
> >> +
> >> static struct attribute *coresight_sink_attrs[] = {
> >> &dev_attr_enable_sink.attr,
> >> + &dev_attr_label.attr,
> >> NULL,
> >> };
> >> ATTRIBUTE_GROUPS(coresight_sink);
> >>
> >> static struct attribute *coresight_source_attrs[] = {
> >> &dev_attr_enable_source.attr,
> >> + &dev_attr_label.attr,
> >> NULL,
> >> };
> >> ATTRIBUTE_GROUPS(coresight_source);
> >>
> >> +static struct attribute *coresight_link_attrs[] = {
> >> + &dev_attr_label.attr,
> >> + NULL,
> >> +};
> >> +ATTRIBUTE_GROUPS(coresight_link);
> >> +
> >> +static struct attribute *coresight_helper_attrs[] = {
> >> + &dev_attr_label.attr,
> >> + NULL,
> >> +};
> >> +ATTRIBUTE_GROUPS(coresight_helper);
> >> +
> >
> > This change adds a 'label' entry for source, link, helper, and sink
> > components, but the documentation has only updated for three components:
> > CTI, funnel, and TPDM.
> >
> > Should we also update the documentation for all relevant components,
> > such as ETM, ETR, etc.?
> >
> > Additionally, patch 01 is missing the update to the ETM yaml file for
> > the new property. I checked patch v4 [1], which includes a change to
> > etm.yaml, but this change was dropped since v5. I briefly read the
> > v4 discussion thread and didn't see any mention of removing the ETM
> > related change. Did you see any particular issue when add label for
> > ETM devices?
> >
> > Overall, this series is fine for me. Just please ensure that all
> > relevant components are covered for completeness.
> >
> > Thanks,
> > Leo
> >
>
> I will update all coresight docs.
>
> Thanks
> Jinlong Mao
>
> > [1] https://patchwork.kernel.org/project/linux-arm-msm/cover/20240703122340.26864-1-quic_jinlmao@quicinc.com/
> >
> >> const struct device_type coresight_dev_type[] = {
> >> [CORESIGHT_DEV_TYPE_SINK] = {
> >> .name = "sink",
> >> @@ -390,6 +420,7 @@ const struct device_type coresight_dev_type[] = {
> >> },
> >> [CORESIGHT_DEV_TYPE_LINK] = {
> >> .name = "link",
> >> + .groups = coresight_link_groups,
> >> },
> >> [CORESIGHT_DEV_TYPE_LINKSINK] = {
> >> .name = "linksink",
> >> @@ -401,6 +432,7 @@ const struct device_type coresight_dev_type[] = {
> >> },
> >> [CORESIGHT_DEV_TYPE_HELPER] = {
> >> .name = "helper",
> >> + .groups = coresight_helper_groups,
> >> }
> >> };
> >> /* Ensure the enum matches the names and groups */
> >> --
> >> 2.17.1
> >>
> >> _______________________________________________
> >> CoreSight mailing list -- coresight@lists.linaro.org
> >> To unsubscribe send an email to coresight-leave@lists.linaro.org
>
Revisiting this - the label DT attribute is purely optional, and
provides context for the hardware instance.
This code as written appears to add a "label" file to all devices,
irrespective of if the label is set in the DT.or not, with blank
labels where the attribute is not present.
The visibility of the sysfs attribute should be controlled so that it
only appears if label is present in the DT.
Mike
--
Mike Leach
Principal Engineer, ARM Ltd.
Manchester Design Centre. UK
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v8 2/2] coresight: Add label sysfs node support
2025-07-16 10:45 ` Mike Leach
@ 2025-07-17 3:03 ` Jinlong Mao
0 siblings, 0 replies; 8+ messages in thread
From: Jinlong Mao @ 2025-07-17 3:03 UTC (permalink / raw)
To: Mike Leach
Cc: Leo Yan, Suzuki K Poulose, James Clark, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Mathieu Poirier,
Bjorn Andersson, Konrad Dybcio, coresight, linux-arm-kernel,
devicetree, linux-kernel, linux-arm-msm
On 2025/7/16 18:45, Mike Leach wrote:
> Hi,
>
> On Wed, 16 Jul 2025 at 03:43, Jinlong Mao <quic_jinlmao@quicinc.com> wrote:
>>
>>
>>
>> On 2025/7/3 22:19, Leo Yan wrote:
>>> On Thu, Jul 03, 2025 at 09:04:53PM +0800, Mao Jinlong wrote:
>>>
>>> [...]
>>>
>>>> +static ssize_t label_show(struct device *dev,
>>>> + struct device_attribute *attr, char *buf)
>>>> +{
>>>> +
>>>> + const char *str;
>>>> + int ret = 0;
>>>
>>> No need to init ret to 0.
>>>
>>>> + ret = fwnode_property_read_string(dev_fwnode(dev), "label", &str);
>>>> + if (ret == 0)
>>>> + return scnprintf(buf, PAGE_SIZE, "%s\n", str);
>>>> + else
>>>> + return ret;
>>>> +}
>>>> +static DEVICE_ATTR_RO(label);
>>>> +
>>>> static struct attribute *coresight_sink_attrs[] = {
>>>> &dev_attr_enable_sink.attr,
>>>> + &dev_attr_label.attr,
>>>> NULL,
>>>> };
>>>> ATTRIBUTE_GROUPS(coresight_sink);
>>>>
>>>> static struct attribute *coresight_source_attrs[] = {
>>>> &dev_attr_enable_source.attr,
>>>> + &dev_attr_label.attr,
>>>> NULL,
>>>> };
>>>> ATTRIBUTE_GROUPS(coresight_source);
>>>>
>>>> +static struct attribute *coresight_link_attrs[] = {
>>>> + &dev_attr_label.attr,
>>>> + NULL,
>>>> +};
>>>> +ATTRIBUTE_GROUPS(coresight_link);
>>>> +
>>>> +static struct attribute *coresight_helper_attrs[] = {
>>>> + &dev_attr_label.attr,
>>>> + NULL,
>>>> +};
>>>> +ATTRIBUTE_GROUPS(coresight_helper);
>>>> +
>>>
>>> This change adds a 'label' entry for source, link, helper, and sink
>>> components, but the documentation has only updated for three components:
>>> CTI, funnel, and TPDM.
>>>
>>> Should we also update the documentation for all relevant components,
>>> such as ETM, ETR, etc.?
>>>
>>> Additionally, patch 01 is missing the update to the ETM yaml file for
>>> the new property. I checked patch v4 [1], which includes a change to
>>> etm.yaml, but this change was dropped since v5. I briefly read the
>>> v4 discussion thread and didn't see any mention of removing the ETM
>>> related change. Did you see any particular issue when add label for
>>> ETM devices?
>>>
>>> Overall, this series is fine for me. Just please ensure that all
>>> relevant components are covered for completeness.
>>>
>>> Thanks,
>>> Leo
>>>
>>
>> I will update all coresight docs.
>>
>> Thanks
>> Jinlong Mao
>>
>>> [1] https://patchwork.kernel.org/project/linux-arm-msm/cover/20240703122340.26864-1-quic_jinlmao@quicinc.com/
>>>
>>>> const struct device_type coresight_dev_type[] = {
>>>> [CORESIGHT_DEV_TYPE_SINK] = {
>>>> .name = "sink",
>>>> @@ -390,6 +420,7 @@ const struct device_type coresight_dev_type[] = {
>>>> },
>>>> [CORESIGHT_DEV_TYPE_LINK] = {
>>>> .name = "link",
>>>> + .groups = coresight_link_groups,
>>>> },
>>>> [CORESIGHT_DEV_TYPE_LINKSINK] = {
>>>> .name = "linksink",
>>>> @@ -401,6 +432,7 @@ const struct device_type coresight_dev_type[] = {
>>>> },
>>>> [CORESIGHT_DEV_TYPE_HELPER] = {
>>>> .name = "helper",
>>>> + .groups = coresight_helper_groups,
>>>> }
>>>> };
>>>> /* Ensure the enum matches the names and groups */
>>>> --
>>>> 2.17.1
>>>>
>>>> _______________________________________________
>>>> CoreSight mailing list -- coresight@lists.linaro.org
>>>> To unsubscribe send an email to coresight-leave@lists.linaro.org
>>
>
> Revisiting this - the label DT attribute is purely optional, and
> provides context for the hardware instance.
> This code as written appears to add a "label" file to all devices,
> irrespective of if the label is set in the DT.or not, with blank
> labels where the attribute is not present.
> The visibility of the sysfs attribute should be controlled so that it
> only appears if label is present in the DT.
>
I will follow this.
Thanks
Jinlong Mao
> Mike
>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-07-17 3:04 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-03 13:04 [PATCH v8 0/2] coresight: Add label sysfs node support Mao Jinlong
2025-07-03 13:04 ` [PATCH v8 1/2] dt-bindings: arm: Add label in the coresight components Mao Jinlong
2025-07-03 15:43 ` Rob Herring
2025-07-03 13:04 ` [PATCH v8 2/2] coresight: Add label sysfs node support Mao Jinlong
2025-07-03 14:19 ` Leo Yan
2025-07-16 2:42 ` Jinlong Mao
2025-07-16 10:45 ` Mike Leach
2025-07-17 3:03 ` Jinlong Mao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).