[PATCH v3 2/4] iommu/io-pgtable-arm: Add read_and_clear_dirty() support
Jason Gunthorpe
jgg at nvidia.com
Wed May 22 05:37:44 PDT 2024
On Wed, May 22, 2024 at 07:12:27AM +0000, Tian, Kevin wrote:
> > +static int arm_lpae_read_and_clear_dirty(struct io_pgtable_ops *ops,
> > + unsigned long iova, size_t size,
> > + unsigned long flags,
> > + struct iommu_dirty_bitmap *dirty)
> > +{
> > + struct arm_lpae_io_pgtable *data = io_pgtable_ops_to_data(ops);
> > + struct io_pgtable_cfg *cfg = &data->iop.cfg;
> > + struct io_pgtable_walk_data walk_data = {
> > + .dirty = dirty,
> > + .flags = flags,
> > + .addr = iova,
> > + .end = iova + size,
> > + };
> > + arm_lpae_iopte *ptep = data->pgd;
> > + int lvl = data->start_level;
> > +
> > + if (WARN_ON(!size))
> > + return -EINVAL;
> > + if (WARN_ON((iova + size - 1) & ~(BIT(cfg->ias) - 1)))
> > + return -EINVAL;
> > + if (data->iop.fmt != ARM_64_LPAE_S1)
> > + return -EINVAL;
> > +
> > + return __arm_lpae_iopte_walk_dirty(data, &walk_data, ptep, lvl);
>
> Intel/AMD drivers also checks:
>
> if (!dmar_domain->dirty_tracking && dirty->bitmap)
> return -EINVAL;
Those both seem redundant checks on a fast path?
Jason
More information about the linux-arm-kernel
mailing list