Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5245374rwl; Tue, 11 Apr 2023 02:35:31 -0700 (PDT) X-Google-Smtp-Source: AKy350a3UJ5TfUbmDlt7zx/7N/rt3YlLga0HJn9jiKWIvPMf+tUW6po/p4EJYe+YAw6NvRlL8WSP X-Received: by 2002:aa7:962c:0:b0:635:e961:3350 with SMTP id r12-20020aa7962c000000b00635e9613350mr2149868pfg.19.1681205731166; Tue, 11 Apr 2023 02:35:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681205731; cv=none; d=google.com; s=arc-20160816; b=QVpoKRuYIP/N2ouBLtaU/RYhiQ4jWGFOmh1mW6s4u5Q+mwtHt3KU2bFhPx0+Jwy75g +VClIJhjm3h6Tw/m8JhxU3cKzaHMZIn/VQoZ/uaMP2EKukDli47nkVF8sUz6leg963Oi aeHEgkaWDSnLnp0Ekj07FZbkbJYj8yxvzyZ+swdWRiCggDGEaw5Rp6r/Ys1zEBUy+xtb HePpbbWt9Jn5ARkfhfIF3Muydt3FuKcYoVz0klBkvsM+uW95BN5nG4EdTWrdh9gqFsXh wQ8+9nQ/xFu2JQbb6lYynmgzyKJTmg/DEgbRP+YryGIoTkOyDllDJnLKvnTn8oDex0ax gvRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Gbacnh4qt5DCcPUzPDRzUSmOnmUijCnl8GTEcmOfwW0=; b=G2NuT/zl9YCCFyokF9LBnxODHxRFubXrz7oh5Q2kuG+Xbnd4Hyt7dDs2MeJ5qNBaRw sWepZb4FclSnfdUo2JO6GN4fmTmgPFi/TX+DYDCNZ0uxd/Gofo3O+u5n0OSAEG9GOXbJ CmrVV68xNo85Y51rXnqo8FwdwWMkMq0QdhmT0TQ38dOivHikUqZAU1RsXMB/47Apx1vQ XgiCNmdSsjbvtoPioxtBOA9x+3KrDZRkhmMLWWe6KvDCp/knDroCCoKIF1ts/MR3uMGZ Ahb4o2WnVJAN9VntYhVVMq5h7/B8EZRWu2mWFqtj8AvoadzHttmDdmiTMAlEMtS69j10 7Oig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=rcJg4iun; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t186-20020a6381c3000000b0051a3f3efee1si4313899pgd.451.2023.04.11.02.35.16; Tue, 11 Apr 2023 02:35:31 -0700 (PDT) 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=rcJg4iun; 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 S230086AbjDKJdu (ORCPT + 99 others); Tue, 11 Apr 2023 05:33:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229548AbjDKJdj (ORCPT ); Tue, 11 Apr 2023 05:33:39 -0400 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E018A2D60; Tue, 11 Apr 2023 02:33:16 -0700 (PDT) X-UUID: e047fd80d84b11edb6b9f13eb10bd0fe-20230411 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=Gbacnh4qt5DCcPUzPDRzUSmOnmUijCnl8GTEcmOfwW0=; b=rcJg4iunB9vIHcEoLDrWjjQdQQjdQhWTy/XhiGP0/CNg8XdgLxLDyETHMeocQM5ZP+GcrZggnCnpB8klafS/DYcacURog+oszdi507H6Lxa1VLSQ6ott1B58AXlSJpfFVWhj5DKdE8LIm2wxiC89uUHmfPLhuzh43E7EJW3UXfY=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.22,REQID:a07a08fe-86b0-4ef2-bc62-233ae6b33d12,IP:0,U RL:0,TC:0,Content:-20,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-20 X-CID-META: VersionHash:120426c,CLOUDID:3c79f3a0-8fcb-430b-954a-ba3f00fa94a5,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:1,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-CID-BAS: 0,_,0,_ X-UUID: e047fd80d84b11edb6b9f13eb10bd0fe-20230411 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 717596227; Tue, 11 Apr 2023 17:33:11 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) 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.1118.25; Tue, 11 Apr 2023 17:33:10 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.25 via Frontend Transport; Tue, 11 Apr 2023 17:33:09 +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 v7 06/14] iommu/mediatek: mt8195: Add iova_region_larb_msk Date: Tue, 11 Apr 2023 17:31:36 +0800 Message-ID: <20230411093144.2690-7-yong.wu@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230411093144.2690-1-yong.wu@mediatek.com> References: <20230411093144.2690-1-yong.wu@mediatek.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-MTK: N X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, UNPARSEABLE_RELAY autolearn=unavailable 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 Add iova_region_larb_msk for mt8195. We separate the 16GB iova regions by each device's larbid/portid. Refer to include/dt-bindings/memory/mt8195-memory-port.h Signed-off-by: Yong Wu Reviewed-by: AngeloGioacchino Del Regno --- drivers/iommu/mtk_iommu.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index 672059f9e0b7..bb3734378934 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -1579,6 +1579,21 @@ static const struct mtk_iommu_plat_data mt8195_data_infra = { .iova_region_nr = ARRAY_SIZE(single_domain), }; +static const unsigned int mt8195_larb_region_msk[MT8192_MULTI_REGION_NR_MAX][MTK_LARB_NR_MAX] = { + [0] = {~0, ~0, ~0, ~0}, /* Region0: all ports for larb0/1/2/3 */ + [1] = {0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, ~0, ~0, ~0, ~0, ~0, /* Region1: larb19/20/21/22/23/24 */ + ~0}, + [2] = {0, 0, 0, 0, ~0, ~0, ~0, ~0, /* Region2: the other larbs. */ + ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, + ~0, ~0, 0, 0, 0, 0, 0, 0, + 0, ~0, ~0, ~0, ~0}, + [3] = {0}, + [4] = {[18] = BIT(0) | BIT(1)}, /* Only larb18 port0/1 */ + [5] = {[18] = BIT(2) | BIT(3)}, /* Only larb18 port2/3 */ +}; + static const struct mtk_iommu_plat_data mt8195_data_vdo = { .m4u_plat = M4U_MT8195, .flags = HAS_BCLK | HAS_SUB_COMM_2BITS | OUT_ORDER_WR_EN | @@ -1589,6 +1604,7 @@ static const struct mtk_iommu_plat_data mt8195_data_vdo = { .banks_enable = {true}, .iova_region = mt8192_multi_dom, .iova_region_nr = ARRAY_SIZE(mt8192_multi_dom), + .iova_region_larb_msk = mt8195_larb_region_msk, .larbid_remap = {{2, 0}, {21}, {24}, {7}, {19}, {9, 10, 11}, {13, 17, 15/* 17b */, 25}, {5}}, }; @@ -1603,6 +1619,7 @@ static const struct mtk_iommu_plat_data mt8195_data_vpp = { .banks_enable = {true}, .iova_region = mt8192_multi_dom, .iova_region_nr = ARRAY_SIZE(mt8192_multi_dom), + .iova_region_larb_msk = mt8195_larb_region_msk, .larbid_remap = {{1}, {3}, {22, MTK_INVALID_LARBID, MTK_INVALID_LARBID, MTK_INVALID_LARBID, 23}, {8}, {20}, {12}, -- 2.25.1