Skip to content

Direct memory access for devices (v2)

Avi Kivity qemu-devel 1 version Applied

Status from this message: Applied all. Thanks.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 4 repliesApplied

Changes from v1 from the cover letter

- documented memory mapping API
- added access_len parameter to unmap operation, to indicate how much memory was actually accessed
- move QEMUIOVector to cutils.c, and add flatten/unflatten operations
- change block format driver API to accept a QEMUIOVector rather than a bare struct iovec

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/5Add target memory mapping APIcpu-all.h exec.c+108 -01 reply
2/5Add map client retry notificationcpu-all.h exec.c+42 -02 replies
3/5I/O vector helperscutils.c qemu-common.h+59 -00 replies
4/5Vectored block device APIblock.c block.h+76 -00 replies
5/5Convert IDE to directly access guest memoryhw/ide.c+117 -160 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [Qemu-devel] [PATCH 0/5] Direct memory access for devices (v2)

One of the deficiencies of the current device layer is that it can only access guest RAM via cpu_physical_memory_rw(). This means that the device emulation code must copy the memory to or from a temporary buffer, even though the host offers APIs which allow direct access to memory. This reduces efficiency on DMA capable devices, especially disks.

This patchset introduces a complement to the read/write API, cpu_physical_memory_map() which allows device emulation code to map guest memory directly. The API bounces memory regions which cannot be mapped (such as mmio regions) using an internal buffer.

As an example, IDE emulation is converted to use the new API. This exposes another deficiency: lack of scatter/gather support in the block layer. To work around this, a vectored block API is introduced, currently emulated by bouncing. Additional work is needed to convert all block format drivers to use the vectored API.

Changes from v1:
- documented memory mapping API
- added access_len parameter to unmap operation, to indicate how much memory was actually accessed
- move QEMUIOVector to cutils.c, and add flatten/unflatten operations
- change block format driver API to accept a QEMUIOVector rather than a bare struct iovec

Avi Kivity (5):
Add target memory mapping API
Add map client retry notification
I/O vector helpers
Vectored block device API
Convert IDE to directly access guest memory

 block.c       |   68 +++++++++++++++++++++++++++
 block.h       |    8 +++
 cpu-all.h     |    8 +++
 cutils.c      |   47 +++++++++++++++++++
 exec.c        |  142 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 hw/ide.c      |  133 +++++++++++++++++++++++++++++++++++++++++++++++------
 qemu-common.h |   12 +++++
 7 files changed, 402 insertions(+), 16 deletions(-)