Re: [Patch v4 21/23] x86/PCI: Refine the way to release PCI IRQ resources

From: Alex Williamson
Date: Wed Mar 04 2015 - 18:49:15 EST


On Wed, 2015-03-04 at 09:06 -0700, Alex Williamson wrote:
> Hi,
>
> I'm getting a regression from this patch when using VFIO for device
> assignment to a QEMU VM. I have a device initially bound to the nouveau
> driver, which is unbound from that driver and bound to vfio-pci for use
> by userspace. vfio-pci calls pci_enable_device, but when userspace
> attempts to setup the legacy INTx interrupt, pci_dev->irq is zero and
> vfio-pci errors with -ENODEV.
>
> Where is pci_dev->irq supposed to be getting re-initialized in this
> case? Am I missing an important initialization step in vfio-pci? I
> certainly don't think I should be calling request_irq(pci_dev->irq, ...
> when pci_dev->irq is zero. Thanks,

It looks like the imbalance is in pci_dev->enable_cnt. Any call to
pci_disable_device() will clear pci_dev->irq, but pci_enable_device()
does effectively nothing unless it's called with enable_cnt == zero. So
I'm at the mercy of the previous driver behaving relatively sanely in
order to re-enable legacy interrupts for a device :-\ Maybe the unbound
notifier needs to do some sanitizing of the device? Thanks,

Alex

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/