1 /******************************************************************************
2  * event.h
3  *
4  * A nice interface for passing asynchronous events to guest OSes.
5  * (architecture-dependent part)
6  *
7  */
8 
9 #ifndef __ASM_EVENT_H__
10 #define __ASM_EVENT_H__
11 
12 #include <xen/shared.h>
13 
14 void vcpu_kick(struct vcpu *v);
15 void vcpu_mark_events_pending(struct vcpu *v);
16 
vcpu_event_delivery_is_enabled(struct vcpu * v)17 static inline int vcpu_event_delivery_is_enabled(struct vcpu *v)
18 {
19     return !vcpu_info(v, evtchn_upcall_mask);
20 }
21 
22 int hvm_local_events_need_delivery(struct vcpu *v);
local_events_need_delivery(void)23 static inline int local_events_need_delivery(void)
24 {
25     struct vcpu *v = current;
26 
27     ASSERT(!is_idle_vcpu(v));
28 
29     return (is_hvm_vcpu(v) ? hvm_local_events_need_delivery(v) :
30             (vcpu_info(v, evtchn_upcall_pending) &&
31              !vcpu_info(v, evtchn_upcall_mask)));
32 }
33 
local_event_delivery_disable(void)34 static inline void local_event_delivery_disable(void)
35 {
36     vcpu_info(current, evtchn_upcall_mask) = 1;
37 }
38 
local_event_delivery_enable(void)39 static inline void local_event_delivery_enable(void)
40 {
41     vcpu_info(current, evtchn_upcall_mask) = 0;
42 }
43 
44 /* No arch specific virq definition now. Default to global. */
arch_virq_is_global(uint32_t virq)45 static inline int arch_virq_is_global(uint32_t virq)
46 {
47     return 1;
48 }
49 
50 #endif
51