Message ID | 20240701084957.1567641-1-eric.auger@redhat.com |
---|---|
Headers | show |
Series | VIRTIO-IOMMU/HostIOMMUDevice: Fixes and page size mask rework | expand |
On Mon, Jul 01, 2024 at 10:48:52AM +0200, Eric Auger wrote: > 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 So presumably will be merged with rest of host iommu stuff. For virtio bits: Reviewed-by: Michael S. Tsirkin <mst@redhat.com> > --- > 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(-) > > -- > 2.41.0
On 7/1/24 10:48 AM, Eric Auger wrote: > 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(-) > Applied to vfio-next. Thanks, C.