* [PATCH v4 0/2] coresight: core: Add device name support
@ 2024-07-03 12:23 Mao Jinlong
2024-07-03 12:23 ` [PATCH v4 1/2] dt-bindings: arm: Add device-name in the coresight components Mao Jinlong
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Mao Jinlong @ 2024-07-03 12:23 UTC (permalink / raw)
To: Suzuki K Poulose, Mike Leach, James Clark, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Mao Jinlong,
Alexander Shishkin
Cc: coresight, linux-arm-kernel, devicetree, linux-kernel,
linux-arm-msm, Tingwei Zhang, Yuanfang Zhang, Tao Zhang, songchai,
Jie Gan
With current design, the name of the non-cpu bounded coresight
component is the device type with the number. And with 'ls' command
we can get the register address of the component. But from these
information, we can't know what the HW or system the component belongs
to. Add device-name in DT to support it.
cti_sys0 -> ../../../devices/platform/soc@0/138f0000.cti/cti_sys0
cti_sys1 -> ../../../devices/platform/soc@0/13900000.cti/cti_sys1
tpdm0 -> ../../../devices/platform/soc@0/10b0d000.tpdm/tpdm0
tpdm1 -> ../../../devices/platform/soc@0/10c28000.tpdm/tpdm1
tpdm2 -> ../../../devices/platform/soc@0/10c29000.tpdm/tpdm2
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.
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
Change since V1:
1. Change coresight-name to device name.
2. Add the device-name in coresight dt bindings.
Mao Jinlong (2):
coresight: core: Add device name support
dt-bindings: arm: Add device-name in the coresight components
.../bindings/arm/arm,coresight-catu.yaml | 6 +++
.../bindings/arm/arm,coresight-cpu-debug.yaml | 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 +++
.../bindings/arm/arm,coresight-etb10.yaml | 6 +++
.../bindings/arm/arm,coresight-etm.yaml | 6 +++
.../arm/arm,coresight-static-funnel.yaml | 6 +++
.../arm/arm,coresight-static-replicator.yaml | 6 +++
.../bindings/arm/arm,coresight-stm.yaml | 6 +++
.../bindings/arm/arm,coresight-tmc.yaml | 6 +++
.../bindings/arm/arm,coresight-tpiu.yaml | 6 +++
.../bindings/arm/qcom,coresight-tpda.yaml | 6 +++
.../bindings/arm/qcom,coresight-tpdm.yaml | 6 +++
drivers/hwtracing/coresight/coresight-core.c | 37 ++++++++++---------
.../hwtracing/coresight/coresight-platform.c | 31 ++++++++++++++++
include/linux/coresight.h | 3 +-
19 files changed, 149 insertions(+), 18 deletions(-)
Mao Jinlong (2):
dt-bindings: arm: Add device-name in the coresight components
coresight: core: Add device name support
.../bindings/arm/arm,coresight-cti.yaml | 6 +++
.../arm/arm,coresight-dummy-source.yaml | 6 +++
.../bindings/arm/arm,coresight-stm.yaml | 6 +++
.../bindings/arm/qcom,coresight-tpdm.yaml | 6 +++
drivers/hwtracing/coresight/coresight-core.c | 37 ++++++++++---------
.../hwtracing/coresight/coresight-platform.c | 30 +++++++++++++++
include/linux/coresight.h | 3 +-
7 files changed, 76 insertions(+), 18 deletions(-)
--
2.41.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v4 1/2] dt-bindings: arm: Add device-name in the coresight components
2024-07-03 12:23 [PATCH v4 0/2] coresight: core: Add device name support Mao Jinlong
@ 2024-07-03 12:23 ` Mao Jinlong
2024-07-24 19:13 ` Krzysztof Kozlowski
2024-07-03 12:23 ` [PATCH v4 2/2] coresight: core: Add device name support Mao Jinlong
2024-07-31 15:15 ` [PATCH v4 0/2] " Mike Leach
2 siblings, 1 reply; 9+ messages in thread
From: Mao Jinlong @ 2024-07-03 12:23 UTC (permalink / raw)
To: Suzuki K Poulose, Mike Leach, James Clark, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Mao Jinlong,
Alexander Shishkin
Cc: coresight, linux-arm-kernel, devicetree, linux-kernel,
linux-arm-msm, Tingwei Zhang, Yuanfang Zhang, Tao Zhang, songchai,
Jie Gan
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 device-name in device tree which can provide a better description
of the coresight device. It can provide the info like the system or
HW it belongs to.
Signed-off-by: Mao Jinlong <quic_jinlmao@quicinc.com>
---
.../devicetree/bindings/arm/arm,coresight-cti.yaml | 6 ++++++
.../devicetree/bindings/arm/arm,coresight-dummy-source.yaml | 6 ++++++
.../devicetree/bindings/arm/arm,coresight-stm.yaml | 6 ++++++
.../devicetree/bindings/arm/qcom,coresight-tpdm.yaml | 6 ++++++
4 files changed, 24 insertions(+)
diff --git a/Documentation/devicetree/bindings/arm/arm,coresight-cti.yaml b/Documentation/devicetree/bindings/arm/arm,coresight-cti.yaml
index 2d5545a2b49c..6a73eaa66a42 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
+ arm,cs-dev-name:
+ $ref: /schemas/types.yaml#/definitions/string
+ description:
+ Define the name 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-source.yaml b/Documentation/devicetree/bindings/arm/arm,coresight-dummy-source.yaml
index 6745b4cc8f1c..578c5e3227a6 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
+ arm,cs-dev-name:
+ $ref: /schemas/types.yaml#/definitions/string
+ description:
+ Define the name which can describe what kind of HW or system the
+ coresight device belongs to.
+
out-ports:
$ref: /schemas/graph.yaml#/properties/ports
diff --git a/Documentation/devicetree/bindings/arm/arm,coresight-stm.yaml b/Documentation/devicetree/bindings/arm/arm,coresight-stm.yaml
index 378380c3f5aa..3261d4f4adbb 100644
--- a/Documentation/devicetree/bindings/arm/arm,coresight-stm.yaml
+++ b/Documentation/devicetree/bindings/arm/arm,coresight-stm.yaml
@@ -51,6 +51,12 @@ properties:
- const: stm-base
- const: stm-stimulus-base
+ arm,cs-dev-name:
+ $ref: /schemas/types.yaml#/definitions/string
+ description:
+ Define the name which can describe what kind of HW or system the
+ coresight device belongs to.
+
clocks:
minItems: 1
maxItems: 2
diff --git a/Documentation/devicetree/bindings/arm/qcom,coresight-tpdm.yaml b/Documentation/devicetree/bindings/arm/qcom,coresight-tpdm.yaml
index 8eec07d9d454..12bb6403e934 100644
--- a/Documentation/devicetree/bindings/arm/qcom,coresight-tpdm.yaml
+++ b/Documentation/devicetree/bindings/arm/qcom,coresight-tpdm.yaml
@@ -44,6 +44,12 @@ properties:
minItems: 1
maxItems: 2
+ arm,cs-dev-name:
+ $ref: /schemas/types.yaml#/definitions/string
+ description:
+ Define the name which can describe what kind of HW or system the
+ coresight device belongs to.
+
qcom,dsb-element-bits:
description:
Specifies the DSB(Discrete Single Bit) element size supported by
--
2.41.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v4 2/2] coresight: core: Add device name support
2024-07-03 12:23 [PATCH v4 0/2] coresight: core: Add device name support Mao Jinlong
2024-07-03 12:23 ` [PATCH v4 1/2] dt-bindings: arm: Add device-name in the coresight components Mao Jinlong
@ 2024-07-03 12:23 ` Mao Jinlong
2024-07-31 15:15 ` [PATCH v4 0/2] " Mike Leach
2 siblings, 0 replies; 9+ messages in thread
From: Mao Jinlong @ 2024-07-03 12:23 UTC (permalink / raw)
To: Suzuki K Poulose, Mike Leach, James Clark, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Mao Jinlong,
Alexander Shishkin
Cc: coresight, linux-arm-kernel, devicetree, linux-kernel,
linux-arm-msm, Tingwei Zhang, Yuanfang Zhang, Tao Zhang, songchai,
Jie Gan
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 the device-name support for
adding the intuitive name of the device.
Signed-off-by: Mao Jinlong <quic_jinlmao@quicinc.com>
---
drivers/hwtracing/coresight/coresight-core.c | 37 ++++++++++---------
.../hwtracing/coresight/coresight-platform.c | 30 +++++++++++++++
include/linux/coresight.h | 3 +-
3 files changed, 52 insertions(+), 18 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c
index 9fc6f6b863e0..1d43333bbeb0 100644
--- a/drivers/hwtracing/coresight/coresight-core.c
+++ b/drivers/hwtracing/coresight/coresight-core.c
@@ -1328,33 +1328,36 @@ EXPORT_SYMBOL_GPL(coresight_loses_context_with_cpu);
* duplicate indices for the same device (e.g, if we defer probing of
* a device due to dependencies), in case the index is requested again.
*/
-char *coresight_alloc_device_name(struct coresight_dev_list *dict,
+const char *coresight_alloc_device_name(struct coresight_dev_list *dict,
struct device *dev)
{
int idx;
- char *name = NULL;
+ const char *name = NULL;
struct fwnode_handle **list;
mutex_lock(&coresight_mutex);
- idx = coresight_search_device_idx(dict, dev_fwnode(dev));
- if (idx < 0) {
- /* Make space for the new entry */
- idx = dict->nr_idx;
- list = krealloc_array(dict->fwnode_list,
- idx + 1, sizeof(*dict->fwnode_list),
- GFP_KERNEL);
- if (ZERO_OR_NULL_PTR(list)) {
- idx = -ENOMEM;
- goto done;
+ name = coresight_get_device_name(dev);
+ if (!name) {
+ idx = coresight_search_device_idx(dict, dev_fwnode(dev));
+ if (idx < 0) {
+ /* Make space for the new entry */
+ idx = dict->nr_idx;
+ list = krealloc_array(dict->fwnode_list,
+ idx + 1, sizeof(*dict->fwnode_list),
+ GFP_KERNEL);
+ if (ZERO_OR_NULL_PTR(list)) {
+ idx = -ENOMEM;
+ goto done;
+ }
+
+ list[idx] = dev_fwnode(dev);
+ dict->fwnode_list = list;
+ dict->nr_idx = idx + 1;
}
- list[idx] = dev_fwnode(dev);
- dict->fwnode_list = list;
- dict->nr_idx = idx + 1;
+ name = devm_kasprintf(dev, GFP_KERNEL, "%s%d", dict->pfx, idx);
}
-
- name = devm_kasprintf(dev, GFP_KERNEL, "%s%d", dict->pfx, idx);
done:
mutex_unlock(&coresight_mutex);
return name;
diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c
index 64e171eaad82..66de52bd6c5e 100644
--- a/drivers/hwtracing/coresight/coresight-platform.c
+++ b/drivers/hwtracing/coresight/coresight-platform.c
@@ -183,6 +183,22 @@ static int of_coresight_get_cpu(struct device *dev)
return cpu;
}
+static const char *of_coresight_get_device_name(struct device *dev)
+{
+ const char *name = NULL;
+
+ if (!dev->of_node)
+ return NULL;
+
+ /*
+ * Get the device name from DT. The name describes the HW or
+ * system the device is for.
+ */
+ of_property_read_string(dev->of_node, "arm,cs-dev-name", &name);
+
+ return name;
+}
+
/*
* of_coresight_parse_endpoint : Parse the given output endpoint @ep
* and fill the connection information in @pdata->out_conns
@@ -317,6 +333,11 @@ static inline int of_coresight_get_cpu(struct device *dev)
{
return -ENODEV;
}
+
+static inline const char *of_coresight_get_device_name(struct device *dev)
+{
+ return NULL;
+}
#endif
#ifdef CONFIG_ACPI
@@ -796,6 +817,15 @@ int coresight_get_cpu(struct device *dev)
}
EXPORT_SYMBOL_GPL(coresight_get_cpu);
+const char *coresight_get_device_name(struct device *dev)
+{
+ if (is_of_node(dev->fwnode))
+ return of_coresight_get_device_name(dev);
+ else
+ return NULL;
+}
+EXPORT_SYMBOL_GPL(coresight_get_device_name);
+
struct coresight_platform_data *
coresight_get_platform_data(struct device *dev)
{
diff --git a/include/linux/coresight.h b/include/linux/coresight.h
index f09ace92176e..f021f3e93978 100644
--- a/include/linux/coresight.h
+++ b/include/linux/coresight.h
@@ -626,7 +626,7 @@ extern int coresight_claim_device_unlocked(struct coresight_device *csdev);
extern void coresight_disclaim_device(struct coresight_device *csdev);
extern void coresight_disclaim_device_unlocked(struct coresight_device *csdev);
-extern char *coresight_alloc_device_name(struct coresight_dev_list *devs,
+extern const char *coresight_alloc_device_name(struct coresight_dev_list *devs,
struct device *dev);
extern bool coresight_loses_context_with_cpu(struct device *dev);
@@ -643,6 +643,7 @@ void coresight_relaxed_write64(struct coresight_device *csdev,
void coresight_write64(struct coresight_device *csdev, u64 val, u32 offset);
extern int coresight_get_cpu(struct device *dev);
+extern const char *coresight_get_device_name(struct device *dev);
struct coresight_platform_data *coresight_get_platform_data(struct device *dev);
struct coresight_connection *
--
2.41.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v4 1/2] dt-bindings: arm: Add device-name in the coresight components
2024-07-03 12:23 ` [PATCH v4 1/2] dt-bindings: arm: Add device-name in the coresight components Mao Jinlong
@ 2024-07-24 19:13 ` Krzysztof Kozlowski
2024-10-18 10:17 ` Suzuki K Poulose
0 siblings, 1 reply; 9+ messages in thread
From: Krzysztof Kozlowski @ 2024-07-24 19:13 UTC (permalink / raw)
To: Mao Jinlong, Suzuki K Poulose, Mike Leach, James Clark,
Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Alexander Shishkin
Cc: coresight, linux-arm-kernel, devicetree, linux-kernel,
linux-arm-msm, Tingwei Zhang, Yuanfang Zhang, Tao Zhang, songchai,
Jie Gan
On 03/07/2024 14:23, 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 device-name in device tree which can provide a better description
> of the coresight device. It can provide the info like the system or
> HW it belongs to.
>
> Signed-off-by: Mao Jinlong <quic_jinlmao@quicinc.com>
> ---
> .../devicetree/bindings/arm/arm,coresight-cti.yaml | 6 ++++++
> .../devicetree/bindings/arm/arm,coresight-dummy-source.yaml | 6 ++++++
> .../devicetree/bindings/arm/arm,coresight-stm.yaml | 6 ++++++
> .../devicetree/bindings/arm/qcom,coresight-tpdm.yaml | 6 ++++++
> 4 files changed, 24 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/arm/arm,coresight-cti.yaml b/Documentation/devicetree/bindings/arm/arm,coresight-cti.yaml
> index 2d5545a2b49c..6a73eaa66a42 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
>
> + arm,cs-dev-name:
> + $ref: /schemas/types.yaml#/definitions/string
> + description:
> + Define the name which can describe what kind of HW or system the
> + coresight device belongs to.
Don't we use already label for such cases? Power domains, input, leds,
panels, IIO, hwmon and more.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v4 0/2] coresight: core: Add device name support
2024-07-03 12:23 [PATCH v4 0/2] coresight: core: Add device name support Mao Jinlong
2024-07-03 12:23 ` [PATCH v4 1/2] dt-bindings: arm: Add device-name in the coresight components Mao Jinlong
2024-07-03 12:23 ` [PATCH v4 2/2] coresight: core: Add device name support Mao Jinlong
@ 2024-07-31 15:15 ` Mike Leach
2024-10-18 8:42 ` Jinlong Mao
2 siblings, 1 reply; 9+ messages in thread
From: Mike Leach @ 2024-07-31 15:15 UTC (permalink / raw)
To: Mao Jinlong
Cc: Suzuki K Poulose, James Clark, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Alexander Shishkin, coresight, linux-arm-kernel,
devicetree, linux-kernel, linux-arm-msm, Tingwei Zhang,
Yuanfang Zhang, Tao Zhang, songchai, Jie Gan
Hi,
1) As per Krzysztof comment - use the standard "label" property
2) Do not use the label string as the node name - there is no
guarantee of uniqueness which will cause issues. Please add the label
as a sysfs file to the standard node.
This uses the existing standard names, allowing any scripting based on
this to continue to work, and will not cause issues with uniqueness
e.g.
This will allow :
cat cti_cpu0/label
to extract the additional hardware context information that you need.
Thanks
Mike
On Wed, 3 Jul 2024 at 13:24, Mao Jinlong <quic_jinlmao@quicinc.com> wrote:
>
> With current design, the name of the non-cpu bounded coresight
> component is the device type with the number. And with 'ls' command
> we can get the register address of the component. But from these
> information, we can't know what the HW or system the component belongs
> to. Add device-name in DT to support it.
>
> cti_sys0 -> ../../../devices/platform/soc@0/138f0000.cti/cti_sys0
> cti_sys1 -> ../../../devices/platform/soc@0/13900000.cti/cti_sys1
> tpdm0 -> ../../../devices/platform/soc@0/10b0d000.tpdm/tpdm0
> tpdm1 -> ../../../devices/platform/soc@0/10c28000.tpdm/tpdm1
> tpdm2 -> ../../../devices/platform/soc@0/10c29000.tpdm/tpdm2
>
> 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.
>
> 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
>
> Change since V1:
> 1. Change coresight-name to device name.
> 2. Add the device-name in coresight dt bindings.
>
>
> Mao Jinlong (2):
> coresight: core: Add device name support
> dt-bindings: arm: Add device-name in the coresight components
>
> .../bindings/arm/arm,coresight-catu.yaml | 6 +++
> .../bindings/arm/arm,coresight-cpu-debug.yaml | 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 +++
> .../bindings/arm/arm,coresight-etb10.yaml | 6 +++
> .../bindings/arm/arm,coresight-etm.yaml | 6 +++
> .../arm/arm,coresight-static-funnel.yaml | 6 +++
> .../arm/arm,coresight-static-replicator.yaml | 6 +++
> .../bindings/arm/arm,coresight-stm.yaml | 6 +++
> .../bindings/arm/arm,coresight-tmc.yaml | 6 +++
> .../bindings/arm/arm,coresight-tpiu.yaml | 6 +++
> .../bindings/arm/qcom,coresight-tpda.yaml | 6 +++
> .../bindings/arm/qcom,coresight-tpdm.yaml | 6 +++
> drivers/hwtracing/coresight/coresight-core.c | 37 ++++++++++---------
> .../hwtracing/coresight/coresight-platform.c | 31 ++++++++++++++++
> include/linux/coresight.h | 3 +-
> 19 files changed, 149 insertions(+), 18 deletions(-)
>
> Mao Jinlong (2):
> dt-bindings: arm: Add device-name in the coresight components
> coresight: core: Add device name support
>
> .../bindings/arm/arm,coresight-cti.yaml | 6 +++
> .../arm/arm,coresight-dummy-source.yaml | 6 +++
> .../bindings/arm/arm,coresight-stm.yaml | 6 +++
> .../bindings/arm/qcom,coresight-tpdm.yaml | 6 +++
> drivers/hwtracing/coresight/coresight-core.c | 37 ++++++++++---------
> .../hwtracing/coresight/coresight-platform.c | 30 +++++++++++++++
> include/linux/coresight.h | 3 +-
> 7 files changed, 76 insertions(+), 18 deletions(-)
>
> --
> 2.41.0
>
--
Mike Leach
Principal Engineer, ARM Ltd.
Manchester Design Centre. UK
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v4 0/2] coresight: core: Add device name support
2024-07-31 15:15 ` [PATCH v4 0/2] " Mike Leach
@ 2024-10-18 8:42 ` Jinlong Mao
2024-10-24 12:45 ` Mike Leach
0 siblings, 1 reply; 9+ messages in thread
From: Jinlong Mao @ 2024-10-18 8:42 UTC (permalink / raw)
To: Mike Leach
Cc: Suzuki K Poulose, James Clark, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Alexander Shishkin, coresight, linux-arm-kernel,
devicetree, linux-kernel, linux-arm-msm, Tingwei Zhang,
Yuanfang Zhang, Tao Zhang, songchai, Jie Gan
On 2024/7/31 23:15, Mike Leach wrote:
> Hi,
>
> 1) As per Krzysztof comment - use the standard "label" property
>
> 2) Do not use the label string as the node name - there is no
> guarantee of uniqueness which will cause issues. Please add the label
> as a sysfs file to the standard node.
> This uses the existing standard names, allowing any scripting based on
> this to continue to work, and will not cause issues with uniqueness
>
> e.g.
> This will allow :
>
> cat cti_cpu0/label
>
> to extract the additional hardware context information that you need.
>
> Thanks
>
> Mike
Hi Mike,
I tried to get the label in the driver code. But I don't find any
function for it. Do you know the function to get the label of the device
tree node ?
label: node_name@node_address
Thanks
Jinlong Mao
>
>
> On Wed, 3 Jul 2024 at 13:24, Mao Jinlong <quic_jinlmao@quicinc.com> wrote:
>>
>> With current design, the name of the non-cpu bounded coresight
>> component is the device type with the number. And with 'ls' command
>> we can get the register address of the component. But from these
>> information, we can't know what the HW or system the component belongs
>> to. Add device-name in DT to support it.
>>
>> cti_sys0 -> ../../../devices/platform/soc@0/138f0000.cti/cti_sys0
>> cti_sys1 -> ../../../devices/platform/soc@0/13900000.cti/cti_sys1
>> tpdm0 -> ../../../devices/platform/soc@0/10b0d000.tpdm/tpdm0
>> tpdm1 -> ../../../devices/platform/soc@0/10c28000.tpdm/tpdm1
>> tpdm2 -> ../../../devices/platform/soc@0/10c29000.tpdm/tpdm2
>>
>> 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.
>>
>> 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
>>
>> Change since V1:
>> 1. Change coresight-name to device name.
>> 2. Add the device-name in coresight dt bindings.
>>
>>
>> Mao Jinlong (2):
>> coresight: core: Add device name support
>> dt-bindings: arm: Add device-name in the coresight components
>>
>> .../bindings/arm/arm,coresight-catu.yaml | 6 +++
>> .../bindings/arm/arm,coresight-cpu-debug.yaml | 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 +++
>> .../bindings/arm/arm,coresight-etb10.yaml | 6 +++
>> .../bindings/arm/arm,coresight-etm.yaml | 6 +++
>> .../arm/arm,coresight-static-funnel.yaml | 6 +++
>> .../arm/arm,coresight-static-replicator.yaml | 6 +++
>> .../bindings/arm/arm,coresight-stm.yaml | 6 +++
>> .../bindings/arm/arm,coresight-tmc.yaml | 6 +++
>> .../bindings/arm/arm,coresight-tpiu.yaml | 6 +++
>> .../bindings/arm/qcom,coresight-tpda.yaml | 6 +++
>> .../bindings/arm/qcom,coresight-tpdm.yaml | 6 +++
>> drivers/hwtracing/coresight/coresight-core.c | 37 ++++++++++---------
>> .../hwtracing/coresight/coresight-platform.c | 31 ++++++++++++++++
>> include/linux/coresight.h | 3 +-
>> 19 files changed, 149 insertions(+), 18 deletions(-)
>>
>> Mao Jinlong (2):
>> dt-bindings: arm: Add device-name in the coresight components
>> coresight: core: Add device name support
>>
>> .../bindings/arm/arm,coresight-cti.yaml | 6 +++
>> .../arm/arm,coresight-dummy-source.yaml | 6 +++
>> .../bindings/arm/arm,coresight-stm.yaml | 6 +++
>> .../bindings/arm/qcom,coresight-tpdm.yaml | 6 +++
>> drivers/hwtracing/coresight/coresight-core.c | 37 ++++++++++---------
>> .../hwtracing/coresight/coresight-platform.c | 30 +++++++++++++++
>> include/linux/coresight.h | 3 +-
>> 7 files changed, 76 insertions(+), 18 deletions(-)
>>
>> --
>> 2.41.0
>>
>
>
> --
> Mike Leach
> Principal Engineer, ARM Ltd.
> Manchester Design Centre. UK
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v4 1/2] dt-bindings: arm: Add device-name in the coresight components
2024-07-24 19:13 ` Krzysztof Kozlowski
@ 2024-10-18 10:17 ` Suzuki K Poulose
2024-10-18 10:22 ` Krzysztof Kozlowski
0 siblings, 1 reply; 9+ messages in thread
From: Suzuki K Poulose @ 2024-10-18 10:17 UTC (permalink / raw)
To: Krzysztof Kozlowski, Mao Jinlong, Mike Leach, James Clark,
Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Alexander Shishkin
Cc: coresight, linux-arm-kernel, devicetree, linux-kernel,
linux-arm-msm, Tingwei Zhang, Yuanfang Zhang, Tao Zhang, songchai,
Jie Gan
On 24/07/2024 20:13, Krzysztof Kozlowski wrote:
> On 03/07/2024 14:23, 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 device-name in device tree which can provide a better description
>> of the coresight device. It can provide the info like the system or
>> HW it belongs to.
>>
>> Signed-off-by: Mao Jinlong <quic_jinlmao@quicinc.com>
>> ---
>> .../devicetree/bindings/arm/arm,coresight-cti.yaml | 6 ++++++
>> .../devicetree/bindings/arm/arm,coresight-dummy-source.yaml | 6 ++++++
>> .../devicetree/bindings/arm/arm,coresight-stm.yaml | 6 ++++++
>> .../devicetree/bindings/arm/qcom,coresight-tpdm.yaml | 6 ++++++
>> 4 files changed, 24 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/arm/arm,coresight-cti.yaml b/Documentation/devicetree/bindings/arm/arm,coresight-cti.yaml
>> index 2d5545a2b49c..6a73eaa66a42 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
>>
>> + arm,cs-dev-name:
>> + $ref: /schemas/types.yaml#/definitions/string
>> + description:
>> + Define the name which can describe what kind of HW or system the
>> + coresight device belongs to.
>
> Don't we use already label for such cases? Power domains, input, leds,
> panels, IIO, hwmon and more.
We do and if we can get hold of them, that would be ideal. but do we get
them in the binary DT blob ? At least I couldn't see them on my Juno
dtb.
Cheers
Suzuki
>
> Best regards,
> Krzysztof
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v4 1/2] dt-bindings: arm: Add device-name in the coresight components
2024-10-18 10:17 ` Suzuki K Poulose
@ 2024-10-18 10:22 ` Krzysztof Kozlowski
0 siblings, 0 replies; 9+ messages in thread
From: Krzysztof Kozlowski @ 2024-10-18 10:22 UTC (permalink / raw)
To: Suzuki K Poulose, Mao Jinlong, Mike Leach, James Clark,
Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Alexander Shishkin
Cc: coresight, linux-arm-kernel, devicetree, linux-kernel,
linux-arm-msm, Tingwei Zhang, Yuanfang Zhang, Tao Zhang, songchai,
Jie Gan
On 18/10/2024 12:17, Suzuki K Poulose wrote:
> On 24/07/2024 20:13, Krzysztof Kozlowski wrote:
>> On 03/07/2024 14:23, 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 device-name in device tree which can provide a better description
>>> of the coresight device. It can provide the info like the system or
>>> HW it belongs to.
>>>
>>> Signed-off-by: Mao Jinlong <quic_jinlmao@quicinc.com>
>>> ---
>>> .../devicetree/bindings/arm/arm,coresight-cti.yaml | 6 ++++++
>>> .../devicetree/bindings/arm/arm,coresight-dummy-source.yaml | 6 ++++++
>>> .../devicetree/bindings/arm/arm,coresight-stm.yaml | 6 ++++++
>>> .../devicetree/bindings/arm/qcom,coresight-tpdm.yaml | 6 ++++++
>>> 4 files changed, 24 insertions(+)
>>>
>>> diff --git a/Documentation/devicetree/bindings/arm/arm,coresight-cti.yaml b/Documentation/devicetree/bindings/arm/arm,coresight-cti.yaml
>>> index 2d5545a2b49c..6a73eaa66a42 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
>>>
>>> + arm,cs-dev-name:
>>> + $ref: /schemas/types.yaml#/definitions/string
>>> + description:
>>> + Define the name which can describe what kind of HW or system the
>>> + coresight device belongs to.
>>
>> Don't we use already label for such cases? Power domains, input, leds,
>> panels, IIO, hwmon and more.
>
> We do and if we can get hold of them, that would be ideal. but do we get
> them in the binary DT blob ? At least I couldn't see them on my Juno
> dtb.
I meant "label" property (a string). See above bindings.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v4 0/2] coresight: core: Add device name support
2024-10-18 8:42 ` Jinlong Mao
@ 2024-10-24 12:45 ` Mike Leach
0 siblings, 0 replies; 9+ messages in thread
From: Mike Leach @ 2024-10-24 12:45 UTC (permalink / raw)
To: Jinlong Mao
Cc: Suzuki K Poulose, James Clark, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Alexander Shishkin, coresight, linux-arm-kernel,
devicetree, linux-kernel, linux-arm-msm, Tingwei Zhang,
Yuanfang Zhang, Tao Zhang, songchai, Jie Gan
Hi Jinlong
I was suggesting using the label property - see p44, table 4.3 of the
devicetree specification.
e.g.
node_name@node_address {
label = "text description of this device instance";
}
Then use the normal of_xxxx functions to extract the string value from "label".
Regards
Mike
On Fri, 18 Oct 2024 at 09:42, Jinlong Mao <quic_jinlmao@quicinc.com> wrote:
>
>
>
> On 2024/7/31 23:15, Mike Leach wrote:
> > Hi,
> >
> > 1) As per Krzysztof comment - use the standard "label" property
> >
> > 2) Do not use the label string as the node name - there is no
> > guarantee of uniqueness which will cause issues. Please add the label
> > as a sysfs file to the standard node.
> > This uses the existing standard names, allowing any scripting based on
> > this to continue to work, and will not cause issues with uniqueness
> >
> > e.g.
> > This will allow :
> >
> > cat cti_cpu0/label
> >
> > to extract the additional hardware context information that you need.
> >
> > Thanks
> >
> > Mike
>
> Hi Mike,
>
> I tried to get the label in the driver code. But I don't find any
> function for it. Do you know the function to get the label of the device
> tree node ?
>
> label: node_name@node_address
>
> Thanks
> Jinlong Mao
>
> >
> >
> > On Wed, 3 Jul 2024 at 13:24, Mao Jinlong <quic_jinlmao@quicinc.com> wrote:
> >>
> >> With current design, the name of the non-cpu bounded coresight
> >> component is the device type with the number. And with 'ls' command
> >> we can get the register address of the component. But from these
> >> information, we can't know what the HW or system the component belongs
> >> to. Add device-name in DT to support it.
> >>
> >> cti_sys0 -> ../../../devices/platform/soc@0/138f0000.cti/cti_sys0
> >> cti_sys1 -> ../../../devices/platform/soc@0/13900000.cti/cti_sys1
> >> tpdm0 -> ../../../devices/platform/soc@0/10b0d000.tpdm/tpdm0
> >> tpdm1 -> ../../../devices/platform/soc@0/10c28000.tpdm/tpdm1
> >> tpdm2 -> ../../../devices/platform/soc@0/10c29000.tpdm/tpdm2
> >>
> >> 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.
> >>
> >> 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
> >>
> >> Change since V1:
> >> 1. Change coresight-name to device name.
> >> 2. Add the device-name in coresight dt bindings.
> >>
> >>
> >> Mao Jinlong (2):
> >> coresight: core: Add device name support
> >> dt-bindings: arm: Add device-name in the coresight components
> >>
> >> .../bindings/arm/arm,coresight-catu.yaml | 6 +++
> >> .../bindings/arm/arm,coresight-cpu-debug.yaml | 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 +++
> >> .../bindings/arm/arm,coresight-etb10.yaml | 6 +++
> >> .../bindings/arm/arm,coresight-etm.yaml | 6 +++
> >> .../arm/arm,coresight-static-funnel.yaml | 6 +++
> >> .../arm/arm,coresight-static-replicator.yaml | 6 +++
> >> .../bindings/arm/arm,coresight-stm.yaml | 6 +++
> >> .../bindings/arm/arm,coresight-tmc.yaml | 6 +++
> >> .../bindings/arm/arm,coresight-tpiu.yaml | 6 +++
> >> .../bindings/arm/qcom,coresight-tpda.yaml | 6 +++
> >> .../bindings/arm/qcom,coresight-tpdm.yaml | 6 +++
> >> drivers/hwtracing/coresight/coresight-core.c | 37 ++++++++++---------
> >> .../hwtracing/coresight/coresight-platform.c | 31 ++++++++++++++++
> >> include/linux/coresight.h | 3 +-
> >> 19 files changed, 149 insertions(+), 18 deletions(-)
> >>
> >> Mao Jinlong (2):
> >> dt-bindings: arm: Add device-name in the coresight components
> >> coresight: core: Add device name support
> >>
> >> .../bindings/arm/arm,coresight-cti.yaml | 6 +++
> >> .../arm/arm,coresight-dummy-source.yaml | 6 +++
> >> .../bindings/arm/arm,coresight-stm.yaml | 6 +++
> >> .../bindings/arm/qcom,coresight-tpdm.yaml | 6 +++
> >> drivers/hwtracing/coresight/coresight-core.c | 37 ++++++++++---------
> >> .../hwtracing/coresight/coresight-platform.c | 30 +++++++++++++++
> >> include/linux/coresight.h | 3 +-
> >> 7 files changed, 76 insertions(+), 18 deletions(-)
> >>
> >> --
> >> 2.41.0
> >>
> >
> >
> > --
> > Mike Leach
> > Principal Engineer, ARM Ltd.
> > Manchester Design Centre. UK
>
--
Mike Leach
Principal Engineer, ARM Ltd.
Manchester Design Centre. UK
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2024-10-24 12:45 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-03 12:23 [PATCH v4 0/2] coresight: core: Add device name support Mao Jinlong
2024-07-03 12:23 ` [PATCH v4 1/2] dt-bindings: arm: Add device-name in the coresight components Mao Jinlong
2024-07-24 19:13 ` Krzysztof Kozlowski
2024-10-18 10:17 ` Suzuki K Poulose
2024-10-18 10:22 ` Krzysztof Kozlowski
2024-07-03 12:23 ` [PATCH v4 2/2] coresight: core: Add device name support Mao Jinlong
2024-07-31 15:15 ` [PATCH v4 0/2] " Mike Leach
2024-10-18 8:42 ` Jinlong Mao
2024-10-24 12:45 ` Mike Leach
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox