qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] adb: Fix assertion failure in adb_request() by blocking/unblocking autopoll
@ 2024-06-18 15:36 Zheyu Ma
  0 siblings, 0 replies; only message in thread
From: Zheyu Ma @ 2024-06-18 15:36 UTC (permalink / raw)
  To: Mark Cave-Ayland; +Cc: Zheyu Ma, qemu-ppc, qemu-devel

This commit addresses an assertion failure in the adb_request()
function. The failure occurs because the autopoll feature is not
properly blocked/unblocked during an ADB request. By calling
adb_autopoll_block() at the beginning and adb_autopoll_unblock() at
the end of the adb_request() function, we ensure that autopolling is
correctly managed.

Reproducer:
cat << EOF | qemu-system-m68k -display none
-machine accel=qtest, -m 512M -machine q800 -qtest stdio
write 0x5000166d 0x1 0x10
write 0x5000000b 0x1 0x10
EOF

Signed-off-by: Zheyu Ma zheyuma97@gmail.com
---
 hw/input/adb.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/input/adb.c b/hw/input/adb.c
index aff7130fd0..2d65ad3f4d 100644
--- a/hw/input/adb.c
+++ b/hw/input/adb.c
@@ -98,10 +98,12 @@ int adb_request(ADBBusState *s, uint8_t *obuf, const uint8_t *buf, int len)
 
     trace_adb_bus_request(buf[0] >> 4, adb_commands[buf[0] & 0xf], len);
 
-    assert(s->autopoll_blocked);
+    adb_autopoll_block(s);
 
     ret = do_adb_request(s, obuf, buf, len);
 
+    adb_autopoll_unblock(s);
+
     trace_adb_bus_request_done(buf[0] >> 4, adb_commands[buf[0] & 0xf], ret);
     return ret;
 }
-- 
2.34.1



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2024-06-18 15:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-18 15:36 [PATCH] adb: Fix assertion failure in adb_request() by blocking/unblocking autopoll Zheyu Ma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).