Re: [PATCH v3 03/19] iommu: Add iommu_domain ops for dirty tracking

Jason Gunthorpe
2023-10-13T16:06:14Z

On Sat, Sep 23, 2023 at 02:24:55AM +0100, Joao Martins wrote:

> +/**
> + * struct iommu_dirty_bitmap - Dirty IOVA bitmap state
> + * @bitmap: IOVA bitmap
> + * @gather: Range information for a pending IOTLB flush
> + */
> +struct iommu_dirty_bitmap {
> + struct iova_bitmap *bitmap;
> + struct iommu_iotlb_gather *gather;
> +};

Why the struct ?

> +
> +/**
> + * struct iommu_dirty_ops - domain specific dirty tracking operations
> + * @set_dirty_tracking: Enable or Disable dirty tracking on the iommu domain
> + * @read_and_clear_dirty: Walk IOMMU page tables for dirtied PTEs marshalled
> + * into a bitmap, with a bit represented as a page.
> + * Reads the dirty PTE bits and clears it from IO
> + * pagetables.
> + */
> +struct iommu_dirty_ops {
> + int (*set_dirty_tracking)(struct iommu_domain *domain, bool enabled);
> + int (*read_and_clear_dirty)(struct iommu_domain *domain,
> + unsigned long iova, size_t size,
> + unsigned long flags,
> + struct iommu_dirty_bitmap *dirty);
> +};

vs 1 more parameter here?

vs putting more stuff in the struct?

Jason