qemu/system
Mattias Nissler 637b0aa139 softmmu: Support concurrent bounce buffers
When DMA memory can't be directly accessed, as is the case when
running the device model in a separate process without shareable DMA
file descriptors, bounce buffering is used.

It is not uncommon for device models to request mapping of several DMA
regions at the same time. Examples include:
 * net devices, e.g. when transmitting a packet that is split across
   several TX descriptors (observed with igb)
 * USB host controllers, when handling a packet with multiple data TRBs
   (observed with xhci)

Previously, qemu only provided a single bounce buffer per AddressSpace
and would fail DMA map requests while the buffer was already in use. In
turn, this would cause DMA failures that ultimately manifest as hardware
errors from the guest perspective.

This change allocates DMA bounce buffers dynamically instead of
supporting only a single buffer. Thus, multiple DMA mappings work
correctly also when RAM can't be mmap()-ed.

The total bounce buffer allocation size is limited individually for each
AddressSpace. The default limit is 4096 bytes, matching the previous
maximum buffer size. A new x-max-bounce-buffer-size parameter is
provided to configure the limit for PCI devices.

Signed-off-by: Mattias Nissler <mnissler@rivosinc.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Acked-by: Peter Xu <peterx@redhat.com>
Link: https://lore.kernel.org/r/20240819135455.2957406-1-mnissler@rivosinc.com
Signed-off-by: Peter Xu <peterx@redhat.com>
2024-09-09 10:55:39 -04:00
..
arch_init.c
async-teardown.c qemu/osdep: Add excluded fd parameter to qemu_close_all_open_fd() 2024-08-05 08:21:59 +10:00
balloon.c
bootdevice.c
cpu-throttle.c
cpu-timers.c
cpus.c qmp: Fix higher half vaddrs for [p]memsave 2024-08-05 09:34:34 +02:00
datadir.c
device_tree-stub.c
device_tree.c
dirtylimit.c
dma-helpers.c
globals.c hw/xen: detect when running inside stubdomain 2024-07-01 14:57:18 +02:00
ioport.c
main.c
memory_ldst.c.inc
memory_mapping.c system/memory_mapping: make range overlap check more readable 2024-07-23 20:30:36 +02:00
memory.c softmmu: Support concurrent bounce buffers 2024-09-09 10:55:39 -04:00
meson.build
physmem.c softmmu: Support concurrent bounce buffers 2024-09-09 10:55:39 -04:00
qdev-monitor.c
qemu-seccomp.c
qtest.c qtest: move qtest_{get, set}_virtual_clock to accel/qtest/qtest.c 2024-06-24 10:14:56 +01:00
rtc.c
runstate-action.c
runstate-hmp-cmds.c
runstate.c replay: allow runstate shutdown->running when replaying trace 2024-08-16 14:04:19 +01:00
tpm-hmp-cmds.c
tpm.c
trace-events tracepoints: move physmem trace points 2024-07-05 12:33:37 +01:00
trace.h
vl.c system/vl.c: Print machine name, not "(null)", for unknown machine types 2024-08-23 12:08:11 +03:00
watchpoint.c