2024-01-15 16:43:37

by Mao Jinlong

[permalink] [raw]
Subject: [PATCH v2 0/2] coresight: core: Add device name support

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 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 | 5 +++
.../bindings/arm/arm,coresight-cpu-debug.yaml | 5 +++
.../bindings/arm/arm,coresight-cti.yaml | 5 +++
.../arm/arm,coresight-dummy-sink.yaml | 5 +++
.../arm/arm,coresight-dummy-source.yaml | 5 +++
.../arm/arm,coresight-dynamic-funnel.yaml | 5 +++
.../arm/arm,coresight-dynamic-replicator.yaml | 5 +++
.../bindings/arm/arm,coresight-etb10.yaml | 5 +++
.../bindings/arm/arm,coresight-etm.yaml | 5 +++
.../arm/arm,coresight-static-funnel.yaml | 5 +++
.../arm/arm,coresight-static-replicator.yaml | 5 +++
.../bindings/arm/arm,coresight-stm.yaml | 5 +++
.../bindings/arm/arm,coresight-tmc.yaml | 5 +++
.../bindings/arm/arm,coresight-tpiu.yaml | 5 +++
.../bindings/arm/qcom,coresight-tpda.yaml | 5 +++
.../bindings/arm/qcom,coresight-tpdm.yaml | 5 +++
drivers/hwtracing/coresight/coresight-core.c | 33 ++++++++++---------
.../hwtracing/coresight/coresight-platform.c | 31 +++++++++++++++++
include/linux/coresight.h | 1 +
19 files changed, 130 insertions(+), 15 deletions(-)

--
2.41.0



2024-01-15 16:43:48

by Mao Jinlong

[permalink] [raw]
Subject: [PATCH v2 1/2] coresight: core: Add device name support

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 <[email protected]>
---
drivers/hwtracing/coresight/coresight-core.c | 33 ++++++++++---------
.../hwtracing/coresight/coresight-platform.c | 31 +++++++++++++++++
include/linux/coresight.h | 1 +
3 files changed, 50 insertions(+), 15 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c
index 9fabe00a40d6..b85fc5cc3807 100644
--- a/drivers/hwtracing/coresight/coresight-core.c
+++ b/drivers/hwtracing/coresight/coresight-core.c
@@ -1772,24 +1772,27 @@ char *coresight_alloc_device_name(struct coresight_dev_list *dict,

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 9d550f5697fa..c6c68fc9f787 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, "device-name", &name);
+
+ return name;
+}
+
/*
* of_coresight_parse_endpoint : Parse the given output endpoint @ep
* and fill the connection information in @pdata->out_conns
@@ -315,6 +331,12 @@ 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
@@ -794,6 +816,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 a269fffaf991..caa17c8af865 100644
--- a/include/linux/coresight.h
+++ b/include/linux/coresight.h
@@ -675,6 +675,7 @@ static inline void coresight_write64(struct coresight_device *csdev, u64 val, u3
#endif /* IS_ENABLED(CONFIG_CORESIGHT) */

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


2024-01-15 16:44:11

by Mao Jinlong

[permalink] [raw]
Subject: [PATCH v2 2/2] dt-bindings: arm: Add device-name in the coresight components

device-name is used to 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 <[email protected]>
---
.../devicetree/bindings/arm/arm,coresight-catu.yaml | 5 +++++
.../devicetree/bindings/arm/arm,coresight-cpu-debug.yaml | 5 +++++
Documentation/devicetree/bindings/arm/arm,coresight-cti.yaml | 5 +++++
.../devicetree/bindings/arm/arm,coresight-dummy-sink.yaml | 5 +++++
.../devicetree/bindings/arm/arm,coresight-dummy-source.yaml | 5 +++++
.../bindings/arm/arm,coresight-dynamic-funnel.yaml | 5 +++++
.../bindings/arm/arm,coresight-dynamic-replicator.yaml | 5 +++++
.../devicetree/bindings/arm/arm,coresight-etb10.yaml | 5 +++++
Documentation/devicetree/bindings/arm/arm,coresight-etm.yaml | 5 +++++
.../devicetree/bindings/arm/arm,coresight-static-funnel.yaml | 5 +++++
.../bindings/arm/arm,coresight-static-replicator.yaml | 5 +++++
Documentation/devicetree/bindings/arm/arm,coresight-stm.yaml | 5 +++++
Documentation/devicetree/bindings/arm/arm,coresight-tmc.yaml | 5 +++++
.../devicetree/bindings/arm/arm,coresight-tpiu.yaml | 5 +++++
.../devicetree/bindings/arm/qcom,coresight-tpda.yaml | 5 +++++
.../devicetree/bindings/arm/qcom,coresight-tpdm.yaml | 5 +++++
16 files changed, 80 insertions(+)

