diff options
| author | Rusty Russell <rusty@rustcorp.com.au> | 2009-03-09 12:06:28 -0400 |
|---|---|---|
| committer | Rusty Russell <rusty@rustcorp.com.au> | 2009-03-08 19:36:29 -0400 |
| commit | 6db6a5f3ae2ca6b874b0fd97ae16fdc9b5cdd6cc (patch) | |
| tree | 567ab7d3593f6ab63fecfb8c9797fb4efda67ea7 | |
| parent | cbd88c8e6f5cdb8d4b9af01df825305200240382 (diff) | |
lguest: fix for CONFIG_SPARSE_IRQ=y
Impact: remove lots of lguest boot WARN_ON() when CONFIG_SPARSE_IRQ=y
We now need to call irq_to_desc_alloc_cpu() before
set_irq_chip_and_handler_name(), but we can't do that from init_IRQ (no
kmalloc available).
So do it as we use interrupts instead. Also means we only alloc for
irqs we use, which was the intent of CONFIG_SPARSE_IRQ anyway.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: Ingo Molnar <mingo@redhat.com>
| -rw-r--r-- | arch/x86/lguest/boot.c | 16 | ||||
| -rw-r--r-- | drivers/lguest/lguest_device.c | 6 |
2 files changed, 15 insertions, 7 deletions
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c index ba5c05e97f10..960a8d9c049c 100644 --- a/arch/x86/lguest/boot.c +++ b/arch/x86/lguest/boot.c | |||
| @@ -594,19 +594,21 @@ static void __init lguest_init_IRQ(void) | |||
| 594 | /* Some systems map "vectors" to interrupts weirdly. Lguest has | 594 | /* Some systems map "vectors" to interrupts weirdly. Lguest has |
| 595 | * a straightforward 1 to 1 mapping, so force that here. */ | 595 | * a straightforward 1 to 1 mapping, so force that here. */ |
| 596 | __get_cpu_var(vector_irq)[vector] = i; | 596 | __get_cpu_var(vector_irq)[vector] = i; |
| 597 | if (vector != SYSCALL_VECTOR) { | 597 | if (vector != SYSCALL_VECTOR) |
| 598 | set_intr_gate(vector, | 598 | set_intr_gate(vector, interrupt[i]); |
| 599 | interrupt[vector-FIRST_EXTERNAL_VECTOR]); | ||
| 600 | set_irq_chip_and_handler_name(i, &lguest_irq_controller, | ||
| 601 | handle_level_irq, | ||
| 602 | "level"); | ||
| 603 | } | ||
| 604 | } | 599 | } |
| 605 | /* This call is required to set up for 4k stacks, where we have | 600 | /* This call is required to set up for 4k stacks, where we have |
| 606 | * separate stacks for hard and soft interrupts. */ | 601 | * separate stacks for hard and soft interrupts. */ |
| 607 | irq_ctx_init(smp_processor_id()); | 602 | irq_ctx_init(smp_processor_id()); |
| 608 | } | 603 | } |
| 609 | 604 | ||
| 605 | void lguest_setup_irq(unsigned int irq) | ||
| 606 | { | ||
| 607 | irq_to_desc_alloc_cpu(irq, 0); | ||
| 608 | set_irq_chip_and_handler_name(irq, &lguest_irq_controller, | ||
| 609 | handle_level_irq, "level"); | ||
| 610 | } | ||
| 611 | |||
| 610 | /* | 612 | /* |
| 611 | * Time. | 613 | * Time. |
| 612 | * | 614 | * |
diff --git a/drivers/lguest/lguest_device.c b/drivers/lguest/lguest_device.c index b4d44e571d76..8132533d71f9 100644 --- a/drivers/lguest/lguest_device.c +++ b/drivers/lguest/lguest_device.c | |||
| @@ -212,6 +212,9 @@ static void lg_notify(struct virtqueue *vq) | |||
| 212 | hcall(LHCALL_NOTIFY, lvq->config.pfn << PAGE_SHIFT, 0, 0); | 212 | hcall(LHCALL_NOTIFY, lvq->config.pfn << PAGE_SHIFT, 0, 0); |
| 213 | } | 213 | } |
| 214 | 214 | ||
| 215 | /* An extern declaration inside a C file is bad form. Don't do it. */ | ||
| 216 | extern void lguest_setup_irq(unsigned int irq); | ||
| 217 | |||
| 215 | /* This routine finds the first virtqueue described in the configuration of | 218 | /* This routine finds the first virtqueue described in the configuration of |
| 216 | * this device and sets it up. | 219 | * this device and sets it up. |
| 217 | * | 220 | * |
| @@ -266,6 +269,9 @@ static struct virtqueue *lg_find_vq(struct virtio_device *vdev, | |||
| 266 | goto unmap; | 269 | goto unmap; |
| 267 | } | 270 | } |
| 268 | 271 | ||
| 272 | /* Make sure the interrupt is allocated. */ | ||
| 273 | lguest_setup_irq(lvq->config.irq); | ||
| 274 | |||
| 269 | /* Tell the interrupt for this virtqueue to go to the virtio_ring | 275 | /* Tell the interrupt for this virtqueue to go to the virtio_ring |
| 270 | * interrupt handler. */ | 276 | * interrupt handler. */ |
| 271 | /* FIXME: We used to have a flag for the Host to tell us we could use | 277 | /* FIXME: We used to have a flag for the Host to tell us we could use |
