From: Alex Williamson <alex.williamson@redhat.com>
To: Cornelia Huck <cohuck@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] vfio-pci: Mask cap zero
Date: Mon, 4 May 2020 12:52:53 -0600 [thread overview]
Message-ID: <20200504125253.3d5f9cbf@x1.home> (raw)
In-Reply-To: <20200504180916.0e90cad9.cohuck@redhat.com>
On Mon, 4 May 2020 18:09:16 +0200
Cornelia Huck <cohuck@redhat.com> wrote:
> On Fri, 01 May 2020 15:41:24 -0600
> Alex Williamson <alex.williamson@redhat.com> wrote:
>
> > There is no PCI spec defined capability with ID 0, therefore we don't
> > expect to find it in a capability chain and we use this index in an
> > internal array for tracking the sizes of various capabilities to handle
> > standard config space. Therefore if a device does present us with a
> > capability ID 0, we mark our capability map with nonsense that can
> > trigger conflicts with other capabilities in the chain. Ignore ID 0
> > when walking the capability chain, handling it as a hidden capability.
> >
> > Seen on an NVIDIA Tesla T4.
> >
> > Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
> > ---
> > drivers/vfio/pci/vfio_pci_config.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c
> > index 87d0cc8c86ad..5935a804cb88 100644
> > --- a/drivers/vfio/pci/vfio_pci_config.c
> > +++ b/drivers/vfio/pci/vfio_pci_config.c
> > @@ -1487,7 +1487,7 @@ static int vfio_cap_init(struct vfio_pci_device *vdev)
> > if (ret)
> > return ret;
> >
> > - if (cap <= PCI_CAP_ID_MAX) {
>
> Maybe add a comment:
>
> /* no PCI spec defined capability with ID 0: hide it */
>
Sure.
>
> > + if (cap && cap <= PCI_CAP_ID_MAX) {
> > len = pci_cap_length[cap];
> > if (len == 0xFF) { /* Variable length */
> > len = vfio_cap_len(vdev, cap, pos);
> >
>
> Is there a requirement for caps to be strictly ordered? If not, could
> len hold a residual value from a previous iteration?
There is no ordering requirement for capabilities, but len is declared
non-static with an initial value within the scope of the loop, it's
reset every iteration. Thanks,
Alex
next prev parent reply other threads:[~2020-05-04 18:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-01 21:41 [PATCH] vfio-pci: Mask cap zero Alex Williamson
2020-05-04 16:09 ` Cornelia Huck
2020-05-04 18:52 ` Alex Williamson [this message]
2020-05-04 22:08 ` Neo Jia
2020-05-04 23:03 ` Alex Williamson
2020-05-05 6:09 ` Cornelia Huck
2020-05-05 21:58 ` Neo Jia
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=20200504125253.3d5f9cbf@x1.home \
--to=alex.williamson@redhat.com \
--cc=cohuck@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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