Re: [PATCH v10 11/12] iommu: Per-domain I/O page fault handling

From: Jason Gunthorpe
Date: Sat Jul 23 2022 - 10:34:56 EST


On Tue, Jul 05, 2022 at 01:07:09PM +0800, Lu Baolu wrote:
> Tweak the I/O page fault handling framework to route the page faults to
> the domain and call the page fault handler retrieved from the domain.
> This makes the I/O page fault handling framework possible to serve more
> usage scenarios as long as they have an IOMMU domain and install a page
> fault handler in it. Some unused functions are also removed to avoid
> dead code.
>
> The iommu_get_domain_for_dev_pasid() which retrieves attached domain
> for a {device, PASID} pair is used. It will be used by the page fault
> handling framework which knows {device, PASID} reported from the iommu
> driver. We have a guarantee that the SVA domain doesn't go away during
> IOPF handling, because unbind() won't free the domain until all the
> pending page requests have been flushed from the pipeline. The drivers
> either call iopf_queue_flush_dev() explicitly, or in stall case, the
> device driver is required to flush all DMAs including stalled
> transactions before calling unbind().
>
> This also renames iopf_handle_group() to iopf_handler() to avoid
> confusing.
>
> Signed-off-by: Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx>
> Reviewed-by: Jean-Philippe Brucker <jean-philippe@xxxxxxxxxx>
> Tested-by: Zhangfei Gao <zhangfei.gao@xxxxxxxxxx>
> Tested-by: Tony Zhu <tony.zhu@xxxxxxxxx>
> ---
> drivers/iommu/io-pgfault.c | 68 +++++---------------------------------
> 1 file changed, 9 insertions(+), 59 deletions(-)

Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx>

Jason