diff --git a/Documentation/devicetree/bindings/arm/arm,coresight-catu.yaml b/Documentation/devicetree/bindings/arm/arm,coresight-catu.yaml
index 2bae06eed693..313e25d62f0d 100644
--- a/Documentation/devicetree/bindings/arm/arm,coresight-catu.yaml
+++ b/Documentation/devicetree/bindings/arm/arm,coresight-catu.yaml
@@ -44,6 +44,11 @@ properties:
- const: arm,coresight-catu
- const: arm,primecell

+ device-name:
+ description:
+ Define the name which can describe what kind of HW or system the
+ device is for.
+
reg:
maxItems: 1

diff --git a/Documentation/devicetree/bindings/arm/arm,coresight-cpu-debug.yaml b/Documentation/devicetree/bindings/arm/arm,coresight-cpu-debug.yaml
index 0a6bc03ebe00..f7904a7df726 100644
--- a/Documentation/devicetree/bindings/arm/arm,coresight-cpu-debug.yaml
+++ b/Documentation/devicetree/bindings/arm/arm,coresight-cpu-debug.yaml
@@ -39,6 +39,11 @@ properties:
- const: arm,coresight-cpu-debug
- const: arm,primecell

+ device-name:
+ description:
+ Define the name which can describe what kind of HW or system the
+ device is for.
+
reg:
maxItems: 1

diff --git a/Documentation/devicetree/bindings/arm/arm,coresight-cti.yaml b/Documentation/devicetree/bindings/arm/arm,coresight-cti.yaml
index 2d5545a2b49c..ba7b4e2db77c 100644
--- a/Documentation/devicetree/bindings/arm/arm,coresight-cti.yaml
+++ b/Documentation/devicetree/bindings/arm/arm,coresight-cti.yaml
@@ -88,6 +88,11 @@ properties:
- const: arm,coresight-cti
- const: arm,primecell

+ device-name:
+ description:
+ Define the name which can describe what kind of HW or system the
+ device is for.
+
reg:
maxItems: 1

diff --git a/Documentation/devicetree/bindings/arm/arm,coresight-dummy-sink.yaml b/Documentation/devicetree/bindings/arm/arm,coresight-dummy-sink.yaml
index c960c8e0a9a5..f94e08ca91f0 100644
--- a/Documentation/devicetree/bindings/arm/arm,coresight-dummy-sink.yaml
+++ b/Documentation/devicetree/bindings/arm/arm,coresight-dummy-sink.yaml
@@ -39,6 +39,11 @@ properties:
enum:
- arm,coresight-dummy-sink

+ device-name:
+ description:
+ Define the name which can describe what kind of HW or system the
+ device is for.
+
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 6745b4cc8f1c..031c4a1cb199 100644
--- a/Documentation/devicetree/bindings/arm/arm,coresight-dummy-source.yaml
+++ b/Documentation/devicetree/bindings/arm/arm,coresight-dummy-source.yaml
@@ -38,6 +38,11 @@ properties:
enum:
- arm,coresight-dummy-source

+ device-name:
+ description:
+ Define the name which can describe what kind of HW or system the
+ device is for.
+
out-ports:
$ref: /schemas/graph.yaml#/properties/ports

diff --git a/Documentation/devicetree/bindings/arm/arm,coresight-dynamic-funnel.yaml b/Documentation/devicetree/bindings/arm/arm,coresight-dynamic-funnel.yaml
index 44a1041cb0fc..2b4829492218 100644
--- a/Documentation/devicetree/bindings/arm/arm,coresight-dynamic-funnel.yaml
+++ b/Documentation/devicetree/bindings/arm/arm,coresight-dynamic-funnel.yaml
@@ -41,6 +41,11 @@ properties:
- const: arm,coresight-dynamic-funnel
- const: arm,primecell

+ device-name:
+ description:
+ Define the name which can describe what kind of HW or system the
+ device is for.
+
reg:
maxItems: 1

