From patchwork Tue Feb 14 03:11:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yong Wu X-Patchwork-Id: 56636 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2729855wrn; Mon, 13 Feb 2023 19:13:46 -0800 (PST) X-Google-Smtp-Source: AK7set8x/ThICbepaYK7qVMjSt+Yv8Ddo4FG5Z8ZO5t/mGHtwKvng29jDyGCJEF2zohysLuAVfwT X-Received: by 2002:a17:902:ecd1:b0:19a:9984:5562 with SMTP id a17-20020a170902ecd100b0019a99845562mr466861plh.33.1676344426583; Mon, 13 Feb 2023 19:13:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676344426; cv=none; d=google.com; s=arc-20160816; b=vB9dlG5sZjTyJh3qBuHkmbgmd7L+G4yo+dRrQP+bCe1B2B5B8LMSTekk0oapkaqsOL iv3APfPsKmvLa1e0pTCSSNtbX2Mp1eGuOGFMtMPEQcP7ep00ATAn+DmWpSaZTMmU31hK smriJGpdoPQjop0/zV33bxTToXW9nvca1FtWCHn1spXNM+RJVE2G+0VnGELFO7Ra8Kok GmhEA+6AIQzRDYTVARk+D0SYj7/ZhzA77z3+2X1Yuf49DHy/D7cHHrjXsMLOdADcKAXO 6qPcVadKfWQ001Hzp8rALz+duolLVyODVouKF3Ie1pUoJgXYncFLvbmNOFyzTx8arAz9 Xu6A== 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=peavVusQeZHXkfJ5gLzdRFCDza4y4JlhLRiqN/ma/lU=; b=ZyRCJCbqMEbhk7eYKJMLxjmohwNozARYkNl8pxI+3bKa4yiIHUr4N/IpeKZ4kUXvXu vXgYGBqkg2XgUmEg0fudGXGvh8W1kSHiTTepQC3zfTB/CDV1zJlNNbrSDBQwum0yxNXj V118RYMrc1/7Uwrah1yJW65VkB7qHWB1cVTLyWZqWQhV/ffSAvN9WHk2PktxF2OwGAF8 OPGPhphCZ7c3lX4e3lNJWC6GPGq9fEmXHOjraHLJZR2x5s3Ex4csVZ25cHGwJDJrULB3 fWr25Xy6cAAwbSRqjacAMRmj+RpiVjLwbWjz11PPVcGbiXXqN8fxuDa8tQXHNy2+Vniu 1kxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=W1A6hdbh; 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 n14-20020a170903110e00b001945ff85d7asi14742331plh.357.2023.02.13.19.13.34; Mon, 13 Feb 2023 19:13:46 -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=W1A6hdbh; 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 S230480AbjBNDMS (ORCPT + 99 others); Mon, 13 Feb 2023 22:12:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230259AbjBNDMR (ORCPT ); Mon, 13 Feb 2023 22:12:17 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCD8DBB95; Mon, 13 Feb 2023 19:12:10 -0800 (PST) X-UUID: 5b620212ac1511ed945fc101203acc17-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=peavVusQeZHXkfJ5gLzdRFCDza4y4JlhLRiqN/ma/lU=; b=W1A6hdbhIfd8V7v6rILa0p145TFqwfkXqwM2FMR869cF48S3Bef/ayu+Yorjh5GJPQoFWJBcrVCZM5V6lFwqKdlvkAvzfXA55Yq6kHnEF2HI+rmFNAWByX3+S8p+pTI1b6iQE1Xifq6q+rpolucmnbZg8LF/lhxp+ZbGwSSEoqA=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:97f5f6ca-aaeb-452d-a7cf-a79f8cbf5d1c,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:885ddb2,CLOUDID:fba9cc8e-8530-4eff-9f77-222cf6e2895b,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,NGT X-UUID: 5b620212ac1511ed945fc101203acc17-20230214 Received: from mtkmbs10n2.mediatek.inc [(172.21.101.183)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 868878484; Tue, 14 Feb 2023 11:12:04 +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:03 +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:02 +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 03/11] iommu/mediatek: Improve comment for the current region/bank Date: Tue, 14 Feb 2023 11:11:06 +0800 Message-ID: <20230214031114.926-4-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?1757774533404886906?= X-GMAIL-MSGID: =?utf-8?q?1757774533404886906?= 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..ab53edcb221f 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 indenpendent 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]; };