linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vfio: pci: Advertise INTx only if LINE is connected
@ 2025-03-18 17:29 Shivaprasad G Bhat
  2025-03-18 17:58 ` Alex Williamson
  2025-03-25  7:13 ` Christophe Leroy
  0 siblings, 2 replies; 5+ messages in thread
From: Shivaprasad G Bhat @ 2025-03-18 17:29 UTC (permalink / raw)
  To: alex.williamson, jgg, kevin.tian
  Cc: linux-kernel, kvm, yi.l.liu, Yunxiang.Li, pstanner, maddy,
	linuxppc-dev, sbhat

On POWER systems, when the device is behind the io expander,
not all PCI slots would have the PCI_INTERRUPT_LINE connected.
The firmware assigns a valid PCI_INTERRUPT_PIN though. In such
configuration, the irq_info ioctl currently advertizes the
irq count as 1 as the PCI_INTERRUPT_PIN is valid.

The patch adds the additional check[1] if the irq is assigned
for the PIN which is done iff the LINE is connected.

[1]: https://lore.kernel.org/qemu-devel/20250131150201.048aa3bf.alex.williamson@redhat.com/

Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com>
Suggested-By: Alex Williamson <alex.williamson@redhat.com>
---
 drivers/vfio/pci/vfio_pci_core.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c
index 586e49efb81b..4ce70f05b4a8 100644
--- a/drivers/vfio/pci/vfio_pci_core.c
+++ b/drivers/vfio/pci/vfio_pci_core.c
@@ -734,6 +734,10 @@ static int vfio_pci_get_irq_count(struct vfio_pci_core_device *vdev, int irq_typ
 			return 0;
 
 		pci_read_config_byte(vdev->pdev, PCI_INTERRUPT_PIN, &pin);
+#if IS_ENABLED(CONFIG_PPC64)
+		if (!vdev->pdev->irq)
+			pin = 0;
+#endif
 
 		return pin ? 1 : 0;
 	} else if (irq_type == VFIO_PCI_MSI_IRQ_INDEX) {




^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-03-25  7:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-18 17:29 [PATCH] vfio: pci: Advertise INTx only if LINE is connected Shivaprasad G Bhat
2025-03-18 17:58 ` Alex Williamson
2025-03-20 17:54   ` Shivaprasad G Bhat
2025-03-21 14:06     ` Alex Williamson
2025-03-25  7:13 ` Christophe Leroy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).