]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
ppc: avoid QEMU IRQ lock inversion
authorStefan Reinauer <stefan.reinauer@coreboot.org>
Mon, 25 May 2026 17:47:45 +0000 (10:47 -0700)
committerStefan Reinauer <stefan.reinauer@coreboot.org>
Tue, 2 Jun 2026 23:49:08 +0000 (16:49 -0700)
QEMU 10 and newer take the BQL inside ppc_set_irq(). The external
interrupt path can call into QEMU while still holding the UAE PPC
spinlock.

That can deadlock if the main thread waits for QEMU BQL while the
QEMU CPU thread waits for the UAE spinlock.

Use the release-spinlock path for external interrupt injection. This
matches the ordering used for QEMU memory mapping and state changes.

ppc/ppc.cpp

index 1b5df8f6c743ffeff77bf01b8462e34b5a7574c6..b9b315c3caa84879430ddff20c643e33e9cb62d7 100644 (file)
@@ -939,7 +939,7 @@ void uae_ppc_interrupt(bool active)
                return;
        }
 
-       PPCLockStatus status = get_ppc_lock(PPC_KEEP_SPINLOCK);
+       PPCLockStatus status = get_ppc_lock(PPC_RELEASE_SPINLOCK);
        impl.external_interrupt(active);
        release_ppc_lock(status);
 }