From patchwork Tue Feb 14 03:11:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yong Wu X-Patchwork-Id: 56641 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2730056wrn; Mon, 13 Feb 2023 19:14:18 -0800 (PST) X-Google-Smtp-Source: AK7set+Zz9Xg7DWYTAi5z0BrvvYxrPuBCP67tYG4leOgIR4FlJIqmroHoG9cfJSBYSi72Uj76rrB X-Received: by 2002:a17:90b:4c09:b0:22b:b832:d32 with SMTP id na9-20020a17090b4c0900b0022bb8320d32mr890038pjb.9.1676344458025; Mon, 13 Feb 2023 19:14:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676344458; cv=none; d=google.com; s=arc-20160816; b=qKLluLWqCEH/VETpT6Jj25q1i1XcepQj0Yp2lKOnD5YzUdwQ1/F5xQ/oGDhMBIeRfL 4Om3FuOOhxY9jXJOt8vLJURSRQtnEnguHQtSUo/Q59xH9tkFk9BxggfUGRJmbLUsKmia SYeEgWEH0xGjOxdba7RAsa5AX2oxLZ5GwZBsFs8G0MnzqJqsQF6BstfQFyZJfFo3guPa /hs4Q0EitknJMDy364ktytlIlIvAaMnuM5U+Mx39nEuuU7cHlgS1WIx2RlaeU5fyX2yl TUtJncFjwOMWop8bpFxcM/yWJvguo+Ei9m0+I/XRWd4OtnapTxqgs+PHxKSZxgEcbOKA uhjg== 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=nlc1O0uGFdKL0HVge6HHQXyE6Jn19cM7Bw82F07IIP4=; b=ZQsdytzsuQQrSuTMnPh+OJfcISrLsBBU5bFhDY5uh41gWKNwv1QRPp5F8gw1Hip3iL 9yJyzz4pno5FXb4ghtQcnXgUY5h+ZnVuqofXpqve8d8XJsIGR5+ZjmlDWT54OygaYVwf ALhY4FsmlYhDJGrxNXo6dzlwKpSN07ZazTSf12JHTaIYVex6/EDxkDnxNwN1fEyBDT8q VCwZ/CJUyhDEVVARmX1UEjpuA0zY+LZyhvkDxbvdTRNhqFb/whijjcfZkqARZ3eKqD6d 2vCYZx1O/FMLK7S8PmmrqLNpiEPXGjgXpbJWwwcgHI/w0mBf57RXXxMnyTIa8RPIQw5y z7AA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=c2xLMOtV; 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 v24-20020a17090a899800b002312812e917si7416090pjn.63.2023.02.13.19.14.05; Mon, 13 Feb 2023 19:14:17 -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=c2xLMOtV; 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 S231320AbjBNDN0 (ORCPT + 99 others); Mon, 13 Feb 2023 22:13:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231301AbjBNDNX (ORCPT ); Mon, 13 Feb 2023 22:13:23 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D15541A962; Mon, 13 Feb 2023 19:12:59 -0800 (PST) X-UUID: 792ddc3aac1511eda06fc9ecc4dadd91-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=nlc1O0uGFdKL0HVge6HHQXyE6Jn19cM7Bw82F07IIP4=; b=c2xLMOtVIDQh7FYtaHp3KGXgfuEJ2219WQql06deySBtJP0y5QzO53E6JBJ6aooeCcXEBYQ60zPrKG4ixDrcd6KG6C/WDAxz2cqUMphVu5x6tlMz7gdqccu5/pWZiK7UR/o8hiBanIUjBuB1U1gaf5QetWVpp+zCRR24DdHsjz0=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:639c7643-989e-4e76-9fec-581d30cc0ccf,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:885ddb2,CLOUDID:75b2cc8e-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 X-UUID: 792ddc3aac1511eda06fc9ecc4dadd91-20230214 Received: from mtkmbs11n2.mediatek.inc [(172.21.101.187)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 537414409; Tue, 14 Feb 2023 11:12:54 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.194) by mtkmbs13n1.mediatek.inc (172.21.101.193) 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:53 +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:52 +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 07/11] iommu/mediatek: mt8192: Add iova_region_larb_msk Date: Tue, 14 Feb 2023 11:11:10 +0800 Message-ID: <20230214031114.926-8-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?1757774566162812968?= X-GMAIL-MSGID: =?utf-8?q?1757774566162812968?= Add iova_region_larb_msk for mt8192. We separate the 16GB iova regions by each device's larbid/portid. Note: larb3/6/8/10/12/15 connect nothing in this SoC. Refer to the comment in include/dt-bindings/memory/mt8192-larb-port.h Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index 49f018138d9a..995e59cabf6c 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -1552,6 +1552,17 @@ static const struct mtk_iommu_plat_data mt8186_data_mm = { .iova_region_larb_msk = mt8186_larb_region_msk, }; +static const unsigned int mt8192_larb_region_msk[MT8192_MULTI_REGION_MAX_NR][MTK_LARB_NR_MAX] = { + [0] = {~0, ~0}, /* Region0: larb0/1 */ + [1] = {0, 0, 0, 0, ~0, ~0, 0, ~0}, /* Region1: larb4/5/7 */ + [2] = {0, 0, ~0, 0, 0, 0, 0, 0, /* Region2: larb2/9/11/13/14/16/17/18/19/20 */ + 0, ~0, 0, ~0, 0, ~(u32)(BIT(9) | BIT(10)), ~(u32)(BIT(4) | BIT(5)), 0, + ~0, ~0, ~0, ~0, ~0}, + [3] = {0}, + [4] = {[13] = BIT(9) | BIT(10)}, /* larb13 port9/10 */ + [5] = {[14] = BIT(4) | BIT(5)}, /* larb14 port4/5 */ +}; + static const struct mtk_iommu_plat_data mt8192_data = { .m4u_plat = M4U_MT8192, .flags = HAS_BCLK | HAS_SUB_COMM_2BITS | OUT_ORDER_WR_EN | @@ -1561,6 +1572,7 @@ static const struct mtk_iommu_plat_data mt8192_data = { .banks_enable = {true}, .iova_region = mt8192_multi_dom, .iova_region_nr = ARRAY_SIZE(mt8192_multi_dom), + .iova_region_larb_msk = mt8192_larb_region_msk, .larbid_remap = {{0}, {1}, {4, 5}, {7}, {2}, {9, 11, 19, 20}, {0, 14, 16}, {0, 13, 18, 17}}, };