[PATCH v7 06/12] media: iris: Skip DMA mask setup when the core device has no IOMMU

From: Vikash Garodia

Date: Fri Nov 20 2026 - 06:12:22 EST


Once the streams are described as context bank subnodes, the "iommus"
property no longer sits on the parent iris node. That device then has no
IOMMU domain of its own and never performs DMA directly, so calling
dma_set_mask_and_coherent() on it is meaningless, and on a device with no
IOMMU it can fail and abort probe.

Set the DMA mask only when device_iommu_mapped() reports an IOMMU on the
core device. IOVA reservation and cleanup are also skipped when the core
device is not attached to an IOMMU domain. Platforms that have not been
converted still carry "iommus" on the parent node and keep the existing
setup. For converted platforms the mask is applied to each context bank
device instead, in iris_create_cb_dev().

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxxxxxxxx>
Co-developed-by: Vishnu Reddy <busanna.reddy@xxxxxxxxxxxxxxxx>
Signed-off-by: Vishnu Reddy <busanna.reddy@xxxxxxxxxxxxxxxx>
Signed-off-by: Vikash Garodia <vikash.garodia@xxxxxxxxxxxxxxxx>
---
drivers/media/platform/qcom/iris/iris_probe.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/qcom/iris/iris_probe.c b/drivers/media/platform/qcom/iris/iris_probe.c
index 8b45a062a510dd0e96824e90d4398f9ef9294709..3c6c170a3d75f73b55d3abba0c6c8fa0378fd498 100644
--- a/drivers/media/platform/qcom/iris/iris_probe.c
+++ b/drivers/media/platform/qcom/iris/iris_probe.c
@@ -156,6 +156,9 @@ static void iris_unreserve_iova_region(struct device *dev, struct dma_iova_state
{
unsigned int i;

+ if (!device_iommu_mapped(dev))
+ return;
+
for (i = 0; dma_iova_size(&iova_state[i]); i++)
dma_iova_free(dev, &iova_state[i]);
}
@@ -169,6 +172,9 @@ static int iris_reserve_iova_region(struct device *dev, struct dma_iova_state **
unsigned int count = 0;
int ret = -ENOMEM;

+ if (!device_iommu_mapped(dev))
+ return 0;
+
state = devm_kzalloc_objs(dev, *state, BITS_PER_TYPE(dma_addr_t) + 1);
if (!state)
return ret;
@@ -464,9 +470,11 @@ static int iris_probe(struct platform_device *pdev)

dma_mask = core->iris_platform_data->dma_mask;

- ret = dma_set_mask_and_coherent(dev, dma_mask);
- if (ret)
- goto err_vdev_unreg_enc;
+ if (device_iommu_mapped(dev)) {
+ ret = dma_set_mask_and_coherent(dev, dma_mask);
+ if (ret)
+ goto err_vdev_unreg_enc;
+ }

dma_set_max_seg_size(&pdev->dev, DMA_BIT_MASK(32));
dma_set_seg_boundary(&pdev->dev, DMA_BIT_MASK(32));

--
2.34.1