Skip to content

Commit 2bd42b0

Browse files
committed
vfio/pci: Virtualize zero INTx PIN if no pdev->irq
Typically pdev->irq is consistent with whether the device itself supports INTx, where device support is reported via the PIN register. Therefore the PIN register is often already zero if pdev->irq is zero. Recently virtualization of the PIN register was expanded to include the case where the device supports INTx but the platform does not route the interrupt. This is reported by a value of IRQ_NOTCONNECTED on some architectures. Other architectures just report zero for pdev->irq. We already disallow INTx setup if pdev->irq is zero, therefore add this to the PIN register virtualization criteria so that a consistent view is provided to userspace through virtualized config space and ioctls. Reported-by: Shivaprasad G Bhat <sbhat@linux.ibm.com> Link: https://lore.kernel.org/all/174231895238.2295.12586708771396482526.stgit@linux.ibm.com/ Tested-by: Shivaprasad G Bhat <sbhat@linux.ibm.com> Link: https://lore.kernel.org/r/20250320194145.2816379-1-alex.williamson@redhat.com Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
1 parent 8ffd015 commit 2bd42b0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/vfio/pci/vfio_pci_config.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1815,7 +1815,7 @@ int vfio_config_init(struct vfio_pci_core_device *vdev)
18151815
}
18161816

18171817
if (!IS_ENABLED(CONFIG_VFIO_PCI_INTX) || vdev->nointx ||
1818-
vdev->pdev->irq == IRQ_NOTCONNECTED)
1818+
!vdev->pdev->irq || vdev->pdev->irq == IRQ_NOTCONNECTED)
18191819
vconfig[PCI_INTERRUPT_PIN] = 0;
18201820

18211821
ret = vfio_cap_init(vdev);

0 commit comments

Comments
 (0)