qemu/hw/pci
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
..
Kconfig kconfig: Add PCIe devices to s390x machines 2023-07-14 11:10:57 +02:00
meson.build meson: remove CONFIG_ALL 2023-12-31 09:11:28 +01:00
msi.c hw/pci/msi: Restrict xen_is_pirq_msi() call to Xen 2024-03-09 18:51:45 +01:00
msix.c hw/pci: Constify VMState 2023-12-30 07:38:06 +11:00
pci_bridge.c pci: SLT must be RO 2023-10-04 04:53:52 -04:00
pci_host.c Revert "hw/pci: Rename has_power to enabled" 2024-08-01 04:32:00 -04:00
pci-hmp-cmds.c include/hw/pci: Split pci_device.h off pci.h 2023-01-08 01:54:22 -05:00
pci-internal.h hw/pci/aer: Make PCIE AER error injection facility available for other emulation to use. 2023-03-07 12:39:00 -05:00
pci-qmp-cmds.c pci: Move QMP commands to new hw/pci/pci-qmp-cmds.c 2022-12-19 16:15:17 +01:00
pci-stub.c pci: Move HMP command from hw/pci/pcie_aer.c to pci-hmp-cmds.c 2022-12-19 16:21:56 +01:00
pci.c softmmu: Support concurrent bounce buffers 2024-09-09 10:55:39 -04:00
pcie_aer.c hw/pci: Constify VMState 2023-12-30 07:38:06 +11:00
pcie_doe.c hw/pci: PCIe Data Object Exchange emulation 2022-11-07 13:12:19 -05:00
pcie_host.c include/hw/pci: Split pci_device.h off pci.h 2023-01-08 01:54:22 -05:00
pcie_port.c hw/pci: Add pcie_count_ds_port() and pcie_find_port_first() helpers 2023-03-07 19:51:07 -05:00
pcie_sriov.c Revert "pcie_sriov: Do not manually unrealize" 2024-08-01 04:32:00 -04:00
pcie.c virtio,pc,pci: features, cleanups, fixes 2024-03-13 15:11:53 +00:00
shpc.c hw/pci: add some convenient trace-events for pcie and shpc hotplug 2024-03-11 22:09:42 +01:00
slotid_cap.c include/hw/pci: Split pci_device.h off pci.h 2023-01-08 01:54:22 -05:00
trace-events Revert "pcie_sriov: Remove num_vfs from PCIESriovPF" 2024-08-01 04:32:00 -04:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00