qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Zheyu Ma <zheyuma97@gmail.com>
To: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Cc: Zheyu Ma <zheyuma97@gmail.com>,
	qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Subject: [PATCH] adb: Fix assertion failure in adb_request() by blocking/unblocking autopoll
Date: Tue, 18 Jun 2024 17:36:01 +0200	[thread overview]
Message-ID: <20240618153602.3169932-1-zheyuma97@gmail.com> (raw)

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



                 reply	other threads:[~2024-06-18 15:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240618153602.3169932-1-zheyuma97@gmail.com \
    --to=zheyuma97@gmail.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).