All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hw/ppc: Fix iothread locking in the 405 code
@ 2021-10-06  7:11 Thomas Huth
  2021-10-06  8:15 ` Cédric Le Goater
  2021-10-07  0:48 ` David Gibson
  0 siblings, 2 replies; 3+ messages in thread
From: Thomas Huth @ 2021-10-06  7:11 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-ppc, Greg Kurz, David Gibson

When using u-boot as firmware with the taihu board, QEMU aborts with
this assertion:

 ERROR:../accel/tcg/tcg-accel-ops.c:79:tcg_handle_interrupt: assertion failed:
  (qemu_mutex_iothread_locked())

Running QEMU with "-d in_asm" shows that the crash happens when writing
to SPR 0x3f2, so we are missing to lock the iothread in the code path
here.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 hw/ppc/ppc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c
index f5d012f860..bb57f1c9ed 100644
--- a/hw/ppc/ppc.c
+++ b/hw/ppc/ppc.c
@@ -336,6 +336,8 @@ void store_40x_dbcr0(CPUPPCState *env, uint32_t val)
 {
     PowerPCCPU *cpu = env_archcpu(env);
 
+    qemu_mutex_lock_iothread();
+
     switch ((val >> 28) & 0x3) {
     case 0x0:
         /* No action */
@@ -353,6 +355,8 @@ void store_40x_dbcr0(CPUPPCState *env, uint32_t val)
         ppc40x_system_reset(cpu);
         break;
     }
+
+    qemu_mutex_unlock_iothread();
 }
 
 /* PowerPC 40x internal IRQ controller */
-- 
2.27.0



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

* Re: [PATCH] hw/ppc: Fix iothread locking in the 405 code
  2021-10-06  7:11 [PATCH] hw/ppc: Fix iothread locking in the 405 code Thomas Huth
@ 2021-10-06  8:15 ` Cédric Le Goater
  2021-10-07  0:48 ` David Gibson
  1 sibling, 0 replies; 3+ messages in thread
From: Cédric Le Goater @ 2021-10-06  8:15 UTC (permalink / raw)
  To: Thomas Huth, qemu-devel; +Cc: qemu-ppc, Greg Kurz, David Gibson

On 10/6/21 09:11, Thomas Huth wrote:
> When using u-boot as firmware with the taihu board, QEMU aborts with
> this assertion:
> 
>   ERROR:../accel/tcg/tcg-accel-ops.c:79:tcg_handle_interrupt: assertion failed:
>    (qemu_mutex_iothread_locked())
> 
> Running QEMU with "-d in_asm" shows that the crash happens when writing
> to SPR 0x3f2, so we are missing to lock the iothread in the code path
> here.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>

Reviewed-by: Cédric Le Goater <clg@kaod.org>
Tested-by: Cédric Le Goater <clg@kaod.org>

Thanks,

C.

> ---
>   hw/ppc/ppc.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c
> index f5d012f860..bb57f1c9ed 100644
> --- a/hw/ppc/ppc.c
> +++ b/hw/ppc/ppc.c
> @@ -336,6 +336,8 @@ void store_40x_dbcr0(CPUPPCState *env, uint32_t val)
>   {
>       PowerPCCPU *cpu = env_archcpu(env);
>   
> +    qemu_mutex_lock_iothread();
> +
>       switch ((val >> 28) & 0x3) {
>       case 0x0:
>           /* No action */
> @@ -353,6 +355,8 @@ void store_40x_dbcr0(CPUPPCState *env, uint32_t val)
>           ppc40x_system_reset(cpu);
>           break;
>       }
> +
> +    qemu_mutex_unlock_iothread();
>   }
>   
>   /* PowerPC 40x internal IRQ controller */
> 



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

* Re: [PATCH] hw/ppc: Fix iothread locking in the 405 code
  2021-10-06  7:11 [PATCH] hw/ppc: Fix iothread locking in the 405 code Thomas Huth
  2021-10-06  8:15 ` Cédric Le Goater
@ 2021-10-07  0:48 ` David Gibson
  1 sibling, 0 replies; 3+ messages in thread
From: David Gibson @ 2021-10-07  0:48 UTC (permalink / raw)
  To: Thomas Huth; +Cc: qemu-ppc, qemu-devel, Greg Kurz

[-- Attachment #1: Type: text/plain, Size: 1420 bytes --]

On Wed, Oct 06, 2021 at 09:11:40AM +0200, Thomas Huth wrote:
> When using u-boot as firmware with the taihu board, QEMU aborts with
> this assertion:
> 
>  ERROR:../accel/tcg/tcg-accel-ops.c:79:tcg_handle_interrupt: assertion failed:
>   (qemu_mutex_iothread_locked())
> 
> Running QEMU with "-d in_asm" shows that the crash happens when writing
> to SPR 0x3f2, so we are missing to lock the iothread in the code path
> here.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>

Applied to ppc-for-6.2, thanks.

> ---
>  hw/ppc/ppc.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c
> index f5d012f860..bb57f1c9ed 100644
> --- a/hw/ppc/ppc.c
> +++ b/hw/ppc/ppc.c
> @@ -336,6 +336,8 @@ void store_40x_dbcr0(CPUPPCState *env, uint32_t val)
>  {
>      PowerPCCPU *cpu = env_archcpu(env);
>  
> +    qemu_mutex_lock_iothread();
> +
>      switch ((val >> 28) & 0x3) {
>      case 0x0:
>          /* No action */
> @@ -353,6 +355,8 @@ void store_40x_dbcr0(CPUPPCState *env, uint32_t val)
>          ppc40x_system_reset(cpu);
>          break;
>      }
> +
> +    qemu_mutex_unlock_iothread();
>  }
>  
>  /* PowerPC 40x internal IRQ controller */

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2021-10-07  0:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-06  7:11 [PATCH] hw/ppc: Fix iothread locking in the 405 code Thomas Huth
2021-10-06  8:15 ` Cédric Le Goater
2021-10-07  0:48 ` David Gibson

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.