qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

adb: only call autopoll callbacks when autopoll is not blocked

Handle this at the ADB bus level so that individual implementations do not need
to handle this themselves.

Finally add an assert() into adb_request() to prevent developers from accidentally
making an explicit ADB request without blocking autopoll.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Tested-by: Finn Thain <fthain@telegraphics.com.au>
Acked-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20200623204936.24064-21-mark.cave-ayland@ilande.co.uk>

+6 -7
+5 -2
hw/input/adb.c
··· 86 86 87 87 int adb_request(ADBBusState *s, uint8_t *obuf, const uint8_t *buf, int len) 88 88 { 89 + assert(s->autopoll_blocked); 90 + 89 91 return do_adb_request(s, obuf, buf, len); 90 92 } 91 93 92 - /* XXX: move that to cuda ? */ 93 94 int adb_poll(ADBBusState *s, uint8_t *obuf, uint16_t poll_mask) 94 95 { 95 96 ADBDevice *d; ··· 181 182 { 182 183 ADBBusState *s = opaque; 183 184 184 - s->autopoll_cb(s->autopoll_cb_opaque); 185 + if (!s->autopoll_blocked) { 186 + s->autopoll_cb(s->autopoll_cb_opaque); 187 + } 185 188 186 189 timer_mod(s->autopoll_timer, 187 190 qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) +
+1 -5
hw/misc/mac_via.c
··· 615 615 * received, however we must block autopoll until the point where 616 616 * the entire reply has been read back to the host 617 617 */ 618 - if (adb_bus->autopoll_blocked) { 619 - return; 620 - } else { 621 - adb_autopoll_block(adb_bus); 622 - } 618 + adb_autopoll_block(adb_bus); 623 619 624 620 m->adb_data_in_index = 0; 625 621 m->adb_data_out_index = 0;