Skip to contentSkip to conversation

iommu/mediatek: Set dma_mask for PGTABLE_PA_35_EN

PATCH In review Yong Wu 2 participants 2 messages Mar 16, 2023

Subsystems (3)
lore
Share & tools
lore

Yong Wu

author maintainer
#0 lore raw

PATCH v3 1/1 iommu/mediatek: Set dma_mask for PGTABLE_PA_35_EN

When we enable PGTABLE_PA_35_EN, the PA for pgtable may be 35bits. Thus add dma_mask for it.

Fixes 301c3ca12576 ("iommu/mediatek: Allow page table PA up to 35bit")

---
v3: Sorry for a typo. Change from "if (!ret)" to "if (ret)".

v2: Just move this out from mt8188 series. Nothing change.

v1: https://lore.kernel.org/linux-mediatek/[email protected]/

---
 drivers/iommu/mtk_iommu.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/iommu/mtk_iommu.c +8 -0
index d5a4955910ff..6a00ce208dc2 100644
@@ -1258,6 +1258,14 @@ static int mtk_iommu_probe(struct platform_device *pdev)
 			return PTR_ERR(data->bclk);
 	}
 
+	if (MTK_IOMMU_HAS_FLAG(data->plat_data, PGTABLE_PA_35_EN)) {
+		ret = dma_set_mask(dev, DMA_BIT_MASK(35));
+		if (ret) {
+			dev_err(dev, "Failed to set dma_mask 35.\n");
+			return ret;
+		}
+	}
+
 	pm_runtime_enable(dev);
 
 	if (MTK_IOMMU_IS_TYPE(data->plat_data, MTK_IOMMU_TYPE_MM)) {
Signature · 1 line
2.25.1
#1 lore raw

Il 16/03/23 11:14, Yong Wu ha scritto:

Quoted 9 lines

When we enable PGTABLE_PA_35_EN, the PA for pgtable may be 35bits. Thus add dma_mask for it.

Fixes 301c3ca12576 ("iommu/mediatek: Allow page table PA up to 35bit")

---
v3: Sorry for a typo. Change from "if (!ret)" to "if (ret)".

I was just about to make you notice. Glad you've fixed that promptly and before giving me a chance to complain! :-P

Good job!

Cheers,
Angelo

Quoted 27 lines

v2: Just move this out from mt8188 series. Nothing change.

v1: https://lore.kernel.org/linux-mediatek/[email protected]/

---
  drivers/iommu/mtk_iommu.c | 8 ++++++++
  1 file changed, 8 insertions(+)
drivers/iommu/mtk_iommu.c +8 -0
index d5a4955910ff..6a00ce208dc2 100644
@@ -1258,6 +1258,14 @@ static int mtk_iommu_probe(struct platform_device *pdev)
  			return PTR_ERR(data->bclk);
  	}
 
+	if (MTK_IOMMU_HAS_FLAG(data->plat_data, PGTABLE_PA_35_EN)) {
+		ret = dma_set_mask(dev, DMA_BIT_MASK(35));
+		if (ret) {
+			dev_err(dev, "Failed to set dma_mask 35.\n");
+			return ret;
+		}
+	}
+
  	pm_runtime_enable(dev);
 
  	if (MTK_IOMMU_IS_TYPE(data->plat_data, MTK_IOMMU_TYPE_MM)) {