[PATCH v2.5/3] iommu/arm-smmu-v3: Undo SMMU enable on probe failure

Will Deacon will at kernel.org
Tue Nov 12 07:57:52 PST 2024


On Tue, Nov 12, 2024 at 02:49:59PM +0000, Robin Murphy wrote:
> If SMMU probe fails afer arm_smmu_device_reset(), we leave the SMMU
> enabled with an empty Stream Table, silently blocking all DMA. This
> proves rather annoying for debugging said probe failure, so let's handle
> it a bit better by putting the SMMU back into (more or less) the same
> state as if it hadn't probed at all.
> 
> Signed-off-by: Robin Murphy <robin.murphy at arm.com>
> ---
>  drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> index 7908fca962fe..566d66e9c91e 100644
> --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> @@ -4640,6 +4640,7 @@ static int arm_smmu_device_probe(struct platform_device *pdev)
>  	iommu_device_sysfs_remove(&smmu->iommu);
>  free_iopf:
>  	iopf_queue_free(smmu->evtq.iopf);
> +	arm_smmu_device_disable(smmu);
>  	return ret;
>  }

Heh, this is starting to look an awful lot like arm_smmu_device_remove()...

Will



More information about the linux-arm-kernel mailing list