I am running QEMU version 5.0.1 in TCG mode. And I am looking for a mechanism to actually run disk read and disk write functions in the TCG guest execution loop. I am using the virtio-blk pci device and I am using a qcow2 image file.
static inline tcg_target_ulong cpu_tb_exec(CPUState *cpu, TranslationBlock *itb)
< disk I/O function here >
ret = tcg_qemu_tb_exec(env, tb_ptr);
I will run the disk I/O function based on some condition and I want it to execute synchronously. After it finishes I will run the tcg execution loop for that particular translated block.
Is it possible and acceptable to run disk I/O functions within the qemu main loop?
What are the steps I need to follow in order to ensure the disk I/O operation is complete before the execution of the current translated block?
If it matters, the host and target architecture is x86-64.
Thank you very much for all your help so far.