Fix bug in tlb_fill.
PATCH 1/1 Fix bug in tlb_fill.
Fix a simple bug in tlb_fill for moxie. The port was mostly working before, which is why I only really noticed it recently. Thanks to @jcmvbkbc for tracking it down.
--- target-moxie/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target-moxie/helper.c +1 -1
@@ -55,8 +55,8 @@ void tlb_fill(CPUMoxieState *env, target_ulong addr, int is_write, int mmu_idx,if (retaddr) {cpu_restore_state (env, retaddr); } +cpu_loop_exit (env); } -cpu_loop_exit (env); }void helper_raise_exception (CPUMoxieState *env,int ex)
Signature · 1 line
1.8.1.4
Quoted 14 lines · Anthony Green
Fix a simple bug in
tlb_fillfor moxie. The port was mostly working before, which is why I only really noticed it recently. Thanks to @jcmvbkbc for tracking it down.Signed-off-by Anthony Green <[email protected]>--- target-moxie/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target-moxie/helper.c +0
-0
target-moxie/helper.c void tlb_fill(CPUMoxieState *env, target_ulong addr, int is_write, int mmu_idx, · line 60
Quoted 7 lines
target-moxie/helper.c +1
-1@@ -55,8 +55,8 @@ void tlb_fill(CPUMoxieState *env, target_ulong addr, int is_write, int mmu_idx,if (retaddr) {cpu_restore_state (env, retaddr); } +cpu_loop_exit (env); } -cpu_loop_exit (env); }
Hi Anthony,
that bug only revealed that some instructions (in that particular case jsra) issue memory access while they have inconsistent registers state:
case 0x03: /* jsra */
{
TCGv t1 = tcg_temp_new_i32();
TCGv t2 = tcg_temp_new_i32();
tcg_gen_movi_i32(t1, ctx->pc + 6);
/* Make space for the static chain and return address. */
tcg_gen_subi_i32(t2, REG(1), 8);
tcg_gen_mov_i32(REG(1), t2);(1)--> tcg_gen_qemu_st32(t1, REG(1), ctx->memidx);
/* Push the current frame pointer. */
tcg_gen_subi_i32(t2, REG(1), 4);
tcg_gen_mov_i32(REG(1), t2);(2)--> tcg_gen_qemu_st32(REG(0), REG(1), ctx->memidx);
/* Set the pc and $fp. */
tcg_gen_mov_i32(REG(0), REG(1));
gen_goto_tb(env, ctx, 0, cpu_ldl_code(env, ctx->pc+2));
tcg_temp_free_i32(t1);
tcg_temp_free_i32(t2);
ctx->bstate = BS_BRANCH;
length = 6;
}memory access at points (1) and (2) can abort the instruction (it did so b/o the bug, but it may do so legitimately when you add MMU support), but it has modified REG(1) at those points, which will not be restored. It's probably worth carrying register modifications in some temporary until after the point (2).
Signature · 2 lines
Thanks. -- Max
Quoted 5 lines · Max Filippov
memory access at points (1) and (2) can abort the instruction (it did so b/o the bug, but it may do so legitimately when you add MMU support), but it has modified REG(1) at those points, which will not be restored. It's probably worth carrying register modifications in some temporary until after the point (2).
... Which you'll recall that I pointed out during initial review, AG.
r~
[Qemu-devel] ping.. Re: [PATCH moxie] Fix bug in tlb_fill.
In reply to Anthony GreenThis patch still needs to be applied. There was some follow-up discussion on this patch back in May, but none of it negates the fact that this patch needs to be applied.
Thanks!
AG
Quoted 23 lines · Anthony Green
Fix a simple bug in
tlb_fillfor moxie. The port was mostly working before, which is why I only really noticed it recently. Thanks to @jcmvbkbc for tracking it down.Signed-off-by Anthony Green <[email protected]>--- target-moxie/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target-moxie/helper.c +1
-1@@ -55,8 +55,8 @@ void tlb_fill(CPUMoxieState *env, target_ulong addr, int is_write, int mmu_idx,if (retaddr) {cpu_restore_state (env, retaddr); } +cpu_loop_exit (env); } -cpu_loop_exit (env); }void helper_raise_exception (CPUMoxieState *env,int ex)
Re: [Qemu-devel] ping.. Re: [PATCH moxie] Fix bug in tlb_fill.
Hi,
Am 15.12.2013 05:10, schrieb Anthony Green:
Quoted 4 lines
This patch still needs to be applied. There was some follow-up discussion on this patch back in May, but none of it negates the fact that this patch needs to be applied.
It introduces a tab, please fix.
Apart from that I believe I reported some inconsistencies between targets in that function, so "all targets except moxie do it conditional to FOO" may be a convincing explanation independent of the bug you were discussing that may or may not be otherwise workaroundable.
And since this is purely in target-moxie I would suggest to simply send a pull as target maintainer once you have someone trustworthy's Reviewed-by and it doesn't break make check, similar to how it's done for OpenRISC.
And as usual the warning that I have a patch lying around that changes the cpu_loop_exit() argument to CPUState, but I may not get to rebasing that until the holidays, so no imminent conflict.
Regards,
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Re: [Qemu-devel] ping.. Re: [PATCH moxie] Fix bug in tlb_fill.
Quoted 11 lines · Andreas Färber
Am 15.12.2013 05:10, schrieb Anthony Green:
Quoted 3 lines
This patch still needs to be applied. There was some follow-up discussion on this patch back in May, but none of it negates the fact that this patch needs to be applied.
It introduces a tab, please fix.
Apart from that I believe I reported some inconsistencies between targets in that function, so "all targets except moxie do it conditional to FOO" may be a convincing explanation independent of the bug you were discussing that may or may not be otherwise workaroundable.
I dug out the thread where you did that (which turns out to be private mail and not qemu-devel). In follow up to that RTH and I agreed that it definitely is a bug and this patch is the correct fix.
Quoted 4 lines
And since this is purely in target-moxie I would suggest to simply send a pull as target maintainer once you have someone trustworthy's Reviewed-by and it doesn't break
make check, similar to how it's done for OpenRISC.
Yes, this makes sense to me, especially since Anthony has a number of other moxie patches on list at this point.
thanks
-- PMM
Re: [Qemu-devel] ping.. Re: [PATCH moxie] Fix bug in tlb_fill.
Quoted 8 lines · Peter Maydell
Quoted 4 lines · Andreas Färber
And since this is purely in target-moxie I would suggest to simply send a pull as target maintainer once you have someone trustworthy's Reviewed-by and it doesn't break
make check, similar to how it's done for OpenRISC.Yes, this makes sense to me, especially since Anthony has a number of other moxie patches on list at this point.
According to this page...
http://wiki.qemu.org/Contribute/SubmitAPullRequest
...I need to get a key signed by a member of the QEMU community in person. Are there any QEMU hackers in the Toronto area?
AG
Re: [Qemu-devel] ping.. Re: [PATCH moxie] Fix bug in tlb_fill.
Quoted 11 lines · Anthony Green
Quoted 8 lines · Peter Maydell
Quoted 4 lines · Andreas Färber
And since this is purely in target-moxie I would suggest to simply send a pull as target maintainer once you have someone trustworthy's Reviewed-by and it doesn't break
make check, similar to how it's done for OpenRISC.Yes, this makes sense to me, especially since Anthony has a number of other moxie patches on list at this point.
Quoted 7 lines
According to this page...
http://wiki.qemu.org/Contribute/SubmitAPullRequest
...I need to get a key signed by a member of the QEMU community in person. Are there any QEMU hackers in the Toronto area?
While this question has air, anyone in and around Brisbane Australia who can sign me? (although that's probably a long shot).
I can get a key signed by Edgar if that is enough.
Regards,
Peter
Quoted 2 lines
AG