target/arm: set the correct TI bits for WFIT traps
PATCH 1/1 target/arm: set the correct TI bits for WFIT traps
The WFIT trap should be reported as 0b10.
--- target/arm/tcg/op_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/arm/tcg/op_helper.c +1 -1
@@ -448,7 +448,7 @@ void HELPER(wfit)(CPUARMState *env, uint64_t timeout)if (target_el) { env->pc -=4 ; -raise_exception (env, excp,syn_wfx (1 ,0xe ,0 , false), target_el); +raise_exception (env, excp,syn_wfx (1 ,0xe ,2 , false), target_el); }if (uadd64_overflow (timeout, offset, &nexttick)) {
Signature · 1 line
2.47.3
Hi Alex,
Quoted 12 lines · Alex Bennée
The WFIT trap should be reported as 0b10.
Signed-off-by Alex Bennée <[email protected]>--- target/arm/tcg/op_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/arm/tcg/op_helper.c +0
-0
target/arm/tcg/op_helper.c void HELPER(wfit)(CPUARMState *env, uint64_t timeout) · line 451
Quoted 5 lines
target/arm/tcg/op_helper.c +1
-1@@ -448,7 +448,7 @@ void HELPER(wfit)(CPUARMState *env, uint64_t timeout)if (target_el) { env->pc -=4 ; -raise_exception (env, excp,syn_wfx (1 ,0xe ,0 , false), target_el); +raise_exception (env, excp,syn_wfx (1 ,0xe ,2 , false), target_el);
As per the AArch64.WFxTrap() Arm Arm pseudo code:
Cheers,
Gustavo
Quoted 3 lines
target/arm/tcg/op_helper.c +0
-0}if (uadd64_overflow (timeout, offset, &nexttick)) {
Peter Maydell
AppliedQuoted 13 lines · Alex Bennée
The WFIT trap should be reported as 0b10.
Signed-off-by Alex Bennée <[email protected]>--- target/arm/tcg/op_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/arm/tcg/op_helper.c +0
-0
target/arm/tcg/op_helper.c void HELPER(wfit)(CPUARMState *env, uint64_t timeout) · line 452
Quoted 6 lines
target/arm/tcg/op_helper.c +1
-1@@ -448,7 +448,7 @@ void HELPER(wfit)(CPUARMState *env, uint64_t timeout)if (target_el) { env->pc -=4 ; -raise_exception (env, excp,syn_wfx (1 ,0xe ,0 , false), target_el); +raise_exception (env, excp,syn_wfx (1 ,0xe ,2 , false), target_el); }
It would be nice to also report the register number in the syndrome (especially since KVM will use it if it's there), but that is architecturally optional, and getting the TI bits right is a bug fix.
Applied to target-arm.next, thanks.
-- PMM
Quoted 15 lines · Peter Maydell
Quoted 14 lines · Alex Bennée
The WFIT trap should be reported as 0b10.
Signed-off-by Alex Bennée <[email protected]>--- target/arm/tcg/op_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/arm/tcg/op_helper.c +0
-0@@ -448,7 +448,7 @@ void HELPER(wfit)(CPUARMState *env, uint64_t timeout)
Quoted 10 lines
target/arm/tcg/op_helper.c void HELPER(wfit)(CPUARMState *env, uint64_t timeout) · line 452
Quoted 5 lines
target/arm/tcg/op_helper.c +1
-1if (target_el) { env->pc -=4 ; -raise_exception (env, excp,syn_wfx (1 ,0xe ,0 , false), target_el); +raise_exception (env, excp,syn_wfx (1 ,0xe ,2 , false), target_el); }It would be nice to also report the register number in the syndrome (especially since KVM will use it if it's there), but that is architecturally optional, and getting the TI bits right is a bug fix.
Turned out just getting the rd information is trivially simple so I sent a follow-up series.
https://patchew.org/QEMU/[email protected]/
Quoted 6 lines
Applied to target-arm.next, thanks.
-- PMM
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro