From: Ashish Mhetre <amhetre@nvidia.com>
To: <will@kernel.org>, <robin.murphy@arm.com>, <joro@8bytes.org>,
<robh@kernel.org>, <krzk+dt@kernel.org>, <conor+dt@kernel.org>,
<thierry.reding@gmail.com>, <jonathanh@nvidia.com>,
<jgg@ziepe.ca>, <nicolinc@nvidia.com>
Cc: <linux-tegra@nvidia.com>, <linux-arm-kernel@lists.infradead.org>,
<iommu@lists.linux.dev>, <devicetree@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <linux-tegra@vger.kernel.org>,
Ashish Mhetre <amhetre@nvidia.com>
Subject: [PATCH 1/3] iommu/arm-smmu-v3: Add device-tree support for CMDQV driver
Date: Fri, 31 Oct 2025 06:29:57 +0000 [thread overview]
Message-ID: <20251031062959.1521704-2-amhetre@nvidia.com> (raw)
In-Reply-To: <20251031062959.1521704-1-amhetre@nvidia.com>
Add device tree support to the CMDQV driver to enable usage on Tegra264
SoCs. The implementation mirrors the existing ACPI probe path, parsing
the nvidia,cmdqv phandle from the SMMU device tree node to associate
each SMMU with its corresponding CMDQV instance.
Remove the ACPI dependency from Kconfig as the driver now supports both
ACPI and device tree initialization through conditional compilation.
Signed-off-by: Ashish Mhetre <amhetre@nvidia.com>
---
drivers/iommu/arm/Kconfig | 1 -
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 30 +++++++++++++
.../iommu/arm/arm-smmu-v3/tegra241-cmdqv.c | 43 ++++++++++++++++++-
3 files changed, 72 insertions(+), 2 deletions(-)
diff --git a/drivers/iommu/arm/Kconfig b/drivers/iommu/arm/Kconfig
index ef42bbe07dbe..5fac08b89dee 100644
--- a/drivers/iommu/arm/Kconfig
+++ b/drivers/iommu/arm/Kconfig
@@ -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
diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
index a33fbd12a0dd..b2657eaa9e17 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -4530,6 +4530,34 @@ 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;
+
+ 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_info(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,
@@ -4634,6 +4662,8 @@ 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;
+ tegra_cmdqv_dt_probe(dev->of_node, smmu);
+
return ret;
}
diff --git a/drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c b/drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c
index 378104cd395e..a5eb8e23083c 100644
--- a/drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c
+++ b/drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c
@@ -11,6 +11,8 @@
#include <linux/iommufd.h>
#include <linux/iopoll.h>
#include <uapi/linux/iommufd.h>
+#include <linux/of_platform.h>
+#include <linux/platform_device.h>
#include <acpi/acpixf.h>
@@ -917,6 +919,26 @@ tegra241_cmdqv_find_acpi_resource(struct device *dev, int *irq)
return res;
}
+static struct resource *
+tegra241_cmdqv_find_dt_resource(struct device *dev, int *irq)
+{
+ struct platform_device *pdev = to_platform_device(dev);
+ struct resource *res;
+
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!res) {
+ dev_err(dev, "no memory resource found for CMDQV\n");
+ return NULL;
+ }
+
+ if (irq)
+ *irq = platform_get_irq_byname_optional(pdev, "cmdqv");
+ if (!irq || *irq <= 0)
+ dev_warn(dev, "no interrupt. errors will not be reported\n");
+
+ return res;
+}
+
static int tegra241_cmdqv_init_structures(struct arm_smmu_device *smmu)
{
struct tegra241_cmdqv *cmdqv =
@@ -1048,11 +1070,14 @@ struct arm_smmu_device *tegra241_cmdqv_probe(struct arm_smmu_device *smmu)
if (!smmu->dev->of_node)
res = tegra241_cmdqv_find_acpi_resource(smmu->impl_dev, &irq);
+ else
+ res = tegra241_cmdqv_find_dt_resource(smmu->impl_dev, &irq);
if (!res)
goto out_fallback;
new_smmu = __tegra241_cmdqv_probe(smmu, res, irq);
- kfree(res);
+ if (!smmu->dev->of_node)
+ kfree(res);
if (new_smmu)
return new_smmu;
@@ -1346,4 +1371,20 @@ tegra241_cmdqv_init_vintf_user(struct arm_vsmmu *vsmmu,
return ret;
}
+static const struct of_device_id tegra241_cmdqv_of_match[] = {
+ { .compatible = "nvidia,tegra264-cmdqv" },
+ { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, tegra241_cmdqv_of_match);
+
+static struct platform_driver tegra241_cmdqv_driver = {
+ .driver = {
+ .name = "tegra241-cmdqv",
+ .of_match_table = tegra241_cmdqv_of_match,
+ },
+};
+module_platform_driver(tegra241_cmdqv_driver);
+
+MODULE_DESCRIPTION("NVIDIA Tegra241 Command Queue Virtualization Driver");
+MODULE_LICENSE("GPL");
MODULE_IMPORT_NS("IOMMUFD");
--
2.25.1
next prev parent reply other threads:[~2025-10-31 6:30 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-31 6:29 [PATCH 0/3] Add device tree support for NVIDIA Tegra CMDQV Ashish Mhetre
2025-10-31 6:29 ` Ashish Mhetre [this message]
2025-10-31 17:29 ` [PATCH 1/3] iommu/arm-smmu-v3: Add device-tree support for CMDQV driver Nicolin Chen
2025-11-03 13:06 ` Ashish Mhetre
2025-10-31 6:29 ` [PATCH 2/3] dt-bindings: iommu: Add NVIDIA Tegra CMDQV support Ashish Mhetre
2025-10-31 8:14 ` Krzysztof Kozlowski
2025-10-31 21:00 ` Nicolin Chen
2025-11-03 13:54 ` Ashish Mhetre
2025-11-10 6:50 ` Ashish Mhetre
2025-11-20 6:07 ` Ashish Mhetre
2025-11-20 10:23 ` Robin Murphy
2025-11-21 5:46 ` Ashish Mhetre
2025-10-31 6:29 ` [PATCH 3/3] arm64: dts: nvidia: Add nodes for CMDQV Ashish Mhetre
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251031062959.1521704-2-amhetre@nvidia.com \
--to=amhetre@nvidia.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=iommu@lists.linux.dev \
--cc=jgg@ziepe.ca \
--cc=jonathanh@nvidia.com \
--cc=joro@8bytes.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@nvidia.com \
--cc=linux-tegra@vger.kernel.org \
--cc=nicolinc@nvidia.com \
--cc=robh@kernel.org \
--cc=robin.murphy@arm.com \
--cc=thierry.reding@gmail.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox