Re: [PATCH v7 03/10] iommu/sva: Add iommu_sva_domain support

Jean-Philippe Brucker
2022-05-25T11:07:17Z

On Wed, May 25, 2022 at 11:07:49AM +0100, Robin Murphy wrote:
> > Did you mean @handler and @handler_token staffs below?
> >
> > struct iommu_domain {
> >         unsigned type;
> >         const struct iommu_domain_ops *ops;
> >         unsigned long pgsize_bitmap;    /* Bitmap of page sizes in use */
> >         iommu_fault_handler_t handler;
> >         void *handler_token;
> >         struct iommu_domain_geometry geometry;
> >         struct iommu_dma_cookie *iova_cookie;
> > };
> >
> > Is it only for DMA domains? From the point view of IOMMU faults, it
> > seems to be generic.
>
> Yes, it's the old common iommu_set_fault_handler() stuff (which arguably is
> more of a "notifier" than a "handler"), but I assume that that's irrelevant
> if SVA is using IOPF instead?

Yes IOMMU drivers call either the newer iommu_report_device_fault() or the
old report_iommu_fault(), and only the former can support IOPF/SVA. I've
tried to merge them before but never completed it. I think the main issue
was with finding the endpoint that caused the fault from the fault
handler. Some IOMMU drivers just pass the IOMMU device to
report_iommu_fault(). I'll probably pick that up at some point.

Thanks,
Jean