From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED, USER_AGENT_SANE_2 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0486AC433E0 for ; Tue, 30 Jun 2020 11:13:38 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C417620663 for ; Tue, 30 Jun 2020 11:13:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Bb7BIh0B"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="QdYEMiVn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C417620663 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Date:To:From: Subject:Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=d8Dptw6B3o9YKG6rIg3IX/fBXnSEtiaqFRF3KUpcOC8=; b=Bb7BIh0BFFB+abLgm9Ub3ZIj5 ZLphL81e/3RhsjiRhjrhOBn9U+aW+sYHGIw09bU5k+qcK9VU5fId5GMP43grzaWQKvJ6Xpt4K1g1s eWj5lmB0zkSAgGb5kYTcEI4vcr/1BkmzkZsEKJ97tTlk176PCf62d68t7WX6TchEKOd8beN+k93jV nr9iHIRkUp3vgtS+h97n/iTJLdhwPh2aPMvKMEqn1yoiw0Y6HFsAFnlnM4BzYDqbjjzFErI73/Xqy xF/oqwOeZVnmwDjU+OQzEkc02ZnalzrnZ5TAL3c0Ny1xv1tgUatQNYEMk1uSfPyXgElUZM63ZmPVB TDJjCWPZQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqEBO-0004QK-18; Tue, 30 Jun 2020 11:12:10 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqEBK-0004Pf-74; Tue, 30 Jun 2020 11:12:07 +0000 X-UUID: 612b1822e95d492e8c792324431e7b1a-20200630 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:MIME-Version:Content-Type:References:In-Reply-To:Date:CC:To:From:Subject:Message-ID; bh=39/WvHSlJfaFdr2D13fz2nqg2RkI5zVNbDVhi335aSs=; b=QdYEMiVnLC6j2wkjoPe9otfBPOvvTnQNjkp72LSuDMilXnB+Gshlfn3W5t4Frjsk054juspP+vB6jHnYXEJaxR5PL3ZH1RskjD1vZhhLoeo48dMEPye530Fp6/UK/mqSDf0MiNOnfFmpBFBBgJcnqQ60+i4TqQBGERuk3/gC/7g=; X-UUID: 612b1822e95d492e8c792324431e7b1a-20200630 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 563094311; Tue, 30 Jun 2020 03:11:59 -0800 Received: from MTKMBS01N1.mediatek.inc (172.21.101.68) by MTKMBS62N2.mediatek.inc (172.29.193.42) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 30 Jun 2020 04:09:00 -0700 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs01n1.mediatek.inc (172.21.101.68) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 30 Jun 2020 19:08:52 +0800 Received: from [10.15.20.246] (10.15.20.246) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 30 Jun 2020 19:08:52 +0800 Message-ID: <1593515273.26985.0.camel@mbjsdccf07> Subject: Re: [PATCH v5 06/10] iommu/mediatek: Add sub_comm id in translation fault From: chao hao To: Yong Wu Date: Tue, 30 Jun 2020 19:07:53 +0800 In-Reply-To: <1593514516.24171.25.camel@mhfsdcap03> References: <20200629071310.1557-1-chao.hao@mediatek.com> <20200629071310.1557-7-chao.hao@mediatek.com> <1593514516.24171.25.camel@mhfsdcap03> X-Mailer: Evolution 3.10.4-0ubuntu2 MIME-Version: 1.0 X-MTK: N X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, FY Yang , wsd_upstream@mediatek.com, Joerg Roedel , linux-kernel@vger.kernel.org, Evan Green , Chao Hao , iommu@lists.linux-foundation.org, Rob Herring , linux-mediatek@lists.infradead.org, Matthias Brugger , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, 2020-06-30 at 18:55 +0800, Yong Wu wrote: > On Mon, 2020-06-29 at 15:13 +0800, Chao Hao wrote: > > The max larb number that a iommu HW support is 8(larb0~larb7 in the below > > diagram). > > If the larb's number is over 8, we use a sub_common for merging > > several larbs into one larb. At this case, we will extend larb_id: > > bit[11:9] means common-id; > > bit[8:7] means subcommon-id; > > From these two variables, we could get the real larb number when > > translation fault happen. > > The diagram is as below: > > EMI > > | > > IOMMU > > | > > ----------------- > > | | > > common1 common0 > > | | > > ----------------- > > | > > smi common > > | > > ------------------------------------ > > | | | | | | > > 3'd0 3'd1 3'd2 3'd3 ... 3'd7 <-common_id(max is 8) > > | | | | | | > > Larb0 Larb1 | Larb3 ... Larb7 > > | > > smi sub common > > | > > -------------------------- > > | | | | > > 2'd0 2'd1 2'd2 2'd3 <-sub_common_id(max is 4) > > | | | | > > Larb8 Larb9 Larb10 Larb11 > > > > In this patch we extend larb_remap[] to larb_remap[8][4] for this. > > larb_remap[x][y]: x means common-id above, y means subcommon_id above. > > > > We can also distinguish if the M4U HW has sub_common by HAS_SUB_COMM > > macro. > > > > Cc: Matthias Brugger > > Signed-off-by: Chao Hao > > Reviewed-by: Yong Wu > > --- > > drivers/iommu/mtk_iommu.c | 20 +++++++++++++------- > > drivers/iommu/mtk_iommu.h | 3 ++- > > include/soc/mediatek/smi.h | 2 ++ > > 3 files changed, 17 insertions(+), 8 deletions(-) > > [snip] > > > @@ -48,7 +49,7 @@ struct mtk_iommu_plat_data { > > enum mtk_iommu_plat m4u_plat; > > u32 flags; > > u32 inv_sel_reg; > > - unsigned char larbid_remap[MTK_LARB_NR_MAX]; > > + unsigned char larbid_remap[MTK_LARB_COM_MAX][MTK_LARB_SUBCOM_MAX]; > > }; > > > > struct mtk_iommu_domain; > > diff --git a/include/soc/mediatek/smi.h b/include/soc/mediatek/smi.h > > index 5a34b87d89e3..fa65a55468e2 100644 > > --- a/include/soc/mediatek/smi.h > > +++ b/include/soc/mediatek/smi.h > > @@ -12,6 +12,8 @@ > > #ifdef CONFIG_MTK_SMI > > > > #define MTK_LARB_NR_MAX 16 > > +#define MTK_LARB_COM_MAX 8 > > +#define MTK_LARB_SUBCOM_MAX 4 > > Both are only used in mtk_iommu.h, and I don't think smi has plan to use > them. thus we could move them into mtk_iommu.h > ok, got it. Thanks for your advice. > > > > #define MTK_SMI_MMU_EN(port) BIT(port) > > > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel