Hello all,

I am trying to understand how a virtio-block device updates "used" buffers
in the virtqueue. I intend to 'mimic' this process without the actual disk
event happening, by storing the used buffers and then re-using them later.
I can see that the function *virtqueue_fill *is primarily responsible for
filling up the virtqueue which eventually updates the guest memory.
*vring_used_write* eventually does a memcpy to write the used buffer
contents to the memory.

I do not understand what is the primary role of the *virtqueue_unmap_sg*
function. I have a few questions.

- What does this function do?

- Does it in any way modify the guest's physical memory?

- Why do we need to map and unmap the in_sg and out_sg into/out of the DMA
address space? Is this for updating the IOMMU and destroying the address
mappings that existed before?

- What happens if unmapping does not happen?

If there are good articles that describe this process of DMA address space
mapping/unmapping, feel free to point me to them and I would love to read
them too.

Thank you very much.
Best Regards,
Arnabjyoti Kalita

Reply via email to