Re: [PATCH v8 13/14] iommu/arm-smmu-v3: Report events that belong to devices attached to vIOMMU

Will Deacon
2025-03-11T15:56:45Z

On Tue, Feb 25, 2025 at 09:25:41AM -0800, Nicolin Chen wrote:
> Aside from the IOPF framework, iommufd provides an additional pathway to
> report hardware events, via the vEVENTQ of vIOMMU infrastructure.
>
> Define an iommu_vevent_arm_smmuv3 uAPI structure, and report stage-1 events
> in the threaded IRQ handler. Also, add another four event record types that
> can be forwarded to a VM.
>
> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
> Reviewed-by: Pranjal Shrivastavat <praan@google.com>
> Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
> ---
> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 7 +++
> include/uapi/linux/iommufd.h | 23 +++++++
> .../arm/arm-smmu-v3/arm-smmu-v3-iommufd.c | 17 ++++++
> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 60 +++++++++++--------
> 4 files changed, 82 insertions(+), 25 deletions(-)

[...]

> @@ -1866,7 +1869,14 @@ static int arm_smmu_handle_event(struct arm_smmu_device *smmu,
> goto out_unlock;
> }
>
> - ret = iommu_report_device_fault(master->dev, &fault_evt);
> + if (event->stall) {
> + ret = iommu_report_device_fault(master->dev, &fault_evt);
> + } else {
> + if (master->vmaster && !event->s2)
> + ret = arm_vmaster_report_event(master->vmaster, evt);
> + else
> + ret = -EOPNOTSUPP; /* Unhandled events should be pinned */
> + }

nit: You don't need this extra indentation.

Patch looks fine:

Acked-by: Will Deacon <will@kernel.org>

Will