From: Shivaprasad G Bhat <sbhat@linux.ibm.com>
To: alex.williamson@redhat.com, jgg@ziepe.ca, kevin.tian@intel.com
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
yi.l.liu@intel.com, Yunxiang.Li@amd.com, pstanner@redhat.com,
maddy@linux.ibm.com, linuxppc-dev@lists.ozlabs.org,
sbhat@linux.ibm.com
Subject: [PATCH] vfio: pci: Advertise INTx only if LINE is connected
Date: Tue, 18 Mar 2025 17:29:21 +0000 [thread overview]
Message-ID: <174231895238.2295.12586708771396482526.stgit@linux.ibm.com> (raw)
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) {
next reply other threads:[~2025-03-18 17:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-18 17:29 Shivaprasad G Bhat [this message]
2025-03-18 17:58 ` [PATCH] vfio: pci: Advertise INTx only if LINE is connected Alex Williamson
2025-03-20 17:54 ` Shivaprasad G Bhat
2025-03-21 14:06 ` Alex Williamson
2025-03-25 7:13 ` Christophe Leroy
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=174231895238.2295.12586708771396482526.stgit@linux.ibm.com \
--to=sbhat@linux.ibm.com \
--cc=Yunxiang.Li@amd.com \
--cc=alex.williamson@redhat.com \
--cc=jgg@ziepe.ca \
--cc=kevin.tian@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=pstanner@redhat.com \
--cc=yi.l.liu@intel.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.