Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4262248rwl; Mon, 3 Apr 2023 02:17:23 -0700 (PDT) X-Google-Smtp-Source: AKy350Z5VvFh9LFw2cAhJY3g7T2htSRavWq0ef8QlZ8+C9Y0vXseg8uMO1O/0uXu95Tw0Hi0b/TV X-Received: by 2002:a17:907:86ac:b0:92b:eefb:b966 with SMTP id qa44-20020a17090786ac00b0092beefbb966mr46581703ejc.0.1680513442780; Mon, 03 Apr 2023 02:17:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680513442; cv=none; d=google.com; s=arc-20160816; b=By3xP0zo1FMZjNHjYlctwUgDFF7xhEd2N6WLfes79q6o0HaNJDKGPGf/wPoTDFV3tC 75l3qGVz7XTLhnyxGds/2TZCT2t3WJbNS6X+/pFc5S4IPg0KMfTRoJ8oS5CoTEugVzMq TKrsX90P9N8Hs8BQMGUGEGzY2RtIB6Yb7LN83AHNLKbn1ffA2sI074dkOCJq09Jb2Zw6 aIedvHkZbCkhkuEQwYariqpupv+ylSqZ6OnA81nqklJK0XN4AG7OQdtkcJzYGw/c4EOd z0CuU6KRg4JlICSsoPGofmwVJ9b97ZkDkJ95BBvskYVzILbxdh37SvD+AkEUc9C2qZBU aAPg== 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=eBXkSojB8wSJB3GohwzIj/E4GKI5dR+jP+qPkiSmBC3rjy4wGVx2Bwv6Jw5LnU31hz UOV6yLZH7xELPiH6Rz6r1WKjCXzYgwy/99SUbiSnu/KMELUJdTH9ycBXgaoLLzVUsY8a oPvdP6WVHThWpEb/X/9f0kybe7ql44Y/a73CJT75izDCHy8dpb5bbng5a/FgGXRNihMp kkeNX8R8tATn727WPu1KxokXxAHhIEPg6DXw0a4Y66kEW1ZliTbGj+mDJMIiNHn+jsks gHdmdoK+5gFzkQM9cjxEN3SkuSyiv3bdzhdxjEq2dQpIQzIc09dd6RI1KEpoujY3FMtl EEFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b="mkQlX/5I"; 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 q15-20020a170906388f00b009477b197ba4si7995688ejd.321.2023.04.03.02.16.58; Mon, 03 Apr 2023 02:17:22 -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="mkQlX/5I"; 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 S231936AbjDCJOx (ORCPT + 99 others); Mon, 3 Apr 2023 05:14:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231905AbjDCJOs (ORCPT ); Mon, 3 Apr 2023 05:14:48 -0400 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1C587692; Mon, 3 Apr 2023 02:14:35 -0700 (PDT) X-UUID: f0931ec4d1ff11edb6b9f13eb10bd0fe-20230403 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=mkQlX/5IRAaRrjuWEmfWaio5jeYZRgi0N/Cx1prgGHrgjUHn0PIeA0pTGljMYD6F8C04T0shGhuKTmOEFsxxO3C+B15+GQXtP8Fq9k9QBqAR9dFmLtU3dok7DMtWN+1bPO95e9HnAOEslytJaSIr1vh1XltGE+k2Z4MpTmjDx0I=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.22,REQID:f5891834-5ce0-4ad0-ac79-bb532c8f56e4,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:f5891834-5ce0-4ad0-ac79-bb532c8f56e4,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:5597b1f7-ddba-41c3-91d9-10eeade8eac7,B ulkID:230403171432W80VIW0I,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-CID-BAS: 0,_,0,_ X-UUID: f0931ec4d1ff11edb6b9f13eb10bd0fe-20230403 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 1044971192; Mon, 03 Apr 2023 17:14:30 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) 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; Mon, 3 Apr 2023 17:14:28 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.25 via Frontend Transport; Mon, 3 Apr 2023 17:14:27 +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 v6 03/14] iommu/mediatek: Improve comment for the current region/bank Date: Mon, 3 Apr 2023 17:13:26 +0800 Message-ID: <20230403091337.26745-4-yong.wu@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230403091337.26745-1-yong.wu@mediatek.com> References: <20230403091337.26745-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