From: Bjorn Helgaas <helgaas@kernel.org>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: bhelgaas@google.com, linux-pci@vger.kernel.org,
mark.d.rustad@intel.com, myron.stowe@redhat.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PCI: Fix devfn for VPD access through function 0
Date: Thu, 24 Sep 2015 13:27:55 -0500 [thread overview]
Message-ID: <20150924182755.GC3648@localhost> (raw)
In-Reply-To: <20150915171216.7049.58119.stgit@gimli.home>
On Tue, Sep 15, 2015 at 11:17:21AM -0600, Alex Williamson 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
Applied to for-linus for v4.3 with acks from Myron & Mark, thanks!
I removed the stable tag because 932c435caba8 first appeared in
v4.3-rc1, so it shouldn't appear in any stable kernels yet. Right?
> ---
>
> 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-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/
next prev parent reply other threads:[~2015-09-24 18:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-15 17:17 [PATCH] PCI: Fix devfn for VPD access through function 0 Alex Williamson
2015-09-23 17:19 ` Myron Stowe
2015-09-23 19:11 ` Rustad, Mark D
2015-09-24 18:27 ` Bjorn Helgaas [this message]
2015-09-24 18:35 ` Rustad, Mark D
2015-09-24 19:03 ` Bjorn Helgaas
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=20150924182755.GC3648@localhost \
--to=helgaas@kernel.org \
--cc=alex.williamson@redhat.com \
--cc=bhelgaas@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mark.d.rustad@intel.com \
--cc=myron.stowe@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.