mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 17:53:56 -06:00
hw/arm/smmu-common: Manage IOTLB block entries
At the moment each entry in the IOTLB corresponds to a page sized mapping (4K, 16K or 64K), even if the page belongs to a mapped block. In case of block mapping this unefficiently consumes IOTLB entries. Change the value of the entry so that it reflects the actual mapping it belongs to (block or page start address and size). Also the level/tg of the entry is encoded in the key. In subsequent patches we will enable range invalidation. This latter is able to provide the level/tg of the entry. Encoding the level/tg directly in the key will allow to invalidate using g_hash_table_remove() when num_pages equals to 1. Signed-off-by: Eric Auger <eric.auger@redhat.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 20200728150815.11446-6-eric.auger@redhat.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
a755015855
commit
9e54dee71f
5 changed files with 67 additions and 25 deletions
|
@ -674,7 +674,7 @@ static IOMMUTLBEntry smmuv3_translate(IOMMUMemoryRegion *mr, hwaddr addr,
|
|||
page_mask = (1ULL << (tt->granule_sz)) - 1;
|
||||
aligned_addr = addr & ~page_mask;
|
||||
|
||||
cached_entry = smmu_iotlb_lookup(bs, cfg, aligned_addr);
|
||||
cached_entry = smmu_iotlb_lookup(bs, cfg, tt, aligned_addr);
|
||||
if (cached_entry) {
|
||||
if ((flag & IOMMU_WO) && !(cached_entry->entry.perm & IOMMU_WO)) {
|
||||
status = SMMU_TRANS_ERROR;
|
||||
|
@ -744,7 +744,7 @@ epilogue:
|
|||
case SMMU_TRANS_SUCCESS:
|
||||
entry.perm = flag;
|
||||
entry.translated_addr = cached_entry->entry.translated_addr +
|
||||
(addr & page_mask);
|
||||
(addr & cached_entry->entry.addr_mask);
|
||||
entry.addr_mask = cached_entry->entry.addr_mask;
|
||||
trace_smmuv3_translate_success(mr->parent_obj.name, sid, addr,
|
||||
entry.translated_addr, entry.perm);
|
||||
|
@ -972,7 +972,7 @@ static int smmuv3_cmdq_consume(SMMUv3State *s)
|
|||
|
||||
trace_smmuv3_cmdq_tlbi_nh_vaa(vmid, addr);
|
||||
smmuv3_inv_notifiers_iova(bs, -1, addr);
|
||||
smmu_iotlb_inv_all(bs);
|
||||
smmu_iotlb_inv_iova(bs, -1, addr);
|
||||
break;
|
||||
}
|
||||
case SMMU_CMD_TLBI_NH_VA:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue