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: <CAErSpo5TZC3iM09SB1td+F7b-+aiu9EHwPYa1ayiU-i1tseV5w@mail.gmail.com>
Date:   Thu, 18 Jul 2019 07:48:51 -0500
From:   Bjorn Helgaas <bhelgaas@...gle.com>
To:     Frederick Lawler <fred@...dlawl.com>
Cc:     Jens Axboe <axboe@...nel.dk>, linux-block@...r.kernel.org,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mtip32xx: Prefer pcie_capability_read_word()

On Wed, Jul 17, 2019 at 9:09 PM Frederick Lawler <fred@...dlawl.com> wrote:
>
> Commit 8c0d3a02c130 ("PCI: Add accessors for PCI Express Capability")
> added accessors for the PCI Express Capability so that drivers didn't
> need to be aware of differences between v1 and v2 of the PCI
> Express Capability.
>
> Replace pci_read_config_word() and pci_write_config_word() calls with
> pcie_capability_read_word() and pcie_capability_write_word().
>
> Signed-off-by: Frederick Lawler <fred@...dlawl.com>
> ---
>  drivers/block/mtip32xx/mtip32xx.c | 28 ++++++++++++----------------
>  1 file changed, 12 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
> index f0105d118056..b7b26e33248b 100644
> --- a/drivers/block/mtip32xx/mtip32xx.c
> +++ b/drivers/block/mtip32xx/mtip32xx.c
> @@ -3952,22 +3952,18 @@ static void mtip_disable_link_opts(struct driver_data *dd, struct pci_dev *pdev)
>         int pos;
>         unsigned short pcie_dev_ctrl;
>
> -       pos = pci_find_capability(pdev, PCI_CAP_ID_EXP);
> -       if (pos) {
> -               pci_read_config_word(pdev,
> -                       pos + PCI_EXP_DEVCTL,
> -                       &pcie_dev_ctrl);
> -               if (pcie_dev_ctrl & (1 << 11) ||
> -                   pcie_dev_ctrl & (1 << 4)) {
> -                       dev_info(&dd->pdev->dev,
> -                               "Disabling ERO/No-Snoop on bridge device %04x:%04x\n",
> -                                       pdev->vendor, pdev->device);
> -                       pcie_dev_ctrl &= ~(PCI_EXP_DEVCTL_NOSNOOP_EN |
> -                                               PCI_EXP_DEVCTL_RELAX_EN);
> -                       pci_write_config_word(pdev,
> -                               pos + PCI_EXP_DEVCTL,
> -                               pcie_dev_ctrl);
> -               }
> +       if (!pci_is_pcie(pdev))
> +               return;
> +
> +       pcie_capability_read_word(pdev, PCI_EXP_DEVCTL, &pcie_dev_ctrl);
> +       if (pcie_dev_ctrl & (1 << 11) ||
> +           pcie_dev_ctrl & (1 << 4)) {

Hmm, sort of sloppy that  d1e714db8129 ("mtip32xx: Fix ERO and NoSnoop
values in PCIe upstream on AMD systems") used
PCI_EXP_DEVCTL_NOSNOOP_EN and PCI_EXP_DEVCTL_RELAX_EN below, but not
here.  Could be fixed with a separate follow-on patch.

> +               dev_info(&dd->pdev->dev,
> +                        "Disabling ERO/No-Snoop on bridge device %04x:%04x\n",
> +                        pdev->vendor, pdev->device);
> +               pcie_dev_ctrl &= ~(PCI_EXP_DEVCTL_NOSNOOP_EN |
> +                                       PCI_EXP_DEVCTL_RELAX_EN);
> +               pcie_capability_write_word(pdev, PCI_EXP_DEVCTL, pcie_dev_ctrl);
>         }
>  }
>
> --
> 2.17.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