[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0jUG+4ey18VX5OJyzxXJDfDtxasH-HRYeba-oAB9VJJ8A@mail.gmail.com>
Date: Wed, 17 May 2023 13:32:55 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
Cc: linux-pci@...r.kernel.org, Bjorn Helgaas <bhelgaas@...gle.com>,
Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
Rob Herring <robh@...nel.org>,
Krzysztof Wilczyński <kw@...ux.com>,
Emmanuel Grumbach <emmanuel.grumbach@...el.com>,
"Rafael J . Wysocki" <rafael@...nel.org>,
Heiner Kallweit <hkallweit1@...il.com>,
Lukas Wunner <lukas@...ner.de>,
Jesse Barnes <jbarnes@...tuousgeek.org>,
Yinghai Lu <yinghai@...nel.org>, linux-kernel@...r.kernel.org,
Dean Luick <dean.luick@...nelisnetworks.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
stable@...r.kernel.org
Subject: Re: [PATCH v2 2/9] PCI: pciehp: Use RMW accessors for changing LNKCTL
On Wed, May 17, 2023 at 12:53 PM Ilpo Järvinen
<ilpo.jarvinen@...ux.intel.com> wrote:
>
> As hotplug is not the only driver touching LNKCTL, use the RMW
> capability accessor which handles concurrent changes correctly.
>
> Fixes: 7f822999e12a ("PCI: pciehp: Add Disable/enable link functions")
> Suggested-by: Lukas Wunner <lukas@...ner.de>
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
> Cc: stable@...r.kernel.org
Acked-by: Rafael J. Wysocki <rafael@...nel.org>
> ---
> drivers/pci/hotplug/pciehp_hpc.c | 12 +++---------
> 1 file changed, 3 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
> index f8c70115b691..26623e2884a3 100644
> --- a/drivers/pci/hotplug/pciehp_hpc.c
> +++ b/drivers/pci/hotplug/pciehp_hpc.c
> @@ -332,17 +332,11 @@ int pciehp_check_link_status(struct controller *ctrl)
> static int __pciehp_link_set(struct controller *ctrl, bool enable)
> {
> struct pci_dev *pdev = ctrl_dev(ctrl);
> - u16 lnk_ctrl;
>
> - pcie_capability_read_word(pdev, PCI_EXP_LNKCTL, &lnk_ctrl);
> + pcie_capability_clear_and_set_word(pdev, PCI_EXP_LNKCTL,
> + PCI_EXP_LNKCTL_LD,
> + !enable ? PCI_EXP_LNKCTL_LD : 0);
>
> - if (enable)
> - lnk_ctrl &= ~PCI_EXP_LNKCTL_LD;
> - else
> - lnk_ctrl |= PCI_EXP_LNKCTL_LD;
> -
> - pcie_capability_write_word(pdev, PCI_EXP_LNKCTL, lnk_ctrl);
> - ctrl_dbg(ctrl, "%s: lnk_ctrl = %x\n", __func__, lnk_ctrl);
> return 0;
> }
>
> --
> 2.30.2
>
Powered by blists - more mailing lists