intel-iommu: Document iova_tree

It seems not super clear on when iova_tree is used, and why.  Add a rich
comment above iova_tree to track why we needed the iova_tree, and when we
need it.

Also comment for the map/unmap messages, on how they're used and
implications (e.g. unmap can be larger than the mapped ranges).

Suggested-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20230109193727.1360190-1-peterx@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
Peter Xu
2023-01-27 11:47:02 -05:00
committed by Michael S. Tsirkin
parent bad9c5a516
commit 8a7c606016
2 changed files with 63 additions and 1 deletions
+26
View File
@@ -129,6 +129,32 @@ struct IOMMUTLBEntry {
/*
* Bitmap for different IOMMUNotifier capabilities. Each notifier can
* register with one or multiple IOMMU Notifier capability bit(s).
*
* Normally there're two use cases for the notifiers:
*
* (1) When the device needs accurate synchronizations of the vIOMMU page
* tables, it needs to register with both MAP|UNMAP notifies (which
* is defined as IOMMU_NOTIFIER_IOTLB_EVENTS below).
*
* Regarding to accurate synchronization, it's when the notified
* device maintains a shadow page table and must be notified on each
* guest MAP (page table entry creation) and UNMAP (invalidation)
* events (e.g. VFIO). Both notifications must be accurate so that
* the shadow page table is fully in sync with the guest view.
*
* (2) When the device doesn't need accurate synchronizations of the
* vIOMMU page tables, it needs to register only with UNMAP or
* DEVIOTLB_UNMAP notifies.
*
* It's when the device maintains a cache of IOMMU translations
* (IOTLB) and is able to fill that cache by requesting translations
* from the vIOMMU through a protocol similar to ATS (Address
* Translation Service).
*
* Note that in this mode the vIOMMU will not maintain a shadowed
* page table for the address space, and the UNMAP messages can cover
* more than the pages that used to get mapped. The IOMMU notifiee
* should be able to take care of over-sized invalidations.
*/
typedef enum {
IOMMU_NOTIFIER_NONE = 0,