1 #ifndef __ASM_EVENT_H__ 2 #define __ASM_EVENT_H__ 3 4 #include <asm/gic.h> 5 #include <asm/domain.h> 6 7 void vcpu_kick(struct vcpu *v); 8 void vcpu_mark_events_pending(struct vcpu *v); 9 void vcpu_block_unless_event_pending(struct vcpu *v); 10 vcpu_event_delivery_is_enabled(struct vcpu * v)11static inline int vcpu_event_delivery_is_enabled(struct vcpu *v) 12 { 13 struct cpu_user_regs *regs = &v->arch.cpu_info->guest_cpu_user_regs; 14 return !(regs->cpsr & PSR_IRQ_MASK); 15 } 16 local_events_need_delivery_nomask(void)17static inline int local_events_need_delivery_nomask(void) 18 { 19 struct pending_irq *p = irq_to_pending(current, 20 current->domain->arch.evtchn_irq); 21 22 /* Does not work for LPIs. */ 23 ASSERT(!is_lpi(current->domain->arch.evtchn_irq)); 24 25 /* XXX: if the first interrupt has already been delivered, we should 26 * check whether any other interrupts with priority higher than the 27 * one in GICV_IAR are in the lr_pending queue or in the LR 28 * registers and return 1 only in that case. 29 * In practice the guest interrupt handler should run with 30 * interrupts disabled so this shouldn't be a problem in the general 31 * case. 32 */ 33 if ( gic_events_need_delivery() ) 34 return 1; 35 36 if ( vcpu_info(current, evtchn_upcall_pending) && 37 list_empty(&p->inflight) ) 38 return 1; 39 40 return 0; 41 } 42 local_events_need_delivery(void)43static inline int local_events_need_delivery(void) 44 { 45 if ( !vcpu_event_delivery_is_enabled(current) ) 46 return 0; 47 return local_events_need_delivery_nomask(); 48 } 49 local_event_delivery_enable(void)50static inline void local_event_delivery_enable(void) 51 { 52 struct cpu_user_regs *regs = guest_cpu_user_regs(); 53 regs->cpsr &= ~PSR_IRQ_MASK; 54 } 55 56 /* No arch specific virq definition now. Default to global. */ arch_virq_is_global(int virq)57static inline int arch_virq_is_global(int virq) 58 { 59 return 1; 60 } 61 62 #endif 63 /* 64 * Local variables: 65 * mode: C 66 * c-file-style: "BSD" 67 * c-basic-offset: 4 68 * indent-tabs-mode: nil 69 * End: 70 */ 71