Skip to contentSkip to conversation

Add device tree support for NVIDIA Tegra CMDQV

PATCH Applied Ashish Mhetre 4 participants 11 messages Jan 13 – Jan 23

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

v8 cover Add device tree support for NVIDIA Tegra CMDQV

This series adds device tree support for the CMDQ-Virtualization (CMDQV) hardware on NVIDIA Tegra264 SoCs.

CMDQV is a hardware block that works alongside the ARM SMMUv3 to assist in virtualizing the command queue. It was previously only supported through ACPI on Tegra241. This series extends the existing driver to support device tree based initialization, which is required for Tegra264 platforms.

The series is structured as follows:

Patch 1: Decouple tegra241-cmdqv driver from ACPI by replacing all the
ACPI functions with standard platform functions.

Patch 2: Extends the tegra241-cmdqv driver to support device tree probing
alongside the existing ACPI support. The SMMU driver now parses the nvidia,cmdqv phandle to associate each SMMU with its corresponding CMDQV instance.

Patch 3: Adds device tree binding documentation for nvidia,tegra264-cmdqv
and extends the arm,smmu-v3 binding with an optional nvidia,cmdqv property.

Patch 4: Adds CMDQV device nodes to the Tegra264 device tree and enables
them on the tegra264-p3834 platform.

The implementation follows the existing ACPI probe path to minimize code divergence and maintain consistency with Tegra241 support.

Changes in V8:
- Changed CMDQV device print from info to debug.
- Removed the CMDQV example for Nvidia from arm-smmu-v3 bindings yaml.

Changes in V7:
- Hold reference on platform device (impl_dev) and drop ref on ACPI device (adev).

Changes in V6:
- Added Nicolin's patch for decoupling tegra241-cmdqv from ACPI and rebased other patches on top of it.
- Removed put_device() from DT path as tegra241-cmdqv driver takes care of dropping reference in remove callback.

Changes in V5:
- Guard ACPI functions with CONFIG_ACPI to fix build without ACPI.

Changes in V4:
- Removed platform driver registration from tegra241-cmdqv.c to avoid duplicate module init/cleanup symbols
- Fixed the ordering of properties in CMDQV device tree nodes
- Added "Reviewed-by: Rob Herring" for binding documentation patch(2/3) carry-forwarding from V3.

Changes in V3:
- Remove the Kconfig dependency for CONFIG_TEGRA241_CMDQV
- Drop the reference on the platform device after getting it from of_find_device_by_node()
- Remove the unnecessary "nvidia,tegra264-smmu" compatible string from arm-smmu-v3 match table
- Order CMDQV nodes in device tree files according to its address

Changes in V2:
- Updated dependency for CONFIG_TEGRA241_CMDQV on OF || ACPI
- Changed maintainer to Nicolin Chen
- Removed interrupt-names property

Ashish Mhetre (3):
iommu/arm-smmu-v3: Add device-tree support for CMDQV driver
dt-bindings: iommu: Add NVIDIA Tegra CMDQV support
arm64: dts: nvidia: Add nodes for CMDQV

Nicolin Chen (1):
iommu/tegra241-cmdqv: Decouple driver from ACPI

 .../bindings/iommu/arm,smmu-v3.yaml           | 27 +++++-
 .../bindings/iommu/nvidia,tegra264-cmdqv.yaml | 42 ++++++++++
 .../arm64/boot/dts/nvidia/tegra264-p3834.dtsi |  8 ++
 arch/arm64/boot/dts/nvidia/tegra264.dtsi      | 50 +++++++++--
 drivers/iommu/arm/Kconfig                     |  1 -
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c   | 35 +++++++-
 .../iommu/arm/arm-smmu-v3/tegra241-cmdqv.c    | 84 +++----------------
 7 files changed, 167 insertions(+), 80 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/iommu/nvidia,tegra264-cmdqv.yaml
Signature · 1 line
2.25.1
#1 lore raw

PATCH v8 1/4 iommu/tegra241-cmdqv: Decouple driver from ACPI

From: Nicolin Chen <[email protected]>

A platform device is created by acpi_create_platform_device() per CMDQV's adev. That means there is no point in going through _CRS of ACPI.

Replace all the ACPI functions with standard platform functions. And drop all ACPI dependencies. This will make the driver compatible with DT also.

---
 drivers/iommu/arm/Kconfig                     |  1 -
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c   |  3 +-
 .../iommu/arm/arm-smmu-v3/tegra241-cmdqv.c    | 84 +++----------------
 3 files changed, 14 insertions(+), 74 deletions(-)
