Re: [PATCH v10 03/14] media: iris: Add helper to create a context bank device

Vishnu Reddy <[email protected]>
Newsgroups dev.linux.lists.sashiko-reviews,org.kernel.vger.linux-devicetree
Message-ID <[email protected]>
On 7/26/2026 11:33 AM, [email protected] wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [High] The newly created context bank device is never attached to an IOMMU domain because `of_dma_configure()` is not called.
> --
>
> --- Patch [3]: [PATCH v10 03/14] media: iris: Add helper to create a context bank device ---
> commit 461ae3ede65da976a81591c71089c7621d163869
> Author: Vikash Garodia <[email protected]>
>
> media: iris: Add helper to create a context bank device
>     
> This commit adds a helper function to create a context bank device for the
> iris driver. The subnode in the device tree is registered as a separate
> device so that it gets its own IOMMU context for mapping pixel/non-pixel
> buffers.
>
>> diff --git a/drivers/media/platform/qcom/iris/iris_resources.c b/drivers/media/platform/qcom/iris/iris_resources.c
>> index 773f6548370a2..a685915a19e9b 100644
>> --- a/drivers/media/platform/qcom/iris/iris_resources.c
>> +++ b/drivers/media/platform/qcom/iris/iris_resources.c
> [ ... ]
>
>> @@ -141,3 +142,30 @@ int iris_disable_unprepare_clock(struct iris_core *core, enum platform_clk_type
>>  
>>  	return 0;
>>  }
> [ ... ]
>
>> +	pdev = platform_device_register_full(&plat_dev_info);
>> +	of_node_put(child_of_node);
>> +	if (IS_ERR(pdev))
>> +		return ERR_CAST(pdev);
>> +
>> +	dma_set_max_seg_size(&pdev->dev, DMA_BIT_MASK(32));
>> +	dma_set_seg_boundary(&pdev->dev, DMA_BIT_MASK(32));
>> +
>> +	return &pdev->dev;
>> +}
> [Severity: High]
> Since this subnode device won't be probed by a driver (due to lacking a
> compatible string), it won't go through the device driver core's
> really_probe() which would automatically call platform_dma_configure().
>
> Will this newly created context bank device fail to attach to an IOMMU domain
> without an explicit call to of_dma_configure() here? If it isn't attached,
> could subsequent dma_map_* calls using this device bypass the IOMMU or fail?

This is not true, please refer the other path

device_add() (called by platform_device_add(), which
platform_device_register_full() invokes) unconditionally calls
bus_notify(dev, BUS_NOTIFY_ADD_DEVICE) in core.c. For any device on a
bus in iommu_buses[] (platform bus included), that fires
iommu_bus_notifier() → iommu_probe_device() → __iommu_probe_device() →
iommu_init_device(), all at device-registration time, independent of any
driver binding. And iommu_init_device() explicitly handles exactly this case
dev->bus->dma_configure(dev);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.