Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3996103pxu; Wed, 9 Dec 2020 06:02:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJxL3fyI5prnlXasNI5fxyiWSu5DtzNg7kLT9fjIS5LOzUScHaoRM1AmyRRhF7L/Fk+y+3kX X-Received: by 2002:a05:6402:895:: with SMTP id e21mr2158204edy.284.1607522544158; Wed, 09 Dec 2020 06:02:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607522544; cv=none; d=google.com; s=arc-20160816; b=Wm5pCiMLpgQVoxiKsiI1YcG552y2MGPX3VnvnJbH32U1te2nEshnTb43eeIRTIRvoq otl4DH5x+FfULDOal+LzYDVTOg3RC6732XWbKAa7avFIx7L6XPxm34BkdMLQ5ASuReZJ bk2RsUapRz5Ugr61a7EuN3d5tYtsXf+EHXwHj4m3jrxQ84CWfEPqWGsT2Y6sgjov/Kik U9fmGL+ftz/sD7JKclHuMDOogE7J1SVjvgP/48PKPzATnGe56uHMj/KR0Rv/Iaapf28A s4UOZOKDZfXsb8AZGXAKgeTSbaGxfDj4ZBcbXD3tvCoXt/quL0/ufQp6Eb8SnU3REQSV rAZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=U1vVgkxvFw0bV598ojqcRiqubxn+04s1lugG24+brnQ=; b=e2OhFui9wcWEgkeAk2YBs+nMqMzS2vmTZH7g7+6/VXFzG9WczLjK3Oy86kWBE/pIgM ijl5BAW8YB4ttPQ98TdKHBGl0gEX3WYXXlL8fpTEIvCmvs28Izj+5mgHOacgWtJaErIL siUI/MoO840CeOl0zzK5ptF4maWeAbiQpEnhH2fbTUGXg4vhhokCQaRpAb7Zw4h6aaZv SsZ4asBgW4PeAqNBsXGJRso2sW2swMr0jve5YoepNHnkVqKXi742O/UkvvkgSrLfGRZR vBTVFn0FbLdJ0XtcwVrXqEqH3Ybmrpcgw2Z9G8WMnzwoKzqzfwaRC/nrab1b3CsoTOdZ hBGQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c25si838848edx.588.2020.12.09.06.01.55; Wed, 09 Dec 2020 06:02:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728929AbgLIIHf (ORCPT + 99 others); Wed, 9 Dec 2020 03:07:35 -0500 Received: from mailgw01.mediatek.com ([210.61.82.183]:52643 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728723AbgLIIFf (ORCPT ); Wed, 9 Dec 2020 03:05:35 -0500 X-UUID: a8e0e510645748d7904469ee4f517edf-20201209 X-UUID: a8e0e510645748d7904469ee4f517edf-20201209 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1748252722; Wed, 09 Dec 2020 16:04:51 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 9 Dec 2020 16:04:25 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 9 Dec 2020 16:04:28 +0800 From: Yong Wu To: Joerg Roedel , Matthias Brugger , Rob Herring , Will Deacon , Robin Murphy CC: Krzysztof Kozlowski , Evan Green , Tomasz Figa , , , , , , , , , Nicolas Boichat , , Subject: [PATCH v5 20/27] iommu/mediatek: Add single domain Date: Wed, 9 Dec 2020 16:00:55 +0800 Message-ID: <20201209080102.26626-21-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20201209080102.26626-1-yong.wu@mediatek.com> References: <20201209080102.26626-1-yong.wu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Defaultly the iova range is 0-4G. here we add a single-domain(0-4G) for the previous SoC. this also is a preparing patch for supporting multi-domains. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index 6a909efc984f..c3a6712c497b 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -162,6 +162,10 @@ struct mtk_iommu_iova_region { unsigned long long size; }; +static const struct mtk_iommu_iova_region single_domain[] = { + {.iova_base = 0, .size = SZ_4G}, +}; + /* * There may be 1 or 2 M4U HWs, But we always expect they are in the same domain * for the performance. @@ -936,6 +940,8 @@ static const struct mtk_iommu_plat_data mt2712_data = { .m4u_plat = M4U_MT2712, .flags = HAS_4GB_MODE | HAS_BCLK | HAS_VLD_PA_RNG, .inv_sel_reg = REG_MMU_INV_SEL_GEN1, + .iova_region = single_domain, + .iova_region_nr = ARRAY_SIZE(single_domain), .larbid_remap = {{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}}, }; @@ -943,6 +949,8 @@ static const struct mtk_iommu_plat_data mt6779_data = { .m4u_plat = M4U_MT6779, .flags = HAS_SUB_COMM | OUT_ORDER_WR_EN | WR_THROT_EN, .inv_sel_reg = REG_MMU_INV_SEL_GEN2, + .iova_region = single_domain, + .iova_region_nr = ARRAY_SIZE(single_domain), .larbid_remap = {{0}, {1}, {2}, {3}, {5}, {7, 8}, {10}, {9}}, }; @@ -950,6 +958,8 @@ static const struct mtk_iommu_plat_data mt8167_data = { .m4u_plat = M4U_MT8167, .flags = RESET_AXI | HAS_LEGACY_IVRP_PADDR, .inv_sel_reg = REG_MMU_INV_SEL_GEN1, + .iova_region = single_domain, + .iova_region_nr = ARRAY_SIZE(single_domain), .larbid_remap = {{0}, {1}, {2}}, /* Linear mapping. */ }; @@ -958,6 +968,8 @@ static const struct mtk_iommu_plat_data mt8173_data = { .flags = HAS_4GB_MODE | HAS_BCLK | RESET_AXI | HAS_LEGACY_IVRP_PADDR, .inv_sel_reg = REG_MMU_INV_SEL_GEN1, + .iova_region = single_domain, + .iova_region_nr = ARRAY_SIZE(single_domain), .larbid_remap = {{0}, {1}, {2}, {3}, {4}, {5}}, /* Linear mapping. */ }; @@ -965,6 +977,8 @@ static const struct mtk_iommu_plat_data mt8183_data = { .m4u_plat = M4U_MT8183, .flags = RESET_AXI, .inv_sel_reg = REG_MMU_INV_SEL_GEN1, + .iova_region = single_domain, + .iova_region_nr = ARRAY_SIZE(single_domain), .larbid_remap = {{0}, {4}, {5}, {6}, {7}, {2}, {3}, {1}}, }; -- 2.18.0