From 9f3b8c283d4c1014ff292faddb78bbbfd7ec22d3 Mon Sep 17 00:00:00 2001 From: Nicolin Chen Date: Tue, 9 Apr 2024 01:49:26 +0000 Subject: [PATCH] hw/arm/smmuv3: Ignore IOMMU_NOTIFIER_MAP for nested-smmuv3 If a device's MemmoryRegion type is iommu, vfio core registers a listener, passing the IOMMU_NOTIFIER_IOTLB_EVENTS flag (bundle of IOMMU_NOTIFIER_MAP and IOMMU_NOTIFIER_UNMAP). On the other hand, nested SMMUv3 does not use a map notifier. And it would only insert an IOTLB entry for MSI doorbell page mapping, which can simply be done by the mr->translate call. Ignore the IOMMU_NOTIFIER_MAP flag and drop the error out. Signed-off-by: Nicolin Chen --- hw/arm/smmuv3.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c index 64ca4c5542..db111220c7 100644 --- a/hw/arm/smmuv3.c +++ b/hw/arm/smmuv3.c @@ -1881,12 +1881,9 @@ static int smmuv3_notify_flag_changed(IOMMUMemoryRegion *iommu, return -EINVAL; } - if (new & IOMMU_NOTIFIER_MAP) { - error_setg(errp, - "device %02x.%02x.%x requires iommu MAP notifier which is " - "not currently supported", pci_bus_num(sdev->bus), - PCI_SLOT(sdev->devfn), PCI_FUNC(sdev->devfn)); - return -EINVAL; + /* nested-smmuv3 does not need IOMMU_NOTIFIER_MAP. Ignore it. */ + if (s->nested) { + new &= ~IOMMU_NOTIFIER_MAP; } if (old == IOMMU_NOTIFIER_NONE) { -- 2.41.0.windows.1