Hi Peter,

On Thu, Nov 22, 2012 at 04:13:17PM +0000, Peter Maydell wrote:
> On 22 November 2012 15:58, Will Deacon <will.dea...@arm.com> 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 :-))

Thanks for pointing this out, somehow I missed it despite updating the ARMv8
code. Will fix for v3.

Will
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to