aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/xen/events.c
diff options
context:
space:
mode:
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>2010-05-17 12:08:21 -0400
committerJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>2010-07-22 19:46:09 -0400
commit183d03cc4ff39e0f0d952c09aa96d0abfd6e0c3c (patch)
tree75947fc4a9ac69e902663c9cb618993b7c656cff /drivers/xen/events.c
parent38e20b07efd541a959de367dc90a17f92ce2e8a6 (diff)
xen: Xen PCI platform device driver.
Add the xen pci platform device driver that is responsible for initializing the grant table and xenbus in PV on HVM mode. Few changes to xenbus and grant table are necessary to allow the delayed initialization in HVM mode. Grant table needs few additional modifications to work in HVM mode. The Xen PCI platform device raises an irq every time an event has been delivered to us. However these interrupts are only delivered to vcpu 0. The Xen PCI platform interrupt handler calls xen_hvm_evtchn_do_upcall that is a little wrapper around __xen_evtchn_do_upcall, the traditional Xen upcall handler, the very same used with traditional PV guests. When running on HVM the event channel upcall is never called while in progress because it is a normal Linux irq handler (and we cannot switch the irq chip wholesale to the Xen PV ones as we are running QEMU and might have passed in PCI devices), therefore we cannot be sure that evtchn_upcall_pending is 0 when returning. For this reason if evtchn_upcall_pending is set by Xen we need to loop again on the event channels set pending otherwise we might loose some event channel deliveries. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Diffstat (limited to 'drivers/xen/events.c')
-rw-r--r--drivers/xen/events.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index d659480125f0..7c64473c9f3f 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -665,7 +665,7 @@ static void __xen_evtchn_do_upcall(void)
665 665
666 count = __get_cpu_var(xed_nesting_count); 666 count = __get_cpu_var(xed_nesting_count);
667 __get_cpu_var(xed_nesting_count) = 0; 667 __get_cpu_var(xed_nesting_count) = 0;
668 } while(count != 1); 668 } while (count != 1 || vcpu_info->evtchn_upcall_pending);
669 669
670out: 670out:
671 671
@@ -689,6 +689,7 @@ void xen_hvm_evtchn_do_upcall(void)
689{ 689{
690 __xen_evtchn_do_upcall(); 690 __xen_evtchn_do_upcall();
691} 691}
692EXPORT_SYMBOL_GPL(xen_hvm_evtchn_do_upcall);
692 693
693/* Rebind a new event channel to an existing irq. */ 694/* Rebind a new event channel to an existing irq. */
694void rebind_evtchn_irq(int evtchn, int irq) 695void rebind_evtchn_irq(int evtchn, int irq)
@@ -725,7 +726,10 @@ static int rebind_irq_to_cpu(unsigned irq, unsigned tcpu)
725 struct evtchn_bind_vcpu bind_vcpu; 726 struct evtchn_bind_vcpu bind_vcpu;
726 int evtchn = evtchn_from_irq(irq); 727 int evtchn = evtchn_from_irq(irq);
727 728
728 if (!VALID_EVTCHN(evtchn)) 729 /* events delivered via platform PCI interrupts are always
730 * routed to vcpu 0 */
731 if (!VALID_EVTCHN(evtchn) ||
732 (xen_hvm_domain() && !xen_have_vector_callback))
729 return -1; 733 return -1;
730 734
731 /* Send future instances of this interrupt to other vcpu. */ 735 /* Send future instances of this interrupt to other vcpu. */