Re: [PATCH for-11.1 2/3] target/arm: Make YIELD, WFI and WFE be NOPs on pre-v6K

Richard Henderson <[email protected]> Tue, 28 Jul 2026 07:36:05 -0700
Newsgroups org.nongnu.qemu-arm,org.nongnu.qemu-devel
Message-ID <[email protected]>
On 7/28/26 04:16, Peter Maydell wrote:
> The YIELD, WFI and WFE instructions are in the NOP hint space, and
> were only defined to actual non-NOP instructions starting in the v6K
> architecture; they are also present for all M-profile architecture
> versions.
> 
> We never did check the architecture version before making these
> instructions have their special behaviour.  Mostly this has not been
> a problem because a guest won't execute one of these insns unless it
> is prepared for it to have its usual effect, and because we
> implemented SEV and WFE as NOPs anyway.
> 
> Now we have implemented SEV and WFE to be more than just NOPs, it's
> important that we have the same condition on the SEV as the WFE, so
> that we either NOP both or else implement both.  A guest probably
> won't try to use SEV/WFE on CPUs that don't implement them, but it is
> valid for it to do that and rely on them both being NOPs (and so a
> WFE-loop falls back to a pure busy-wait loop).
> 
> Add the "only if M profile or v6K or better" check to YIELD, WFE and
> WFI.  This means that all the insns in the NOP-hint space for A32,
> T32 and T16 have a correct feature check.
> 
> Fixes: 60e7ee5bb7cd ("target/arm: implements SEV/SEVL for all modes")
> Signed-off-by: Peter Maydell<[email protected]>
> ---
>   target/arm/tcg/translate.c | 35 ++++++++++++++++++++++++++---------
>   1 file changed, 26 insertions(+), 9 deletions(-)

Reviewed-by: Richard Henderson <[email protected]>

r~