The 2 first patches are fixes of
cf2647a76e ("virtio-iommu: Compute host reserved regions")
They can be taken separately of the rest.
Then the series uses the HostIOMMUDevice interface to fetch
information about the page size mask supported along the assigned
device and propagate it to the virtio-iommu. This is a similar
work as what was done in
VIRTIO-IOMMU/VFIO: Fix host iommu geometry handling series
but this time for the page size mask. Using this new
infrastructure allows to handle page size mask conflicts
earlier on device hotplug as opposed to current QEMU
abort:
qemu-system-aarch64: virtio-iommu virtio-iommu-memory-region-8-0
does not support frozen granule 0x10000
qemu: hardware error: vfio: DMA mapping failed, unable to continue
With this series the hotplug nicely fails.
Also this allows to remove hacks consisting in transiently enabling
IOMMU MRs to collect coldplugged device page size mask before machine
init. Those hacks were introduced by
94df5b2180d6 ("virtio-iommu: Fix 64kB host page size VFIO device
assignment")
The series can be found at:
https://github.com/eauger/qemu/tree/virtio-iommu-psmask-rework-v2
---
v1 -> v2:
- Don't update mask if the granule is frozen (Zhenzhong)
- Collected Zhenzhong's and Cédric's R-bs
Eric Auger (7):
virtio-iommu: Fix error handling in
virtio_iommu_set_host_iova_ranges()
vfio-container-base: Introduce vfio_container_get_iova_ranges() helper
HostIOMMUDevice : remove Error handle from get_iova_ranges callback
HostIOMMUDevice: Introduce get_page_size_mask() callback
virtio-iommu : Retrieve page size mask on
virtio_iommu_set_iommu_device()
memory: remove IOMMU MR iommu_set_page_size_mask() callback
virtio-iommu: Revert transient enablement of IOMMU MR in bypass mode
include/exec/memory.h | 38 --------
include/hw/vfio/vfio-container-base.h | 9 ++
include/sysemu/host_iommu_device.h | 11 ++-
hw/vfio/common.c | 8 --
hw/vfio/container-base.c | 15 ++++
hw/vfio/container.c | 16 ++--
hw/vfio/iommufd.c | 21 +++--
hw/virtio/virtio-iommu.c | 123 +++++++++++++-------------
system/memory.c | 13 ---
hw/virtio/trace-events | 2 +-
10 files changed, 119 insertions(+), 137 deletions(-)