From patchwork Wed Feb 15 06:25:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yong Wu X-Patchwork-Id: 57378 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp30997wrn; Tue, 14 Feb 2023 22:28:04 -0800 (PST) X-Google-Smtp-Source: AK7set8MGY/YemQ83yPrW7sF7IFGVEueqDUK6XsYX0K3Dx4g+KIRKkYSPomz7DoagmDMCabeAhyL X-Received: by 2002:a17:902:f9c4:b0:196:89c9:20f4 with SMTP id kz4-20020a170902f9c400b0019689c920f4mr1144121plb.7.1676442483882; Tue, 14 Feb 2023 22:28:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676442483; cv=none; d=google.com; s=arc-20160816; b=FseYe+jdInwfoTqsjKIZy3+YjXXtMVOmAtnl3PYq176cMaKKRGSpGQYa9DgfgugVj+ 5lijAHxwcOPQp8ZYqPYNHYGkJO/RsOoeawa9t7KdxD/XBQisrSxftP/XnvcAIBqDWLzY C3Iv7pgBAvyq/BJ5CDPkeAz/5SHSHohpGs3KKRsMJ0asrdBesO1W8dXXyaLy4oXsg3KL J4/UM73N3zoaZkDnSUZbFKTqJBcKAS9c+dpn4yGPq2IkMV64/pSl+W89r/+woMR7iz38 rScPczhCZSRaodwwlLwTYCYmMHH3C9MpXmHWNh8dB50QFaTsp6uzT8rpnMps3ZIJbvjz XVnQ== 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=1CSrx+zCSBkyvjy4KRaBV0IuYXilNNdpDy6Avu7acRg=; b=AHknuooidUnuPXlUhytWkfGyE5G1rI/z665E7TeyGOX3nXCGy5zFPVprt6fbaJYE5M xUi0yCzNDDHQh/R4ZHaxBnPaFN7I68eYNfCWfrixbmDVzyT2IjvHJHoDlh3gUJxxvInB FcnJNwN5f6hU8n1mQjdfqqTCawJdnDXSUHkfRBlWPohxh5F+5Vs/ldkBD5ufqh9tLK9S LGnL8XRBV42zRBh5E/M0TnURe4LHvylPjfVEz6gXWA8OxwUtSNenXlpVZ6ji7eBOnJJy zfaKzaEUq9c++fqKJaVrLqBQ5LiSa/8mtgIlSbvuu3sFUKo4MwHHValOd/il2rD64/yd XsXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=Riipnc09; 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 b5-20020a170902e94500b00194a2575c84si16411157pll.596.2023.02.14.22.27.51; Tue, 14 Feb 2023 22:28:03 -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=Riipnc09; 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 S231923AbjBOG0y (ORCPT + 99 others); Wed, 15 Feb 2023 01:26:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233098AbjBOG0u (ORCPT ); Wed, 15 Feb 2023 01:26:50 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BCE33524C; Tue, 14 Feb 2023 22:26:36 -0800 (PST) X-UUID: b05a934eacf911eda06fc9ecc4dadd91-20230215 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=1CSrx+zCSBkyvjy4KRaBV0IuYXilNNdpDy6Avu7acRg=; b=Riipnc09WxnpdkbvH0Pz5f8DfVIKvQhENWTPsda5iIkGICbxhlKg50cQcdCoI+1AlE0X6n1TZsofBdYOJmRojTv9Cp/4ieqMWo2i77Ld1tg4A2xpWjtkAwEqzVR7jxYedwhyB+Zt1GMSuap9zGEGzbW/jNg4nYI884b8A131EMM=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:bc711064-e87e-4976-8996-93c1394e07ed,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.19,REQID:bc711064-e87e-4976-8996-93c1394e07ed,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:885ddb2,CLOUDID:aa490df3-ddba-41c3-91d9-10eeade8eac7,B ulkID:230215142633RLEPW8JG,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: b05a934eacf911eda06fc9ecc4dadd91-20230215 Received: from mtkmbs13n1.mediatek.inc [(172.21.101.193)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1108693227; Wed, 15 Feb 2023 14:26:32 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.194) by mtkmbs11n1.mediatek.inc (172.21.101.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Wed, 15 Feb 2023 14:26:31 +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; Wed, 15 Feb 2023 14:26:30 +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 v4 03/11] iommu/mediatek: Improve comment for the current region/bank Date: Wed, 15 Feb 2023 14:25:36 +0800 Message-ID: <20230215062544.8677-4-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230215062544.8677-1-yong.wu@mediatek.com> References: <20230215062544.8677-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?1757877354122055330?= X-GMAIL-MSGID: =?utf-8?q?1757877354122055330?= 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]; };