Skip to content

Commit b07eba7

Browse files
YongWu-HFjoergroedel
authored andcommitted
iommu/mediatek: Fix share pgtable for iova over 4GB
In mt8192/mt8186, there is only one MM IOMMU that supports 16GB iova space, which is shared by display, vcodec and camera. These two SoC use one pgtable and have not the flag SHARE_PGTABLE, we should also keep share pgtable for this case. In mtk_iommu_domain_finalise, MM IOMMU always share pgtable, thus remove the flag SHARE_PGTABLE checking. Infra IOMMU always uses independent pgtable. Fixes: cf69ef4 ("iommu/mediatek: Fix two IOMMU share pagetable issue") Reported-by: Laura Nao <[email protected]> Closes: https://lore.kernel.org/linux-iommu/[email protected]/ Signed-off-by: Yong Wu <[email protected]> Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Tested-by: Laura Nao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 6465e26 commit b07eba7

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

drivers/iommu/mtk_iommu.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ struct mtk_iommu_data {
262262
struct device *smicomm_dev;
263263

264264
struct mtk_iommu_bank_data *bank;
265-
struct mtk_iommu_domain *share_dom; /* For 2 HWs share pgtable */
265+
struct mtk_iommu_domain *share_dom;
266266

267267
struct regmap *pericfg;
268268
struct mutex mutex; /* Protect m4u_group/m4u_dom above */
@@ -643,8 +643,8 @@ static int mtk_iommu_domain_finalise(struct mtk_iommu_domain *dom,
643643
struct mtk_iommu_domain *share_dom = data->share_dom;
644644
const struct mtk_iommu_iova_region *region;
645645

646-
/* Always use share domain in sharing pgtable case */
647-
if (MTK_IOMMU_HAS_FLAG(data->plat_data, SHARE_PGTABLE) && share_dom) {
646+
/* Share pgtable when 2 MM IOMMU share the pgtable or one IOMMU use multiple iova ranges */
647+
if (share_dom) {
648648
dom->iop = share_dom->iop;
649649
dom->cfg = share_dom->cfg;
650650
dom->domain.pgsize_bitmap = share_dom->cfg.pgsize_bitmap;
@@ -677,8 +677,7 @@ static int mtk_iommu_domain_finalise(struct mtk_iommu_domain *dom,
677677
/* Update our support page sizes bitmap */
678678
dom->domain.pgsize_bitmap = dom->cfg.pgsize_bitmap;
679679

680-
if (MTK_IOMMU_HAS_FLAG(data->plat_data, SHARE_PGTABLE))
681-
data->share_dom = dom;
680+
data->share_dom = dom;
682681

683682
update_iova_region:
684683
/* Update the iova region for this domain */

0 commit comments

Comments
 (0)