Thread (12 messages) 12 messages, 3 authors, 2025-11-20

Re: [PATCH 3/3] iommu: Allow drivers to say if they use report_iommu_fault()

From: Jason Gunthorpe <jgg@nvidia.com>
Date: 2025-10-23 16:59:00
Also in: linux-arm-msm, linux-iommu, linux-mediatek, linux-patches, linux-rdma, linux-rockchip, linux-sunxi

On Thu, Oct 23, 2025 at 11:54:34AM -0300, Jason Gunthorpe wrote:
On Thu, Oct 23, 2025 at 12:24:01PM +0100, Robin Murphy wrote:
quoted
On 2025-10-22 6:12 pm, Jason Gunthorpe wrote:
quoted
report_iommu_fault() is an older API that has been superseded by
iommu_report_device_fault() which is capable to support PRI.

Only two external drivers consume this, drivers/remoteproc and
drivers/gpu/drm/msm. Ideally they would move over to the new APIs, but for
now protect against accidentally mix and matching the wrong components.

The iommu drivers support either the old iommu_set_fault_handler() via the
driver calling report_iommu_fault(), or they are newer server focused
drivers that call iommu_report_device_fault().

Include a flag in the domain_ops if it calls report_iommu_fault() and
block iommu_set_fault_handler() on iommu's that can't support it.
This isn't a domain operation though; depending on how you look at it,
supporting a legacy fault_handler is either a capability of the IOMMU driver
(that would be reachable via domain->owner->capable) or a property of the
iommu_domain itself that the drivers can set at allocation time (basically
this same patch just with the lines in slightly different places).
That's right, the issue is:

void iommu_set_fault_handler(struct iommu_domain *domain,
					iommu_fault_handler_t handler,
					void *token)

We can't get to the iommu instance starting from a domain pointer

Do you think we should change the above signature to include a
struct device *?
Reading this again, it is easy to move it to the domain->owner, which
is an *ops* pointer. It would still be driver global and not
per-instance. Lets try that then

I like adding a iommu_paging_domain_alloc_flags() option too..

Jason
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help