From patchwork Tue Apr 11 09:31:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yong Wu X-Patchwork-Id: 81845 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2449330vqo; Tue, 11 Apr 2023 02:52:36 -0700 (PDT) X-Google-Smtp-Source: AKy350ZFZ957tiaQmNb2QJitDdz+TwY63iofiJet44146pl47OJrSDEpzzt+ujzM+Pc0xiujMViS X-Received: by 2002:a17:906:208b:b0:930:e634:3d52 with SMTP id 11-20020a170906208b00b00930e6343d52mr1970996ejq.24.1681206756685; Tue, 11 Apr 2023 02:52:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681206756; cv=none; d=google.com; s=arc-20160816; b=Q783A8URYIo5hNh5U4y9lNqmLrzRmFVjC2FHtm5hWl1OSusN1mSwqSt/XCeWfroOBN UutL2xtcfcq750ctHuWGSnLvhxMqNvhPqIAR7MMtmuO8ogxNV4jN0sHgSjdnl4c4Y+l4 4JYcG63DWsbtxmEqte4ymJ99/AFkczwWuZvW8/8YKIX1BQgAmM1WHPkn238T6U97AUPZ JCJBFL1XhqNDQk0G3xRy3/Z5Z4h/20/lPEADESBWyosQDImiY+IdJ6IrivxPACgtGPSI 13xNLC1V+URHEENSAtUC/opaF5cohbg/wZNMYpZ3TEkZ9dNSFxgoF9kmZvxNveDe1Pxp pR3g== 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=5TzwrGm8MDwxREZVxNarlcOBJfzC0Abb3wd33GfWDz4=; b=LlSqrsFxyqyXkmJcj57B/JGwGoKpj+NT5NNJXQu23TbmFRvKHXTCx+E99XNGtecZZG LHh+nbUEhgRlg5GChGaoToWQ28yGKI7eWcTSPnI47SWyT9/ADNRVtMIY0tE6qFkPr+kZ jnrta+CBCHMzp0PEmU9MZqxpUWevPRo2FKn6L9nzJdPBYdxD4BHamQz9QD/+XfL3IExf IYcpCRwKHkfo3RzhuogzoNLCVmkPDvKqaj/QjGOkpE4ZYumTVnzfhDZIS/WZiFh2XKsq J6s16otsm+D6qi2N86x6k+VXQxac5UqaCYl9FI+r8kEHUwev5RuhaNJlFKsNDPowi1U0 a6eQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=bbcKZviR; 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 jg11-20020a170907970b00b0094a38a9d599si7299740ejc.628.2023.04.11.02.52.09; Tue, 11 Apr 2023 02:52:36 -0700 (PDT) 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=bbcKZviR; 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 S230058AbjDKJd7 (ORCPT + 99 others); Tue, 11 Apr 2023 05:33:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230026AbjDKJdq (ORCPT ); Tue, 11 Apr 2023 05:33:46 -0400 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96C653C0C; Tue, 11 Apr 2023 02:33:25 -0700 (PDT) X-UUID: e500594ed84b11edb6b9f13eb10bd0fe-20230411 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=5TzwrGm8MDwxREZVxNarlcOBJfzC0Abb3wd33GfWDz4=; b=bbcKZviRCE/rngFKkW2wzWlxn2bIiMkH5VibDZQXrFShmDuq1yyjdO+0jKURP2R/8OzejPCD0p/kzQLC6pIgNzT1Ys/Nr1n/ARt2mDw6nl1OsQ2ViBkZxtsIFEPmLlLDZ0rURF++Ms9ePaDnCaBLRlOKDL1t2PPxEnoLpt4D0G8=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.22,REQID:6d6a3152-5f04-4de4-98af-b546c7d22f17,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:120426c,CLOUDID:8d0995ea-db6f-41fe-8b83-13fe7ed1ef52,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-CID-BAS: 0,_,0,_ X-UUID: e500594ed84b11edb6b9f13eb10bd0fe-20230411 Received: from mtkmbs11n2.mediatek.inc [(172.21.101.187)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1731459184; Tue, 11 Apr 2023 17:33:19 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.25; Tue, 11 Apr 2023 17:33:18 +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, 11 Apr 2023 17:33:17 +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 v7 07/14] iommu/mediatek: mt8186: Add iova_region_larb_msk Date: Tue, 11 Apr 2023 17:31:37 +0800 Message-ID: <20230411093144.2690-8-yong.wu@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230411093144.2690-1-yong.wu@mediatek.com> References: <20230411093144.2690-1-yong.wu@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, UNPARSEABLE_RELAY autolearn=unavailable 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?1762873056173840570?= X-GMAIL-MSGID: =?utf-8?q?1762873056173840570?= 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 bb3734378934..2c2a64c1712a 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -1525,6 +1525,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 | @@ -1537,6 +1549,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] = {