diff --git a/Documentation/devicetree/bindings/arm/arm,coresight-dynamic-replicator.yaml b/Documentation/devicetree/bindings/arm/arm,coresight-dynamic-replicator.yaml
index 03792e9bd97a..c841db363a87 100644
--- a/Documentation/devicetree/bindings/arm/arm,coresight-dynamic-replicator.yaml
+++ b/Documentation/devicetree/bindings/arm/arm,coresight-dynamic-replicator.yaml
@@ -41,6 +41,11 @@ properties:
- const: arm,coresight-dynamic-replicator
- const: arm,primecell

+ device-name:
+ description:
+ Define the name which can describe what kind of HW or system the
+ device is for.
+
reg:
maxItems: 1

diff --git a/Documentation/devicetree/bindings/arm/arm,coresight-etb10.yaml b/Documentation/devicetree/bindings/arm/arm,coresight-etb10.yaml
index 90679788e0bf..6605a8097a14 100644
--- a/Documentation/devicetree/bindings/arm/arm,coresight-etb10.yaml
+++ b/Documentation/devicetree/bindings/arm/arm,coresight-etb10.yaml
@@ -41,6 +41,11 @@ properties:
- const: arm,coresight-etb10
- const: arm,primecell

+ device-name:
+ description:
+ Define the name which can describe what kind of HW or system the
+ device is for.
+
reg:
maxItems: 1

diff --git a/Documentation/devicetree/bindings/arm/arm,coresight-etm.yaml b/Documentation/devicetree/bindings/arm/arm,coresight-etm.yaml
index 01200f67504a..d9ab0fc57f72 100644
--- a/Documentation/devicetree/bindings/arm/arm,coresight-etm.yaml
+++ b/Documentation/devicetree/bindings/arm/arm,coresight-etm.yaml
@@ -60,6 +60,11 @@ properties:
Embedded Trace Macrocell (version 4.x), with system register access only
const: arm,coresight-etm4x-sysreg

+ device-name:
+ description:
+ Define the name which can describe what kind of HW or system the
+ device is for.
+
reg:
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..342dfb303072 100644
--- a/Documentation/devicetree/bindings/arm/arm,coresight-static-funnel.yaml
+++ b/Documentation/devicetree/bindings/arm/arm,coresight-static-funnel.yaml
@@ -27,6 +27,11 @@ properties:
compatible:
const: arm,coresight-static-funnel

+ device-name:
+ description:
+ Define the name which can describe what kind of HW or system the
+ device is for.
+
power-domains:
maxItems: 1

diff --git a/Documentation/devicetree/bindings/arm/arm,coresight-static-replicator.yaml b/Documentation/devicetree/bindings/arm/arm,coresight-static-replicator.yaml
index 1892a091ac35..eaa828124c58 100644
--- a/Documentation/devicetree/bindings/arm/arm,coresight-static-replicator.yaml
+++ b/Documentation/devicetree/bindings/arm/arm,coresight-static-replicator.yaml
@@ -27,6 +27,11 @@ properties:
compatible:
const: arm,coresight-static-replicator

+ device-name:
+ description:
+ Define the name which can describe what kind of HW or system the
+ device is for.
+
power-domains:
maxItems: 1

diff --git a/Documentation/devicetree/bindings/arm/arm,coresight-stm.yaml b/Documentation/devicetree/bindings/arm/arm,coresight-stm.yaml
index 378380c3f5aa..9bc49fed2096 100644
--- a/Documentation/devicetree/bindings/arm/arm,coresight-stm.yaml
+++ b/Documentation/devicetree/bindings/arm/arm,coresight-stm.yaml
@@ -43,6 +43,11 @@ properties:
- const: arm,coresight-stm
- const: arm,primecell

+ device-name:
+ description:
+ Define the name which can describe what kind of HW or system the
+ device is for.
+
reg:
maxItems: 2

diff --git a/Documentation/devicetree/bindings/arm/arm,coresight-tmc.yaml b/Documentation/devicetree/bindings/arm/arm,coresight-tmc.yaml
index cb8dceaca70e..ba1dec0f580a 100644
--- a/Documentation/devicetree/bindings/arm/arm,coresight-tmc.yaml
+++ b/Documentation/devicetree/bindings/arm/arm,coresight-tmc.yaml
@@ -42,6 +42,11 @@ properties:
- const: arm,coresight-tmc
- const: arm,primecell

