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

[XenPPC] [xenppc-unstable] [ppc] implement vcpu_mark_events_pending()



# HG changeset patch
# User Hollis Blanchard <hollisb@xxxxxxxxxx>
# Node ID 19bd6e089f673ab2aa6b51171dbbf03312367ffd
# Parent  dd6634464024412d692df7518e8038a175c73b5d
[ppc] implement vcpu_mark_events_pending()
Signed-off-by: Hollis Blanchard <hollisb@xxxxxxxxxx>
---
 xen/include/asm-ppc/event.h |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+)

diff -r dd6634464024 -r 19bd6e089f67 xen/include/asm-ppc/event.h
--- a/xen/include/asm-ppc/event.h       Fri Jun 16 15:54:42 2006 -0500
+++ b/xen/include/asm-ppc/event.h       Fri Jun 16 15:55:30 2006 -0500
@@ -53,4 +53,35 @@ static inline int arch_virq_is_global(in
     return 1;
 }
 
+static inline void vcpu_kick(struct vcpu *v)
+{
+    /*
+     * NB1. 'vcpu_flags' and 'processor' must be checked /after/ update of
+     * pending flag. These values may fluctuate (after all, we hold no
+     * locks) but the key insight is that each change will cause
+     * evtchn_upcall_pending to be polled.
+     *
+     * NB2. We save VCPUF_running across the unblock to avoid a needless
+     * IPI for domains that we IPI'd to unblock.
+     */
+    int running = test_bit(_VCPUF_running, &v->vcpu_flags);
+    vcpu_unblock(v);
+    if (running)
+        smp_send_event_check_cpu(v->processor);
+}
+
+/* HACK: evtchn_upcall_pending is only a byte, but our atomic instructions
+ * only store in 4/8 byte quantities. However, because evtchn_upcall_pending
+ * is part of the guest ABI, we can't change its size without breaking
+ * backwards compatibility. In this particular case, struct vcpu_info is big
+ * enough that we can safely store a full long into it. However, note that bit
+ * 0 of evtchn_upcall_pending is bit 56 when cast to a long.
+ */
+static inline void vcpu_mark_events_pending(struct vcpu *v)
+{
+    unsigned long *l = (unsigned long *)&v->vcpu_info->evtchn_upcall_pending;
+    if (!test_and_set_bit(BITS_PER_LONG - 8, l))
+        vcpu_kick(v);
+}
+
 #endif

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


 


Rackspace

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