drivers/iommu/arm/Kconfig +0 -1
index ef42bbe07dbe..5fac08b89dee 100644
@@ -121,7 +121,6 @@ config ARM_SMMU_V3_KUNIT_TEST
 
 config TEGRA241_CMDQV
 	bool "NVIDIA Tegra241 CMDQ-V extension support for ARM SMMUv3"
-	depends on ACPI
 	help
 	  Support for NVIDIA CMDQ-Virtualization extension for ARM SMMUv3. The
 	  CMDQ-V extension is similar to v3.3 ECMDQ for multi command queues
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +2 -1
index d16d35c78c06..dad3c0cb800b 100644
@@ -4542,10 +4542,11 @@ static void acpi_smmu_dsdt_probe_tegra241_cmdqv(struct acpi_iort_node *node,
 	adev = acpi_dev_get_first_match_dev("NVDA200C", uid, -1);
 	if (adev) {
 		/* Tegra241 CMDQV driver is responsible for put_device() */
-		smmu->impl_dev = &adev->dev;
+		smmu->impl_dev = get_device(acpi_get_first_physical_node(adev));
 		smmu->options |= ARM_SMMU_OPT_TEGRA241_CMDQV;
 		dev_info(smmu->dev, "found companion CMDQV device: %s\n",
 			 dev_name(smmu->impl_dev));
+		acpi_dev_put(adev);
 	}
 	kfree(uid);
 }
drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c +12 -72

116 lines not on this page · raw message

Signature · 1 line
2.25.1
#2 lore raw

PATCH v8 2/4 iommu/arm-smmu-v3: Add device-tree support for CMDQV driver

In reply to Ashish Mhetre

Add device tree support to the CMDQV driver to enable usage on Tegra264 SoCs. The implementation parses the nvidia,cmdqv phandle from the SMMU device tree node to associate each SMMU with its corresponding CMDQV instance based on compatible string.

---
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 32 +++++++++++++++++++++
 1 file changed, 32 insertions(+)
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +32 -0
index dad3c0cb800b..8653c52977d7 100644
@@ -4530,6 +4530,35 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
 	return 0;
 }
 
+#ifdef CONFIG_TEGRA241_CMDQV
+static void tegra_cmdqv_dt_probe(struct device_node *smmu_node,
+				 struct arm_smmu_device *smmu)
+{
+	struct platform_device *pdev;
+	struct device_node *np;
+
+	np = of_parse_phandle(smmu_node, "nvidia,cmdqv", 0);
+	if (!np)
+		return;
+
+	/* Tegra241 CMDQV driver is responsible for put_device() */
+	pdev = of_find_device_by_node(np);
+	of_node_put(np);
+	if (!pdev)
+		return;
+
+	smmu->impl_dev = &pdev->dev;
+	smmu->options |= ARM_SMMU_OPT_TEGRA241_CMDQV;
+	dev_dbg(smmu->dev, "found companion CMDQV device: %s\n",
+		dev_name(smmu->impl_dev));
+}
+#else
+static void tegra_cmdqv_dt_probe(struct device_node *smmu_node,
+				 struct arm_smmu_device *smmu)
+{
+}
+#endif
+
 #ifdef CONFIG_ACPI
 #ifdef CONFIG_TEGRA241_CMDQV
 static void acpi_smmu_dsdt_probe_tegra241_cmdqv(struct acpi_iort_node *node,
@@ -4635,6 +4664,9 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev,
 	if (of_dma_is_coherent(dev->of_node))
 		smmu->features |= ARM_SMMU_FEAT_COHERENCY;
 
+	if (of_device_is_compatible(dev->of_node, "nvidia,tegra264-smmu"))
+		tegra_cmdqv_dt_probe(dev->of_node, smmu);
+
 	return ret;
 }
 
Signature · 1 line
2.25.1
maintainer Reviewed-by on v8 2/4
#3 lore raw

Re: [PATCH V8 2/4] iommu/arm-smmu-v3: Add device-tree support for CMDQV driver

Quoted 52 lines · Ashish Mhetre

Add device tree support to the CMDQV driver to enable usage on Tegra264 SoCs. The implementation parses the nvidia,cmdqv phandle from the SMMU device tree node to associate each SMMU with its corresponding CMDQV instance based on compatible string.

---
  drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 32 +++++++++++++++++++++
  1 file changed, 32 insertions(+)
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +29 -0
index dad3c0cb800b..8653c52977d7 100644
@@ -4530,6 +4530,35 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
  	return 0;
  }
 
