Skip to content

Commit f7da2da

Browse files
YongWu-HFjoergroedel
authored andcommitted
iommu/mediatek: Set dma_mask for the master devices
MediaTek iommu arranges dma ranges for all the masters, this patch is to help them set dma mask. This is to avoid each master setting their own mask, but also to avoid a real issue, such as JPEG uses "mediatek,mtk-jpgenc" for 2701/8183/8186/8188, then JPEG could ignore its different dma_mask in different SoC to achieve common code. Signed-off-by: Yong Wu <yong.wu@mediatek.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20230411093144.2690-10-yong.wu@mediatek.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent 3df9bdd commit f7da2da

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

drivers/iommu/mtk_iommu.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,14 @@ static int mtk_iommu_attach_device(struct iommu_domain *domain,
738738
}
739739
mutex_unlock(&data->mutex);
740740

741+
if (region_id > 0) {
742+
ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(34));
743+
if (ret) {
744+
dev_err(m4udev, "Failed to set dma_mask for %s(%d).\n", dev_name(dev), ret);
745+
return ret;
746+
}
747+
}
748+
741749
return mtk_iommu_config(data, dev, true, region_id);
742750

743751
err_unlock:

0 commit comments

Comments
 (0)