Skip to contentSkip to conversation

hw/arm/smmuv3: Pass the actual perm to returned IOMMUTLBEntry in smmuv3_translate()

PATCH Applied chenxiang via 2 participants 2 messages Apr 16, 2022 – Apr 22, 2022

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 hw/arm/smmuv3: Pass the actual perm to returned IOMMUTLBEntry in smmuv3_translate()

From: Xiang Chen <[email protected]>

It always calls the IOMMU MR translate() callback with flag=IOMMU_NONE in memory_region_iommu_replay(). Currently, smmuv3_translate() return an IOMMUTLBEntry with perm set to IOMMU_NONE even if the translation success, whereas it is expected to return the actual permission set in the table entry.
So pass the actual perm to returned IOMMUTLBEntry in the table entry.

---
 hw/arm/smmuv3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/arm/smmuv3.c +1 -1
index 674623aabe..707eb430c2 100644
@@ -760,7 +760,7 @@ epilogue:
     qemu_mutex_unlock(&s->mutex);
     switch (status) {
     case SMMU_TRANS_SUCCESS:
-        entry.perm = flag;
+        entry.perm = cached_entry->entry.perm;
         entry.translated_addr = cached_entry->entry.translated_addr +
                                     (addr & cached_entry->entry.addr_mask);
         entry.addr_mask = cached_entry->entry.addr_mask;
Signature · 1 line
2.33.0
#1 lore raw
Quoted 10 lines · chenxiang via

From: Xiang Chen <[email protected]>

It always calls the IOMMU MR translate() callback with flag=IOMMU_NONE in memory_region_iommu_replay(). Currently, smmuv3_translate() return an IOMMUTLBEntry with perm set to IOMMU_NONE even if the translation success, whereas it is expected to return the actual permission set in the table entry.
So pass the actual perm to returned IOMMUTLBEntry in the table entry.

Quoted 3 lines

---

Applied to target-arm.next, thanks.

-- PMM