From patchwork Tue Feb 14 03:11:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yong Wu X-Patchwork-Id: 56640 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2729997wrn; Mon, 13 Feb 2023 19:14:07 -0800 (PST) X-Google-Smtp-Source: AK7set8JNGsnvsA0kVt5E7j9AS3ED2m6P6wXbiskUUSP+lpwvV6B1xlVWKy9nzpm8vSNU+AokyQk X-Received: by 2002:a05:6a20:938b:b0:bf:488a:1da8 with SMTP id x11-20020a056a20938b00b000bf488a1da8mr987476pzh.3.1676344447098; Mon, 13 Feb 2023 19:14:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676344447; cv=none; d=google.com; s=arc-20160816; b=RqBi3vCDQaDgnEuMElhu3UyNSvT8NaxCEA10OrtYAd0f99mGhVFhduyEFn0QbXo1An 5jcD4AW8YCyWbk8omKflwAUDrS2TKC2HVm3ExJX/xgwXFvcQCPcwH/EKyuhp54b/aFpa MZ93TJjAuFWKJ6EN4rCQB0l5lw+8ecVioCSlDxoMw5JYsyI2FwxB4elt3XhmtbpHMB21 bYftjvhAzFKY2uf5ISK01bfc5+hIn+NoAkD6m/6oDsJvp4xtaAI1boWKXkb/eXC2qVlG 4bE4/Ier7aaFE4dRtKbusq1EpkkRGIZrdr0BbcmVlrETK8OSvJxrOAvk6MEF6A+0XEMI Nnfg== 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:dkim-signature; bh=e6k/c+D3qs5VVTmos21pDkg6tyU1V28oamrg6Z9QP/g=; b=qhWMjsf9zvvkecUUt9YM3KyxCPcxMOnnMUeOfAhx7CN//zHoLSkQIQd9wyKV0Re1Af V1D8KZKl8HHJdzbKfhyRV0LNNYE8Y1Ng0lXzsJ6obHTnvpHbWmGcgkNGrD/4UKmlMKf5 c95R2BwSW9dalFoMDX05ABLghS9r7JAVMZHh8U/d7l0wAdwW+0+5pQg4b65d4g8bHJld sdWFsV1jjwt++uMM4Qkmw71sSmdhiRjxCX7cf3PUGgPXGp9bN9dSgEdcviHnHW8c0+fc sO/kBGPL1rY9Wcf24uyEcIHkXhaXDaxPvd1dwaarscIKjq4XGlOvumVg6l89fYVKaolI +EHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=eQkXzdLR; 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 w64-20020a638243000000b004fb8a5ac64bsi7608205pgd.500.2023.02.13.19.13.54; Mon, 13 Feb 2023 19:14:07 -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=eQkXzdLR; 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 S231289AbjBNDNS (ORCPT + 99 others); Mon, 13 Feb 2023 22:13:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230412AbjBNDNP (ORCPT ); Mon, 13 Feb 2023 22:13:15 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B42FA4693; Mon, 13 Feb 2023 19:12:50 -0800 (PST) X-UUID: 73144adcac1511ed945fc101203acc17-20230214 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=e6k/c+D3qs5VVTmos21pDkg6tyU1V28oamrg6Z9QP/g=; b=eQkXzdLRzF/p86QIedmnp/Z6D7VArAlC5odBGaazlqAdnwLahiM5tykA4riwyjhhdR5ksVQX87rvorsTe49s22MOQltIxZal42IbpFN+4IFzA2pqpDHtxCRcodPYJVz52t26CgTQZLpvpVH6bvBdmvitxLXphp7aMV4AoTFZQKo=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:234c9c43-0455-497d-b36a-51065bda95c8,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:90 X-CID-INFO: VERSION:1.1.19,REQID:234c9c43-0455-497d-b36a-51065bda95c8,IP:0,URL :0,TC:0,Content:-5,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTIO N:quarantine,TS:90 X-CID-META: VersionHash:885ddb2,CLOUDID:c41c3257-dd49-462e-a4be-2143a3ddc739,B ulkID:230214111245CAU0YFD0,BulkQuantity:0,Recheck:0,SF:38|29|28|17|19|48,T C:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 ,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-UUID: 73144adcac1511ed945fc101203acc17-20230214 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1406791041; Tue, 14 Feb 2023 11:12:44 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs13n2.mediatek.inc (172.21.101.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Tue, 14 Feb 2023 11:12:43 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Tue, 14 Feb 2023 11:12:41 +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 v3 06/11] iommu/mediatek: mt8186: Add iova_region_larb_msk Date: Tue, 14 Feb 2023 11:11:09 +0800 Message-ID: <20230214031114.926-7-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230214031114.926-1-yong.wu@mediatek.com> References: <20230214031114.926-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 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?1757774554987246106?= X-GMAIL-MSGID: =?utf-8?q?1757774554987246106?= 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 3d9986fb49a5..49f018138d9a 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_MAX_NR][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 struct mtk_iommu_plat_data mt8192_data = {