aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/pci/xen.c6
-rw-r--r--drivers/xen/events.c12
-rw-r--r--include/xen/events.h5
3 files changed, 9 insertions, 14 deletions
diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
index 47c4688dcd48..ca5fa09ca56d 100644
--- a/arch/x86/pci/xen.c
+++ b/arch/x86/pci/xen.c
@@ -101,7 +101,7 @@ static int xen_hvm_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
101 ((msg.address_lo >> MSI_ADDR_DEST_ID_SHIFT) & 0xff); 101 ((msg.address_lo >> MSI_ADDR_DEST_ID_SHIFT) & 0xff);
102 if (xen_irq_from_pirq(pirq) >= 0 && msg.data == XEN_PIRQ_MSI_DATA) { 102 if (xen_irq_from_pirq(pirq) >= 0 && msg.data == XEN_PIRQ_MSI_DATA) {
103 xen_allocate_pirq_msi((type == PCI_CAP_ID_MSIX) ? 103 xen_allocate_pirq_msi((type == PCI_CAP_ID_MSIX) ?
104 "msi-x" : "msi", &irq, &pirq, XEN_ALLOC_IRQ); 104 "msi-x" : "msi", &irq, &pirq, 0);
105 if (irq < 0) 105 if (irq < 0)
106 goto error; 106 goto error;
107 ret = set_irq_msi(irq, msidesc); 107 ret = set_irq_msi(irq, msidesc);
@@ -112,7 +112,7 @@ static int xen_hvm_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
112 return 0; 112 return 0;
113 } 113 }
114 xen_allocate_pirq_msi((type == PCI_CAP_ID_MSIX) ? 114 xen_allocate_pirq_msi((type == PCI_CAP_ID_MSIX) ?
115 "msi-x" : "msi", &irq, &pirq, (XEN_ALLOC_IRQ | XEN_ALLOC_PIRQ)); 115 "msi-x" : "msi", &irq, &pirq, 1);
116 if (irq < 0 || pirq < 0) 116 if (irq < 0 || pirq < 0)
117 goto error; 117 goto error;
118 printk(KERN_DEBUG "xen: msi --> irq=%d, pirq=%d\n", irq, pirq); 118 printk(KERN_DEBUG "xen: msi --> irq=%d, pirq=%d\n", irq, pirq);
@@ -160,7 +160,7 @@ static int xen_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
160 xen_allocate_pirq_msi( 160 xen_allocate_pirq_msi(
161 (type == PCI_CAP_ID_MSIX) ? 161 (type == PCI_CAP_ID_MSIX) ?
162 "pcifront-msi-x" : "pcifront-msi", 162 "pcifront-msi-x" : "pcifront-msi",
163 &irq, &v[i], XEN_ALLOC_IRQ); 163 &irq, &v[i], 0);
164 if (irq < 0) { 164 if (irq < 0) {
165 ret = -1; 165 ret = -1;
166 goto free; 166 goto free;
diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index bce303590075..36e9adcdebe9 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -664,17 +664,15 @@ static int find_unbound_pirq(int type)
664 return -1; 664 return -1;
665} 665}
666 666
667void xen_allocate_pirq_msi(char *name, int *irq, int *pirq, int alloc) 667void xen_allocate_pirq_msi(char *name, int *irq, int *pirq, int alloc_pirq)
668{ 668{
669 spin_lock(&irq_mapping_update_lock); 669 spin_lock(&irq_mapping_update_lock);
670 670
671 if (alloc & XEN_ALLOC_IRQ) { 671 *irq = xen_allocate_irq_dynamic();
672 *irq = xen_allocate_irq_dynamic(); 672 if (*irq == -1)
673 if (*irq == -1) 673 goto out;
674 goto out;
675 }
676 674
677 if (alloc & XEN_ALLOC_PIRQ) { 675 if (alloc_pirq) {
678 *pirq = find_unbound_pirq(MAP_PIRQ_TYPE_MSI); 676 *pirq = find_unbound_pirq(MAP_PIRQ_TYPE_MSI);
679 if (*pirq == -1) { 677 if (*pirq == -1) {
680 xen_free_irq(*irq); 678 xen_free_irq(*irq);
diff --git a/include/xen/events.h b/include/xen/events.h
index 00f53ddcc062..8d98861e4d92 100644
--- a/include/xen/events.h
+++ b/include/xen/events.h
@@ -75,10 +75,7 @@ int xen_allocate_pirq(unsigned gsi, int shareable, char *name);
75int xen_map_pirq_gsi(unsigned pirq, unsigned gsi, int shareable, char *name); 75int xen_map_pirq_gsi(unsigned pirq, unsigned gsi, int shareable, char *name);
76 76
77#ifdef CONFIG_PCI_MSI 77#ifdef CONFIG_PCI_MSI
78/* Allocate an irq and a pirq to be used with MSIs. */ 78void xen_allocate_pirq_msi(char *name, int *irq, int *pirq, int alloc_pirq);
79#define XEN_ALLOC_PIRQ (1 << 0)
80#define XEN_ALLOC_IRQ (1 << 1)
81void xen_allocate_pirq_msi(char *name, int *irq, int *pirq, int alloc_mask);
82int xen_create_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int type); 79int xen_create_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int type);
83#endif 80#endif
84 81