]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
hw/arm/smmuv3: Fix addr_mask for range-based invalidation
authorZenghui Yu <yuzenghui@huawei.com>
Sat, 30 Jan 2021 04:32:20 +0000 (12:32 +0800)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 2 Feb 2021 17:00:54 +0000 (17:00 +0000)
When handling guest range-based IOTLB invalidation, we should decode the TG
field into the corresponding translation granule size so that we can pass
the correct invalidation range to backend. Set @granule to (tg * 2 + 10) to
properly emulate the architecture.

Fixes: d52915616c05 ("hw/arm/smmuv3: Get prepared for range invalidation")
Signed-off-by: Zenghui Yu <yuzenghui@huawei.com>
Acked-by: Eric Auger <eric.auger@redhat.com>
Message-id: 20210130043220.1345-1-yuzenghui@huawei.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/arm/smmuv3.c

index bbca0e9f2093865a34f228c5384ed2e99ce8a7db..98b99d4fe8ecdc2c8b6ab187aab9ed36d35f1438 100644 (file)
@@ -801,7 +801,7 @@ static void smmuv3_notify_iova(IOMMUMemoryRegion *mr,
 {
     SMMUDevice *sdev = container_of(mr, SMMUDevice, iommu);
     IOMMUTLBEvent event;
-    uint8_t granule = tg;
+    uint8_t granule;
 
     if (!tg) {
         SMMUEventInfo event = {.inval_ste_allowed = true};
@@ -821,6 +821,8 @@ static void smmuv3_notify_iova(IOMMUMemoryRegion *mr,
             return;
         }
         granule = tt->granule_sz;
+    } else {
+        granule = tg * 2 + 10;
     }
 
     event.type = IOMMU_NOTIFIER_UNMAP;