From: Alexey Kardashevskiy Date: Thu, 7 Dec 2017 01:56:54 +0000 (+1100) Subject: vfio-pci: Mask INTx if a device is not capabable of enabling it X-Git-Tag: v4.16-rc1~102^2~3 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=2170dd04316e0754cbbfa4892a25aead39d225f7;p=linux.git vfio-pci: Mask INTx if a device is not capabable of enabling it At the moment VFIO rightfully assumes that INTx is supported if the interrupt pin is not set to zero in the device config space. However if that is not the case (the pin is not zero but pdev->irq is), vfio_intx_enable() fails. In order to prevent the userspace from trying to enable INTx when we know that it cannot work, let's mask the PCI_INTERRUPT_PIN register. Signed-off-by: Alexey Kardashevskiy Signed-off-by: Alex Williamson --- diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c index f041b1a6cf66..a98681dca1d3 100644 --- a/drivers/vfio/pci/vfio_pci.c +++ b/drivers/vfio/pci/vfio_pci.c @@ -207,6 +207,9 @@ static bool vfio_pci_nointx(struct pci_dev *pdev) } } + if (!pdev->irq) + return true; + return false; }