qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [PATCH v2] hw/arm/smmuv3: Simplify range invalidation


From: Liu, Renwei
Subject: RE: [PATCH v2] hw/arm/smmuv3: Simplify range invalidation
Date: Wed, 1 Sep 2021 06:33:25 +0000

> -----Original Message-----
> From: Eric Auger [mailto:eric.auger@redhat.com]
> Sent: Tuesday, August 31, 2021 10:46 PM
> To: Liu, Renwei; Peter Maydell
> Cc: qemu-arm@nongnu.org; qemu-devel@nongnu.org; Li, Chunming; Wen,
> Jianxian
> Subject: Re: [PATCH v2] hw/arm/smmuv3: Simplify range invalidation
> 
> Hi Liu,
> 
> On 8/23/21 9:50 AM, Liu, Renwei wrote:
> > Simplify range invalidation which can avoid to iterate over all
> > iotlb entries multi-times. For instance invalidations patterns like
> > "invalidate 32 4kB pages starting from 0xffacd000" need to iterate
> over
> > all iotlb entries 6 times (num_pages: 1, 2, 16, 8, 4, 1). It only
> needs
> > to iterate over all iotlb entries once with new implementation.
> 
> This wouldn't work. This reverts commit
> 6d9cd115b9df ("hw/arm/smmuv3: Enforce invalidation on a power of two
> range")
> which is mandated for VFIO and virtio to work. IOTLB invalidations must
> be naturally aligned and with a power of 2 range, hence this iteration.
> 
> Thanks
>
> Eric
Hi Eric,

Could you try the patch firstly? I want to know whether it's failed
in your application scenario with this implementation.
I agree with you that IOTLB entry must be naturally aligned and
with a power of 2 range. But we can invalidate multi IOTLB entries
in one iteration. We check the overlap between invalidation range
and IOTLB range, not check mask. The final result is same with
your implementation (split to multi times with a power of 2 range).
I wonder why we can't implement it directly when the application can
send an invalidation command with a non power of 2 range.
We have tested it in our application scenario and not find any fail.

In addition, from the code implementation, smmu_iotlb_inv_iova()
should be OK. In another call smmuv3_inv_notifiers_iova() ->
smmuv3_notify_iova() -> memory_region_notify_iommu_one(),
it also checks range overlap. So it should be OK if the range
is not a power of 2.

Could you take a look at it again?

Thanks
Renwei Liu

reply via email to

[Prev in Thread] Current Thread [Next in Thread]