WFI functionality is required at different places in xen.
Moving it to seperate helper function so that it is easier
to call WFI function and avoid duplication of code
Signed-off-by: Parth Dixit <parth.dixit@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
vgic_vcpu_inject_irq(v, v->domain->arch.evtchn_irq);
}
+/* The ARM spec declares that even if local irqs are masked in
+ * the CPSR register, an irq should wake up a cpu from WFI anyway.
+ * For this reason we need to check for irqs that need delivery,
+ * ignoring the CPSR register, *after* calling SCHEDOP_block to
+ * avoid races with vgic_vcpu_inject_irq.
+ */
+void vcpu_block_unless_event_pending(struct vcpu *v)
+{
+ vcpu_block();
+ if ( local_events_need_delivery_nomask() )
+ vcpu_unblock(current);
+}
+
/*
* Local variables:
* mode: C
return;
}
/* at the moment we only trap WFI */
- vcpu_block();
- /* The ARM spec declares that even if local irqs are masked in
- * the CPSR register, an irq should wake up a cpu from WFI anyway.
- * For this reason we need to check for irqs that need delivery,
- * ignoring the CPSR register, *after* calling SCHEDOP_block to
- * avoid races with vgic_vcpu_inject_irq.
- */
- if ( local_events_need_delivery_nomask() )
- vcpu_unblock(current);
+ vcpu_block_unless_event_pending(current);
advance_pc(regs, hsr);
break;
case HSR_EC_CP15_32:
void vcpu_kick(struct vcpu *v);
void vcpu_mark_events_pending(struct vcpu *v);
+void vcpu_block_unless_event_pending(struct vcpu *v);
static inline int vcpu_event_delivery_is_enabled(struct vcpu *v)
{