+#ifdef CONFIG_TEGRA241_CMDQV
+static void tegra_cmdqv_dt_probe(struct device_node *smmu_node,
+				 struct arm_smmu_device *smmu)
+{
+	struct platform_device *pdev;
+	struct device_node *np;
+
+	np = of_parse_phandle(smmu_node, "nvidia,cmdqv", 0);
+	if (!np)
+		return;
+
+	/* Tegra241 CMDQV driver is responsible for put_device() */
+	pdev = of_find_device_by_node(np);
+	of_node_put(np);
+	if (!pdev)
+		return;
+
+	smmu->impl_dev = &pdev->dev;
+	smmu->options |= ARM_SMMU_OPT_TEGRA241_CMDQV;
+	dev_dbg(smmu->dev, "found companion CMDQV device: %s\n",
+		dev_name(smmu->impl_dev));
+}
+#else
+static void tegra_cmdqv_dt_probe(struct device_node *smmu_node,
+				 struct arm_smmu_device *smmu)
+{
+}
+#endif
+
  #ifdef CONFIG_ACPI
  #ifdef CONFIG_TEGRA241_CMDQV
  static void acpi_smmu_dsdt_probe_tegra241_cmdqv(struct acpi_iort_node *node,

drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c static int arm_smmu_device_dt_probe(struct platform_device *pdev, · line 4672

Quoted 9 lines
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +3 -0
@@ -4635,6 +4664,9 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev,
  	if (of_dma_is_coherent(dev->of_node))
  		smmu->features |= ARM_SMMU_FEAT_COHERENCY;
 
+	if (of_device_is_compatible(dev->of_node, "nvidia,tegra264-smmu"))
+		tegra_cmdqv_dt_probe(dev->of_node, smmu);
+
  	return ret;
  }
 

Looks good to me!

Cheers
Jon

Signature · 1 line
nvpublic
#4 lore raw

PATCH v8 3/4 dt-bindings: iommu: Add NVIDIA Tegra CMDQV support

In reply to Ashish Mhetre

The Command Queue Virtualization (CMDQV) hardware is part of the SMMUv3 implementation on NVIDIA Tegra SoCs. It assists in virtualizing the command queue for the SMMU.

Add a new device tree binding document for nvidia,tegra264-cmdqv.

Also update the arm,smmu-v3 binding to include an optional nvidia,cmdqv property. This property is a phandle to the CMDQV device node, allowing the SMMU driver to associate with its corresponding CMDQV instance. Restrict this property usage to Nvidia Tegra264 only.

---
 .../bindings/iommu/arm,smmu-v3.yaml           | 27 +++++++++++-
 .../bindings/iommu/nvidia,tegra264-cmdqv.yaml | 42 +++++++++++++++++++
 2 files changed, 68 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/iommu/nvidia,tegra264-cmdqv.yaml
Documentation/devicetree/bindings/iommu/arm,smmu-v3.yaml +26 -1
index 75fcf4cb52d9..82957334bea2 100644
@@ -20,7 +20,12 @@ properties:
   $nodename:
     pattern: "^iommu@[0-9a-f]*"
   compatible:
-    const: arm,smmu-v3
+    oneOf:
+      - const: arm,smmu-v3
+      - items:
+          - enum:
+              - nvidia,tegra264-smmu
+          - const: arm,smmu-v3
 
   reg:
     maxItems: 1
@@ -58,6 +63,15 @@ properties:
 
   msi-parent: true
 
+  nvidia,cmdqv:
+    description: |
+      A phandle to its pairing CMDQV extension for an implementation on NVIDIA
+      Tegra SoC.
+
+      If this property is absent, CMDQ-Virtualization won't be used and SMMU
+      will only use its own CMDQ.
+    $ref: /schemas/types.yaml#/definitions/phandle
+
   hisilicon,broken-prefetch-cmd:
     type: boolean
     description: Avoid sending CMD_PREFETCH_* commands to the SMMU.
@@ -69,6 +83,17 @@ properties:
       register access with page 0 offsets. Set for Cavium ThunderX2 silicon that
       doesn't support SMMU page1 register space.
 
+allOf:
+  - if:
+      not:
+        properties:
+          compatible:
+            contains:
+              const: nvidia,tegra264-smmu
+    then:
+      properties:
+        nvidia,cmdqv: false
+
 required:
   - compatible
   - reg
Documentation/devicetree/bindings/iommu/nvidia,tegra264-cmdqv.yaml new file +42 -0

42 lines not on this page · raw message

Signature · 1 line
2.25.1
maintainer Reviewed-by on v8 3/4
#5 lore raw

Re: [PATCH V8 3/4] dt-bindings: iommu: Add NVIDIA Tegra CMDQV support

Quoted 110 lines · Ashish Mhetre

The Command Queue Virtualization (CMDQV) hardware is part of the SMMUv3 implementation on NVIDIA Tegra SoCs. It assists in virtualizing the command queue for the SMMU.

Add a new device tree binding document for nvidia,tegra264-cmdqv.

Also update the arm,smmu-v3 binding to include an optional nvidia,cmdqv property. This property is a phandle to the CMDQV device node, allowing the SMMU driver to associate with its corresponding CMDQV instance. Restrict this property usage to Nvidia Tegra264 only.

---
  .../bindings/iommu/arm,smmu-v3.yaml           | 27 +++++++++++-
  .../bindings/iommu/nvidia,tegra264-cmdqv.yaml | 42 +++++++++++++++++++
  2 files changed, 68 insertions(+), 1 deletion(-)

create mode 100644 Documentation/devicetree/bindings/iommu/nvidia,tegra264-cmdqv.yaml

Documentation/devicetree/bindings/iommu/arm,smmu-v3.yaml +26 -1
index 75fcf4cb52d9..82957334bea2 100644
@@ -20,7 +20,12 @@ properties:
    $nodename:
      pattern: "^iommu@[0-9a-f]*"
    compatible:
-    const: arm,smmu-v3
+    oneOf:
+      - const: arm,smmu-v3
+      - items:
+          - enum:
+              - nvidia,tegra264-smmu
+          - const: arm,smmu-v3
 
    reg:
      maxItems: 1
@@ -58,6 +63,15 @@ properties:
 
    msi-parent: true
 
+  nvidia,cmdqv:
+    description: |
+      A phandle to its pairing CMDQV extension for an implementation on NVIDIA
+      Tegra SoC.
+
+      If this property is absent, CMDQ-Virtualization won't be used and SMMU
+      will only use its own CMDQ.
+    $ref: /schemas/types.yaml#/definitions/phandle
+
    hisilicon,broken-prefetch-cmd:
      type: boolean
      description: Avoid sending CMD_PREFETCH_* commands to the SMMU.
@@ -69,6 +83,17 @@ properties:
        register access with page 0 offsets. Set for Cavium ThunderX2 silicon that
        doesn't support SMMU page1 register space.
 
+allOf:
+  - if:
+      not:
+        properties:
+          compatible:
+            contains:
+              const: nvidia,tegra264-smmu
+    then:
+      properties:
+        nvidia,cmdqv: false
+
  required:
    - compatible
    - reg
Documentation/devicetree/bindings/iommu/nvidia,tegra264-cmdqv.yaml new file +32 -0
new file mode 100644
index 000000000000..3f5006a59805
@@ -0,0 +1,42 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iommu/nvidia,tegra264-cmdqv.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NVIDIA Tegra264 CMDQV
+
+description:
+  The CMDQ-Virtualization hardware block is part of the SMMUv3 implementation
+  on Tegra264 SoCs. It assists in virtualizing the command queue for the SMMU.
+
+maintainers:
+  - Nicolin Chen <[email protected]>
+
+properties:
+  compatible:
+    const: nvidia,tegra264-cmdqv
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+additionalProperties: false
+

Documentation/devicetree/bindings/iommu/nvidia,tegra264-cmdqv.yaml line 42

Quoted 10 lines
Documentation/devicetree/bindings/iommu/nvidia,tegra264-cmdqv.yaml new file +10 -0
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    cmdqv@5200000 {
+            compatible = "nvidia,tegra264-cmdqv";
+            reg = <0x5200000 0x830000>;
+            interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>;
+    };

Looks good to me!

Cheers
Jon

Signature · 1 line
nvpublic
#6 lore raw

Re: [PATCH V8 3/4] dt-bindings: iommu: Add NVIDIA Tegra CMDQV support

In reply to Ashish Mhetre
Quoted 11 lines · Ashish Mhetre

The Command Queue Virtualization (CMDQV) hardware is part of the SMMUv3 implementation on NVIDIA Tegra SoCs. It assists in virtualizing the command queue for the SMMU.

Add a new device tree binding document for nvidia,tegra264-cmdqv.

Also update the arm,smmu-v3 binding to include an optional nvidia,cmdqv property. This property is a phandle to the CMDQV device node, allowing the SMMU driver to associate with its corresponding CMDQV instance. Restrict this property usage to Nvidia Tegra264 only.

Quoted 8 lines
---
 .../bindings/iommu/arm,smmu-v3.yaml           | 27 +++++++++++-
 .../bindings/iommu/nvidia,tegra264-cmdqv.yaml | 42 +++++++++++++++++++
 2 files changed, 68 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/iommu/nvidia,tegra264-cmdqv.yaml

Applied, thanks.

Thierry

#7 lore raw

PATCH v8 4/4 arm64: dts: nvidia: Add nodes for CMDQV

In reply to Ashish Mhetre

The Command Queue Virtualization (CMDQV) hardware is part of the SMMUv3 implementation on NVIDIA Tegra SoCs. It assists in virtualizing the command queue for the SMMU.

Update SMMU compatible strings to use nvidia,tegra264-smmu to enable CMDQV support. Add device tree nodes for the CMDQV hardware and enable them on the tegra264-p3834 platform where SMMUs are enabled. Each SMMU instance is paired with its corresponding CMDQV instance via the nvidia,cmdqv property.

---
 .../arm64/boot/dts/nvidia/tegra264-p3834.dtsi |  8 +++
 arch/arm64/boot/dts/nvidia/tegra264.dtsi      | 50 +++++++++++++++++--
 2 files changed, 53 insertions(+), 5 deletions(-)
arch/arm64/boot/dts/nvidia/tegra264-p3834.dtsi +8 -0
index 06795c82427a..7e2c3e66c2ab 100644
@@ -23,8 +23,16 @@ iommu@5000000 {
 			status = "okay";
 		};
 
+		cmdqv@5200000 {
+			status = "okay";
+		};
+
 		iommu@6000000 {
 			status = "okay";
 		};
+
+		cmdqv@6200000 {
+			status = "okay";
+		};
 	};
 };
