Skip to contentSkip to conversation

perf/smmuv3: dts get opt and simplify code

RFC PATCH Applied Jay Chen 5 participants 12 messages Jul 6, 2020 – Jul 14, 2020

Subsystems (4)
lore
Share & tools
lore

Jay Chen

author
#0 lore raw

cover perf/smmuv3: dts get opt and simplify code

This patch set firstly to simplify the code in smmu pmu probe, and then support to get options in dts

Jay Chen (2):
perf/smmuv3: To simplify code for ioremap page in pmcg perf/smmuv3: To support the dts to get options

 drivers/perf/arm_smmuv3_pmu.c | 45 ++++++++++++++++++++++++++++++++---
 1 file changed, 42 insertions(+), 3 deletions(-)
Signature · 7 lines
2.27.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author
#1 lore raw

RFC PATCH 1/2 perf/smmuv3: To simplify code for ioremap page in pmcg

Use the devm_platform_get_and_ioremap_resource to simplify the code a bit.

---
 drivers/perf/arm_smmuv3_pmu.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/perf/arm_smmuv3_pmu.c +1 -2
index 48e28ef93a70..2d09f3e47d12 100644
@@ -755,8 +755,7 @@ static int smmu_pmu_probe(struct platform_device *pdev)
 		.capabilities	= PERF_PMU_CAP_NO_EXCLUDE,
 	};
 
-	res_0 = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	smmu_pmu->reg_base = devm_ioremap_resource(dev, res_0);
+	smmu_pmu->reg_base = devm_platform_get_and_ioremap_resource(pdev, 0, &res_0);
 	if (IS_ERR(smmu_pmu->reg_base))
 		return PTR_ERR(smmu_pmu->reg_base);
 
Signature · 7 lines
2.27.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author
#2 lore raw

RFC PATCH 2/2 perf/smmuv3: To support the dts to get options

In reply to Jay Chen

For the smmuv3 pmu for support the dts to get the
options

---
 drivers/perf/arm_smmuv3_pmu.c | 42 ++++++++++++++++++++++++++++++++++-
 1 file changed, 41 insertions(+), 1 deletion(-)
drivers/perf/arm_smmuv3_pmu.c +41 -1
index 2d09f3e47d12..44e9f4197444 100644
@@ -115,6 +115,16 @@ struct smmu_pmu {
 	bool global_filter;
 };
 
+struct smmu_pmu_prop {
+	u32 opt;
+	const char *prop;
+};
+
+static struct smmu_pmu_prop smmu_pmu_options[] = {
+	{ SMMU_PMCG_EVCNTR_RDONLY, "hisilicon,smmu-pmcg-evcntr-rdonly"},
+	{ 0, NULL},
+};
+
 #define to_smmu_pmu(p) (container_of(p, struct smmu_pmu, pmu))
 
 #define SMMU_PMU_EVENT_ATTR_EXTRACTOR(_name, _config, _start, _end)        \
@@ -708,6 +718,7 @@ static void smmu_pmu_reset(struct smmu_pmu *smmu_pmu)
 		       smmu_pmu->reloc_base + SMMU_PMCG_OVSCLR0);
 }
 
+#ifdef CONFIG_ACPI
 static void smmu_pmu_get_acpi_options(struct smmu_pmu *smmu_pmu)
 {
 	u32 model;
@@ -723,6 +734,26 @@ static void smmu_pmu_get_acpi_options(struct smmu_pmu *smmu_pmu)
 
 	dev_notice(smmu_pmu->dev, "option mask 0x%x\n", smmu_pmu->options);
 }
