qemu/include/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
..
msi.h hw/xen: Support MSI mapping to PIRQ 2023-03-01 09:09:22 +00:00
msix.h msix: Assert that specified vector is in range 2022-11-07 14:08:17 -05:00
pci_bridge.h pci: SLT must be RO 2023-10-04 04:53:52 -04:00
pci_bus.h hw/pci: modify pci_setup_iommu() to set PCIIOMMUOps 2023-11-03 09:20:31 +01:00
pci_device.h softmmu: Support concurrent bounce buffers 2024-09-09 10:55:39 -04:00
pci_host.h hw/pci/pci_host: Introduce PCI_HOST_BYPASS_IOMMU macro 2023-07-10 16:29:17 -04:00
pci_ids.h pci_ids/tulip: Add PCI vendor ID for HP and use it in tulip 2023-10-17 23:13:19 +02:00
pci_regs.h pcie: Add 1.2 version token for the Power Management Capability 2022-03-06 05:08:23 -05:00
pci.h Revert "hw/pci: Rename has_power to enabled" 2024-08-01 04:32:00 -04:00
pcie_aer.h pci: remove some types from typedefs.h 2024-05-03 15:47:48 +02:00
pcie_doe.h hw/nvme: Add SPDM over DOE support 2024-07-22 20:15:42 -04:00
pcie_host.h include/hw/pci/pcie_host: Correct PCIE_MMCFG_SIZE_MAX 2022-05-16 16:15:40 -04:00
pcie_port.h hw/pci: Add pcie_count_ds_port() and pcie_find_port_first() helpers 2023-03-07 19:51:07 -05:00
pcie_regs.h pcie: Support PCIe Gen5/Gen6 link speeds 2024-03-12 17:56:55 -04:00
pcie_sriov.h Revert "pcie_sriov: Ensure VF function number does not overflow" 2024-08-01 04:32:00 -04:00
pcie.h pci: remove some types from typedefs.h 2024-05-03 15:47:48 +02:00
shpc.h hw/pci: Constify VMState 2023-12-30 07:38:06 +11:00
slotid_cap.h Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00