From: Thierry Reding <thierry.reding@gmail.com>
To: Oliver Neukum <oneukum@suse.com>
Cc: Haotien Hsu <haotienh@nvidia.com>,
Mathias Nyman <mathias.nyman@intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jonathan Hunter <jonathanh@nvidia.com>,
linux-usb@vger.kernel.org, linux-tegra@vger.kernel.org,
linux-kernel@vger.kernel.org, Wayne Chang <waynec@nvidia.com>,
JC Kuo <jckuo@nvidia.com>, WK Tsai <wtsai@nvidia.com>,
Henry Lin <henryl@nvidia.com>
Subject: Re: [PATCH v2] usb: xhci: tegra: Add shutdown callback for Tegra XUSB
Date: Tue, 18 Jul 2023 13:35:05 +0200 [thread overview]
Message-ID: <ZLZ46fPCdPt1Bpul@orome> (raw)
In-Reply-To: <525bc794-b797-9a53-7f59-debcfca9edd8@suse.com>
[-- Attachment #1: Type: text/plain, Size: 2715 bytes --]
On Tue, Jul 18, 2023 at 11:18:25AM +0200, Oliver Neukum wrote:
>
>
> On 18.07.23 11:14, Haotien Hsu wrote:
> > From: Henry Lin <henryl@nvidia.com>
> >
> > If memory accesses by the Tegra XUSB controller are translated through
> > the SMMU (System MMU), the hardware may continue accessing memory even
> > after the SMMU translations have been disabled during the shutdown
> > process and this can in turn cause unpredictable crashes.
> > Fix this by adding a shutdown implementation that ensures the hardware
> > is turned off during system reboot or shutdown.
> >
> > Signed-off-by: Henry Lin <henryl@nvidia.com>
> > Signed-off-by: Haotien Hsu <haotienh@nvidia.com>
> > Acked-by: Thierry Reding <treding@nvidia.com>
> >
> > ---
> > V1 -> V2: Resend for the typo in the mailing list
> > ---
> > drivers/usb/host/xhci-tegra.c | 28 +++++++++++++++++++++-------
> > 1 file changed, 21 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c
> > index a56cc81b9404..6ef2eac9835d 100644
> > --- a/drivers/usb/host/xhci-tegra.c
> > +++ b/drivers/usb/host/xhci-tegra.c
> > @@ -1925,6 +1925,15 @@ static int tegra_xusb_probe(struct platform_device *pdev)
> > return err;
> > }
> > +static void tegra_xusb_disable(struct tegra_xusb *tegra)
> > +{
> > + tegra_xusb_powergate_partitions(tegra);
> > + tegra_xusb_powerdomain_remove(tegra->dev, tegra);
> > + tegra_xusb_phy_disable(tegra);
> > + tegra_xusb_clk_disable(tegra);
> > + regulator_bulk_disable(tegra->soc->num_supplies, tegra->supplies);
> > +}
> > +
> > static int tegra_xusb_remove(struct platform_device *pdev)
> > {
> > struct tegra_xusb *tegra = platform_get_drvdata(pdev);
> > @@ -1947,18 +1956,22 @@ static int tegra_xusb_remove(struct platform_device *pdev)
> > pm_runtime_put(&pdev->dev);
> > - tegra_xusb_powergate_partitions(tegra);
> > -
> > - tegra_xusb_powerdomain_remove(&pdev->dev, tegra);
> > -
> > - tegra_xusb_phy_disable(tegra);
> > - tegra_xusb_clk_disable(tegra);
> > - regulator_bulk_disable(tegra->soc->num_supplies, tegra->supplies);
> > + tegra_xusb_disable(tegra);
> > tegra_xusb_padctl_put(tegra->padctl);
> > return 0;
> > }
> > +static void tegra_xusb_shutdown(struct platform_device *pdev)
> > +{
> > + struct tegra_xusb *tegra = platform_get_drvdata(pdev);
> > +
> > + pm_runtime_get_sync(&pdev->dev);
>
> Where is this balanced?
Well, I suppose we could add a pm_runtime_put() at the end of this
function, but since we expect the system to shut down after this, at
which point any runtime PM accounting is going to go bye-bye anyway,
do we really want to bother?
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2023-07-18 11:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-18 9:14 [PATCH v2] usb: xhci: tegra: Add shutdown callback for Tegra XUSB Haotien Hsu
2023-07-18 9:18 ` Oliver Neukum
2023-07-18 11:35 ` Thierry Reding [this message]
2023-07-25 16:19 ` Greg Kroah-Hartman
2023-07-27 8:08 ` Haotien Hsu
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=ZLZ46fPCdPt1Bpul@orome \
--to=thierry.reding@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=haotienh@nvidia.com \
--cc=henryl@nvidia.com \
--cc=jckuo@nvidia.com \
--cc=jonathanh@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--cc=oneukum@suse.com \
--cc=waynec@nvidia.com \
--cc=wtsai@nvidia.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;
as well as URLs for NNTP newsgroup(s).