Hi Jason, On Fri, 7 Feb 2025 10:46:00 -0400 Jason Gunthorpe <jgg@xxxxxxxxxx> wrote: > virtio-iommu and fsl_pamu are the only two drivers left that still > rely on ops.domain_alloc() > > Update virtio-iommu to have a global static identity domain, implement > domain_alloc_paging(), and finalize its domain during allocation > instead of on first attach. > > As virtio-iommu was the last real iommu driver using domain_alloc() > update the core code to isolate the remains to fsl_pamu. > > I tested this using qemu x86 7.0.0 and 9.2.0 with a mlx5 VFIO PCI > device. The kernel behaves the same after this series. > > However, there seem to be some unrelated qemu bugs. 7.0.0 does not > have working VIRTIO_IOMMU_F_BYPASS_CONFIG and neither qemu works with > an IDENTITY domain using !VIRTIO_IOMMU_F_BYPASS_CONFIG. It prints: > > qemu-system-x86_64: iommu has granularity incompatible with target AS > qemu-system-x86_64: iommu map to non memory area 80000000 > qemu-system-x86_64: iommu map to non memory area c0000000 > qemu-system-x86_64: iommu map to non memory area e0000000 > qemu-system-x86_64: iommu map to non memory area f0000000 > qemu-system-x86_64: iommu map to non memory area f8000000 > qemu-system-x86_64: iommu map to non memory area fc000000 > qemu-system-x86_64: iommu map to non memory area fe000000 > qemu-system-x86_64: iommu map to non memory area fe800000 > qemu-system-x86_64: iommu map to non memory area 0 > qemu-system-x86_64: iommu map to non memory area fef00000 > qemu-system-x86_64: iommu map to non memory area ff000000 > qemu-system-x86_64: iommu has granularity incompatible with target AS > qemu-system-x86_64: iommu map to non memory area 200000000 > qemu-system-x86_64: iommu map to non memory area 400000000 > qemu-system-x86_64: iommu map to non memory area 800000000 > qemu-system-x86_64: iommu map to non memory area 1000000000 > qemu-system-x86_64: iommu map to non memory area 2000000000 > qemu-system-x86_64: iommu map to non memory area 4000000000 I see the same on arm64 with v9.0, assigned an ixgbe nic via VFIO. qemu-system-aarch64: iommu map to non memory area 0 qemu-system-aarch64: iommu map to non memory area 8100000 qemu-system-aarch64: iommu map to non memory area 8200000 qemu-system-aarch64: iommu map to non memory area 8400000 qemu-system-aarch64: iommu map to non memory area 8800000 qemu-system-aarch64: iommu map to non memory area 0 qemu-system-aarch64: iommu map to non memory area 0 qemu-system-aarch64: iommu map to non memory area c000000 qemu-system-aarch64: iommu map to non memory area 10000000 qemu-system-aarch64: iommu map to non memory area 20000000 qemu-system-aarch64: iommu has granularity incompatible with target AS qemu-system-aarch64: iommu map to non memory area 200000000 qemu-system-aarch64: iommu map to non memory area 400000000 qemu-system-aarch64: iommu map to non memory area 800000000 qemu-system-aarch64: iommu map to non memory area 1000000000 qemu-system-aarch64: iommu map to non memory area 2000000000 qemu-system-aarch64: iommu map to non memory area 4000000000 qemu-system-aarch64: iommu map to non memory area 8000000000 qemu-system-aarch64: iommu map to non memory area 10000000000 qemu-system-aarch64: iommu map to non memory area 20000000000 qemu-system-aarch64: iommu map to non memory area 40000000000 qemu-system-aarch64: iommu map to non memory area 80000000000 qemu-system-aarch64: iommu map to non memory area 100000000000 qemu-system-aarch64: iommu map to non memory area 200000000000 qemu-system-aarch64: iommu map to non memory area 400000000000 qemu-system-aarch64: iommu map to non memory area 800000000000 > Jason Gunthorpe (5): > iommu/virtio: Break out bypass identity support into a global static > iommu: Add domain_alloc_identity() > iommu/virtio: Move to domain_alloc_paging() > iommu: Do not call domain_alloc() in iommu_sva_domain_alloc() > iommu: Hide ops.domain_alloc behind CONFIG_FSL_PAMU > > drivers/iommu/iommu-sva.c | 15 ++- > drivers/iommu/iommu.c | 16 +-- > drivers/iommu/virtio-iommu.c | 200 > +++++++++++++++++++++-------------- include/linux/iommu.h | > 10 +- 4 files changed, 141 insertions(+), 100 deletions(-) > > > base-commit: 2014c95afecee3e76ca4a56956a936e23283f05b