On Thu, Aug 03, 2017 at 01:28:28PM -0700, Richard Henderson wrote: > On 08/02/2017 09:43 AM, Peter Maydell wrote: > > M profile cores can never trap on WFI or WFE instructions. Check for > > M profile in check_wfx_trap() to ensure this. > > > > The existing code will do the right thing for v7M cores because > > the hcr_el2 and scr_el3 registers will be all-zeroes and so we > > won't attempt to trap, but when we start setting ARM_FEATURE_V8 > > for v8M cores the v8A handling of SCTLR.nTWE and .nTWI will not > > give the right results. > > > > Signed-off-by: Peter Maydell <peter.mayd...@linaro.org> > > --- > > target/arm/op_helper.c | 5 +++++ > > 1 file changed, 5 insertions(+) > > Reviewed-by: Richard Henderson <richard.hender...@linaro.org> > > While looking at this, I think there's an error in helper_wfi. The early exit > for cpu_has_work should happen after the exception check.
I don't have the spec at hand but IIRC the trap should only happen if the processor would have entered the low-power state (i.e if there's no work). A comment in the code would probably be good... Cheers, Edgar