[dpdk-dev,1/2,kernel] uio: add irq control support to uio_pci_generic
Commit Message
The driver already supported INTX interrupts but had no in kernel
function to enable and disable them.
It is possible for userspace to do this by accessing PCI config
directly, but this racy and better handled by same mechanism
that already exists in kernel.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
Patch against latest 4.0 upstream kernel
@@ -53,6 +53,18 @@ static irqreturn_t irqhandler(int irq, s
return IRQ_HANDLED;
}
+static int irqcontrol(struct uio_info *info, s32 irq_on)
+{
+ struct uio_pci_generic_dev *gdev = to_uio_pci_generic_dev(info);
+ struct pci_dev *pdev = gdev->pdev;
+
+ pci_cfg_access_lock(pdev);
+ pci_intx(pdev, irq_on);
+ pci_cfg_access_unlock(pdev);
+
+ return 0;
+}
+
static int probe(struct pci_dev *pdev,
const struct pci_device_id *id)
{
@@ -89,6 +101,7 @@ static int probe(struct pci_dev *pdev,
gdev->info.irq = pdev->irq;
gdev->info.irq_flags = IRQF_SHARED;
gdev->info.handler = irqhandler;
+ gdev->info.irqcontrol = irqcontrol;
gdev->pdev = pdev;
err = uio_register_device(&pdev->dev, &gdev->info);