direct-io.hg

view xen/include/asm-x86/event.h @ 15388:50358c4b37f4

hvm: Support injection of virtual NMIs and clean up ExtInt handling in general.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Wed Jun 20 11:50:16 2007 +0100 (2007-06-20)
parents b3c75956303b
children
line source
1 /******************************************************************************
2 * event.h
3 *
4 * A nice interface for passing asynchronous events to guest OSes.
5 * (architecture-dependent part)
6 *
7 */
9 #ifndef __ASM_EVENT_H__
10 #define __ASM_EVENT_H__
12 #include <xen/shared.h>
14 static inline void vcpu_kick(struct vcpu *v)
15 {
16 /*
17 * NB1. 'pause_flags' and 'processor' must be checked /after/ update of
18 * pending flag. These values may fluctuate (after all, we hold no
19 * locks) but the key insight is that each change will cause
20 * evtchn_upcall_pending to be polled.
21 *
22 * NB2. We save the running flag across the unblock to avoid a needless
23 * IPI for domains that we IPI'd to unblock.
24 */
25 int running = v->is_running;
26 vcpu_unblock(v);
27 if ( running )
28 smp_send_event_check_cpu(v->processor);
29 }
31 static inline void vcpu_mark_events_pending(struct vcpu *v)
32 {
33 if ( !test_and_set_bit(0, &vcpu_info(v, evtchn_upcall_pending)) )
34 vcpu_kick(v);
35 }
37 int hvm_local_events_need_delivery(struct vcpu *v);
38 static inline int local_events_need_delivery(void)
39 {
40 struct vcpu *v = current;
41 return (is_hvm_vcpu(v) ? hvm_local_events_need_delivery(v) :
42 (vcpu_info(v, evtchn_upcall_pending) &&
43 !vcpu_info(v, evtchn_upcall_mask)));
44 }
46 static inline int local_event_delivery_is_enabled(void)
47 {
48 return !vcpu_info(current, evtchn_upcall_mask);
49 }
51 static inline void local_event_delivery_disable(void)
52 {
53 vcpu_info(current, evtchn_upcall_mask) = 1;
54 }
56 static inline void local_event_delivery_enable(void)
57 {
58 vcpu_info(current, evtchn_upcall_mask) = 0;
59 }
61 /* No arch specific virq definition now. Default to global. */
62 static inline int arch_virq_is_global(int virq)
63 {
64 return 1;
65 }
67 #endif