+#else
+static void smmu_pmu_get_acpi_options(struct smmu_pmu *smmu_pmu)
+{
+
+}
+#endif
+
+static void smmu_pmu_get_dt_options(struct smmu_pmu *smmu_pmu)
+{
+	int i = 0;
+
+	do {
+		if (of_property_read_bool(smmu_pmu->dev->of_node,
+					  smmu_pmu_options[i].prop)) {
+			smmu_pmu->options |= smmu_pmu_options[i].opt;
+			dev_notice(smmu_pmu->dev, "option mask 0x%x\n",
+				   smmu_pmu->options);
+		}
+	} while (smmu_pmu_options[++i].opt);
+}
 
 static int smmu_pmu_probe(struct platform_device *pdev)
 {
@@ -801,7 +832,10 @@ static int smmu_pmu_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	smmu_pmu_get_acpi_options(smmu_pmu);
+	if (dev->of_node)
+		smmu_pmu_get_dt_options(smmu_pmu);
+	else
+		smmu_pmu_get_acpi_options(smmu_pmu);
 
 	/* Pick one CPU to be the preferred one to use */
 	smmu_pmu->on_cpu = raw_smp_processor_id();
@@ -855,9 +889,15 @@ static void smmu_pmu_shutdown(struct platform_device *pdev)
 	smmu_pmu_disable(&smmu_pmu->pmu);
 }
 
+static const struct of_device_id smmu_pmu_of_match[] = {
+	{ .compatible = "arm-smmu-v3-pmcg", },
+	{ },
+};
+
 static struct platform_driver smmu_pmu_driver = {
 	.driver = {
 		.name = "arm-smmu-v3-pmcg",
+		.of_match_table = smmu_pmu_of_match,
 	},
 	.probe = smmu_pmu_probe,
 	.remove = smmu_pmu_remove,
Signature · 7 lines
2.27.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
reviewer
#3 lore raw

Re: [RFC PATCH v1 2/2] perf/smmuv3: To support the dts to get options

Quoted 13 lines · Jay Chen

For the smmuv3 pmu for support the dts to get the
options

---
  drivers/perf/arm_smmuv3_pmu.c | 42 ++++++++++++++++++++++++++++++++++-
  1 file changed, 41 insertions(+), 1 deletion(-)
drivers/perf/arm_smmuv3_pmu.c +0 -0
index 2d09f3e47d12..44e9f4197444 100644

drivers/perf/arm_smmuv3_pmu.c struct smmu_pmu { · line 124

Quoted 10 lines
drivers/perf/arm_smmuv3_pmu.c +7 -0
@@ -115,6 +115,16 @@ struct smmu_pmu {
  	bool global_filter;
  };
 
+struct smmu_pmu_prop {
+	u32 opt;
+	const char *prop;
+};
+
+static struct smmu_pmu_prop smmu_pmu_options[] = {
+	{ SMMU_PMCG_EVCNTR_RDONLY, "hisilicon,smmu-pmcg-evcntr-rdonly"},

We know this kind of thing doesn't scale well - please define a compatible string for the specific PMU model.

In fact my hope was that DT compatibles would map to the same model values we made up for IORT to pass, such that the *only* firmware-specific difference the driver needs to have is whether to retrieve the model from platdata or OF match data, then the actual quirks are applied commonly.

drivers/perf/arm_smmuv3_pmu.c static void smmu_pmu_reset(struct smmu_pmu *smmu_pmu) · line 721

Quoted 11 lines
drivers/perf/arm_smmuv3_pmu.c +4 -0
+	{ 0, NULL},
+};
+
  #define to_smmu_pmu(p) (container_of(p, struct smmu_pmu, pmu))
 
  #define SMMU_PMU_EVENT_ATTR_EXTRACTOR(_name, _config, _start, _end)        \
@@ -708,6 +718,7 @@ static void smmu_pmu_reset(struct smmu_pmu *smmu_pmu)
  		       smmu_pmu->reloc_base + SMMU_PMCG_OVSCLR0);
  }
 
+#ifdef CONFIG_ACPI

Why bother stubbing this out? It shouldn't have any build-time dependency on ACPI code, and saving a whole 48 bytes from the object size (for my local build setup) struggles to justify the source-code clutter.

