lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZLZ46fPCdPt1Bpul@orome>
Date:   Tue, 18 Jul 2023 13:35:05 +0200
From:   Thierry Reding <thierry.reding@...il.com>
To:     Oliver Neukum <oneukum@...e.com>
Cc:     Haotien Hsu <haotienh@...dia.com>,
        Mathias Nyman <mathias.nyman@...el.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Jonathan Hunter <jonathanh@...dia.com>,
        linux-usb@...r.kernel.org, linux-tegra@...r.kernel.org,
        linux-kernel@...r.kernel.org, Wayne Chang <waynec@...dia.com>,
        JC Kuo <jckuo@...dia.com>, WK Tsai <wtsai@...dia.com>,
        Henry Lin <henryl@...dia.com>
Subject: Re: [PATCH v2] usb: xhci: tegra: Add shutdown callback for Tegra XUSB

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@...dia.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@...dia.com>
> > Signed-off-by: Haotien Hsu <haotienh@...dia.com>
> > Acked-by: Thierry Reding <treding@...dia.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

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