lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <174231895238.2295.12586708771396482526.stgit@linux.ibm.com>
Date: Tue, 18 Mar 2025 17:29:21 +0000
From: Shivaprasad G Bhat <sbhat@...ux.ibm.com>
To: alex.williamson@...hat.com, jgg@...pe.ca, kevin.tian@...el.com
Cc: linux-kernel@...r.kernel.org, kvm@...r.kernel.org, yi.l.liu@...el.com,
        Yunxiang.Li@....com, pstanner@...hat.com, maddy@...ux.ibm.com,
        linuxppc-dev@...ts.ozlabs.org, sbhat@...ux.ibm.com
Subject: [PATCH] vfio: pci: Advertise INTx only if LINE is connected

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@...ux.ibm.com>
Suggested-By: Alex Williamson <alex.williamson@...hat.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) {



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