On Wed, 8 Jul 2020 at 15:19, Eric Auger <[email protected]> wrote:
>
> Enhance the smmu_iotlb_inv_iova() helper with range invalidation.
> This uses the new fields passed in the NH_VA and NH_VAA commands:
> the size of the range, the level and the granule.
>
> As NH_VA and NH_VAA both use those fields, their decoding and
> handling is factorized in a new smmuv3_s1_range_inval() helper.
>
> Signed-off-by: Eric Auger <[email protected]>
> ---
> -inline void smmu_iotlb_inv_iova(SMMUState *s, int asid, dma_addr_t iova)
> +inline void
> +smmu_iotlb_inv_iova(SMMUState *s, int asid, dma_addr_t iova,
> + uint8_t tg, uint64_t num_pages, uint8_t ttl)
> {
> - SMMUIOTLBPageInvInfo info = {.asid = asid, .iova = iova};
> + if (ttl && (num_pages == 1)) {
> + SMMUIOTLBKey key = smmu_get_iotlb_key(asid, iova, tg, ttl);
>
> - trace_smmu_iotlb_inv_iova(asid, iova);
> - g_hash_table_foreach_remove(s->iotlb, smmu_hash_remove_by_asid_iova,
> &info);
> + g_hash_table_remove(s->iotlb, &key);
> + } else {
> + /* if tg is not set we use 4KB range invalidation */
Over-indented here.
> + uint8_t granule = tg ? tg * 2 + 10 : 12;
> +
> + SMMUIOTLBPageInvInfo info = {
> + .asid = asid, .iova = iova,
> + .mask = (num_pages * 1 << granule) - 1};
> +
> + g_hash_table_foreach_remove(s->iotlb,
> + smmu_hash_remove_by_asid_iova,
> + &info);
> + }
>
Otherwise
Reviewed-by: Peter Maydell <[email protected]>
thanks
-- PMM