Michael S. Tsirkin wrote:
Resending with corrected addresses. Sorry about the churn. ----------- I got annoyed by the fact that we don't support shared interrupts with PCI in assigned devides, so here's a draft patch to add that support in kernel through uio. I intend to send this to lkml, but meanwhile I'd appreciate some early feedback/flames from people on the list. Thanks! -----------> This adds a generic uio driver that can bind to any PCI device. First user will be virtualization where a qemu userspace process needs to give guest OS access to the device. Interrupts are handled using the Interrupt Disable bit in the PCI command register and Interrupt Status bit in the PCI status register. All devices compliant to PCI 2.3 (circa 2002) and all compliant PCI Express devices should support these bits. Driver detects this support, and won't bind to devices which do not support the Interrupt Disable Bit in the command register. It's expected that MSI/MSI-X support will be added to this driver in the future, to interface with virtualization irqfd/eventfd infrastructure. Another area to examine, and of interest to virtualization, is iommu. Signed-off-by: Michael S. Tsirkin <mst@xxxxxxxxxx>
I didn't know this was possible... so we could also use this driver for vm-channel.
+ + err = pci_request_regions(pdev, "uio_pci_generic"); + if (err) { + dev_err(&pdev->dev, "%s: pci_request_regions failed: %d\n", + __func__, err); + goto err_verify; + } + + dev = kzalloc(sizeof(struct generic_dev), GFP_KERNEL); + if (!dev) { + err = -ENOMEM; + goto err_alloc; + } + + dev->info.name = "uio_pci_generic"; + dev->info.version = "0.01"; + dev->info.irq = pdev->irq; + dev->info.irq_flags = IRQF_SHARED; + dev->info.handler = irqhandler; + dev->info.irqcontrol = irqcontrol; + dev->pdev = pdev; + spin_lock_init(&dev->lock)
I know it's not strictly needed for PCI pass through, but it would be useful to register the IO regions via UIO. The userspace implementation would then use UIO strictly instead of poking the sysfs pci info directly. I think that ends up being cleaner.
Regards, ANthony Liguori -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html