arch/arm64/boot/dts/nvidia/tegra264.dtsi +45 -5

104 lines not on this page · raw message

Signature · 1 line
2.25.1
maintainer
#8 lore raw

Re: [PATCH V8 4/4] arm64: dts: nvidia: Add nodes for CMDQV

On 13/01/2026 05:49, Ashish Mhetre wrote:

The subject prefix should be "arm64: tegra:". See git log. So may be ...

"arm64: tegra: Add CMDQV nodes for Tegra264"

Quoted 10 lines

The Command Queue Virtualization (CMDQV) hardware is part of the SMMUv3 implementation on NVIDIA Tegra SoCs. It assists in virtualizing the command queue for the SMMU.

Update SMMU compatible strings to use nvidia,tegra264-smmu to enable CMDQV support. Add device tree nodes for the CMDQV hardware and enable them on the tegra264-p3834 platform where SMMUs are enabled. Each SMMU instance is paired with its corresponding CMDQV instance via the nvidia,cmdqv property.

Quoted 3 lines

My reviewed-by should come after your s-o-b.

Thierry may be able to fix these when applying so don't resend unless Thierry wants you to.

Jon

Signature · 1 line
nvpublic
#9 lore raw

Re: [PATCH V8 4/4] arm64: dts: nvidia: Add nodes for CMDQV

