Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1231585 > unrolled thread
| Started by | Myron Stowe <myron.stowe@gmail.com> |
|---|---|
| First post | 2015-09-23 19:20 +0200 |
| Last post | 2015-09-23 19:20 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH] PCI: Fix devfn for VPD access through function 0 Myron Stowe <myron.stowe@gmail.com> - 2015-09-23 19:20 +0200
| From | Myron Stowe <myron.stowe@gmail.com> |
|---|---|
| Date | 2015-09-23 19:20 +0200 |
| Subject | Re: [PATCH] PCI: Fix devfn for VPD access through function 0 |
| Message-ID | <qbVS2-2dI-9@gated-at.bofh.it> |
On Tue, Sep 15, 2015 at 11:17 AM, Alex Williamson
<alex.williamson@redhat.com> wrote:
> Commit 932c435caba8 ("PCI: Add dev_flags bit to access VPD through
> function 0") passes PCI_SLOT(devfn) for the devfn parameter of
> pci_get_slot(). Generally this works because we're fairly well
> guaranteed that a PCIe device is at slot address 0, but for the
> general case, including conventional PCI, it's incorrect. We need
> to get the slot and then convert it back into a devfn.
>
> Fixes: 932c435caba8 ("PCI: Add dev_flags bit to access VPD through function 0")
> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
> Cc: stable@vger.kernel.org
> ---
>
> Since the original patch and quirk was marked for stable and applies
> to all Intel NICs, regardless of the bus type, I assume this needs to
> chase it or VPD might disappear on e1000/e100 if it currently exists.
>
> drivers/pci/access.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pci/access.c b/drivers/pci/access.c
> index 769f7e3..5a5f0a7 100644
> --- a/drivers/pci/access.c
> +++ b/drivers/pci/access.c
> @@ -442,7 +442,8 @@ static const struct pci_vpd_ops pci_vpd_pci22_ops = {
> static ssize_t pci_vpd_f0_read(struct pci_dev *dev, loff_t pos, size_t count,
> void *arg)
> {
> - struct pci_dev *tdev = pci_get_slot(dev->bus, PCI_SLOT(dev->devfn));
> + struct pci_dev *tdev = pci_get_slot(dev->bus,
> + PCI_DEVFN(PCI_SLOT(dev->devfn), 0));
> ssize_t ret;
>
> if (!tdev)
> @@ -456,7 +457,8 @@ static ssize_t pci_vpd_f0_read(struct pci_dev *dev, loff_t pos, size_t count,
> static ssize_t pci_vpd_f0_write(struct pci_dev *dev, loff_t pos, size_t count,
> const void *arg)
> {
> - struct pci_dev *tdev = pci_get_slot(dev->bus, PCI_SLOT(dev->devfn));
> + struct pci_dev *tdev = pci_get_slot(dev->bus,
> + PCI_DEVFN(PCI_SLOT(dev->devfn), 0));
> ssize_t ret;
>
> if (!tdev)
> @@ -475,7 +477,8 @@ static const struct pci_vpd_ops pci_vpd_f0_ops = {
>
> static int pci_vpd_f0_dev_check(struct pci_dev *dev)
> {
> - struct pci_dev *tdev = pci_get_slot(dev->bus, PCI_SLOT(dev->devfn));
> + struct pci_dev *tdev = pci_get_slot(dev->bus,
> + PCI_DEVFN(PCI_SLOT(dev->devfn), 0));
> int ret = 0;
>
> if (!tdev)
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
Acked-by: Myron Stowe <myron.stowe@redhat.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top | Article view | linux.kernel
csiph-web