]> git.baikalelectronics.ru Git - kernel.git/commit
virtio_pci: use irq to detect interrupt support
authorMichael S. Tsirkin <mst@redhat.com>
Wed, 12 Oct 2022 21:58:28 +0000 (17:58 -0400)
committerMichael S. Tsirkin <mst@redhat.com>
Thu, 13 Oct 2022 13:33:03 +0000 (09:33 -0400)
commitf6d531900836a9b6fc06e2f3c33488e47095cd01
tree636cbbd5ca360de788e7f98649a1dc34daa29566
parent1e6f6368fd78312e4ae0a643fb067203e7ec1a32
virtio_pci: use irq to detect interrupt support

commit d1f5a793a497 ("virtio_pci: don't try to use intxif pin is zero")
breaks virtio_pci on powerpc, when running as a qemu guest.

vp_find_vqs() bails out because pci_dev->pin == 0.

But pci_dev->irq is populated correctly, so vp_find_vqs_intx() would
succeed if we called it - which is what the code used to do.

This seems to happen because pci_dev->pin is not populated in
pci_assign_irq(). A PCI core bug? Maybe.

However Linus said:
I really think that that is basically the only time you should use
that 'pci_dev->pin' thing: it basically exists not for "does this
device have an IRQ", but for "what is the routing of this irq on this
device".

and
The correct way to check for "no irq" doesn't use NO_IRQ at all, it just does
if (dev->irq) ...

so let's just check irq and be done with it.

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Reported-by: Michael Ellerman <mpe@ellerman.id.au>
Fixes: d1f5a793a497 ("virtio_pci: don't try to use intxif pin is zero")
Cc: "Angus Chen" <angus.chen@jaguarmicro.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Michael Ellerman <mpe@ellerman.id.au>
Acked-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20221012220312.308522-1-mst@redhat.com>
drivers/virtio/virtio_pci_common.c