Quoted 43 lines
drivers/perf/arm_smmuv3_pmu.c +24 -1
  static void smmu_pmu_get_acpi_options(struct smmu_pmu *smmu_pmu)
  {
  	u32 model;
@@ -723,6 +734,26 @@ static void smmu_pmu_get_acpi_options(struct smmu_pmu *smmu_pmu)
 
  	dev_notice(smmu_pmu->dev, "option mask 0x%x\n", smmu_pmu->options);
  }
+#else
+static void smmu_pmu_get_acpi_options(struct smmu_pmu *smmu_pmu)
+{
+
+}
+#endif
+
+static void smmu_pmu_get_dt_options(struct smmu_pmu *smmu_pmu)
+{
+	int i = 0;
+
+	do {
+		if (of_property_read_bool(smmu_pmu->dev->of_node,
+					  smmu_pmu_options[i].prop)) {
+			smmu_pmu->options |= smmu_pmu_options[i].opt;
+			dev_notice(smmu_pmu->dev, "option mask 0x%x\n",
+				   smmu_pmu->options);
+		}
+	} while (smmu_pmu_options[++i].opt);
+}
 
  static int smmu_pmu_probe(struct platform_device *pdev)
  {
@@ -801,7 +832,10 @@ static int smmu_pmu_probe(struct platform_device *pdev)
  		return -EINVAL;
  	}
 
-	smmu_pmu_get_acpi_options(smmu_pmu);
+	if (dev->of_node)
+		smmu_pmu_get_dt_options(smmu_pmu);
+	else
+		smmu_pmu_get_acpi_options(smmu_pmu);
 
  	/* Pick one CPU to be the preferred one to use */
  	smmu_pmu->on_cpu = raw_smp_processor_id();

drivers/perf/arm_smmuv3_pmu.c static void smmu_pmu_shutdown(struct platform_device *pdev) · line 893

Quoted 5 lines
drivers/perf/arm_smmuv3_pmu.c +2 -0
@@ -855,9 +889,15 @@ static void smmu_pmu_shutdown(struct platform_device *pdev)
  	smmu_pmu_disable(&smmu_pmu->pmu);
  }
 
+static const struct of_device_id smmu_pmu_of_match[] = {
+	{ .compatible = "arm-smmu-v3-pmcg", },

Please define the DT binding first. IIRC Jean-Philippe wrote some patches a while back that never got posted, but I suppose it should be YAML now...

drivers/perf/arm_smmuv3_pmu.c static void smmu_pmu_shutdown(struct platform_device *pdev) · line 895

Quoted 2 lines
drivers/perf/arm_smmuv3_pmu.c +2 -0
+	{ },
+};

How about the thing for module autoloading too?

Robin.

drivers/perf/arm_smmuv3_pmu.c static void smmu_pmu_shutdown(struct platform_device *pdev) · line 903

