diff options
author | Stefano Stabellini <stefano.stabellini@eu.citrix.com> | 2010-10-22 16:24:06 -0400 |
---|---|---|
committer | Stefano Stabellini <stefano.stabellini@eu.citrix.com> | 2010-10-22 16:24:06 -0400 |
commit | 67ba37293e938208795d6a3562201bdb0cf43393 (patch) | |
tree | 3522e949ff19f3809583bfb3fa3973ddf264689d /drivers/xen | |
parent | cd07202cc8262e1669edff0d97715f3dd9260917 (diff) | |
parent | 5bba6c56dc99ff88f79a79572e29ecf445710878 (diff) |
Merge commit 'konrad/stable/xen-pcifront-0.8.2' into 2.6.36-rc8-initial-domain-v6
Diffstat (limited to 'drivers/xen')
-rw-r--r-- | drivers/xen/Kconfig | 3 | ||||
-rw-r--r-- | drivers/xen/Makefile | 1 | ||||
-rw-r--r-- | drivers/xen/biomerge.c | 13 | ||||
-rw-r--r-- | drivers/xen/events.c | 365 | ||||
-rw-r--r-- | drivers/xen/xenbus/xenbus_client.c | 2 |
5 files changed, 356 insertions, 28 deletions
diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig index 60d71e9abe9f..6e6180ccd726 100644 --- a/drivers/xen/Kconfig +++ b/drivers/xen/Kconfig | |||
@@ -74,6 +74,7 @@ config XEN_PLATFORM_PCI | |||
74 | 74 | ||
75 | config SWIOTLB_XEN | 75 | config SWIOTLB_XEN |
76 | def_bool y | 76 | def_bool y |
77 | depends on SWIOTLB | 77 | depends on PCI |
78 | select SWIOTLB | ||
78 | 79 | ||
79 | endmenu | 80 | endmenu |
diff --git a/drivers/xen/Makefile b/drivers/xen/Makefile index fcaf838f54be..b97864551718 100644 --- a/drivers/xen/Makefile +++ b/drivers/xen/Makefile | |||
@@ -4,6 +4,7 @@ obj-y += xenbus/ | |||
4 | nostackp := $(call cc-option, -fno-stack-protector) | 4 | nostackp := $(call cc-option, -fno-stack-protector) |
5 | CFLAGS_features.o := $(nostackp) | 5 | CFLAGS_features.o := $(nostackp) |
6 | 6 | ||
7 | obj-$(CONFIG_BLOCK) += biomerge.o | ||
7 | obj-$(CONFIG_HOTPLUG_CPU) += cpu_hotplug.o | 8 | obj-$(CONFIG_HOTPLUG_CPU) += cpu_hotplug.o |
8 | obj-$(CONFIG_XEN_XENCOMM) += xencomm.o | 9 | obj-$(CONFIG_XEN_XENCOMM) += xencomm.o |
9 | obj-$(CONFIG_XEN_BALLOON) += balloon.o | 10 | obj-$(CONFIG_XEN_BALLOON) += balloon.o |
diff --git a/drivers/xen/biomerge.c b/drivers/xen/biomerge.c new file mode 100644 index 000000000000..ba6eda4b5143 --- /dev/null +++ b/drivers/xen/biomerge.c | |||
@@ -0,0 +1,13 @@ | |||
1 | #include <linux/bio.h> | ||
2 | #include <linux/io.h> | ||
3 | #include <xen/page.h> | ||
4 | |||
5 | bool xen_biovec_phys_mergeable(const struct bio_vec *vec1, | ||
6 | const struct bio_vec *vec2) | ||
7 | { | ||
8 | unsigned long mfn1 = pfn_to_mfn(page_to_pfn(vec1->bv_page)); | ||
9 | unsigned long mfn2 = pfn_to_mfn(page_to_pfn(vec2->bv_page)); | ||
10 | |||
11 | return __BIOVEC_PHYS_MERGEABLE(vec1, vec2) && | ||
12 | ((mfn1 == mfn2) || ((mfn1+1) == mfn2)); | ||
13 | } | ||
diff --git a/drivers/xen/events.c b/drivers/xen/events.c index 13365ba35218..3df53de6b43a 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c | |||
@@ -16,7 +16,7 @@ | |||
16 | * (typically dom0). | 16 | * (typically dom0). |
17 | * 2. VIRQs, typically used for timers. These are per-cpu events. | 17 | * 2. VIRQs, typically used for timers. These are per-cpu events. |
18 | * 3. IPIs. | 18 | * 3. IPIs. |
19 | * 4. Hardware interrupts. Not supported at present. | 19 | * 4. PIRQs - Hardware interrupts. |
20 | * | 20 | * |
21 | * Jeremy Fitzhardinge <jeremy@xensource.com>, XenSource Inc, 2007 | 21 | * Jeremy Fitzhardinge <jeremy@xensource.com>, XenSource Inc, 2007 |
22 | */ | 22 | */ |
@@ -28,11 +28,13 @@ | |||
28 | #include <linux/string.h> | 28 | #include <linux/string.h> |
29 | #include <linux/bootmem.h> | 29 | #include <linux/bootmem.h> |
30 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
31 | #include <linux/irqnr.h> | ||
31 | 32 | ||
32 | #include <asm/desc.h> | 33 | #include <asm/desc.h> |
33 | #include <asm/ptrace.h> | 34 | #include <asm/ptrace.h> |
34 | #include <asm/irq.h> | 35 | #include <asm/irq.h> |
35 | #include <asm/idle.h> | 36 | #include <asm/idle.h> |
37 | #include <asm/io_apic.h> | ||
36 | #include <asm/sync_bitops.h> | 38 | #include <asm/sync_bitops.h> |
37 | #include <asm/xen/hypercall.h> | 39 | #include <asm/xen/hypercall.h> |
38 | #include <asm/xen/hypervisor.h> | 40 | #include <asm/xen/hypervisor.h> |
@@ -89,20 +91,26 @@ struct irq_info | |||
89 | enum ipi_vector ipi; | 91 | enum ipi_vector ipi; |
90 | struct { | 92 | struct { |
91 | unsigned short gsi; | 93 | unsigned short gsi; |
92 | unsigned short vector; | 94 | unsigned char vector; |
95 | unsigned char flags; | ||
93 | } pirq; | 96 | } pirq; |
94 | } u; | 97 | } u; |
95 | }; | 98 | }; |
99 | #define PIRQ_NEEDS_EOI (1 << 0) | ||
100 | #define PIRQ_SHAREABLE (1 << 1) | ||
96 | 101 | ||
97 | static struct irq_info irq_info[NR_IRQS]; | 102 | static struct irq_info *irq_info; |
98 | 103 | ||
99 | static int evtchn_to_irq[NR_EVENT_CHANNELS] = { | 104 | static int *evtchn_to_irq; |
100 | [0 ... NR_EVENT_CHANNELS-1] = -1 | ||
101 | }; | ||
102 | struct cpu_evtchn_s { | 105 | struct cpu_evtchn_s { |
103 | unsigned long bits[NR_EVENT_CHANNELS/BITS_PER_LONG]; | 106 | unsigned long bits[NR_EVENT_CHANNELS/BITS_PER_LONG]; |
104 | }; | 107 | }; |
105 | static struct cpu_evtchn_s *cpu_evtchn_mask_p; | 108 | |
109 | static __initdata struct cpu_evtchn_s init_evtchn_mask = { | ||
110 | .bits[0 ... (NR_EVENT_CHANNELS/BITS_PER_LONG)-1] = ~0ul, | ||
111 | }; | ||
112 | static struct cpu_evtchn_s *cpu_evtchn_mask_p = &init_evtchn_mask; | ||
113 | |||
106 | static inline unsigned long *cpu_evtchn_mask(int cpu) | 114 | static inline unsigned long *cpu_evtchn_mask(int cpu) |
107 | { | 115 | { |
108 | return cpu_evtchn_mask_p[cpu].bits; | 116 | return cpu_evtchn_mask_p[cpu].bits; |
@@ -113,6 +121,7 @@ static inline unsigned long *cpu_evtchn_mask(int cpu) | |||
113 | 121 | ||
114 | static struct irq_chip xen_dynamic_chip; | 122 | static struct irq_chip xen_dynamic_chip; |
115 | static struct irq_chip xen_percpu_chip; | 123 | static struct irq_chip xen_percpu_chip; |
124 | static struct irq_chip xen_pirq_chip; | ||
116 | 125 | ||
117 | /* Constructor for packed IRQ information. */ | 126 | /* Constructor for packed IRQ information. */ |
118 | static struct irq_info mk_unbound_info(void) | 127 | static struct irq_info mk_unbound_info(void) |
@@ -225,6 +234,15 @@ static unsigned int cpu_from_evtchn(unsigned int evtchn) | |||
225 | return ret; | 234 | return ret; |
226 | } | 235 | } |
227 | 236 | ||
237 | static bool pirq_needs_eoi(unsigned irq) | ||
238 | { | ||
239 | struct irq_info *info = info_for_irq(irq); | ||
240 | |||
241 | BUG_ON(info->type != IRQT_PIRQ); | ||
242 | |||
243 | return info->u.pirq.flags & PIRQ_NEEDS_EOI; | ||
244 | } | ||
245 | |||
228 | static inline unsigned long active_evtchns(unsigned int cpu, | 246 | static inline unsigned long active_evtchns(unsigned int cpu, |
229 | struct shared_info *sh, | 247 | struct shared_info *sh, |
230 | unsigned int idx) | 248 | unsigned int idx) |
@@ -336,36 +354,297 @@ static void unmask_evtchn(int port) | |||
336 | put_cpu(); | 354 | put_cpu(); |
337 | } | 355 | } |
338 | 356 | ||
357 | static int get_nr_hw_irqs(void) | ||
358 | { | ||
359 | int ret = 1; | ||
360 | |||
361 | #ifdef CONFIG_X86_IO_APIC | ||
362 | ret = get_nr_irqs_gsi(); | ||
363 | #endif | ||
364 | |||
365 | return ret; | ||
366 | } | ||
367 | |||
339 | static int find_unbound_irq(void) | 368 | static int find_unbound_irq(void) |
340 | { | 369 | { |
341 | int irq; | 370 | struct irq_data *data; |
342 | struct irq_desc *desc; | 371 | int irq, res; |
372 | int start = get_nr_hw_irqs(); | ||
343 | 373 | ||
344 | for (irq = 0; irq < nr_irqs; irq++) { | 374 | if (start == nr_irqs) |
345 | desc = irq_to_desc(irq); | 375 | goto no_irqs; |
376 | |||
377 | /* nr_irqs is a magic value. Must not use it.*/ | ||
378 | for (irq = nr_irqs-1; irq > start; irq--) { | ||
379 | data = irq_get_irq_data(irq); | ||
346 | /* only 0->15 have init'd desc; handle irq > 16 */ | 380 | /* only 0->15 have init'd desc; handle irq > 16 */ |
347 | if (desc == NULL) | 381 | if (!data) |
348 | break; | 382 | break; |
349 | if (desc->chip == &no_irq_chip) | 383 | if (data->chip == &no_irq_chip) |
350 | break; | 384 | break; |
351 | if (desc->chip != &xen_dynamic_chip) | 385 | if (data->chip != &xen_dynamic_chip) |
352 | continue; | 386 | continue; |
353 | if (irq_info[irq].type == IRQT_UNBOUND) | 387 | if (irq_info[irq].type == IRQT_UNBOUND) |
354 | break; | 388 | return irq; |
355 | } | 389 | } |
356 | 390 | ||
357 | if (irq == nr_irqs) | 391 | if (irq == start) |
358 | panic("No available IRQ to bind to: increase nr_irqs!\n"); | 392 | goto no_irqs; |
393 | |||
394 | res = irq_alloc_desc_at(irq, 0); | ||
359 | 395 | ||
360 | desc = irq_to_desc_alloc_node(irq, 0); | 396 | if (WARN_ON(res != irq)) |
361 | if (WARN_ON(desc == NULL)) | ||
362 | return -1; | 397 | return -1; |
363 | 398 | ||
364 | dynamic_irq_init_keep_chip_data(irq); | 399 | return irq; |
400 | |||
401 | no_irqs: | ||
402 | panic("No available IRQ to bind to: increase nr_irqs!\n"); | ||
403 | } | ||
404 | |||
405 | static bool identity_mapped_irq(unsigned irq) | ||
406 | { | ||
407 | /* identity map all the hardware irqs */ | ||
408 | return irq < get_nr_hw_irqs(); | ||
409 | } | ||
410 | |||
411 | static void pirq_unmask_notify(int irq) | ||
412 | { | ||
413 | struct physdev_eoi eoi = { .irq = irq }; | ||
414 | |||
415 | if (unlikely(pirq_needs_eoi(irq))) { | ||
416 | int rc = HYPERVISOR_physdev_op(PHYSDEVOP_eoi, &eoi); | ||
417 | WARN_ON(rc); | ||
418 | } | ||
419 | } | ||
420 | |||
421 | static void pirq_query_unmask(int irq) | ||
422 | { | ||
423 | struct physdev_irq_status_query irq_status; | ||
424 | struct irq_info *info = info_for_irq(irq); | ||
425 | |||
426 | BUG_ON(info->type != IRQT_PIRQ); | ||
427 | |||
428 | irq_status.irq = irq; | ||
429 | if (HYPERVISOR_physdev_op(PHYSDEVOP_irq_status_query, &irq_status)) | ||
430 | irq_status.flags = 0; | ||
431 | |||
432 | info->u.pirq.flags &= ~PIRQ_NEEDS_EOI; | ||
433 | if (irq_status.flags & XENIRQSTAT_needs_eoi) | ||
434 | info->u.pirq.flags |= PIRQ_NEEDS_EOI; | ||
435 | } | ||
436 | |||
437 | static bool probing_irq(int irq) | ||
438 | { | ||
439 | struct irq_desc *desc = irq_to_desc(irq); | ||
440 | |||
441 | return desc && desc->action == NULL; | ||
442 | } | ||
443 | |||
444 | static unsigned int startup_pirq(unsigned int irq) | ||
445 | { | ||
446 | struct evtchn_bind_pirq bind_pirq; | ||
447 | struct irq_info *info = info_for_irq(irq); | ||
448 | int evtchn = evtchn_from_irq(irq); | ||
449 | int rc; | ||
450 | |||
451 | BUG_ON(info->type != IRQT_PIRQ); | ||
452 | |||
453 | if (VALID_EVTCHN(evtchn)) | ||
454 | goto out; | ||
455 | |||
456 | bind_pirq.pirq = irq; | ||
457 | /* NB. We are happy to share unless we are probing. */ | ||
458 | bind_pirq.flags = info->u.pirq.flags & PIRQ_SHAREABLE ? | ||
459 | BIND_PIRQ__WILL_SHARE : 0; | ||
460 | rc = HYPERVISOR_event_channel_op(EVTCHNOP_bind_pirq, &bind_pirq); | ||
461 | if (rc != 0) { | ||
462 | if (!probing_irq(irq)) | ||
463 | printk(KERN_INFO "Failed to obtain physical IRQ %d\n", | ||
464 | irq); | ||
465 | return 0; | ||
466 | } | ||
467 | evtchn = bind_pirq.port; | ||
468 | |||
469 | pirq_query_unmask(irq); | ||
470 | |||
471 | evtchn_to_irq[evtchn] = irq; | ||
472 | bind_evtchn_to_cpu(evtchn, 0); | ||
473 | info->evtchn = evtchn; | ||
474 | |||
475 | out: | ||
476 | unmask_evtchn(evtchn); | ||
477 | pirq_unmask_notify(irq); | ||
478 | |||
479 | return 0; | ||
480 | } | ||
481 | |||
482 | static void shutdown_pirq(unsigned int irq) | ||
483 | { | ||
484 | struct evtchn_close close; | ||
485 | struct irq_info *info = info_for_irq(irq); | ||
486 | int evtchn = evtchn_from_irq(irq); | ||
487 | |||
488 | BUG_ON(info->type != IRQT_PIRQ); | ||
489 | |||
490 | if (!VALID_EVTCHN(evtchn)) | ||
491 | return; | ||
492 | |||
493 | mask_evtchn(evtchn); | ||
494 | |||
495 | close.port = evtchn; | ||
496 | if (HYPERVISOR_event_channel_op(EVTCHNOP_close, &close) != 0) | ||
497 | BUG(); | ||
498 | |||
499 | bind_evtchn_to_cpu(evtchn, 0); | ||
500 | evtchn_to_irq[evtchn] = -1; | ||
501 | info->evtchn = 0; | ||
502 | } | ||
503 | |||
504 | static void enable_pirq(unsigned int irq) | ||
505 | { | ||
506 | startup_pirq(irq); | ||
507 | } | ||
508 | |||
509 | static void disable_pirq(unsigned int irq) | ||
510 | { | ||
511 | } | ||
512 | |||
513 | static void ack_pirq(unsigned int irq) | ||
514 | { | ||
515 | int evtchn = evtchn_from_irq(irq); | ||
516 | |||
517 | move_native_irq(irq); | ||
518 | |||
519 | if (VALID_EVTCHN(evtchn)) { | ||
520 | mask_evtchn(evtchn); | ||
521 | clear_evtchn(evtchn); | ||
522 | } | ||
523 | } | ||
524 | |||
525 | static void end_pirq(unsigned int irq) | ||
526 | { | ||
527 | int evtchn = evtchn_from_irq(irq); | ||
528 | struct irq_desc *desc = irq_to_desc(irq); | ||
529 | |||
530 | if (WARN_ON(!desc)) | ||
531 | return; | ||
532 | |||
533 | if ((desc->status & (IRQ_DISABLED|IRQ_PENDING)) == | ||
534 | (IRQ_DISABLED|IRQ_PENDING)) { | ||
535 | shutdown_pirq(irq); | ||
536 | } else if (VALID_EVTCHN(evtchn)) { | ||
537 | unmask_evtchn(evtchn); | ||
538 | pirq_unmask_notify(irq); | ||
539 | } | ||
540 | } | ||
541 | |||
542 | static int find_irq_by_gsi(unsigned gsi) | ||
543 | { | ||
544 | int irq; | ||
545 | |||
546 | for (irq = 0; irq < nr_irqs; irq++) { | ||
547 | struct irq_info *info = info_for_irq(irq); | ||
548 | |||
549 | if (info == NULL || info->type != IRQT_PIRQ) | ||
550 | continue; | ||
551 | |||
552 | if (gsi_from_irq(irq) == gsi) | ||
553 | return irq; | ||
554 | } | ||
555 | |||
556 | return -1; | ||
557 | } | ||
558 | |||
559 | /* xen_allocate_irq might allocate irqs from the top down, as a | ||
560 | * consequence don't assume that the irq number returned has a low value | ||
561 | * or can be used as a pirq number unless you know otherwise. | ||
562 | * | ||
563 | * One notable exception is when xen_allocate_irq is called passing an | ||
564 | * hardware gsi as argument, in that case the irq number returned | ||
565 | * matches the gsi number passed as first argument. | ||
566 | |||
567 | * Note: We don't assign an | ||
568 | * event channel until the irq actually started up. Return an | ||
569 | * existing irq if we've already got one for the gsi. | ||
570 | */ | ||
571 | int xen_allocate_pirq(unsigned gsi, int shareable, char *name) | ||
572 | { | ||
573 | int irq; | ||
574 | struct physdev_irq irq_op; | ||
575 | |||
576 | spin_lock(&irq_mapping_update_lock); | ||
577 | |||
578 | irq = find_irq_by_gsi(gsi); | ||
579 | if (irq != -1) { | ||
580 | printk(KERN_INFO "xen_allocate_pirq: returning irq %d for gsi %u\n", | ||
581 | irq, gsi); | ||
582 | goto out; /* XXX need refcount? */ | ||
583 | } | ||
584 | |||
585 | /* If we are a PV guest, we don't have GSIs (no ACPI passed). Therefore | ||
586 | * we are using the !xen_initial_domain() to drop in the function.*/ | ||
587 | if (identity_mapped_irq(gsi) || !xen_initial_domain()) { | ||
588 | irq = gsi; | ||
589 | irq_alloc_desc_at(irq, 0); | ||
590 | } else | ||
591 | irq = find_unbound_irq(); | ||
592 | |||
593 | set_irq_chip_and_handler_name(irq, &xen_pirq_chip, | ||
594 | handle_level_irq, name); | ||
595 | |||
596 | irq_op.irq = irq; | ||
597 | irq_op.vector = 0; | ||
598 | |||
599 | /* Only the privileged domain can do this. For non-priv, the pcifront | ||
600 | * driver provides a PCI bus that does the call to do exactly | ||
601 | * this in the priv domain. */ | ||
602 | if (xen_initial_domain() && | ||
603 | HYPERVISOR_physdev_op(PHYSDEVOP_alloc_irq_vector, &irq_op)) { | ||
604 | irq_free_desc(irq); | ||
605 | irq = -ENOSPC; | ||
606 | goto out; | ||
607 | } | ||
608 | |||
609 | irq_info[irq] = mk_pirq_info(0, gsi, irq_op.vector); | ||
610 | irq_info[irq].u.pirq.flags |= shareable ? PIRQ_SHAREABLE : 0; | ||
611 | |||
612 | out: | ||
613 | spin_unlock(&irq_mapping_update_lock); | ||
365 | 614 | ||
366 | return irq; | 615 | return irq; |
367 | } | 616 | } |
368 | 617 | ||
618 | int xen_destroy_irq(int irq) | ||
619 | { | ||
620 | struct irq_desc *desc; | ||
621 | int rc = -ENOENT; | ||
622 | |||
623 | spin_lock(&irq_mapping_update_lock); | ||
624 | |||
625 | desc = irq_to_desc(irq); | ||
626 | if (!desc) | ||
627 | goto out; | ||
628 | |||
629 | irq_info[irq] = mk_unbound_info(); | ||
630 | |||
631 | irq_free_desc(irq); | ||
632 | |||
633 | out: | ||
634 | spin_unlock(&irq_mapping_update_lock); | ||
635 | return rc; | ||
636 | } | ||
637 | |||
638 | int xen_vector_from_irq(unsigned irq) | ||
639 | { | ||
640 | return vector_from_irq(irq); | ||
641 | } | ||
642 | |||
643 | int xen_gsi_from_irq(unsigned irq) | ||
644 | { | ||
645 | return gsi_from_irq(irq); | ||
646 | } | ||
647 | |||
369 | int bind_evtchn_to_irq(unsigned int evtchn) | 648 | int bind_evtchn_to_irq(unsigned int evtchn) |
370 | { | 649 | { |
371 | int irq; | 650 | int irq; |
@@ -495,7 +774,7 @@ static void unbind_from_irq(unsigned int irq) | |||
495 | if (irq_info[irq].type != IRQT_UNBOUND) { | 774 | if (irq_info[irq].type != IRQT_UNBOUND) { |
496 | irq_info[irq] = mk_unbound_info(); | 775 | irq_info[irq] = mk_unbound_info(); |
497 | 776 | ||
498 | dynamic_irq_cleanup(irq); | 777 | irq_free_desc(irq); |
499 | } | 778 | } |
500 | 779 | ||
501 | spin_unlock(&irq_mapping_update_lock); | 780 | spin_unlock(&irq_mapping_update_lock); |
@@ -892,7 +1171,7 @@ void xen_clear_irq_pending(int irq) | |||
892 | if (VALID_EVTCHN(evtchn)) | 1171 | if (VALID_EVTCHN(evtchn)) |
893 | clear_evtchn(evtchn); | 1172 | clear_evtchn(evtchn); |
894 | } | 1173 | } |
895 | 1174 | EXPORT_SYMBOL(xen_clear_irq_pending); | |
896 | void xen_set_irq_pending(int irq) | 1175 | void xen_set_irq_pending(int irq) |
897 | { | 1176 | { |
898 | int evtchn = evtchn_from_irq(irq); | 1177 | int evtchn = evtchn_from_irq(irq); |
@@ -912,9 +1191,9 @@ bool xen_test_irq_pending(int irq) | |||
912 | return ret; | 1191 | return ret; |
913 | } | 1192 | } |
914 | 1193 | ||
915 | /* Poll waiting for an irq to become pending. In the usual case, the | 1194 | /* Poll waiting for an irq to become pending with timeout. In the usual case, |
916 | irq will be disabled so it won't deliver an interrupt. */ | 1195 | * the irq will be disabled so it won't deliver an interrupt. */ |
917 | void xen_poll_irq(int irq) | 1196 | void xen_poll_irq_timeout(int irq, u64 timeout) |
918 | { | 1197 | { |
919 | evtchn_port_t evtchn = evtchn_from_irq(irq); | 1198 | evtchn_port_t evtchn = evtchn_from_irq(irq); |
920 | 1199 | ||
@@ -922,13 +1201,20 @@ void xen_poll_irq(int irq) | |||
922 | struct sched_poll poll; | 1201 | struct sched_poll poll; |
923 | 1202 | ||
924 | poll.nr_ports = 1; | 1203 | poll.nr_ports = 1; |
925 | poll.timeout = 0; | 1204 | poll.timeout = timeout; |
926 | set_xen_guest_handle(poll.ports, &evtchn); | 1205 | set_xen_guest_handle(poll.ports, &evtchn); |
927 | 1206 | ||
928 | if (HYPERVISOR_sched_op(SCHEDOP_poll, &poll) != 0) | 1207 | if (HYPERVISOR_sched_op(SCHEDOP_poll, &poll) != 0) |
929 | BUG(); | 1208 | BUG(); |
930 | } | 1209 | } |
931 | } | 1210 | } |
1211 | EXPORT_SYMBOL(xen_poll_irq_timeout); | ||
1212 | /* Poll waiting for an irq to become pending. In the usual case, the | ||
1213 | * irq will be disabled so it won't deliver an interrupt. */ | ||
1214 | void xen_poll_irq(int irq) | ||
1215 | { | ||
1216 | xen_poll_irq_timeout(irq, 0 /* no timeout */); | ||
1217 | } | ||
932 | 1218 | ||
933 | void xen_irq_resume(void) | 1219 | void xen_irq_resume(void) |
934 | { | 1220 | { |
@@ -965,6 +1251,26 @@ static struct irq_chip xen_dynamic_chip __read_mostly = { | |||
965 | .retrigger = retrigger_dynirq, | 1251 | .retrigger = retrigger_dynirq, |
966 | }; | 1252 | }; |
967 | 1253 | ||
1254 | static struct irq_chip xen_pirq_chip __read_mostly = { | ||
1255 | .name = "xen-pirq", | ||
1256 | |||
1257 | .startup = startup_pirq, | ||
1258 | .shutdown = shutdown_pirq, | ||
1259 | |||
1260 | .enable = enable_pirq, | ||
1261 | .unmask = enable_pirq, | ||
1262 | |||
1263 | .disable = disable_pirq, | ||
1264 | .mask = disable_pirq, | ||
1265 | |||
1266 | .ack = ack_pirq, | ||
1267 | .end = end_pirq, | ||
1268 | |||
1269 | .set_affinity = set_affinity_irq, | ||
1270 | |||
1271 | .retrigger = retrigger_dynirq, | ||
1272 | }; | ||
1273 | |||
968 | static struct irq_chip xen_percpu_chip __read_mostly = { | 1274 | static struct irq_chip xen_percpu_chip __read_mostly = { |
969 | .name = "xen-percpu", | 1275 | .name = "xen-percpu", |
970 | 1276 | ||
@@ -1019,7 +1325,12 @@ void __init xen_init_IRQ(void) | |||
1019 | 1325 | ||
1020 | cpu_evtchn_mask_p = kcalloc(nr_cpu_ids, sizeof(struct cpu_evtchn_s), | 1326 | cpu_evtchn_mask_p = kcalloc(nr_cpu_ids, sizeof(struct cpu_evtchn_s), |
1021 | GFP_KERNEL); | 1327 | GFP_KERNEL); |
1022 | BUG_ON(cpu_evtchn_mask_p == NULL); | 1328 | irq_info = kcalloc(nr_irqs, sizeof(*irq_info), GFP_KERNEL); |
1329 | |||
1330 | evtchn_to_irq = kcalloc(NR_EVENT_CHANNELS, sizeof(*evtchn_to_irq), | ||
1331 | GFP_KERNEL); | ||
1332 | for (i = 0; i < NR_EVENT_CHANNELS; i++) | ||
1333 | evtchn_to_irq[i] = -1; | ||
1023 | 1334 | ||
1024 | init_evtchn_cpu_bindings(); | 1335 | init_evtchn_cpu_bindings(); |
1025 | 1336 | ||
diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c index 7e49527189b6..cdacf923e073 100644 --- a/drivers/xen/xenbus/xenbus_client.c +++ b/drivers/xen/xenbus/xenbus_client.c | |||
@@ -50,6 +50,8 @@ const char *xenbus_strstate(enum xenbus_state state) | |||
50 | [ XenbusStateConnected ] = "Connected", | 50 | [ XenbusStateConnected ] = "Connected", |
51 | [ XenbusStateClosing ] = "Closing", | 51 | [ XenbusStateClosing ] = "Closing", |
52 | [ XenbusStateClosed ] = "Closed", | 52 | [ XenbusStateClosed ] = "Closed", |
53 | [XenbusStateReconfiguring] = "Reconfiguring", | ||
54 | [XenbusStateReconfigured] = "Reconfigured", | ||
53 | }; | 55 | }; |
54 | return (state < ARRAY_SIZE(name)) ? name[state] : "INVALID"; | 56 | return (state < ARRAY_SIZE(name)) ? name[state] : "INVALID"; |
55 | } | 57 | } |