From: Bjorn Helgaas <helgaas@kernel.org>
To: marek.vasut@gmail.com
Cc: linux-pci@vger.kernel.org,
Kazufumi Ikeda <kaz-ikeda@xc.jp.nec.com>,
Gaku Inami <gaku.inami.xw@bp.renesas.com>,
Marek Vasut <marek.vasut+renesas@gmail.com>,
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
Simon Horman <horms+renesas@verge.net.au>,
Wolfram Sang <wsa+renesas@sang-engineering.com>,
stable@vger.kernel.org,
Geert Uytterhoeven <geert+renesas@glider.be>,
Phil Edworthy <phil.edworthy@renesas.com>,
Wolfram Sang <wsa@the-dreams.de>,
linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH V3] PCI: rcar: Add the initialization of PCIe link in resume_noirq()
Date: Thu, 28 Mar 2019 09:18:22 -0500 [thread overview]
Message-ID: <20190328141822.GA156243@google.com> (raw)
In-Reply-To: <20190325194319.12850-1-marek.vasut@gmail.com>
On Mon, Mar 25, 2019 at 08:43:19PM +0100, marek.vasut@gmail.com wrote:
> From: Kazufumi Ikeda <kaz-ikeda@xc.jp.nec.com>
>
> Reestablish the PCIe link very early in the resume process in case it
> went down to prevent PCI accesses from hanging the bus. Such accesses
> can happen early in the PCI resume process, as early as the
> SUSPEND_RESUME_NOIRQ step, thus the link must be reestablished in the
> driver resume_noirq() callback.
>
> Fixes: e015f88c368d ("PCI: rcar: Add support for R-Car H3 to pcie-rcar")
I'm fine with the fix itself, but since e015f88c368d appeared more
than two years ago in v4.5, the justification for merging this after
the merge window is a little weak.
Is there a more recent change that exposed this problem? The usual
situation is that we merged something during the v5.1 merge window
that caused a regression, and we're now fixing that before v5.1 final.
Bjorn
> Signed-off-by: Kazufumi Ikeda <kaz-ikeda@xc.jp.nec.com>
> Signed-off-by: Gaku Inami <gaku.inami.xw@bp.renesas.com>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> [lorenzo.pieralisi@arm.com: reformatted commit log]
> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
> Acked-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> Cc: stable@vger.kernel.org
> Cc: Geert Uytterhoeven <geert+renesas@glider.be>
> Cc: Phil Edworthy <phil.edworthy@renesas.com>
> Cc: Simon Horman <horms+renesas@verge.net.au>
> Cc: Wolfram Sang <wsa@the-dreams.de>
> Cc: linux-renesas-soc@vger.kernel.org
> ---
> V2: - Use BIT() macro for (1 << n)
> - Since polling in rcar_pcie_wait_for_dl() uses udelay(), do not
> add extra changes to this function anymore
> - Make resume_noirq return early and clean up parenthesis therein
> V3: - Add missing PMSR register definition, dropped due to patch reshuffling
> ---
> drivers/pci/controller/pcie-rcar.c | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/drivers/pci/controller/pcie-rcar.c b/drivers/pci/controller/pcie-rcar.c
> index c8febb009454..6a4e435bd35f 100644
> --- a/drivers/pci/controller/pcie-rcar.c
> +++ b/drivers/pci/controller/pcie-rcar.c
> @@ -46,6 +46,7 @@
>
> /* Transfer control */
> #define PCIETCTLR 0x02000
> +#define DL_DOWN BIT(3)
> #define CFINIT 1
> #define PCIETSTR 0x02004
> #define DATA_LINK_ACTIVE 1
> @@ -94,6 +95,7 @@
> #define MACCTLR 0x011058
> #define SPEED_CHANGE BIT(24)
> #define SCRAMBLE_DISABLE BIT(27)
> +#define PMSR 0x01105c
> #define MACS2R 0x011078
> #define MACCGSPSETR 0x011084
> #define SPCNGRSN BIT(31)
> @@ -1130,6 +1132,7 @@ static int rcar_pcie_probe(struct platform_device *pdev)
> pcie = pci_host_bridge_priv(bridge);
>
> pcie->dev = dev;
> + platform_set_drvdata(pdev, pcie);
>
> err = pci_parse_request_of_pci_ranges(dev, &pcie->resources, NULL);
> if (err)
> @@ -1221,10 +1224,28 @@ static int rcar_pcie_probe(struct platform_device *pdev)
> return err;
> }
>
> +static int rcar_pcie_resume_noirq(struct device *dev)
> +{
> + struct rcar_pcie *pcie = dev_get_drvdata(dev);
> +
> + if (rcar_pci_read_reg(pcie, PMSR) &&
> + !(rcar_pci_read_reg(pcie, PCIETCTLR) & DL_DOWN))
> + return 0;
> +
> + /* Re-establish the PCIe link */
> + rcar_pci_write_reg(pcie, CFINIT, PCIETCTLR);
> + return rcar_pcie_wait_for_dl(pcie);
> +}
> +
> +static const struct dev_pm_ops rcar_pcie_pm_ops = {
> + .resume_noirq = rcar_pcie_resume_noirq,
> +};
> +
> static struct platform_driver rcar_pcie_driver = {
> .driver = {
> .name = "rcar-pcie",
> .of_match_table = rcar_pcie_of_match,
> + .pm = &rcar_pcie_pm_ops,
> .suppress_bind_attrs = true,
> },
> .probe = rcar_pcie_probe,
> --
> 2.20.1
>
next prev parent reply other threads:[~2019-03-28 14:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-25 19:43 [PATCH V3] PCI: rcar: Add the initialization of PCIe link in resume_noirq() marek.vasut
2019-03-26 7:57 ` Geert Uytterhoeven
2019-03-26 11:24 ` Lorenzo Pieralisi
2019-03-28 14:18 ` Bjorn Helgaas [this message]
2019-03-28 14:43 ` Lorenzo Pieralisi
2019-03-28 14:59 ` Geert Uytterhoeven
2019-03-28 18:59 ` Bjorn Helgaas
2019-03-29 9:52 ` Marek Vasut
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=20190328141822.GA156243@google.com \
--to=helgaas@kernel.org \
--cc=gaku.inami.xw@bp.renesas.com \
--cc=geert+renesas@glider.be \
--cc=horms+renesas@verge.net.au \
--cc=kaz-ikeda@xc.jp.nec.com \
--cc=linux-pci@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=marek.vasut+renesas@gmail.com \
--cc=marek.vasut@gmail.com \
--cc=phil.edworthy@renesas.com \
--cc=stable@vger.kernel.org \
--cc=wsa+renesas@sang-engineering.com \
--cc=wsa@the-dreams.de \
/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