Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5245360rwl; Tue, 11 Apr 2023 02:35:30 -0700 (PDT) X-Google-Smtp-Source: AKy350aO3AGCCRH6h6Oec/zI2omi+TQ8cX5qd3FTw6TqMtp7Q7zENDstBs2qT6S+Lo5ImwXs2wst X-Received: by 2002:a05:6a20:bf09:b0:ea:fd23:8ad4 with SMTP id gc9-20020a056a20bf0900b000eafd238ad4mr2145732pzb.57.1681205730350; Tue, 11 Apr 2023 02:35:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681205730; cv=none; d=google.com; s=arc-20160816; b=kzPiKiWrqHcqYSDPrvRl0MxT+Mk+EXM4+B/okOdiWa90uAqEICgGr7UUDtzMtWhhbJ 6t74y5ESby69SpIn6xxr/LAPNpO5IET3Q9SCbDG/dRmA2Fg8YXCNyPKaBbvrx9XsA28M KspadP+Kdm6lht5uuRUsjH5jhXJcHc8zx1fG764iE2SxR99MW82Z9b7Kb59rx5zX08FB siS6vd9oBW/uw0t1hDlyrJt/rHhnKlYCuXbts8WEvzOLgTqSeQJSkrMwCpxPwu4rEY+K tW2scVdWZ4ic6laILpX0IvX3s9CLr/Twxok7ML7Dlh9saDDTSE5tJSx/nuOkevAE8+eV lyDw== 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=XNsNsqm+tac4TqBDM7eY2YSHOJMel3hNuiOtLlMEMKY=; b=dUO5rB76zm7hQzbigwLUKmu+yci4vknkYtCl7kBnkkajGRfZIul356w4oJMzWYwUOb jgGiPyBxDY/GDKxWnJ3h3aYOdFiBWuTyO+ijSwYBTeGs4h6tfEvrE/UxxB3xSgYtiM07 xZpMxSLAuA8kvgfukMf7SMgcISFvrCUP8TzZMhVwl8u3bLgb407OevIg6og6MY/ZLqNU NT1xDyU4TJivRYnOvdAwSEr5HQEZJBBV+1nJHv+lluZVSTZnziSpJN9t8HMGe6CatIfy dLFXHrGj69vU/qvj847lXtBPlbIWqW902TDqnZCJiLPeELtCzvgg97PNd27LZudvNwxU Vytw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=AztxEkaP; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i30-20020a63585e000000b0051393805cd1si12953205pgm.461.2023.04.11.02.35.16; Tue, 11 Apr 2023 02:35:30 -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=AztxEkaP; 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 S229964AbjDKJdT (ORCPT + 99 others); Tue, 11 Apr 2023 05:33:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229676AbjDKJdK (ORCPT ); Tue, 11 Apr 2023 05:33:10 -0400 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7F312D57; Tue, 11 Apr 2023 02:32:44 -0700 (PDT) X-UUID: cccdcdcad84b11edb6b9f13eb10bd0fe-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=XNsNsqm+tac4TqBDM7eY2YSHOJMel3hNuiOtLlMEMKY=; b=AztxEkaPWfUjOaSoZrlx+yfgKsWi4c8uXjuIx2PzoVJC63h42rB+en7fmX4SnLTusVqhcs5+Rn5oBkDK32/ZUYwyb1pUjhcBpvFC/XzX7qrEwX42tW4+gTWuUf5++7fhzpryhmYJGy7LqdTpGSaDPXd6AhGocavouz1HPuiR0Pk=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.22,REQID:3e99b252-d57b-4afd-9413-f75406b4d520,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:70 X-CID-INFO: VERSION:1.1.22,REQID:3e99b252-d57b-4afd-9413-f75406b4d520,IP:0,URL :0,TC:0,Content:-25,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTI ON:quarantine,TS:70 X-CID-META: VersionHash:120426c,CLOUDID:1c0495ea-db6f-41fe-8b83-13fe7ed1ef52,B ulkID:230411173241FQC2FI2N,BulkQuantity:0,Recheck:0,SF:48|38|29|28|17|19,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-CID-BAS: 0,_,0,_ X-UUID: cccdcdcad84b11edb6b9f13eb10bd0fe-20230411 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 572185833; Tue, 11 Apr 2023 17:32:38 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) by mtkmbs11n2.mediatek.inc (172.21.101.187) 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:32:37 +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:32:36 +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 03/14] iommu/mediatek: Improve comment for the current region/bank Date: Tue, 11 Apr 2023 17:31:33 +0800 Message-ID: <20230411093144.2690-4-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 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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 No functional change. Just add more comment about the current region/bank in the code. Signed-off-by: Yong Wu Reviewed-by: AngeloGioacchino Del Regno --- drivers/iommu/mtk_iommu.c | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index d5a4955910ff..aa4bdcb65ea7 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -197,12 +197,33 @@ struct mtk_iommu_plat_data { char *pericfg_comp_str; struct list_head *hw_list; - unsigned int iova_region_nr; - const struct mtk_iommu_iova_region *iova_region; - u8 banks_num; - bool banks_enable[MTK_IOMMU_BANK_MAX]; - unsigned int banks_portmsk[MTK_IOMMU_BANK_MAX]; + /* + * The IOMMU HW may support 16GB iova. In order to balance the IOVA ranges, + * different masters will be put in different iova ranges, for example vcodec + * is in 4G-8G and cam is in 8G-12G. Meanwhile, some masters may have the + * special IOVA range requirement, like CCU can only support the address + * 0x40000000-0x44000000. + * Here list the iova ranges this SoC supports and which larbs/ports are in + * which region. + * + * 16GB iova all use one pgtable, but each a region is a iommu group. + */ + struct { + unsigned int iova_region_nr; + const struct mtk_iommu_iova_region *iova_region; + }; + + /* + * The IOMMU HW may have 5 banks. Each bank has a independent pgtable. + * Here list how many banks this SoC supports/enables and which ports are in which bank. + */ + struct { + u8 banks_num; + bool banks_enable[MTK_IOMMU_BANK_MAX]; + unsigned int banks_portmsk[MTK_IOMMU_BANK_MAX]; + }; + unsigned char larbid_remap[MTK_LARB_COM_MAX][MTK_LARB_SUBCOM_MAX]; }; -- 2.25.1