Linux-Rockchip Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Reichel <sebastian.reichel@collabora.com>
To: Rob Herring <robh@kernel.org>
Cc: Arun Iyengar <aiyengar1990@gmail.com>,
	Will Deacon <will@kernel.org>,
	 Robin Murphy <robin.murphy@arm.com>,
	"Joerg Roedel (AMD)" <joro@8bytes.org>,
	 Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	 Heiko Stuebner <heiko@sntech.de>,
	Niklas Cassel <cassel@kernel.org>,
	 Pranjal Shrivastava <praan@google.com>,
	linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev,
	 linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	linux-rockchip@lists.infradead.org,
	 Shawn Lin <shawn.lin@rock-chips.com>,
	Simon Xue <xxm@rock-chips.com>,
	 Finley Xiao <finley.xiao@rock-chips.com>
Subject: Re: [PATCH v3 2/3] iommu/arm-smmu-v3: Enable an optional clock
Date: Wed, 18 Nov 2026 22:00:44 +0100	[thread overview]
Message-ID: <av4PT0Xu8yd6ygN9@venus> (raw)
In-Reply-To: <20261118203236.GA823624-robh@kernel.org>


[-- Attachment #1.1: Type: text/plain, Size: 2663 bytes --]

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@gmail.com>
> > ---
> >  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 #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

  reply	other threads:[~2026-11-18 21:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13  8:45 [PATCH v3 0/3] iommu/arm-smmu-v3: Keep the clock of the RK3588 PCIe SMMU running Arun Iyengar via B4 Relay
2026-11-13  8:45 ` [PATCH v3 1/3] dt-bindings: iommu: arm,smmu-v3: Allow a clock and a reset Arun Iyengar via B4 Relay
2026-11-18 20:32   ` Rob Herring (Arm)
2026-11-13  8:45 ` [PATCH v3 2/3] iommu/arm-smmu-v3: Enable an optional clock Arun Iyengar via B4 Relay
2026-11-18 20:32   ` Rob Herring
2026-11-18 21:00     ` Sebastian Reichel [this message]
2026-11-13  8:45 ` [PATCH v3 3/3] arm64: dts: rockchip: Add the clock and reset of the RK3588 PCIe SMMU Arun Iyengar via B4 Relay

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=av4PT0Xu8yd6ygN9@venus \
    --to=sebastian.reichel@collabora.com \
    --cc=aiyengar1990@gmail.com \
    --cc=cassel@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=finley.xiao@rock-chips.com \
    --cc=heiko@sntech.de \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=praan@google.com \
    --cc=robh@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=shawn.lin@rock-chips.com \
    --cc=will@kernel.org \
    --cc=xxm@rock-chips.com \
    /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