From patchwork Wed Feb 8 05:36:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yong Wu X-Patchwork-Id: 54196 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3271664wrn; Tue, 7 Feb 2023 21:39:02 -0800 (PST) X-Google-Smtp-Source: AK7set/dZhMCxAMJmr3Kpb2UakE2CU8+H1EiRCjHOP1kuPYXwWFzlsUTvwND1Xj2rTCQN6nYhw4+ X-Received: by 2002:a05:6a20:158e:b0:ac:82ff:9f9e with SMTP id h14-20020a056a20158e00b000ac82ff9f9emr5232866pzj.22.1675834742042; Tue, 07 Feb 2023 21:39:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675834742; cv=none; d=google.com; s=arc-20160816; b=JKCvHzAJWfZ/XE6fyDemiP+Fb966RU0citPbLDGR2UVeGqNHY1rGMDTfVYewi6Kh/r JqA0pBHmzpCDydx6iuxkOgTCr+ckYMPynwzuGseSzXDZ/JkpkEMY9b2XvMaeb8vpjn/y 1mLRnORNDAiygUqyZsFcfeDQQ8q4hk8FkG7cAufCjkQgj2tJvlFjfJQVDkHhRNJ6KQf4 kp9kjWlYzondX2jZFfODyTBcpQ9iydrQ+EJ3Jxa8Sp18m/o5DCNYxtNoymT2eOU/o3a1 8+mVDQb5+Rudgu8yYtVl4Hc6yv8dHChM8AmfMh3jZXFqoiAhfoyn+jFg1Im762Da9w1s Ifog== 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=DvLdpvBFoTbv/8lF8zSbZ/zBomvSzV29CTJnZVUJkKU=; b=n3wR5/V4wgJar0VxF3ZhaqfG60V8sazZ1OSRLhLKBl0zfLdzxVXvi4kDhos/1My1v/ UKVMvjBxTgLC80lQVMjQTTjNbN8DSjjkZE0G7kXhjcga6D4GHAvD55xKA99anuc1siYC AYVDK0dCLgWu/C7xPmj1xJUd16xOnI5ngGRTiP/fXdmu9L3DR2e8xZRIrFvUGTJiMiBl gXL4BT9iyvHRXsj6P4ebbCNh+IW2QQ6JKy6OXFO+MUckM3hNGdT96+iPeTC9BvjkTx6O CO4lPaBApOabPBHdbnL6qLN2h9ALCdn9UQ0bX1a5fIPh7A3LKMWB/MNWXJWJ0XEYwATK Q1yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=b8N2WGfl; 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 p3-20020a639503000000b004f3880f668csi15843353pgd.781.2023.02.07.21.38.48; Tue, 07 Feb 2023 21:39:02 -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=b8N2WGfl; 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 S230246AbjBHFia (ORCPT + 99 others); Wed, 8 Feb 2023 00:38:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230287AbjBHFi2 (ORCPT ); Wed, 8 Feb 2023 00:38:28 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 318BB442DA; Tue, 7 Feb 2023 21:38:21 -0800 (PST) X-UUID: c815dfd4a77211eda06fc9ecc4dadd91-20230208 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=DvLdpvBFoTbv/8lF8zSbZ/zBomvSzV29CTJnZVUJkKU=; b=b8N2WGflwo0oaONoNzBtoKgk2ZcBQkBw+WseitRtiZvBtbFCmLC+XxewfB3WLr5pjtFmBzrU/GHZ4pmkzCVWxdzfE/gc2R3q01hE/EZ8kDnSz+e9/u2IqXgKcioRwbYfqmbSU0+OkN7VLzL72evYH2ipY7858FeNFtAoScy9zDM=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:a5e54634-3509-4ac7-84e2-65ac78221563,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:c9143e8e-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: c815dfd4a77211eda06fc9ecc4dadd91-20230208 Received: from mtkmbs13n2.mediatek.inc [(172.21.101.108)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 292321344; Wed, 08 Feb 2023 13:38:14 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) 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; Wed, 8 Feb 2023 13:38:13 +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.792.15 via Frontend Transport; Wed, 8 Feb 2023 13:38:11 +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 v2 06/10] iommu/mediatek: mt8192: add larb_region_msk Date: Wed, 8 Feb 2023 13:36:39 +0800 Message-ID: <20230208053643.28249-7-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230208053643.28249-1-yong.wu@mediatek.com> References: <20230208053643.28249-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?1757240090560359991?= X-GMAIL-MSGID: =?utf-8?q?1757240090560359991?= Add larb_region_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 5a9e0fbb534e..7e8fd0a0536c 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -1522,6 +1522,17 @@ static const struct mtk_iommu_plat_data mt8186_data_mm = { .larb_region_msk = mt8186_larb_region_msk, }; +static const unsigned int mt8192_larb_region_msk[][32] = { + [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 | @@ -1531,6 +1542,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), + .larb_region_msk = mt8192_larb_region_msk, .larbid_remap = {{0}, {1}, {4, 5}, {7}, {2}, {9, 11, 19, 20}, {0, 14, 16}, {0, 13, 18, 17}}, };