+ device-name:
+ description:
+ Define the name which can describe what kind of HW or system the
+ device is for.
+
reg:
maxItems: 1

diff --git a/Documentation/devicetree/bindings/arm/arm,coresight-tpiu.yaml b/Documentation/devicetree/bindings/arm/arm,coresight-tpiu.yaml
index 61a0cdc27745..6a5d0c3468f7 100644
--- a/Documentation/devicetree/bindings/arm/arm,coresight-tpiu.yaml
+++ b/Documentation/devicetree/bindings/arm/arm,coresight-tpiu.yaml
@@ -41,6 +41,11 @@ properties:
- const: arm,coresight-tpiu
- const: arm,primecell

+ device-name:
+ description:
+ Define the name which can describe what kind of HW or system the
+ device is for.
+
reg:
maxItems: 1

diff --git a/Documentation/devicetree/bindings/arm/qcom,coresight-tpda.yaml b/Documentation/devicetree/bindings/arm/qcom,coresight-tpda.yaml
index ea3c5db6b52d..31b7d7471a23 100644
--- a/Documentation/devicetree/bindings/arm/qcom,coresight-tpda.yaml
+++ b/Documentation/devicetree/bindings/arm/qcom,coresight-tpda.yaml
@@ -54,6 +54,11 @@ properties:
- const: qcom,coresight-tpda
- const: arm,primecell

+ device-name:
+ description:
+ Define the name which can describe what kind of HW or system the
+ device is for.
+
reg:
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 3bad47b7b02b..3b72ca36636e 100644
--- a/Documentation/devicetree/bindings/arm/qcom,coresight-tpdm.yaml
+++ b/Documentation/devicetree/bindings/arm/qcom,coresight-tpdm.yaml
@@ -40,6 +40,11 @@ properties:
- const: qcom,coresight-tpdm
- const: arm,primecell

+ device-name:
+ description:
+ Define the name which can describe what kind of HW or system the
+ device is for.
+
reg:
minItems: 1
maxItems: 2
--
2.41.0


2024-01-15 18:52:36

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] dt-bindings: arm: Add device-name in the coresight components


On Mon, 15 Jan 2024 08:42:48 -0800, Mao Jinlong wrote:
> device-name is used to 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 <[email protected]>
> ---
> .../devicetree/bindings/arm/arm,coresight-catu.yaml | 5 +++++
> .../devicetree/bindings/arm/arm,coresight-cpu-debug.yaml | 5 +++++
> Documentation/devicetree/bindings/arm/arm,coresight-cti.yaml | 5 +++++
> .../devicetree/bindings/arm/arm,coresight-dummy-sink.yaml | 5 +++++
> .../devicetree/bindings/arm/arm,coresight-dummy-source.yaml | 5 +++++
> .../bindings/arm/arm,coresight-dynamic-funnel.yaml | 5 +++++
> .../bindings/arm/arm,coresight-dynamic-replicator.yaml | 5 +++++
> .../devicetree/bindings/arm/arm,coresight-etb10.yaml | 5 +++++
> Documentation/devicetree/bindings/arm/arm,coresight-etm.yaml | 5 +++++
> .../devicetree/bindings/arm/arm,coresight-static-funnel.yaml | 5 +++++
> .../bindings/arm/arm,coresight-static-replicator.yaml | 5 +++++
> Documentation/devicetree/bindings/arm/arm,coresight-stm.yaml | 5 +++++
> Documentation/devicetree/bindings/arm/arm,coresight-tmc.yaml | 5 +++++
> .../devicetree/bindings/arm/arm,coresight-tpiu.yaml | 5 +++++
> .../devicetree/bindings/arm/qcom,coresight-tpda.yaml | 5 +++++
> .../devicetree/bindings/arm/qcom,coresight-tpdm.yaml | 5 +++++
> 16 files changed, 80 insertions(+)
>

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/arm/arm,coresight-etm.yaml: device-name: missing type definition

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.


2024-01-15 18:56:10

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] dt-bindings: arm: Add device-name in the coresight components

On 15/01/2024 17:42, Mao Jinlong wrote:
> device-name is used to provide a better description of the coresight
> device. It can provide the info like the system or HW it belongs to.
>

system or HW are defined by top level model, so probably you meant here
something else. Anyway you need to provide better rationale, because
above argument can be applied to any device and we do not have generic
device-name property. Once you have good explanation, then probably you
want "label" not some new property.

