[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] hvm: local_events_need_delivery() should take notice of EFLAGS.IF.



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1175710659 -3600
# Node ID b3c75956303b90a5feb293b05272dc399c68a8da
# Parent  10f06a7a05e90d0d0aad11112945815580520897
hvm: local_events_need_delivery() should take notice of EFLAGS.IF.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/arch/x86/hvm/irq.c      |   19 +++++++++++++++++++
 xen/include/asm-x86/event.h |    7 ++++---
 2 files changed, 23 insertions(+), 3 deletions(-)

diff -r 10f06a7a05e9 -r b3c75956303b xen/arch/x86/hvm/irq.c
--- a/xen/arch/x86/hvm/irq.c    Wed Apr 04 18:41:42 2007 +0100
+++ b/xen/arch/x86/hvm/irq.c    Wed Apr 04 19:17:39 2007 +0100
@@ -335,6 +335,25 @@ int is_isa_irq_masked(struct vcpu *v, in
     return ((v->domain->arch.hvm_domain.vpic[isa_irq >> 3].imr &
              (1 << (isa_irq & 7))) &&
             domain_vioapic(v->domain)->redirtbl[gsi].fields.mask);
+}
+
+/*
+ * TODO: 1. Should not need special treatment of event-channel events.
+ *       2. Should take notice of interrupt shadows (or clear them).
+ */
+int hvm_local_events_need_delivery(struct vcpu *v)
+{
+    int pending;
+
+    pending = (vcpu_info(v, evtchn_upcall_pending) || cpu_has_pending_irq(v));
+    if ( unlikely(pending) )
+    {
+        struct cpu_user_regs regs;
+        hvm_store_cpu_guest_regs(v, &regs, NULL);
+        pending = !irq_masked(regs.eflags);
+    }
+
+    return pending;
 }
 
 #if 0 /* Keep for debugging */
diff -r 10f06a7a05e9 -r b3c75956303b xen/include/asm-x86/event.h
--- a/xen/include/asm-x86/event.h       Wed Apr 04 18:41:42 2007 +0100
+++ b/xen/include/asm-x86/event.h       Wed Apr 04 19:17:39 2007 +0100
@@ -35,12 +35,13 @@ static inline void vcpu_mark_events_pend
         vcpu_kick(v);
 }
 
+int hvm_local_events_need_delivery(struct vcpu *v);
 static inline int local_events_need_delivery(void)
 {
     struct vcpu *v = current;
-    return ((vcpu_info(v, evtchn_upcall_pending) &&
-             !vcpu_info(v, evtchn_upcall_mask)) ||
-            (is_hvm_vcpu(v) && cpu_has_pending_irq(v)));
+    return (is_hvm_vcpu(v) ? hvm_local_events_need_delivery(v) :
+            (vcpu_info(v, evtchn_upcall_pending) &&
+             !vcpu_info(v, evtchn_upcall_mask)));
 }
 
 static inline int local_event_delivery_is_enabled(void)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.