Re: [PATCH v3 2/3] iommu/arm-smmu-v3: Enable an optional clock

From: Sebastian Reichel

Date: Wed Nov 18 2026 - 16:01:17 EST


Hi,

On Wed, Nov 18, 2026 at 02:32:36PM -0600, Rob Herring wrote:
> On Fri, Nov 13, 2026 at 08:45:06AM +0000, Arun Iyengar wrote:
> > On the RK3588 the PCIe SMMU's clock is gated as unused when no PCIe
> > controller holds it, and the next register access (the CR0 write at
> > shutdown) hangs. Enable the clock from the firmware node, if there is
> > one, while the driver is bound.
> >
> > Do it first in probe, as the firmware probe may take a Tegra CMDQV
> > reference that only arm_smmu_impl_probe() releases.
> >
> > Signed-off-by: Arun Iyengar <aiyengar1990@xxxxxxxxx>
> > ---
> > drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 11 +++++++++++
> > 1 file changed, 11 insertions(+)
> >
> > 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 6d4520c47308..d3f42316b0d6 100644
> > --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> > +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> > @@ -12,6 +12,7 @@
> > #include <linux/acpi.h>
> > #include <linux/acpi_iort.h>
> > #include <linux/bitops.h>
> > +#include <linux/clk.h>
> > #include <linux/crash_dump.h>
> > #include <linux/delay.h>
> > #include <linux/err.h>
> > @@ -5786,12 +5787,22 @@ static int arm_smmu_device_probe(struct platform_device *pdev)
> > resource_size_t ioaddr;
> > struct arm_smmu_device *smmu;
> > struct device *dev = &pdev->dev;
> > + struct clk *clk;
> >
> > smmu = devm_kzalloc(dev, sizeof(*smmu), GFP_KERNEL);
> > if (!smmu)
> > return -ENOMEM;
> > smmu->dev = dev;
> >
> > + /*
> > + * Before the firmware probe: it may take a reference on the Tegra
> > + * CMDQV device that only arm_smmu_impl_probe() releases.
> > + */
> > + clk = devm_clk_get_optional_enabled(dev, NULL);
> > + if (IS_ERR(clk))
> > + return dev_err_probe(dev, PTR_ERR(clk),
> > + "failed to enable clock\n");
>
> The primary point of the "optional" flavor of get functions is so the
> get function itself can print an error rather than every driver doing
> it. So drop the error print here.

For clocks no errors are printed for any flavor so far. The primary
point is simplifying the case of a clock not being described in the
firmware:

clk_get -> -ENOENT

clk_get_optional -> NULL (valid dummy clk handle, which may be used
in clk_prepare/clk_enable/clk_set_rate/...; also not covered by
IS_ERR() and thus not considered an error)

I think it is sensible to have a proper error in
/sys/kernel/debug/devices_deferred when getting the clock return
-EPROBE_DEFER, so I consider the error message sensible.

Greetings,

-- Sebastian

Attachment: signature.asc
Description: PGP signature