>-----Original Message----- >From: Eric Auger <eric.au...@redhat.com> >Sent: Thursday, July 6, 2023 12:51 AM >Subject: [PATCH v2 1/2] virtio-iommu: Fix 64kB host page size VFIO device >assignment > >When running on a 64kB page size host and protecting a VFIO device with the >virtio-iommu, qemu crashes with this kind of message: > >qemu-kvm: virtio-iommu page mask 0xfffffffffffff000 is incompatible with >mask 0x20010000 >qemu: hardware error: vfio: DMA mapping failed, unable to continue > >This is due to the fact the IOMMU MR corresponding to the VFIO device is >enabled very late on domain attach, after the machine init. >The device reports a minimal 64kB page size but it is too late to be applied. >virtio_iommu_set_page_size_mask() fails and this causes >vfio_listener_region_add() to end up with hw_error(); > >To work around this issue, we transiently enable the IOMMU MR on machine >init to collect the page size requirements and then restore the bypass state. > >Fixes: 90519b9053 ("virtio-iommu: Add bypass mode support to assigned >device") >Signed-off-by: Eric Auger <eric.au...@redhat.com>
Reviewed-by: Zhenzhong Duan <zhenzhong.d...@intel.com> Thanks Zhenzhong