Best regards,
Krzysztof


2024-01-16 10:10:15

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] coresight: core: Add device name support

Hi Mao,

kernel test robot noticed the following build warnings:

[auto build test WARNING on robh/for-next]
[also build test WARNING on linus/master v6.7 next-20240112]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Mao-Jinlong/coresight-core-Add-device-name-support/20240116-004557
base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
patch link: https://lore.kernel.org/r/20240115164252.26510-2-quic_jinlmao%40quicinc.com
patch subject: [PATCH v2 1/2] coresight: core: Add device name support
config: arm-randconfig-r112-20240116 (https://download.01.org/0day-ci/archive/20240116/[email protected]/config)
compiler: arm-linux-gnueabi-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20240116/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

sparse warnings: (new ones prefixed by >>)
>> drivers/hwtracing/coresight/coresight-core.c:1775:14: sparse: sparse: incorrect type in assignment (different modifiers) @@ expected char *name @@ got char const * @@
drivers/hwtracing/coresight/coresight-core.c:1775:14: sparse: expected char *name
drivers/hwtracing/coresight/coresight-core.c:1775:14: sparse: got char const *

vim +1775 drivers/hwtracing/coresight/coresight-core.c

1758
1759 /*
1760 * coresight_alloc_device_name - Get an index for a given device in the
1761 * device index list specific to a driver. An index is allocated for a
1762 * device and is tracked with the fwnode_handle to prevent allocating
1763 * duplicate indices for the same device (e.g, if we defer probing of
1764 * a device due to dependencies), in case the index is requested again.
1765 */
1766 char *coresight_alloc_device_name(struct coresight_dev_list *dict,
1767 struct device *dev)
1768 {
1769 int idx;
1770 char *name = NULL;
1771 struct fwnode_handle **list;
1772
1773 mutex_lock(&coresight_mutex);
1774
> 1775 name = coresight_get_device_name(dev);
1776 if (!name) {
1777 idx = coresight_search_device_idx(dict, dev_fwnode(dev));
1778 if (idx < 0) {
1779 /* Make space for the new entry */
1780 idx = dict->nr_idx;
1781 list = krealloc_array(dict->fwnode_list,
1782 idx + 1, sizeof(*dict->fwnode_list),
1783 GFP_KERNEL);
1784 if (ZERO_OR_NULL_PTR(list)) {
1785 idx = -ENOMEM;
1786 goto done;
1787 }
1788
1789 list[idx] = dev_fwnode(dev);
1790 dict->fwnode_list = list;
1791 dict->nr_idx = idx + 1;
1792 }
1793
1794 name = devm_kasprintf(dev, GFP_KERNEL, "%s%d", dict->pfx, idx);
1795 }
1796 done:
1797 mutex_unlock(&coresight_mutex);
1798 return name;
1799 }
1800 EXPORT_SYMBOL_GPL(coresight_alloc_device_name);
1801

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

2024-01-16 10:42:21

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] coresight: core: Add device name support

Hi Mao,

kernel test robot noticed the following build warnings:

[auto build test WARNING on robh/for-next]
[also build test WARNING on linus/master v6.7 next-20240112]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Mao-Jinlong/coresight-core-Add-device-name-support/20240116-004557
base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
patch link: https://lore.kernel.org/r/20240115164252.26510-2-quic_jinlmao%40quicinc.com
patch subject: [PATCH v2 1/2] coresight: core: Add device name support
config: arm64-defconfig (https://download.01.org/0day-ci/archive/20240116/[email protected]/config)
compiler: aarch64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240116/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

drivers/hwtracing/coresight/coresight-core.c: In function 'coresight_alloc_device_name':
>> drivers/hwtracing/coresight/coresight-core.c:1775:14: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
1775 | name = coresight_get_device_name(dev);
| ^


vim +/const +1775 drivers/hwtracing/coresight/coresight-core.c

1758
1759 /*
1760 * coresight_alloc_device_name - Get an index for a given device in the
1761 * device index list specific to a driver. An index is allocated for a
1762 * device and is tracked with the fwnode_handle to prevent allocating
1763 * duplicate indices for the same device (e.g, if we defer probing of
1764 * a device due to dependencies), in case the index is requested again.
1765 */
1766 char *coresight_alloc_device_name(struct coresight_dev_list *dict,
1767 struct device *dev)
1768 {
1769 int idx;
1770 char *name = NULL;
1771 struct fwnode_handle **list;
1772
1773 mutex_lock(&coresight_mutex);
1774
> 1775 name = coresight_get_device_name(dev);
1776 if (!name) {
1777 idx = coresight_search_device_idx(dict, dev_fwnode(dev));
1778 if (idx < 0) {
1779 /* Make space for the new entry */
1780 idx = dict->nr_idx;
1781 list = krealloc_array(dict->fwnode_list,
1782 idx + 1, sizeof(*dict->fwnode_list),
1783 GFP_KERNEL);
1784 if (ZERO_OR_NULL_PTR(list)) {
1785 idx = -ENOMEM;
1786 goto done;
1787 }
1788
1789 list[idx] = dev_fwnode(dev);
1790 dict->fwnode_list = list;
1791 dict->nr_idx = idx + 1;
1792 }
1793
1794 name = devm_kasprintf(dev, GFP_KERNEL, "%s%d", dict->pfx, idx);
1795 }
1796 done:
1797 mutex_unlock(&coresight_mutex);
1798 return name;
1799 }
1800 EXPORT_SYMBOL_GPL(coresight_alloc_device_name);
1801

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

2024-01-16 11:36:03

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] coresight: core: Add device name support

