From: Yong Wu <yong.wu@mediatek.com>
To: Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
Rob Herring <robh+dt@kernel.org>,
Matthias Brugger <matthias.bgg@gmail.com>
Cc: Robin Murphy <robin.murphy@arm.com>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Yong Wu <yong.wu@mediatek.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
<iommu@lists.linux.dev>, <linux-mediatek@lists.infradead.org>,
<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<mingyuan.ma@mediatek.com>, <yf.wang@mediatek.com>,
<jianjiao.zeng@mediatek.com>, <chengci.xu@mediatek.com>
Subject: [PATCH v12 6/7] iommu/mediatek: mt8188: Add iova_region_larb_msk
Date: Fri, 2 Jun 2023 17:02:26 +0800 [thread overview]
Message-ID: <20230602090227.7264-7-yong.wu@mediatek.com> (raw)
In-Reply-To: <20230602090227.7264-1-yong.wu@mediatek.com>
Add iova_region_larb_msk for mt8188. We separate the 16GB iova regions
by each device's larbid/portid.
Refer to include/dt-bindings/memory/mediatek,mt8188-memory-port.h
As commented in the code, larb19(21) means it's larb19 while its SW index
is 21.
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
drivers/iommu/mtk_iommu.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index 5c66af0c45a8..b17d3e7288a7 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -1606,6 +1606,20 @@ static const struct mtk_iommu_plat_data mt8188_data_infra = {
.iova_region_nr = ARRAY_SIZE(single_domain),
};
+static const u32 mt8188_larb_region_msk[MT8192_MULTI_REGION_NR_MAX][MTK_LARB_NR_MAX] = {
+ [0] = {~0, ~0, ~0, ~0}, /* Region0: all ports for larb0/1/2/3 */
+ [1] = {0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, ~0, ~0, ~0}, /* Region1: larb19(21)/21(22)/23 */
+ [2] = {0, 0, 0, 0, ~0, ~0, ~0, ~0, /* Region2: the other larbs. */
+ ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0,
+ ~0, ~0, ~0, ~0, ~0, 0, 0, 0,
+ 0, ~0},
+ [3] = {0},
+ [4] = {[24] = BIT(0) | BIT(1)}, /* Only larb27(24) port0/1 */
+ [5] = {[24] = BIT(2) | BIT(3)}, /* Only larb27(24) port2/3 */
+};
+
static const struct mtk_iommu_plat_data mt8188_data_vdo = {
.m4u_plat = M4U_MT8188,
.flags = HAS_BCLK | HAS_SUB_COMM_3BITS | OUT_ORDER_WR_EN |
@@ -1617,6 +1631,7 @@ static const struct mtk_iommu_plat_data mt8188_data_vdo = {
.banks_enable = {true},
.iova_region = mt8192_multi_dom,
.iova_region_nr = ARRAY_SIZE(mt8192_multi_dom),
+ .iova_region_larb_msk = mt8188_larb_region_msk,
.larbid_remap = {{2}, {0}, {21}, {0}, {19}, {9, 10,
11 /* 11a */, 25 /* 11c */},
{13, 0, 29 /* 16b */, 30 /* 17b */, 0}, {5}},
@@ -1633,6 +1648,7 @@ static const struct mtk_iommu_plat_data mt8188_data_vpp = {
.banks_enable = {true},
.iova_region = mt8192_multi_dom,
.iova_region_nr = ARRAY_SIZE(mt8192_multi_dom),
+ .iova_region_larb_msk = mt8188_larb_region_msk,
.larbid_remap = {{1}, {3}, {23}, {7}, {MTK_INVALID_LARBID},
{12, 15, 24 /* 11b */}, {14, MTK_INVALID_LARBID,
16 /* 16a */, 17 /* 17a */, MTK_INVALID_LARBID,
--
2.25.1
next prev parent reply other threads:[~2023-06-02 9:03 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-02 9:02 [PATCH v12 0/7] MT8188 IOMMU SUPPORT Yong Wu
2023-06-02 9:02 ` [PATCH v12 1/7] dt-bindings: mediatek: mt8188: Add binding for MM & INFRA IOMMU Yong Wu
2023-08-17 8:21 ` Chen-Yu Tsai
2023-06-02 9:02 ` [PATCH v12 2/7] iommu/mediatek: Fix two IOMMU share pagetable issue Yong Wu
2023-06-06 13:59 ` Alexandre Mergnat
2023-08-18 15:41 ` Laura Nao
2023-08-19 8:45 ` Yong Wu (吴勇)
2023-06-02 9:02 ` [PATCH v12 3/7] iommu/mediatek: Adjust mtk_iommu_config flow Yong Wu
2023-06-06 14:00 ` Alexandre Mergnat
2023-06-02 9:02 ` [PATCH v12 4/7] iommu/mediatek: Add enable IOMMU SMC command for INFRA masters Yong Wu
2023-06-06 14:04 ` Alexandre Mergnat
2023-06-02 9:02 ` [PATCH v12 5/7] iommu/mediatek: Add MT8188 IOMMU Support Yong Wu
2023-06-06 14:16 ` Alexandre Mergnat
2023-08-08 9:53 ` Chen-Yu Tsai
2023-08-10 12:22 ` Yong Wu (吴勇)
2023-08-11 3:30 ` Chen-Yu Tsai
2023-08-14 7:14 ` Yong Wu (吴勇)
2023-08-14 8:21 ` Chen-Yu Tsai
2023-08-17 8:01 ` Yong Wu (吴勇)
2023-08-17 8:10 ` Chen-Yu Tsai
2023-06-02 9:02 ` Yong Wu [this message]
2023-06-06 14:19 ` [PATCH v12 6/7] iommu/mediatek: mt8188: Add iova_region_larb_msk Alexandre Mergnat
2023-06-02 9:02 ` [PATCH v12 7/7] MAINTAINERS: iommu/mediatek: Update the header file name Yong Wu
2023-07-25 7:59 ` [PATCH v12 0/7] MT8188 IOMMU SUPPORT Fei Shao
[not found] ` <cc910b5c3ec130f092a37049d71bb35c20b278a6.camel@mediatek.com>
2023-08-07 12:17 ` joro
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230602090227.7264-7-yong.wu@mediatek.com \
--to=yong.wu@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=chengci.xu@mediatek.com \
--cc=devicetree@vger.kernel.org \
--cc=iommu@lists.linux.dev \
--cc=jianjiao.zeng@mediatek.com \
--cc=joro@8bytes.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=mingyuan.ma@mediatek.com \
--cc=robh+dt@kernel.org \
--cc=robin.murphy@arm.com \
--cc=will@kernel.org \
--cc=yf.wang@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).