Re: [PATCH v5 08/10] dmaengine: tegra: Use iommu-map for stream ID

Akhil R
2026-03-30T18:21:26Z

On Mon, 30 Mar 2026 14:15:43 -0400, Frank Li wrote:
> On Mon, Mar 30, 2026 at 11:32:40PM +0530, Akhil R wrote:
>> On Mon, 30 Mar 2026 12:47:24 -0400, Frank Li wrote:
>> > On Mon, Mar 30, 2026 at 08:14:54PM +0530, Akhil R wrote:
>> >> Use 'iommu-map', when provided, to get the stream ID to be programmed
>> >> for each channel. Iterate over the channels registered and configure
>> >> each channel device separately using of_dma_configure_id() to allow
>> >> it to use a separate IOMMU domain for the transfer. However, do this
>> >> in a second loop since the first loop populates the DMA device channels
>> >> list and async_device_register() registers the channels. Both are
>> >> prerequisites for using the channel device in the next loop.
>> >>
>> >> Channels will continue to use the same global stream ID if the
>> >> 'iommu-map' property is not present in the device tree.
>> >>
>> >> Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
>> >> ---
>> > ...
>> >>
>> >> + /*
>> >> + * Configure stream ID for each channel from the channels registered
>> >> + * above. This is done in a separate iteration to ensure that only
>> >> + * the channels available and registered for the DMA device are used.
>> >> + */
>> >> + list_for_each_entry(chan, &tdma->dma_dev.channels, device_node) {
>> >> + chdev = &chan->dev->device;
>> >> + tdc = to_tegra_dma_chan(chan);
>> >> +
>> >> + if (use_iommu_map) {
>> >> + chdev->bus = pdev->dev.bus;
>> >> + dma_coerce_mask_and_coherent(chdev, DMA_BIT_MASK(cdata->addr_bits));
>> >> +
>> >> + ret = of_dma_configure_id(chdev, pdev->dev.of_node,
>> >> + true, &tdc->id);
>> >> + if (ret)
>> >> + return dev_err_probe(chdev, ret,
>> >> + "Failed to configure IOMMU for channel %d", tdc->id);
>> >> +
>> >> + if (!tegra_dev_iommu_get_stream_id(chdev, &stream_id)) {
>> >> + dev_err(chdev, "Failed to get stream ID for channel %d\n",
>> >> + tdc->id);
>> >> + return -EINVAL;
>> >
>> > Can you check similar problem before post patch, here also can use
>> > return dev_err_probe()
>>
>> I did notice that, but I thought dev_err_probe is to handle -EPROBE_DEFER
>> and we do not use it when we return a fixed value. It returns -EINVAL here
>> directly.
>
> even that, still can use return dev_err_probe(chddev, -EINVAL, ...) to
> short your code.

I just saw in the dev_err_probe() description that it is not limited to
-EPROBE_DEFER. Thanks for pointing. I will update the patch.

Best Regards,
Akhil