Quoted 9 lines
drivers/perf/arm_smmuv3_pmu.c +2 -0
+
  static struct platform_driver smmu_pmu_driver = {
  	.driver = {
  		.name = "arm-smmu-v3-pmcg",
+		.of_match_table = smmu_pmu_of_match,
  	},
  	.probe = smmu_pmu_probe,
  	.remove = smmu_pmu_remove,

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#4 lore raw

Re: [RFC PATCH v1 2/2] perf/smmuv3: To support the dts to get options

Hi,

Quoted 5 lines · Robin Murphy
Quoted 4 lines · Jay Chen

For the smmuv3 pmu for support the dts to get the
options

[...]

Quoted 5 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+static const struct of_device_id smmu_pmu_of_match[] = {
+	{ .compatible = "arm-smmu-v3-pmcg", },

Please define the DT binding first. IIRC Jean-Philippe wrote some patches a while back that never got posted, but I suppose it should be YAML now...

Yes, I've never followed through with that because it only supported the RevC FastModel with non-default model parameters. I attached the binding I currently have, converted to YAML.

Thanks,
Jean

From b117e5b4ce96a5a8327333ab408cf61200850d4f Mon Sep 17 00:00:00 2001
From: Jean-Philippe Brucker <[email protected]>
Date: Tue, 7 Jul 2020 16:55:16 +0200
Subject: [PATCH] dt-bindings: Add SMMUv3 PMCG binding

Add binding for the SMMUv3 PMU. Each node represents a PMCG, and is placed as a sibling node of the SMMU. As PMCGs are mainly implementation defined there is no 1-1 relation between SMMU and PMCG. The SMMU could have PMU counters for the TCU and each TBU, or a single PMCG.

TODO: although the Linux implementation doesn't need them, it'd be nice to have links from the PMCG node to its associated SMMU. IORT does offer this (Node reference) and perhaps it could later help users figure out which PMCG is which on systems with dozens of SMMU.

---
 .../bindings/iommu/arm,smmu-v3-pmcg.yaml      | 58 +++++++++++++++++++
 1 file changed, 58 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iommu/arm,smmu-v3-pmcg.yaml
Documentation/devicetree/bindings/iommu/arm,smmu-v3-pmcg.yaml new file +58 -0
new file mode 100644
index 000000000000..23190a617e7e
@@ -0,0 +1,58 @@
+# SPDX-License-Identifier: GPL-2.0-only
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iommu/arm,smmu-v3-pmcg.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ARM SMMUv3 Performance Monitor Counter Group
+
+maintainers:
+  - Will Deacon <[email protected]>
+  - Robin Murphy <[email protected]>
+
+description: |+
+  An SMMUv3 may have several Performance Monitor Counter Group (PMCG).
+  They are standalone performance monitoring units that support both
+  architected and IMPLEMENTATION DEFINED event counters.
+
+properties:
+  $nodename:
+    pattern: "^smmu-pmcg@[0-9a-f]*"
+  compatible:
+    const: arm,smmu-v3-pmcg
+
+  reg:
+    minItems: 1
+    maxItems: 2
+
+  interrupts:
+    maxItems: 1
+
+  msi-parent: true
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |+
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    tcu: smmu-pmcg@2b420000 {
+            compatible = "arm,smmu-v3-pmcg";
+            reg = <0 0x2b420000 0 0x1000>,
+                  <0 0x2b430000 0 0x1000>;
+            interrupts = <GIC_SPI 80 IRQ_TYPE_EDGE_RISING>;
+            msi-parent = <&its 0xff0000>;
+    };
+
+    tbu0: smmu-pmcg@2b440000 {
+            compatible = "arm,smmu-v3-pmcg";
+            reg = <0 0x2b440000 0 0x1000>,
+                  <0 0x2b450000 0 0x1000>;
+            interrupts = <GIC_SPI 81 IRQ_TYPE_EDGE_RISING>;
+            msi-parent = <&its 0xff0000>;
+    };
Signature · 1 line
2.27.0

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

maintainer
#5 lore raw

Re: [RFC PATCH v1 2/2] perf/smmuv3: To support the dts to get options

Quoted 33 lines · Jean-Philippe Brucker

Hi,

Quoted 5 lines · Robin Murphy
Quoted 4 lines · Jay Chen

For the smmuv3 pmu for support the dts to get the
options

[...]

Quoted 5 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+static const struct of_device_id smmu_pmu_of_match[] = {
+	{ .compatible = "arm-smmu-v3-pmcg", },

Please define the DT binding first. IIRC Jean-Philippe wrote some patches a while back that never got posted, but I suppose it should be YAML now...

Yes, I've never followed through with that because it only supported the RevC FastModel with non-default model parameters. I attached the binding I currently have, converted to YAML.

Thanks,
Jean

Quoted 1 line

From b117e5b4ce96a5a8327333ab408cf61200850d4f Mon Sep 17 00:00:00 2001

From: Jean-Philippe Brucker <[email protected]>
Date: Tue, 7 Jul 2020 16:55:16 +0200
Subject: [PATCH] dt-bindings: Add SMMUv3 PMCG binding

Add binding for the SMMUv3 PMU. Each node represents a PMCG, and is placed as a sibling node of the SMMU. As PMCGs are mainly implementation defined there is no 1-1 relation between SMMU and PMCG. The SMMU could have PMU counters for the TCU and each TBU, or a single PMCG.

Quoted 4 lines

TODO: although the Linux implementation doesn't need them, it'd be nice to have links from the PMCG node to its associated SMMU. IORT does offer this (Node reference) and perhaps it could later help users figure out which PMCG is which on systems with dozens of SMMU.

Is the PMCG really a separate block or a new node is just convenient to instantiate a driver?

Quoted 13 lines
---
 .../bindings/iommu/arm,smmu-v3-pmcg.yaml      | 58 +++++++++++++++++++
 1 file changed, 58 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iommu/arm,smmu-v3-pmcg.yaml
Documentation/devicetree/bindings/iommu/arm,smmu-v3-pmcg.yaml new file +0 -0
new file mode 100644
index 000000000000..23190a617e7e

Documentation/devicetree/bindings/iommu/arm,smmu-v3-pmcg.yaml line 1

Quoted 1 line
Documentation/devicetree/bindings/iommu/arm,smmu-v3-pmcg.yaml new file +1 -0
@@ -0,0 +1,58 @@
+# SPDX-License-Identifier: GPL-2.0-only

Dual license new bindings.

Quoted 9 lines
Documentation/devicetree/bindings/iommu/arm,smmu-v3-pmcg.yaml new file +9 -0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iommu/arm,smmu-v3-pmcg.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ARM SMMUv3 Performance Monitor Counter Group
+
+maintainers:
+  - Will Deacon <[email protected]>

Documentation/devicetree/bindings/iommu/arm,smmu-v3-pmcg.yaml line 20

Quoted 10 lines
Documentation/devicetree/bindings/iommu/arm,smmu-v3-pmcg.yaml new file +10 -0
+  - Robin Murphy <[email protected]>
+
+description: |+
+  An SMMUv3 may have several Performance Monitor Counter Group (PMCG).
+  They are standalone performance monitoring units that support both
+  architected and IMPLEMENTATION DEFINED event counters.
+
+properties:
+  $nodename:
+    pattern: "^smmu-pmcg@[0-9a-f]*"

Should be generic:

pmu@...

(or whatever we've used for PMUs).

Documentation/devicetree/bindings/iommu/arm,smmu-v3-pmcg.yaml line 22

Quoted 2 lines
Documentation/devicetree/bindings/iommu/arm,smmu-v3-pmcg.yaml new file +2 -0
+  compatible:
+    const: arm,smmu-v3-pmcg

This is correct, but doesn't match the driver.

Documentation/devicetree/bindings/iommu/arm,smmu-v3-pmcg.yaml line 26

Quoted 4 lines
Documentation/devicetree/bindings/iommu/arm,smmu-v3-pmcg.yaml new file +4 -0
+
+  reg:
+    minItems: 1
+    maxItems: 2

More than 1 entry needs a description of what each one is.

A variable number of 'reg' entries generally implies more than 1 compatible unless the 2nd entry is optional.

Quoted 8 lines
Documentation/devicetree/bindings/iommu/arm,smmu-v3-pmcg.yaml new file +8 -0
+
+  interrupts:
+    maxItems: 1
+
+  msi-parent: true
+
+required:
+  - compatible

Documentation/devicetree/bindings/iommu/arm,smmu-v3-pmcg.yaml line 44

Quoted 10 lines
Documentation/devicetree/bindings/iommu/arm,smmu-v3-pmcg.yaml new file +10 -0
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |+
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    tcu: smmu-pmcg@2b420000 {

Drop unused labels.

Quoted 22 lines
Documentation/devicetree/bindings/iommu/arm,smmu-v3-pmcg.yaml new file +14 -0
+            compatible = "arm,smmu-v3-pmcg";
+            reg = <0 0x2b420000 0 0x1000>,
+                  <0 0x2b430000 0 0x1000>;
+            interrupts = <GIC_SPI 80 IRQ_TYPE_EDGE_RISING>;
+            msi-parent = <&its 0xff0000>;
+    };
+
+    tbu0: smmu-pmcg@2b440000 {
+            compatible = "arm,smmu-v3-pmcg";
+            reg = <0 0x2b440000 0 0x1000>,
+                  <0 0x2b450000 0 0x1000>;
+            interrupts = <GIC_SPI 81 IRQ_TYPE_EDGE_RISING>;
+            msi-parent = <&its 0xff0000>;
+    };
Signature · 7 lines
2.27.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

reviewer
#6 lore raw

Re: [RFC PATCH v1 2/2] perf/smmuv3: To support the dts to get options

Quoted 34 lines · Rob Herring
Quoted 33 lines · Jean-Philippe Brucker

Hi,

Quoted 5 lines · Robin Murphy
Quoted 4 lines · Jay Chen

For the smmuv3 pmu for support the dts to get the
options

[...]

Quoted 5 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+static const struct of_device_id smmu_pmu_of_match[] = {
+	{ .compatible = "arm-smmu-v3-pmcg", },

Please define the DT binding first. IIRC Jean-Philippe wrote some patches a while back that never got posted, but I suppose it should be YAML now...

Yes, I've never followed through with that because it only supported the RevC FastModel with non-default model parameters. I attached the binding I currently have, converted to YAML.

Thanks,
Jean

Quoted 1 line

From b117e5b4ce96a5a8327333ab408cf61200850d4f Mon Sep 17 00:00:00 2001

From: Jean-Philippe Brucker <[email protected]>
Date: Tue, 7 Jul 2020 16:55:16 +0200
Subject: [PATCH] dt-bindings: Add SMMUv3 PMCG binding

Add binding for the SMMUv3 PMU. Each node represents a PMCG, and is placed as a sibling node of the SMMU. As PMCGs are mainly implementation defined there is no 1-1 relation between SMMU and PMCG. The SMMU could have PMU counters for the TCU and each TBU, or a single PMCG.

Quoted 7 lines
Quoted 4 lines

TODO: although the Linux implementation doesn't need them, it'd be nice to have links from the PMCG node to its associated SMMU. IORT does offer this (Node reference) and perhaps it could later help users figure out which PMCG is which on systems with dozens of SMMU.

Is the PMCG really a separate block or a new node is just convenient to instantiate a driver?

Yes, PMCGs are their own thing with their own little programming interfaces and interrupts, there are typically multiple PMCG instances per SMMU, and they may even belong to "non-SMMU" components which participate in translation, like PCIe root complexes or devices with their own embedded TLBs.

Quoted 39 lines
Quoted 13 lines
---
  .../bindings/iommu/arm,smmu-v3-pmcg.yaml      | 58 +++++++++++++++++++
  1 file changed, 58 insertions(+)

create mode 100644 Documentation/devicetree/bindings/iommu/arm,smmu-v3-pmcg.yaml

Documentation/devicetree/bindings/iommu/arm,smmu-v3-pmcg.yaml new file +0 -0
new file mode 100644
index 000000000000..23190a617e7e

Documentation/devicetree/bindings/iommu/arm,smmu-v3-pmcg.yaml line 1

Quoted 1 line
Documentation/devicetree/bindings/iommu/arm,smmu-v3-pmcg.yaml new file +1 -0
@@ -0,0 +1,58 @@
+# SPDX-License-Identifier: GPL-2.0-only

Dual license new bindings.

Quoted 9 lines
Documentation/devicetree/bindings/iommu/arm,smmu-v3-pmcg.yaml new file +9 -0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iommu/arm,smmu-v3-pmcg.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ARM SMMUv3 Performance Monitor Counter Group
+
+maintainers:
+  - Will Deacon <[email protected]>

Documentation/devicetree/bindings/iommu/arm,smmu-v3-pmcg.yaml line 20

Quoted 10 lines
Documentation/devicetree/bindings/iommu/arm,smmu-v3-pmcg.yaml new file +10 -0
+  - Robin Murphy <[email protected]>
+
+description: |+
+  An SMMUv3 may have several Performance Monitor Counter Group (PMCG).
+  They are standalone performance monitoring units that support both
+  architected and IMPLEMENTATION DEFINED event counters.
+
+properties:
+  $nodename:
+    pattern: "^smmu-pmcg@[0-9a-f]*"

Should be generic:

Quoted 8 lines

pmu@...

(or whatever we've used for PMUs).

Documentation/devicetree/bindings/iommu/arm,smmu-v3-pmcg.yaml line 22

Quoted 2 lines
Documentation/devicetree/bindings/iommu/arm,smmu-v3-pmcg.yaml new file +2 -0
+  compatible:
+    const: arm,smmu-v3-pmcg

This is correct, but doesn't match the driver.

To be fair, this binding wasn't originally written for this particular driver patch ;)

Quoted 9 lines

Documentation/devicetree/bindings/iommu/arm,smmu-v3-pmcg.yaml line 26

Quoted 4 lines
Documentation/devicetree/bindings/iommu/arm,smmu-v3-pmcg.yaml new file +4 -0
+
+  reg:
+    minItems: 1
+    maxItems: 2

More than 1 entry needs a description of what each one is.

A variable number of 'reg' entries generally implies more than 1 compatible unless the 2nd entry is optional.

The second is "optional" in terms of the architecture (and thus the generic compatible), but fixed for any specific implementation - it's a choice of whether the counter registers are in the same page as the control registers or in a separate page, but that can be architecturally discovered from an ID register in the first page (see the handling of SMMU_PMCG_CFGR_RELOC_CTRS if you're interested). Robin.

Quoted 12 lines
Quoted 12 lines
Documentation/devicetree/bindings/iommu/arm,smmu-v3-pmcg.yaml new file +12 -0
+
+  interrupts:
+    maxItems: 1
+
+  msi-parent: true
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
Quoted 32 lines

Documentation/devicetree/bindings/iommu/arm,smmu-v3-pmcg.yaml line 44

Quoted 6 lines
Documentation/devicetree/bindings/iommu/arm,smmu-v3-pmcg.yaml new file +6 -0
+examples:
+  - |+
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    tcu: smmu-pmcg@2b420000 {

Drop unused labels.

Quoted 22 lines
Documentation/devicetree/bindings/iommu/arm,smmu-v3-pmcg.yaml new file +14 -0
+            compatible = "arm,smmu-v3-pmcg";
+            reg = <0 0x2b420000 0 0x1000>,
+                  <0 0x2b430000 0 0x1000>;
+            interrupts = <GIC_SPI 80 IRQ_TYPE_EDGE_RISING>;
+            msi-parent = <&its 0xff0000>;
+    };
+
+    tbu0: smmu-pmcg@2b440000 {
+            compatible = "arm,smmu-v3-pmcg";
+            reg = <0 0x2b440000 0 0x1000>,
+                  <0 0x2b450000 0 0x1000>;
+            interrupts = <GIC_SPI 81 IRQ_TYPE_EDGE_RISING>;
+            msi-parent = <&its 0xff0000>;
+    };
Signature · 7 lines
2.27.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

maintainer Applied
#7 lore raw
In reply to Jay Chen
Quoted 8 lines · Jay Chen

This patch set firstly to simplify the code in smmu pmu probe, and then support to get options in dts

Jay Chen (2):
perf/smmuv3: To simplify code for ioremap page in pmcg perf/smmuv3: To support the dts to get options

[...]

Applied to will (for-next/perf), thanks!

[1/1] perf/smmuv3: To simplify code for ioremap page in pmcg

      https://git.kernel.org/will/c/f011856ce7b6

Cheers,

Signature · 10 lines
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
maintainer
#8 lore raw
Quoted 11 lines · Will Deacon
Quoted 8 lines · Jay Chen

This patch set firstly to simplify the code in smmu pmu probe, and then support to get options in dts

Jay Chen (2):
perf/smmuv3: To simplify code for ioremap page in pmcg perf/smmuv3: To support the dts to get options

[...]

Applied to will (for-next/perf), thanks!

Without a binding document for the undocumented property and compatible string!?

Is the 'arm-smmu-v3-pmcg' actually a separate block from the SMMU? Or is this just an add a compatible to instantiate a driver?

Rob

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

maintainer
#9 lore raw

Hi Rob,

Quoted 9 lines · Rob Herring
Quoted 8 lines · Will Deacon
Quoted 7 lines · Jay Chen

This patch set firstly to simplify the code in smmu pmu probe, and then support to get options in dts

Jay Chen (2):
perf/smmuv3: To simplify code for ioremap page in pmcg perf/smmuv3: To support the dts to get options

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

[...]

Applied to will (for-next/perf), thanks!

Without a binding document for the undocumented property and compatible string!?

No, I only took the second patch ("To simplify code...")! It would be nice if b4 was a big clearer about that when cherry-picking, but I'm not sure exactly what it could do. Maybe if it only replied to the patch being picked, rather than the cover letter?

I'm usually pretty careful about avoiding DT changes without your ack.

Quoted 2 lines

Is the 'arm-smmu-v3-pmcg' actually a separate block from the SMMU? Or is this just an add a compatible to instantiate a driver?

Not quite sure how to answer that one... afaik, the PMCG is a bunch of distributed counter blocks that may or may not be present and are driven entirely independently of the rest of the SMMU, which is a lot more standardised. In fact, I'm not sure why ARM_SMMU_V3_PMU depends on ARM_SMMU_V3, it builds perfectly fine without that (and with the main driver disabled).

Will

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

maintainer
#10 lore raw
Quoted 10 lines · Will Deacon
Quoted 9 lines · Rob Herring
Quoted 8 lines · Will Deacon
Quoted 7 lines · Jay Chen

This patch set firstly to simplify the code in smmu pmu probe, and then support to get options in dts

Jay Chen (2):
perf/smmuv3: To simplify code for ioremap page in pmcg perf/smmuv3: To support the dts to get options

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

[...]

Applied to will (for-next/perf), thanks!

Without a binding document for the undocumented property and compatible string!?

No, I only took the second patch ("To simplify code...")!

Duh, *first patch*.

Will

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

maintainer
#11 lore raw
In reply to Will Deacon
Quoted 17 lines · Will Deacon

Hi Rob,

Quoted 13 lines · Rob Herring
Quoted 11 lines · Will Deacon
Quoted 8 lines · Jay Chen

This patch set firstly to simplify the code in smmu pmu probe, and then support to get options in dts

Jay Chen (2):
perf/smmuv3: To simplify code for ioremap page in pmcg perf/smmuv3: To support the dts to get options

[...]

Applied to will (for-next/perf), thanks!

Quoted 7 lines
Quoted 2 lines

Without a binding document for the undocumented property and compatible string!?

No, I only took the second patch ("To simplify code...")! It would be nice if b4 was a big clearer about that when cherry-picking, but I'm not sure exactly what it could do. Maybe if it only replied to the patch being picked, rather than the cover letter?

Humm, I thought the default b4 reply did list exactly which patches were applied. See broonie's replies for example which are using it I think. Maybe you lose that if not using the default template.

Quoted 6 lines

I'm usually pretty careful about avoiding DT changes without your ack.

Quoted 2 lines

Is the 'arm-smmu-v3-pmcg' actually a separate block from the SMMU? Or is this just an add a compatible to instantiate a driver?

Quoted 6 lines

Not quite sure how to answer that one... afaik, the PMCG is a bunch of distributed counter blocks that may or may not be present and are driven entirely independently of the rest of the SMMU, which is a lot more standardised. In fact, I'm not sure why ARM_SMMU_V3_PMU depends on ARM_SMMU_V3, it builds perfectly fine without that (and with the main driver disabled).

Okay, seems that a separate node or nodes is warranted.

Rob

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel