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 always_inline bool 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(unsigned int virq)45 static inline bool arch_virq_is_global(unsigned int virq)
46 {
47     return true;
48 }
49 
50 #ifdef CONFIG_PV_SHIM
51 # include <asm/pv/shim.h>
52 # define arch_evtchn_is_special(chn) \
53              (pv_shim && (chn)->port && (chn)->state == ECS_RESERVED)
54 #endif
55 
56 #endif
57