Skip to content

RFC KVM PCI/MSI passthrough with mach-virt

Eric Auger qemu-arm qemu-devel 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 RFC Latest8 patches 4 repliesIn review
  2. v4 RFC8 patches 0 repliesSuperseded
  3. v3 RFC8 patches 1 replySuperseded

Changes in v5 from the cover letter

- update linux header according to last user API changes introduced in [PATCH v14 00/16] KVM PCIe/MSI passthrough on ARM/ARM64
- fix compilation issue on platforms not setting CONFIG_PLATFORM_BUS
- squash [RFC v4 3/8] hw: vfio: common: Introduce vfio_register_msi_iova into the last patch to avoid compilation warning

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8linux-headers: Partial update for MSI IOVA handlinglinux-headers/linux/vfio.h+28 -20 replies
2/8hw: vfio: common: vfio_get_iommu_type1_infohw/vfio/common.c+27 -60 replies
3/8memory: Add reserved_iova region typeinclude/exec/memory.h memory.c+40 -00 replies
4/8memory: memory_region_find_by_nameinclude/exec/memory.h memory.c+27 -00 replies
5/8hw: platform-bus: Enable to map any memory region onto the platform-bushw/core/platform-bus.c include/hw/platform-bus.h+24 -100 replies
6/8hw: platform-bus: Add platform bus stubhw/core/Makefile.objs hw/core/platform-bus-stub.c+28 -10 replies
7/8hw: vfio: common: vfio_prepare_msi_mappinghw/vfio/common.c+68 -00 replies
8/8hw: vfio: common: Adapt vfio_listeners for reserved_iova regionhw/vfio/common.c+53 -150 replies

Reviews trailers per patch

1 of 8 patches has a Reviewed-by or Acked-by.

PatchPeter Maydell
1/8
2/8
3/8
4/8
5/8R-b
6/8
7/8
8/8

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v5 thread

Cover letter [Qemu-arm] [RFC v5 0/8] KVM PCI/MSI passthrough with mach-virt

On ARM, MSI transactions emitted by passthrough'ed devices are translated by the IOMMU. So the host must allocate IOVAs and map them to the host MSI frame physical addresses. Those IOVAs must be allocated within safe GPA slots, unused by the guest.

The QEMU VFIO device retrieves the size if the IOVA window needed by the host using a new VFIO IOMMU type capability chain API. This window is allocated on guest address space withing the platform bus memory container. This latter acts as a pool of usable GPA and comes with its own GPA allocator. The memory region is tagged as "reserved_iova". The vfio_listener_region_add callback is in charge of passing the window characteristics to the kernel through an extended VFIO_IOMMU_MAP_DMA ioctl.

Best Regards

Eric

Dependencies:
The series depends on the not yet upstream kernel series:
[PATCH v14 00/16] KVM PCIe/MSI passthrough on ARM/ARM64,
https://lkml.org/lkml/2016/10/12/347

Git:
https://github.com/eauger/qemu/tree/v2.7.0-passthrough-rfc-v5

History:

RFC v4 -> RFC v5:
- update linux header according to last user API changes introduced in [PATCH v14 00/16] KVM PCIe/MSI passthrough on ARM/ARM64
- fix compilation issue on platforms not setting CONFIG_PLATFORM_BUS
- squash [RFC v4 3/8] hw: vfio: common: Introduce vfio_register_msi_iova into the last patch to avoid compilation warning

RFCv3 -> RFC v4:
- initialize err to NULL in vfio_connect_container and fix hint

RFCv2 -> RFC v3:
- IOVA aperture size is not arbitrary anymore. It is retrieved from the host usig VFIO IOMMU type capability chain API
- GPEX related patches removed since the warning is not seen anymore

RFC v1 -> RFC v2:
- now uses platform bus MMIO for mapping reserved IOVA region; hence the new patch file:
"hw: platform-bus: enable to map any memory region onto the platform-bus"

Eric Auger (8):
linux-headers: Partial update for MSI IOVA handling
hw: vfio: common: vfio_get_iommu_type1_info
memory: Add reserved_iova region type
memory: memory_region_find_by_name
hw: platform-bus: Enable to map any memory region onto the
platform-bus
hw: platform-bus: Add platform bus stub
hw: vfio: common: vfio_prepare_msi_mapping
hw: vfio: common: Adapt vfio_listeners for reserved_iova region

 hw/core/Makefile.objs       |   2 +-
 hw/core/platform-bus-stub.c |  27 +++++++
 hw/core/platform-bus.c      |  27 ++++---
 hw/vfio/common.c            | 169 ++++++++++++++++++++++++++++++++++++++------
 include/exec/memory.h       |  40 +++++++++++
 include/hw/platform-bus.h   |   7 ++
 linux-headers/linux/vfio.h  |  30 +++++++-
 memory.c                    |  27 +++++++
 8 files changed, 295 insertions(+), 34 deletions(-)
 create mode 100644 hw/core/platform-bus-stub.c
Signature · 1 line
1.9.1