In reply to Ashish Mhetre
Quoted 10 lines · Ashish Mhetre

The Command Queue Virtualization (CMDQV) hardware is part of the SMMUv3 implementation on NVIDIA Tegra SoCs. It assists in virtualizing the command queue for the SMMU.

Update SMMU compatible strings to use nvidia,tegra264-smmu to enable CMDQV support. Add device tree nodes for the CMDQV hardware and enable them on the tegra264-p3834 platform where SMMUs are enabled. Each SMMU instance is paired with its corresponding CMDQV instance via the nvidia,cmdqv property.

Quoted 7 lines
---
 .../arm64/boot/dts/nvidia/tegra264-p3834.dtsi |  8 +++
 arch/arm64/boot/dts/nvidia/tegra264.dtsi      | 50 +++++++++++++++++--
 2 files changed, 53 insertions(+), 5 deletions(-)

Applied, with the tags rearranged and the subject prefix fixed.

Thanks,
Thierry

maintainer
#10 lore raw
In reply to Ashish Mhetre
Quoted 9 lines · Ashish Mhetre

This series adds device tree support for the CMDQ-Virtualization (CMDQV) hardware on NVIDIA Tegra264 SoCs.

CMDQV is a hardware block that works alongside the ARM SMMUv3 to assist in virtualizing the command queue. It was previously only supported through ACPI on Tegra241. This series extends the existing driver to support device tree based initialization, which is required for Tegra264 platforms.

[...]

Applied driver changes to iommu (arm/smmu/updates), thanks!

[1/4] iommu/tegra241-cmdqv: Decouple driver from ACPI

      https://git.kernel.org/iommu/c/eb20758f8672
[2/4] iommu/arm-smmu-v3: Add device-tree support for CMDQV driver
      https://git.kernel.org/iommu/c/ea69dc4e207b

Cheers,

Signature · 5 lines
Will

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