* [PATCH kernel] vfio-pci: Mask INTx if a device is not capabable of enabling it
@ 2017-12-07 1:56 Alexey Kardashevskiy
2017-12-20 19:02 ` Alex Williamson
0 siblings, 1 reply; 2+ messages in thread
From: Alexey Kardashevskiy @ 2017-12-07 1:56 UTC (permalink / raw)
To: kvm; +Cc: Alexey Kardashevskiy, Alex Williamson
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 <aik@ozlabs.ru>
---
drivers/vfio/pci/vfio_pci.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c
index 9ed1ecf..505f7a4 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;
}
--
2.11.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH kernel] vfio-pci: Mask INTx if a device is not capabable of enabling it
2017-12-07 1:56 [PATCH kernel] vfio-pci: Mask INTx if a device is not capabable of enabling it Alexey Kardashevskiy
@ 2017-12-20 19:02 ` Alex Williamson
0 siblings, 0 replies; 2+ messages in thread
From: Alex Williamson @ 2017-12-20 19:02 UTC (permalink / raw)
To: Alexey Kardashevskiy; +Cc: kvm
On Thu, 7 Dec 2017 12:56:54 +1100
Alexey Kardashevskiy <aik@ozlabs.ru> wrote:
> 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 <aik@ozlabs.ru>
> ---
> drivers/vfio/pci/vfio_pci.c | 3 +++
> 1 file changed, 3 insertions(+)
Applied to v4.16/vfio. Thanks,
Alex
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-12-20 19:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-07 1:56 [PATCH kernel] vfio-pci: Mask INTx if a device is not capabable of enabling it Alexey Kardashevskiy
2017-12-20 19:02 ` Alex Williamson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox