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

From: Ashish Mhetre

Date: Mon Dec 15 2025 - 01:09:18 EST



On 12/13/2025 2:06 AM, Robin Murphy wrote:
External email: Use caution opening links or attachments


On 12/12/2025 7:46 pm, Nicolin Chen wrote:
On Fri, Dec 12, 2025 at 12:01:41PM +0000, Robin Murphy wrote:
@@ -4542,7 +4542,7 @@ 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() */

Don't we need to bring the put_device(adev) out to this level, since
impl_dev is now something else that AFAICS we are *not* taking a new
reference on (and thus should not be putting either)?

Ah, right! We are using the platform device now.

-           smmu->impl_dev = &adev->dev;
+           smmu->impl_dev = 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));

I think we should squash this:

Ack, it occurred to me shortly after sending that in fact it's good to
still hold our own reference on impl_dev itself, as we're not relying on
a bound driver to hold one for us.

Cheers,
Robin.


Ack, thanks Nic and Robin. I will include this and send
new version.

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 0c98be3135c63..88625e3c27a65 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -5280,10 +5280,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 = acpi_get_first_physical_node(adev);
+             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);
  }

Thanks
Nicolin