diff options
author | Ian Campbell <ian.campbell@citrix.com> | 2011-03-10 11:08:10 -0500 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2011-03-10 14:48:40 -0500 |
commit | 3d4cfa3736f2f080d3bde4f4329b7b6a7544e093 (patch) | |
tree | d4d92641e96aca29cc258113d2e864088fecbf6a /drivers/xen | |
parent | 9158c3588a0693ef11208f5961f0d6b0241694d8 (diff) |
xen: events: push setup of irq<->{evtchn,ipi,virq,pirq} maps into irq_info init functions
Encapsulate setup of XXX_to_irq array in the relevant
xen_irq_info_*_init function.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'drivers/xen')
-rw-r--r-- | drivers/xen/events.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/drivers/xen/events.c b/drivers/xen/events.c index 72725faa2e85..cf372d41077d 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c | |||
@@ -126,6 +126,7 @@ static struct irq_info *info_for_irq(unsigned irq) | |||
126 | 126 | ||
127 | /* Constructors for packed IRQ information. */ | 127 | /* Constructors for packed IRQ information. */ |
128 | static void xen_irq_info_common_init(struct irq_info *info, | 128 | static void xen_irq_info_common_init(struct irq_info *info, |
129 | unsigned irq, | ||
129 | enum xen_irq_type type, | 130 | enum xen_irq_type type, |
130 | unsigned short evtchn, | 131 | unsigned short evtchn, |
131 | unsigned short cpu) | 132 | unsigned short cpu) |
@@ -136,6 +137,8 @@ static void xen_irq_info_common_init(struct irq_info *info, | |||
136 | info->type = type; | 137 | info->type = type; |
137 | info->evtchn = evtchn; | 138 | info->evtchn = evtchn; |
138 | info->cpu = cpu; | 139 | info->cpu = cpu; |
140 | |||
141 | evtchn_to_irq[evtchn] = irq; | ||
139 | } | 142 | } |
140 | 143 | ||
141 | static void xen_irq_info_evtchn_init(unsigned irq, | 144 | static void xen_irq_info_evtchn_init(unsigned irq, |
@@ -143,29 +146,35 @@ static void xen_irq_info_evtchn_init(unsigned irq, | |||
143 | { | 146 | { |
144 | struct irq_info *info = info_for_irq(irq); | 147 | struct irq_info *info = info_for_irq(irq); |
145 | 148 | ||
146 | xen_irq_info_common_init(info, IRQT_EVTCHN, evtchn, 0); | 149 | xen_irq_info_common_init(info, irq, IRQT_EVTCHN, evtchn, 0); |
147 | } | 150 | } |
148 | 151 | ||
149 | static void xen_irq_info_ipi_init(unsigned irq, | 152 | static void xen_irq_info_ipi_init(unsigned cpu, |
153 | unsigned irq, | ||
150 | unsigned short evtchn, | 154 | unsigned short evtchn, |
151 | enum ipi_vector ipi) | 155 | enum ipi_vector ipi) |
152 | { | 156 | { |
153 | struct irq_info *info = info_for_irq(irq); | 157 | struct irq_info *info = info_for_irq(irq); |
154 | 158 | ||
155 | xen_irq_info_common_init(info, IRQT_IPI, evtchn, 0); | 159 | xen_irq_info_common_init(info, irq, IRQT_IPI, evtchn, 0); |
156 | 160 | ||
157 | info->u.ipi = ipi; | 161 | info->u.ipi = ipi; |
162 | |||
163 | per_cpu(ipi_to_irq, cpu)[ipi] = irq; | ||
158 | } | 164 | } |
159 | 165 | ||
160 | static void xen_irq_info_virq_init(unsigned irq, | 166 | static void xen_irq_info_virq_init(unsigned cpu, |
167 | unsigned irq, | ||
161 | unsigned short evtchn, | 168 | unsigned short evtchn, |
162 | unsigned short virq) | 169 | unsigned short virq) |
163 | { | 170 | { |
164 | struct irq_info *info = info_for_irq(irq); | 171 | struct irq_info *info = info_for_irq(irq); |
165 | 172 | ||
166 | xen_irq_info_common_init(info, IRQT_VIRQ, evtchn, 0); | 173 | xen_irq_info_common_init(info, irq, IRQT_VIRQ, evtchn, 0); |
167 | 174 | ||
168 | info->u.virq = virq; | 175 | info->u.virq = virq; |
176 | |||
177 | per_cpu(virq_to_irq, cpu)[virq] = irq; | ||
169 | } | 178 | } |
170 | 179 | ||
171 | static void xen_irq_info_pirq_init(unsigned irq, | 180 | static void xen_irq_info_pirq_init(unsigned irq, |
@@ -177,12 +186,14 @@ static void xen_irq_info_pirq_init(unsigned irq, | |||
177 | { | 186 | { |
178 | struct irq_info *info = info_for_irq(irq); | 187 | struct irq_info *info = info_for_irq(irq); |
179 | 188 | ||
180 | xen_irq_info_common_init(info, IRQT_PIRQ, evtchn, 0); | 189 | xen_irq_info_common_init(info, irq, IRQT_PIRQ, evtchn, 0); |
181 | 190 | ||
182 | info->u.pirq.pirq = pirq; | 191 | info->u.pirq.pirq = pirq; |
183 | info->u.pirq.gsi = gsi; | 192 | info->u.pirq.gsi = gsi; |
184 | info->u.pirq.vector = vector; | 193 | info->u.pirq.vector = vector; |
185 | info->u.pirq.flags = flags; | 194 | info->u.pirq.flags = flags; |
195 | |||
196 | pirq_to_irq[pirq] = irq; | ||
186 | } | 197 | } |
187 | 198 | ||
188 | /* | 199 | /* |
@@ -644,7 +655,6 @@ int xen_bind_pirq_gsi_to_irq(unsigned gsi, | |||
644 | 655 | ||
645 | xen_irq_info_pirq_init(irq, 0, pirq, gsi, irq_op.vector, | 656 | xen_irq_info_pirq_init(irq, 0, pirq, gsi, irq_op.vector, |
646 | shareable ? PIRQ_SHAREABLE : 0); | 657 | shareable ? PIRQ_SHAREABLE : 0); |
647 | pirq_to_irq[pirq] = irq; | ||
648 | 658 | ||
649 | out: | 659 | out: |
650 | spin_unlock(&irq_mapping_update_lock); | 660 | spin_unlock(&irq_mapping_update_lock); |
@@ -682,7 +692,6 @@ int xen_bind_pirq_msi_to_irq(struct pci_dev *dev, struct msi_desc *msidesc, | |||
682 | handle_level_irq, name); | 692 | handle_level_irq, name); |
683 | 693 | ||
684 | xen_irq_info_pirq_init(irq, 0, pirq, 0, vector, 0); | 694 | xen_irq_info_pirq_init(irq, 0, pirq, 0, vector, 0); |
685 | pirq_to_irq[pirq] = irq; | ||
686 | ret = set_irq_msi(irq, msidesc); | 695 | ret = set_irq_msi(irq, msidesc); |
687 | if (ret < 0) | 696 | if (ret < 0) |
688 | goto error_irq; | 697 | goto error_irq; |
@@ -746,7 +755,6 @@ int bind_evtchn_to_irq(unsigned int evtchn) | |||
746 | set_irq_chip_and_handler_name(irq, &xen_dynamic_chip, | 755 | set_irq_chip_and_handler_name(irq, &xen_dynamic_chip, |
747 | handle_fasteoi_irq, "event"); | 756 | handle_fasteoi_irq, "event"); |
748 | 757 | ||
749 | evtchn_to_irq[evtchn] = irq; | ||
750 | xen_irq_info_evtchn_init(irq, evtchn); | 758 | xen_irq_info_evtchn_init(irq, evtchn); |
751 | } | 759 | } |
752 | 760 | ||
@@ -779,9 +787,7 @@ static int bind_ipi_to_irq(unsigned int ipi, unsigned int cpu) | |||
779 | BUG(); | 787 | BUG(); |
780 | evtchn = bind_ipi.port; | 788 | evtchn = bind_ipi.port; |
781 | 789 | ||
782 | evtchn_to_irq[evtchn] = irq; | 790 | xen_irq_info_ipi_init(cpu, irq, evtchn, ipi); |
783 | xen_irq_info_ipi_init(irq, evtchn, ipi); | ||
784 | per_cpu(ipi_to_irq, cpu)[ipi] = irq; | ||
785 | 791 | ||
786 | bind_evtchn_to_cpu(evtchn, cpu); | 792 | bind_evtchn_to_cpu(evtchn, cpu); |
787 | } | 793 | } |
@@ -814,10 +820,7 @@ int bind_virq_to_irq(unsigned int virq, unsigned int cpu) | |||
814 | BUG(); | 820 | BUG(); |
815 | evtchn = bind_virq.port; | 821 | evtchn = bind_virq.port; |
816 | 822 | ||
817 | evtchn_to_irq[evtchn] = irq; | 823 | xen_irq_info_virq_init(cpu, irq, evtchn, virq); |
818 | xen_irq_info_virq_init(irq, evtchn, virq); | ||
819 | |||
820 | per_cpu(virq_to_irq, cpu)[virq] = irq; | ||
821 | 824 | ||
822 | bind_evtchn_to_cpu(evtchn, cpu); | 825 | bind_evtchn_to_cpu(evtchn, cpu); |
823 | } | 826 | } |
@@ -1120,7 +1123,6 @@ void rebind_evtchn_irq(int evtchn, int irq) | |||
1120 | so there should be a proper type */ | 1123 | so there should be a proper type */ |
1121 | BUG_ON(info->type == IRQT_UNBOUND); | 1124 | BUG_ON(info->type == IRQT_UNBOUND); |
1122 | 1125 | ||
1123 | evtchn_to_irq[evtchn] = irq; | ||
1124 | xen_irq_info_evtchn_init(irq, evtchn); | 1126 | xen_irq_info_evtchn_init(irq, evtchn); |
1125 | 1127 | ||
1126 | spin_unlock(&irq_mapping_update_lock); | 1128 | spin_unlock(&irq_mapping_update_lock); |
@@ -1288,8 +1290,7 @@ static void restore_cpu_virqs(unsigned int cpu) | |||
1288 | evtchn = bind_virq.port; | 1290 | evtchn = bind_virq.port; |
1289 | 1291 | ||
1290 | /* Record the new mapping. */ | 1292 | /* Record the new mapping. */ |
1291 | evtchn_to_irq[evtchn] = irq; | 1293 | xen_irq_info_virq_init(cpu, irq, evtchn, virq); |
1292 | xen_irq_info_virq_init(irq, evtchn, virq); | ||
1293 | bind_evtchn_to_cpu(evtchn, cpu); | 1294 | bind_evtchn_to_cpu(evtchn, cpu); |
1294 | } | 1295 | } |
1295 | } | 1296 | } |
@@ -1313,8 +1314,7 @@ static void restore_cpu_ipis(unsigned int cpu) | |||
1313 | evtchn = bind_ipi.port; | 1314 | evtchn = bind_ipi.port; |
1314 | 1315 | ||
1315 | /* Record the new mapping. */ | 1316 | /* Record the new mapping. */ |
1316 | evtchn_to_irq[evtchn] = irq; | 1317 | xen_irq_info_ipi_init(cpu, irq, evtchn, ipi); |
1317 | xen_irq_info_ipi_init(irq, evtchn, ipi); | ||
1318 | bind_evtchn_to_cpu(evtchn, cpu); | 1318 | bind_evtchn_to_cpu(evtchn, cpu); |
1319 | } | 1319 | } |
1320 | } | 1320 | } |