Re: [PATCH v10 15/16] iommu: Make iopf_group_response() return void

From: Jason Gunthorpe
Date: Fri Feb 02 2024 - 10:36:56 EST


On Mon, Jan 22, 2024 at 01:43:07PM +0800, Lu Baolu wrote:
> The iopf_group_response() should return void, as nothing can do anything
> with the failure. This implies that ops->page_response() must also return
> void; this is consistent with what the drivers do. The failure paths,
> which are all integrity validations of the fault, should be WARN_ON'd,
> not return codes.
>
> If the iommu core fails to enqueue the fault, it should respond the fault
> directly by calling ops->page_response() instead of returning an error
> number and relying on the iommu drivers to do so. Consolidate the error
> fault handling code in the core.
>
> Co-developed-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
> Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
> Signed-off-by: Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx>
> ---
> include/linux/iommu.h | 14 +--
> drivers/iommu/intel/iommu.h | 4 +-
> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 50 +++-----
> drivers/iommu/intel/svm.c | 18 +--
> drivers/iommu/io-pgfault.c | 132 +++++++++++---------
> 5 files changed, 99 insertions(+), 119 deletions(-)

Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx>

>
> +static struct iopf_group *iopf_group_alloc(struct iommu_fault_param *iopf_param,
> + struct iopf_fault *evt,
> + struct iopf_group *abort_group)
> +{
> + struct iopf_fault *iopf, *next;
> + struct iopf_group *group;
> +
> + group = kzalloc(sizeof(*group), GFP_KERNEL);
> + if (!group) {
> + /*
> + * We always need to construct the group as we need it to abort
> + * the request at the driver if it cfan't be handled.
^^^^^^ can't


Jason