On 22 November 2012 15:58, Will Deacon <will.deacon@xxxxxxx> wrote: > +++ b/tools/kvm/arm/aarch32/smp-pen.S > @@ -0,0 +1,30 @@ > +#include "kvm/kvm-arch.h" > + > +#include "arm-common/gic.h" > + > + .arm > + > + .globl smp_pen_start > + .globl smp_jump_addr > + .globl smp_pen_end > + > + .align > +smp_pen_start: > + @ Ensure that the CPU interface is enabled for the wfi wakeup > + ldr r0, =ARM_GIC_CPUI_BASE > + mov r1, #GIC_CPUI_CTLR_EN > + str r1, [r0] > + > + @ Now wait for the primary to poke us > + adr r0, smp_jump_addr > + dsb > + wfi > + ldr r1, [r0] > + mov pc, r1 > + > + .ltorg > + > + .align > +smp_jump_addr: > + .long 0xdeadc0de > +smp_pen_end: You've left the gate ajar on your pen -- this won't cope with spurious WFI wakeups (the architecture allows WFI to return at any time, down to the trivial case of "implemented as NOP"). Needs a 'branch back to WFI if not yet poked' (or you could make the initial value stored at smp_jump_addr be the address of the wfi :-)) -- PMM -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html