Hi Mao,

kernel test robot noticed the following build errors:

[auto build test ERROR on robh/for-next]
[also build test ERROR on linus/master v6.7 next-20240112]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Mao-Jinlong/coresight-core-Add-device-name-support/20240116-004557
base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
patch link: https://lore.kernel.org/r/20240115164252.26510-2-quic_jinlmao%40quicinc.com
patch subject: [PATCH v2 1/2] coresight: core: Add device name support
config: arm-randconfig-r081-20240116 (https://download.01.org/0day-ci/archive/20240116/[email protected]/config)
compiler: clang version 18.0.0git (https://github.com/llvm/llvm-project 9bde5becb44ea071f5e1fa1f5d4071dc8788b18c)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240116/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

>> drivers/hwtracing/coresight/coresight-core.c:1775:7: error: assigning to 'char *' from 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
1775 | name = coresight_get_device_name(dev);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.


vim +1775 drivers/hwtracing/coresight/coresight-core.c

1758
1759 /*
1760 * coresight_alloc_device_name - Get an index for a given device in the
1761 * device index list specific to a driver. An index is allocated for a
1762 * device and is tracked with the fwnode_handle to prevent allocating
1763 * duplicate indices for the same device (e.g, if we defer probing of
1764 * a device due to dependencies), in case the index is requested again.
1765 */
1766 char *coresight_alloc_device_name(struct coresight_dev_list *dict,
1767 struct device *dev)
1768 {
1769 int idx;
1770 char *name = NULL;
1771 struct fwnode_handle **list;
1772
1773 mutex_lock(&coresight_mutex);
1774
> 1775 name = coresight_get_device_name(dev);
1776 if (!name) {
1777 idx = coresight_search_device_idx(dict, dev_fwnode(dev));
1778 if (idx < 0) {
1779 /* Make space for the new entry */
1780 idx = dict->nr_idx;
1781 list = krealloc_array(dict->fwnode_list,
1782 idx + 1, sizeof(*dict->fwnode_list),
1783 GFP_KERNEL);
1784 if (ZERO_OR_NULL_PTR(list)) {
1785 idx = -ENOMEM;
1786 goto done;
1787 }
1788
1789 list[idx] = dev_fwnode(dev);
1790 dict->fwnode_list = list;
1791 dict->nr_idx = idx + 1;
1792 }
1793
1794 name = devm_kasprintf(dev, GFP_KERNEL, "%s%d", dict->pfx, idx);
1795 }
1796 done:
1797 mutex_unlock(&coresight_mutex);
1798 return name;
1799 }
1800 EXPORT_SYMBOL_GPL(coresight_alloc_device_name);
1801

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

2024-01-16 13:44:16

by Suzuki K Poulose

[permalink] [raw]
Subject: Re: [PATCH v2 0/2] coresight: core: Add device name support

On 15/01/2024 16:42, Mao Jinlong 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

Please could you rebase this on for-next/queue (which has all bells and
whistles enabled to report Warnings), fixing the reported issue by
kernel test robot ?

Suzuki


>
> 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 | 5 +++
> .../bindings/arm/arm,coresight-cpu-debug.yaml | 5 +++
> .../bindings/arm/arm,coresight-cti.yaml | 5 +++
> .../arm/arm,coresight-dummy-sink.yaml | 5 +++
> .../arm/arm,coresight-dummy-source.yaml | 5 +++
> .../arm/arm,coresight-dynamic-funnel.yaml | 5 +++
> .../arm/arm,coresight-dynamic-replicator.yaml | 5 +++
> .../bindings/arm/arm,coresight-etb10.yaml | 5 +++
> .../bindings/arm/arm,coresight-etm.yaml | 5 +++
> .../arm/arm,coresight-static-funnel.yaml | 5 +++
> .../arm/arm,coresight-static-replicator.yaml | 5 +++
> .../bindings/arm/arm,coresight-stm.yaml | 5 +++
> .../bindings/arm/arm,coresight-tmc.yaml | 5 +++
> .../bindings/arm/arm,coresight-tpiu.yaml | 5 +++
> .../bindings/arm/qcom,coresight-tpda.yaml | 5 +++
> .../bindings/arm/qcom,coresight-tpdm.yaml | 5 +++
> drivers/hwtracing/coresight/coresight-core.c | 33 ++++++++++---------
> .../hwtracing/coresight/coresight-platform.c | 31 +++++++++++++++++
> include/linux/coresight.h | 1 +
> 19 files changed, 130 insertions(+), 15 deletions(-)
>


2024-01-16 22:14:36

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] dt-bindings: arm: Add device-name in the coresight components

Hi Mao,

kernel test robot noticed the following build warnings:

[auto build test WARNING on robh/for-next]
[also build test WARNING on linus/master v6.7 next-20240112]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Mao-Jinlong/coresight-core-Add-device-name-support/20240116-004557
base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
patch link: https://lore.kernel.org/r/20240115164252.26510-3-quic_jinlmao%40quicinc.com
patch subject: [PATCH v2 2/2] dt-bindings: arm: Add device-name in the coresight components
compiler: loongarch64-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20240117/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

dtcheck warnings: (new ones prefixed by >>)
>> Documentation/devicetree/bindings/arm/arm,coresight-cpu-debug.yaml: device-name: missing type definition

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

2024-01-17 01:59:53

by Mao Jinlong

[permalink] [raw]
Subject: Re: [PATCH v2 0/2] coresight: core: Add device name support



On 1/16/2024 9:43 PM, Suzuki K Poulose wrote:
> On 15/01/2024 16:42, Mao Jinlong 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
>
> Please could you rebase this on for-next/queue (which has all bells and
> whistles enabled to report Warnings), fixing the reported issue by
> kernel test robot ?
>
I will rebase the patch.

Thanks
Jinlong Mao
> Suzuki
>
>
>>
>> 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      |  5 +++
>>   .../bindings/arm/arm,coresight-cpu-debug.yaml |  5 +++
>>   .../bindings/arm/arm,coresight-cti.yaml       |  5 +++
>>   .../arm/arm,coresight-dummy-sink.yaml         |  5 +++
>>   .../arm/arm,coresight-dummy-source.yaml       |  5 +++
>>   .../arm/arm,coresight-dynamic-funnel.yaml     |  5 +++
>>   .../arm/arm,coresight-dynamic-replicator.yaml |  5 +++
>>   .../bindings/arm/arm,coresight-etb10.yaml     |  5 +++
>>   .../bindings/arm/arm,coresight-etm.yaml       |  5 +++
>>   .../arm/arm,coresight-static-funnel.yaml      |  5 +++
>>   .../arm/arm,coresight-static-replicator.yaml  |  5 +++
>>   .../bindings/arm/arm,coresight-stm.yaml       |  5 +++
>>   .../bindings/arm/arm,coresight-tmc.yaml       |  5 +++
>>   .../bindings/arm/arm,coresight-tpiu.yaml      |  5 +++
>>   .../bindings/arm/qcom,coresight-tpda.yaml     |  5 +++
>>   .../bindings/arm/qcom,coresight-tpdm.yaml     |  5 +++
>>   drivers/hwtracing/coresight/coresight-core.c  | 33 ++++++++++---------
>>   .../hwtracing/coresight/coresight-platform.c  | 31 +++++++++++++++++
>>   include/linux/coresight.h                     |  1 +
>>   19 files changed, 130 insertions(+), 15 deletions(-)
>>
>