From patchwork Tue Mar 7 02:35:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yong Wu X-Patchwork-Id: 65200 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2200286wrd; Mon, 6 Mar 2023 18:39:14 -0800 (PST) X-Google-Smtp-Source: AK7set8nDFzUa925MVpy0yRnkvFYMZl9sIIXhM9sCTkl1kOHN7JeohQgX76XJ/Hnyry/jRhY1ZE2 X-Received: by 2002:a17:90b:3e8e:b0:233:ee50:d28b with SMTP id rj14-20020a17090b3e8e00b00233ee50d28bmr13174253pjb.16.1678156753816; Mon, 06 Mar 2023 18:39:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678156753; cv=none; d=google.com; s=arc-20160816; b=RNwoJmxU3LLadlZLAN8Z20s+7SZkpeuHl1vTbpkE+J+264N4UTRtqvaS+Ckuv6Phtf QM10FK8/XtLFLeVA+d8VXnS7Ly3dnlG0O3jtLvRv+SyZqF0oUgQg9+5ozU9xhf1QzKcs v/Xiq9phVIWyi8B1F8LOkZQ8MMiwTy2XXuwL30w5+W281VuL9mfWv6GeHU+KNW6tSt1b qS5YMoLWiP77m+2cpKteGLvI2Fcr4OWjwe7rURmwmCEe7Z3GRvXALffbNheeDWsRQsBy eialXfsoG9jr9m3LK1cVkPd7WQiDcLmsJ/NwIiDv2rKHbrky3TlV0ByYWNTvBo4PgCji Cavw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Z4WteDSGVoynl+bCnUIodkVmoAB6SpxjvOkYuZ82sgo=; b=d78TgF39FKygxrC5mqsZ2tl2WBwLwJC6zhWBVnEdyJqbmK2Hqx52Seo3EDcK2o0ztZ e2mHZn83VAd3jxVyY0Q2wFXtepmQldbpze3fx4+3NxMwm7J+n1rJc6ruCzV3aoRIumCh 1y4KLAXiueFP+w9R065KRuewZgduPE41SVD8zJbHsm6GxYYj3HRPtCIUmlRZU/HeNQoY BjSQDbzFXStR61I8BQDukp/xBZOJRHzD0ysiBDEtoJTnN6jw+Cpxi0NKCPrVFspXsKom YW5kkOMCTZOEmxYrnI/VUw0O76DnnX6Eii276wwpxEmsSjSYw32yggKAdv4EPBvEYROz WGJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=JhIFLUxK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t64-20020a638143000000b00502d6f14309si10358271pgd.809.2023.03.06.18.39.01; Mon, 06 Mar 2023 18:39:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=JhIFLUxK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229701AbjCGCh7 (ORCPT + 99 others); Mon, 6 Mar 2023 21:37:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230060AbjCGChz (ORCPT ); Mon, 6 Mar 2023 21:37:55 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88AD257D1B; Mon, 6 Mar 2023 18:37:20 -0800 (PST) X-UUID: efd572eabc9011eda06fc9ecc4dadd91-20230307 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=Z4WteDSGVoynl+bCnUIodkVmoAB6SpxjvOkYuZ82sgo=; b=JhIFLUxKkIM6wHPZ+V9LIG7ZEAJtysrBi/W7qpUNrFYW1Tp3yvSjWoARFN5FLKFHs0DGTJNqrfgrNwUWeGg7sve8/S/NRUK3u2EWCXGFz1/lgJXmO2oTn9liLmI6qetusl5u8ySY40AuaweuFoHAb3otoRKuS+n2OjhaIUzfT0E=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.20,REQID:78d08e40-559a-434f-81fd-5ccc6fb61456,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:25b5999,CLOUDID:917f69b2-beed-4dfc-bd9c-e1b22fa6ccc4,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-UUID: efd572eabc9011eda06fc9ecc4dadd91-20230307 Received: from mtkmbs13n2.mediatek.inc [(172.21.101.108)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 752846381; Tue, 07 Mar 2023 10:37:00 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.186) by mtkmbs13n1.mediatek.inc (172.21.101.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.25; Tue, 7 Mar 2023 10:36:59 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.25 via Frontend Transport; Tue, 7 Mar 2023 10:36:57 +0800 From: Yong Wu To: Joerg Roedel , Matthias Brugger , Mauro Carvalho Chehab , Rob Herring CC: Will Deacon , Robin Murphy , Krzysztof Kozlowski , Hans Verkuil , , , , , , , , AngeloGioacchino Del Regno , , , , Yunfei Dong , kyrie wu , , , , Yong Wu Subject: [PATCH v5 07/11] iommu/mediatek: mt8186: Add iova_region_larb_msk Date: Tue, 7 Mar 2023 10:35:03 +0800 Message-ID: <20230307023507.13306-8-yong.wu@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230307023507.13306-1-yong.wu@mediatek.com> References: <20230307023507.13306-1-yong.wu@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759674896338720234?= X-GMAIL-MSGID: =?utf-8?q?1759674896338720234?= Add iova_region_larb_msk for mt8186. We separate the 16GB iova regions by each device's larbid/portid. Note: larb5/6/10/12/14/15/18 connect nothing in this SoC. Refer to include/dt-bindings/memory/mt8186-memory-port.h Signed-off-by: Yong Wu Reviewed-by: AngeloGioacchino Del Regno --- drivers/iommu/mtk_iommu.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index 0e387345e1c3..fbfc5e4e56a8 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -1529,6 +1529,18 @@ static const struct mtk_iommu_plat_data mt8183_data = { .larbid_remap = {{0}, {4}, {5}, {6}, {7}, {2}, {3}, {1}}, }; +static const unsigned int mt8186_larb_region_msk[MT8192_MULTI_REGION_NR_MAX][MTK_LARB_NR_MAX] = { + [0] = {~0, ~0, ~0}, /* Region0: all ports for larb0/1/2 */ + [1] = {0, 0, 0, 0, ~0, 0, 0, ~0}, /* Region1: larb4/7 */ + [2] = {0, 0, 0, 0, 0, 0, 0, 0, /* Region2: larb8/9/11/13/16/17/19/20 */ + ~0, ~0, 0, ~0, 0, ~(u32)(BIT(9) | BIT(10)), 0, 0, + /* larb13: the other ports except port9/10 */ + ~0, ~0, 0, ~0, ~0}, + [3] = {0}, + [4] = {[13] = BIT(9) | BIT(10)}, /* larb13 port9/10 */ + [5] = {[14] = ~0}, /* larb14 */ +}; + static const struct mtk_iommu_plat_data mt8186_data_mm = { .m4u_plat = M4U_MT8186, .flags = HAS_BCLK | HAS_SUB_COMM_2BITS | OUT_ORDER_WR_EN | @@ -1541,6 +1553,7 @@ static const struct mtk_iommu_plat_data mt8186_data_mm = { .banks_enable = {true}, .iova_region = mt8192_multi_dom, .iova_region_nr = ARRAY_SIZE(mt8192_multi_dom), + .iova_region_larb_msk = mt8186_larb_region_msk, }; static const unsigned int mt8192_larb_region_msk[MT8192_MULTI_REGION_NR_MAX][MTK_LARB_NR_MAX] = {