]> xenbits.xensource.com Git - xen.git/commitdiff
xen/arm : Adding helper function for WFI
authorParth Dixit <parth.dixit@linaro.org>
Mon, 14 Jul 2014 13:51:53 +0000 (19:21 +0530)
committerIan Campbell <ian.campbell@citrix.com>
Wed, 16 Jul 2014 13:57:25 +0000 (14:57 +0100)
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>
xen/arch/arm/domain.c
xen/arch/arm/traps.c
xen/include/asm-arm/event.h

index 87902ef52fd07edfb661916165586a1106f949ae..2b539317184ee8fe7ce7d7e8ad194e3d112ba83b 100644 (file)
@@ -798,6 +798,19 @@ void vcpu_mark_events_pending(struct vcpu *v)
     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
index 686d8b799648b12267e80518dae6fc6561ba1bb5..5e4c837ca4667327cfe76bf48116a54263ee1799 100644 (file)
@@ -1804,15 +1804,7 @@ asmlinkage void do_trap_hypervisor(struct cpu_user_regs *regs)
             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:
index dd3ad13da4136fcfe35a920428a6f6a4ef4899e4..5330dfe62255ea4bd8a4db74ca11f8874c2512e2 100644 (file)
@@ -6,6 +6,7 @@
 
 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)
 {