Skip to content

Commit 45c9d72

Browse files
committed
cuda: add adb_autopoll_block() and adb_autopoll_unblock() functions
Ensure that the CUDA buffer is protected from autopoll requests overwriting its contents whilst existing CUDA requests are in progress. Signed-off-by: Mark Cave-Ayland <[email protected]> Tested-by: Finn Thain <[email protected]> Acked-by: Laurent Vivier <[email protected]> Message-Id: <[email protected]>
1 parent 4e5df03 commit 45c9d72

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

hw/misc/macio/cuda.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ static void cuda_update(CUDAState *s)
116116
{
117117
MOS6522CUDAState *mcs = &s->mos6522_cuda;
118118
MOS6522State *ms = MOS6522(mcs);
119+
ADBBusState *adb_bus = &s->adb_bus;
119120
int packet_received, len;
120121

121122
packet_received = 0;
@@ -126,6 +127,9 @@ static void cuda_update(CUDAState *s)
126127
/* data output */
127128
if ((ms->b & (TACK | TIP)) != (s->last_b & (TACK | TIP))) {
128129
if (s->data_out_index < sizeof(s->data_out)) {
130+
if (s->data_out_index == 0) {
131+
adb_autopoll_block(adb_bus);
132+
}
129133
trace_cuda_data_send(ms->sr);
130134
s->data_out[s->data_out_index++] = ms->sr;
131135
cuda_delay_set_sr_int(s);
@@ -140,6 +144,7 @@ static void cuda_update(CUDAState *s)
140144
/* indicate end of transfer */
141145
if (s->data_in_index >= s->data_in_size) {
142146
ms->b = (ms->b | TREQ);
147+
adb_autopoll_unblock(adb_bus);
143148
}
144149
cuda_delay_set_sr_int(s);
145150
}

0 commit comments

Comments
 (0)