All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] nios2: define tcg_env
@ 2017-10-10 15:18 Paolo Bonzini
  2017-10-10 16:42 ` Richard Henderson
  2017-10-10 16:49 ` Peter Maydell
  0 siblings, 2 replies; 4+ messages in thread
From: Paolo Bonzini @ 2017-10-10 15:18 UTC (permalink / raw)
  To: qemu-devel; +Cc: thuth, qemu-stable, Marek Vasut

This should be done by all target and, since commit 53f6672bcf
("gen-icount: use tcg_ctx.tcg_env instead of cpu_env", 2017-06-30),
is causing the NIOS2 target to hang.

This is because the test for "should I exit to the main loop"
was being done with the correct offset to the icount decrementer,
but using TCG temporary 0 (the frame pointer) rather than the
env pointer.

Cc: qemu-stable@nongnu.org
Cc: Marek Vasut <marex@denx.de>
Reported-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target/nios2/translate.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/target/nios2/translate.c b/target/nios2/translate.c
index 6b0961837d..54fbe898df 100644
--- a/target/nios2/translate.c
+++ b/target/nios2/translate.c
@@ -948,6 +948,7 @@ void nios2_tcg_init(void)
     int i;
 
     cpu_env = tcg_global_reg_new_ptr(TCG_AREG0, "env");
+    tcg_ctx.tcg_env = cpu_env;
 
     for (i = 0; i < NUM_CORE_REGS; i++) {
         cpu_R[i] = tcg_global_mem_new(cpu_env,
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] nios2: define tcg_env
  2017-10-10 15:18 [Qemu-devel] [PATCH] nios2: define tcg_env Paolo Bonzini
@ 2017-10-10 16:42 ` Richard Henderson
  2017-10-10 16:49 ` Peter Maydell
  1 sibling, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2017-10-10 16:42 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: Marek Vasut, thuth, qemu-stable

On 10/10/2017 08:18 AM, Paolo Bonzini wrote:
> This should be done by all target and, since commit 53f6672bcf
> ("gen-icount: use tcg_ctx.tcg_env instead of cpu_env", 2017-06-30),
> is causing the NIOS2 target to hang.
> 
> This is because the test for "should I exit to the main loop"
> was being done with the correct offset to the icount decrementer,
> but using TCG temporary 0 (the frame pointer) rather than the
> env pointer.
> 
> Cc: qemu-stable@nongnu.org
> Cc: Marek Vasut <marex@denx.de>
> Reported-by: Thomas Huth <thuth@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  target/nios2/translate.c | 1 +
>  1 file changed, 1 insertion(+)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] nios2: define tcg_env
  2017-10-10 15:18 [Qemu-devel] [PATCH] nios2: define tcg_env Paolo Bonzini
  2017-10-10 16:42 ` Richard Henderson
@ 2017-10-10 16:49 ` Peter Maydell
  2017-10-10 17:38   ` Richard Henderson
  1 sibling, 1 reply; 4+ messages in thread
From: Peter Maydell @ 2017-10-10 16:49 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU Developers, Marek Vasut, Thomas Huth, qemu-stable

On 10 October 2017 at 16:18, Paolo Bonzini <pbonzini@redhat.com> wrote:
> This should be done by all target and, since commit 53f6672bcf
> ("gen-icount: use tcg_ctx.tcg_env instead of cpu_env", 2017-06-30),
> is causing the NIOS2 target to hang.
>
> This is because the test for "should I exit to the main loop"
> was being done with the correct offset to the icount decrementer,
> but using TCG temporary 0 (the frame pointer) rather than the
> env pointer.
>
> Cc: qemu-stable@nongnu.org
> Cc: Marek Vasut <marex@denx.de>
> Reported-by: Thomas Huth <thuth@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  target/nios2/translate.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/target/nios2/translate.c b/target/nios2/translate.c
> index 6b0961837d..54fbe898df 100644
> --- a/target/nios2/translate.c
> +++ b/target/nios2/translate.c
> @@ -948,6 +948,7 @@ void nios2_tcg_init(void)
>      int i;
>
>      cpu_env = tcg_global_reg_new_ptr(TCG_AREG0, "env");
> +    tcg_ctx.tcg_env = cpu_env;
>
>      for (i = 0; i < NUM_CORE_REGS; i++) {
>          cpu_R[i] = tcg_global_mem_new(cpu_env,
> --

Is there somewhere we could put an assert() so we can catch this
error for future targets rather than them just silently generating
bad code?

thanks
-- PMM

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] nios2: define tcg_env
  2017-10-10 16:49 ` Peter Maydell
@ 2017-10-10 17:38   ` Richard Henderson
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2017-10-10 17:38 UTC (permalink / raw)
  To: Peter Maydell, Paolo Bonzini
  Cc: Marek Vasut, Thomas Huth, QEMU Developers, qemu-stable

On 10/10/2017 09:49 AM, Peter Maydell wrote:
> On 10 October 2017 at 16:18, Paolo Bonzini <pbonzini@redhat.com> wrote:
>> This should be done by all target and, since commit 53f6672bcf
>> ("gen-icount: use tcg_ctx.tcg_env instead of cpu_env", 2017-06-30),
>> is causing the NIOS2 target to hang.
>>
>> This is because the test for "should I exit to the main loop"
>> was being done with the correct offset to the icount decrementer,
>> but using TCG temporary 0 (the frame pointer) rather than the
>> env pointer.
>>
>> Cc: qemu-stable@nongnu.org
>> Cc: Marek Vasut <marex@denx.de>
>> Reported-by: Thomas Huth <thuth@redhat.com>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> ---
>>  target/nios2/translate.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/target/nios2/translate.c b/target/nios2/translate.c
>> index 6b0961837d..54fbe898df 100644
>> --- a/target/nios2/translate.c
>> +++ b/target/nios2/translate.c
>> @@ -948,6 +948,7 @@ void nios2_tcg_init(void)
>>      int i;
>>
>>      cpu_env = tcg_global_reg_new_ptr(TCG_AREG0, "env");
>> +    tcg_ctx.tcg_env = cpu_env;
>>
>>      for (i = 0; i < NUM_CORE_REGS; i++) {
>>          cpu_R[i] = tcg_global_mem_new(cpu_env,
>> --
> 
> Is there somewhere we could put an assert() so we can catch this
> error for future targets rather than them just silently generating
> bad code?

Yes, I can arrange for this.

That said, probably the best change we could make is to eliminate cpu_env
entirely, and create tcg_ctx.tcg_env generically (possibly renaming this to a
standalone global variable called cpu_env, minimizing the changes within
target/*).  It is, after all, the same for every target, and there is no longer
any other TCG_AREG* value that can be used.


r~

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-10-10 17:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-10 15:18 [Qemu-devel] [PATCH] nios2: define tcg_env Paolo Bonzini
2017-10-10 16:42 ` Richard Henderson
2017-10-10 16:49 ` Peter Maydell
2017-10-10 17:38   ` Richard Henderson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.