struct xen_pci_frontend_ops *xen_pci_frontend;
EXPORT_SYMBOL_GPL(xen_pci_frontend);
- if (irq < 0)
+ +static int xen_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
+ +{
+ + int irq, ret, i;
+ + struct msi_desc *msidesc;
+ + int *v;
+ +
+ + v = kzalloc(sizeof(int) * max(1, nvec), GFP_KERNEL);
+ + if (!v)
+ + return -ENOMEM;
+ +
+ + if (type == PCI_CAP_ID_MSIX)
+ + ret = xen_pci_frontend_enable_msix(dev, v, nvec);
+ + else
+ + ret = xen_pci_frontend_enable_msi(dev, v);
+ + if (ret)
+ + goto error;
+ + i = 0;
+ + list_for_each_entry(msidesc, &dev->msi_list, list) {
+ + irq = xen_bind_pirq_msi_to_irq(dev, msidesc, v[i], 0,
+ + (type == PCI_CAP_ID_MSIX) ?
+ + "pcifront-msi-x" :
+ + "pcifront-msi",
+ + DOMID_SELF);
+++ if (irq < 0) {
+++ ret = irq;
+ + goto free;
+++ }
+ + i++;
+ + }
+ + kfree(v);
+ + return 0;
+ +
+ +error:
+ + dev_err(&dev->dev, "Xen PCI frontend has not registered MSI/MSI-X support!\n");
+ +free:
+ + kfree(v);
+ + return ret;
+ +}
+ +
#define XEN_PIRQ_MSI_DATA (MSI_DATA_TRIGGER_EDGE | \
MSI_DATA_LEVEL_ASSERT | (3 << 8) | MSI_DATA_VECTOR(0))
error:
dev_err(&dev->dev,
"Xen PCI frontend has not registered MSI/MSI-X support!\n");
--- return -ENODEV;
- -}
- -
- -/*
- - * For MSI interrupts we have to use drivers/xen/event.s functions to
- - * allocate an irq_desc and setup the right */
- -
- -
- -static int xen_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
- -{
- - int irq, ret, i;
- - struct msi_desc *msidesc;
- - int *v;
- -
- - v = kzalloc(sizeof(int) * max(1, nvec), GFP_KERNEL);
- - if (!v)
- - return -ENOMEM;
- -
- - if (type == PCI_CAP_ID_MSIX)
- - ret = xen_pci_frontend_enable_msix(dev, v, nvec);
- - else
- - ret = xen_pci_frontend_enable_msi(dev, v);
- - if (ret)
- - goto error;
- - i = 0;
- - list_for_each_entry(msidesc, &dev->msi_list, list) {
- - irq = xen_bind_pirq_msi_to_irq(dev, msidesc, v[i], 0,
- - (type == PCI_CAP_ID_MSIX) ?
- - "pcifront-msi-x" :
- - "pcifront-msi",
- - DOMID_SELF);
- - if (irq < 0)
- - goto free;
- - i++;
- - }
- - kfree(v);
- - return 0;
- -
- -error:
- - dev_err(&dev->dev, "Xen PCI frontend has not registered MSI/MSI-X support!\n");
- -free:
- - kfree(v);
- - return ret;
- -}
- -
- -static void xen_teardown_msi_irqs(struct pci_dev *dev)
- -{
- - struct msi_desc *msidesc;
- -
- - msidesc = list_entry(dev->msi_list.next, struct msi_desc, list);
- - if (msidesc->msi_attrib.is_msix)
- - xen_pci_frontend_disable_msix(dev);
- - else
- - xen_pci_frontend_disable_msi(dev);
- -
- - /* Free the IRQ's and the msidesc using the generic code. */
- - default_teardown_msi_irqs(dev);
- -}
- -
- -static void xen_teardown_msi_irq(unsigned int irq)
- -{
- - xen_destroy_irq(irq);
+++ return irq;
}
#ifdef CONFIG_XEN_DOM0