@@ -3056,6 +3056,11 @@ static MemTxResult flatview_write_continue(FlatView *fv, hwaddr addr,
if (release_lock) {
qemu_mutex_unlock_iothread();
+ if (mr->name && !strcmp(mr->name, "ide") && atomic_xchg_my_flag(0)) {
+ printf("start sleep");
+ usleep(5 * 1000 * 1000);
+ printf("end sleep");
+ }
release_lock = false;
}
w00185384@HGHY1w001853841 /cygdrive/f/GitHome/opensource/qemu
$ git diff
@@ -3056,6 +3056,11 @@ static MemTxResult flatview_write_continue(FlatView *fv, hwaddr addr,
if (release_lock) {
qemu_mutex_unlock_iothread();
+ if (mr->name && !strcmp(mr->name, "ide") && atomic_xchg_my_flag(0)) {
+ printf("start sleep");
+ usleep(5 * 1000 * 1000);
+ printf("end sleep");
+ }
release_lock = false;
}
@@ -51,6 +51,11 @@ static void bmdma_start_dma(IDEDMA *dma, IDEState *s,
if (bm->status & BM_STATUS_DMAING) {
bm->dma_cb(bmdma_active_if(bm), 0);
}
+
+ if (!(bm->status & BM_STATUS_DMAING) && bm->dma_cb &&
+ IDE_DMA_ATAPI == bmdma_active_if(bm)->dma_cmd) {
+ atomic_xchg_my_flag(1);
+ }
}
/**
@@ -47,4 +47,6 @@ void info_report(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
const char *error_get_progname(void);
extern bool enable_timestamp_msg;
+int atomic_xchg_my_flag(int flag);
+
#endif
@@ -310,3 +310,9 @@ void info_report(const char *fmt, ...)
vreport(REPORT_TYPE_INFO, fmt, ap);
va_end(ap);
}
+
+int atomic_xchg_my_flag(int flag)
+{
+ static int my_flag = 0;
+ return atomic_xchg(&my_flag, flag);
+}