[PATCH v2.5/3] iommu/arm-smmu-v3: Undo SMMU enable on probe failure
Robin Murphy
robin.murphy at arm.com
Tue Nov 12 08:25:08 PST 2024
On 12/11/2024 3:57 pm, Will Deacon wrote:
> 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()...
Indeed, functionally that's rather the point; implementation-wise, you
know I'd branch straight into the middle of a different function if the
language let me :)
Robin.
More information about the linux-arm-kernel
mailing list