aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Campbell <Ian.Campbell@eu.citrix.com>2009-02-06 19:55:58 -0500
committerIngo Molnar <mingo@elte.hu>2009-02-09 06:18:22 -0500
commit90af9514ac99f51e81682c7bec8f9fb88a17a95c (patch)
tree479e22492c5821e4386f1a258fa6ea92cde05ad4
parent3445a8fd7c6868bd9db0d1bea7d6e89004552122 (diff)
xen: explicitly initialise the cpu field of irq_info
I was seeing a very odd crash on 64 bit in bind_evtchn_to_cpu because cpu_from_irq(irq) was coming out as -1. I found this was coming direct from the mk_ipi_info call. It's not clear to me that this isn't a compiler bug (implicit initialisation to zero of unsigned shorts in a struct not handled correctly?). On the other hand is it true that all event channels start of bound to CPU 0? If not then -1 might be correct and the various other functions should cope with this. Signed-off-by: Ian Campbell <Ian.Campbell@eu.citrix.com> Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--drivers/xen/events.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index e53fd60fe4b8..30963af5dba0 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -115,26 +115,27 @@ static struct irq_info mk_unbound_info(void)
115 115
116static struct irq_info mk_evtchn_info(unsigned short evtchn) 116static struct irq_info mk_evtchn_info(unsigned short evtchn)
117{ 117{
118 return (struct irq_info) { .type = IRQT_EVTCHN, .evtchn = evtchn }; 118 return (struct irq_info) { .type = IRQT_EVTCHN, .evtchn = evtchn,
119 .cpu = 0 };
119} 120}
120 121
121static struct irq_info mk_ipi_info(unsigned short evtchn, enum ipi_vector ipi) 122static struct irq_info mk_ipi_info(unsigned short evtchn, enum ipi_vector ipi)
122{ 123{
123 return (struct irq_info) { .type = IRQT_IPI, .evtchn = evtchn, 124 return (struct irq_info) { .type = IRQT_IPI, .evtchn = evtchn,
124 .u.ipi = ipi }; 125 .cpu = 0, .u.ipi = ipi };
125} 126}
126 127
127static struct irq_info mk_virq_info(unsigned short evtchn, unsigned short virq) 128static struct irq_info mk_virq_info(unsigned short evtchn, unsigned short virq)
128{ 129{
129 return (struct irq_info) { .type = IRQT_VIRQ, .evtchn = evtchn, 130 return (struct irq_info) { .type = IRQT_VIRQ, .evtchn = evtchn,
130 .u.virq = virq }; 131 .cpu = 0, .u.virq = virq };
131} 132}
132 133
133static struct irq_info mk_pirq_info(unsigned short evtchn, 134static struct irq_info mk_pirq_info(unsigned short evtchn,
134 unsigned short gsi, unsigned short vector) 135 unsigned short gsi, unsigned short vector)
135{ 136{
136 return (struct irq_info) { .type = IRQT_PIRQ, .evtchn = evtchn, 137 return (struct irq_info) { .type = IRQT_PIRQ, .evtchn = evtchn,
137 .u.pirq = { .gsi = gsi, .vector = vector } }; 138 .cpu = 0, .u.pirq = { .gsi = gsi, .vector = vector } };
138} 139}
139 140
140/* 141/*
@@ -375,6 +376,7 @@ static int bind_ipi_to_irq(unsigned int ipi, unsigned int cpu)
375 spin_lock(&irq_mapping_update_lock); 376 spin_lock(&irq_mapping_update_lock);
376 377
377 irq = per_cpu(ipi_to_irq, cpu)[ipi]; 378 irq = per_cpu(ipi_to_irq, cpu)[ipi];
379
378 if (irq == -1) { 380 if (irq == -1) {
379 irq = find_unbound_irq(); 381 irq = find_unbound_irq();
380 if (irq < 0) 382 if (irq < 0)
@@ -391,7 +393,6 @@ static int bind_ipi_to_irq(unsigned int ipi, unsigned int cpu)
391 393
392 evtchn_to_irq[evtchn] = irq; 394 evtchn_to_irq[evtchn] = irq;
393 irq_info[irq] = mk_ipi_info(evtchn, ipi); 395 irq_info[irq] = mk_ipi_info(evtchn, ipi);
394
395 per_cpu(ipi_to_irq, cpu)[ipi] = irq; 396 per_cpu(ipi_to_irq, cpu)[ipi] = irq;
396 397
397 bind_evtchn_to_cpu(evtchn, cpu); 398 bind_evtchn_to_cpu(evtchn, cpu);