aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/pci/xen.c12
-rw-r--r--drivers/xen/events.c19
-rw-r--r--include/xen/events.h2
3 files changed, 18 insertions, 15 deletions
diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
index ca5fa09ca56d..6fd695b06faa 100644
--- a/arch/x86/pci/xen.c
+++ b/arch/x86/pci/xen.c
@@ -100,8 +100,8 @@ static int xen_hvm_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
100 pirq = MSI_ADDR_EXT_DEST_ID(msg.address_hi) | 100 pirq = MSI_ADDR_EXT_DEST_ID(msg.address_hi) |
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 irq = xen_allocate_pirq_msi((type == PCI_CAP_ID_MSIX) ?
104 "msi-x" : "msi", &irq, &pirq, 0); 104 "msi-x" : "msi", &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);
@@ -111,8 +111,8 @@ static int xen_hvm_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
111 " pirq=%d\n", irq, pirq); 111 " pirq=%d\n", irq, pirq);
112 return 0; 112 return 0;
113 } 113 }
114 xen_allocate_pirq_msi((type == PCI_CAP_ID_MSIX) ? 114 irq = xen_allocate_pirq_msi((type == PCI_CAP_ID_MSIX) ?
115 "msi-x" : "msi", &irq, &pirq, 1); 115 "msi-x" : "msi", &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);
@@ -157,10 +157,10 @@ static int xen_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
157 goto error; 157 goto error;
158 i = 0; 158 i = 0;
159 list_for_each_entry(msidesc, &dev->msi_list, list) { 159 list_for_each_entry(msidesc, &dev->msi_list, list) {
160 xen_allocate_pirq_msi( 160 irq = 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], 0); 163 &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 36e9adcdebe9..ed3420df0937 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -664,31 +664,34 @@ 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_pirq) 667int xen_allocate_pirq_msi(char *name, int *pirq, int alloc_pirq)
668{ 668{
669 int irq;
670
669 spin_lock(&irq_mapping_update_lock); 671 spin_lock(&irq_mapping_update_lock);
670 672
671 *irq = xen_allocate_irq_dynamic(); 673 irq = xen_allocate_irq_dynamic();
672 if (*irq == -1) 674 if (irq == -1)
673 goto out; 675 goto out;
674 676
675 if (alloc_pirq) { 677 if (alloc_pirq) {
676 *pirq = find_unbound_pirq(MAP_PIRQ_TYPE_MSI); 678 *pirq = find_unbound_pirq(MAP_PIRQ_TYPE_MSI);
677 if (*pirq == -1) { 679 if (*pirq == -1) {
678 xen_free_irq(*irq); 680 xen_free_irq(irq);
679 *irq = -1; 681 irq = -1;
680 goto out; 682 goto out;
681 } 683 }
682 } 684 }
683 685
684 set_irq_chip_and_handler_name(*irq, &xen_pirq_chip, 686 set_irq_chip_and_handler_name(irq, &xen_pirq_chip,
685 handle_level_irq, name); 687 handle_level_irq, name);
686 688
687 irq_info[*irq] = mk_pirq_info(0, *pirq, 0, 0); 689 irq_info[irq] = mk_pirq_info(0, *pirq, 0, 0);
688 pirq_to_irq[*pirq] = *irq; 690 pirq_to_irq[*pirq] = irq;
689 691
690out: 692out:
691 spin_unlock(&irq_mapping_update_lock); 693 spin_unlock(&irq_mapping_update_lock);
694 return irq;
692} 695}
693 696
694int xen_create_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int type) 697int xen_create_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int type)
diff --git a/include/xen/events.h b/include/xen/events.h
index 8d98861e4d92..f70536af921c 100644
--- a/include/xen/events.h
+++ b/include/xen/events.h
@@ -75,7 +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
78void xen_allocate_pirq_msi(char *name, int *irq, int *pirq, int alloc_pirq); 78int xen_allocate_pirq_msi(char *name, int *pirq, int alloc_pirq);
79int 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);
80#endif 80#endif
81 81