From patchwork Wed Feb 15 06:25:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yong Wu X-Patchwork-Id: 57382 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp31253wrn; Tue, 14 Feb 2023 22:28:52 -0800 (PST) X-Google-Smtp-Source: AK7set8sSVhVOCSUuxVkZ2pNsNpMf2XQVE4EoshV+DVrnuvudmEyJqigSOzUx3eVZJJpC2OBKZ0e X-Received: by 2002:a17:902:e393:b0:19a:9221:c716 with SMTP id g19-20020a170902e39300b0019a9221c716mr981757ple.25.1676442532189; Tue, 14 Feb 2023 22:28:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676442532; cv=none; d=google.com; s=arc-20160816; b=ugUFgQTn6wtwMIKnYPLld6o68FuHiDr8F/40+k/7NXWwNRn4Tu2cHsBbQ2pG7qmmJ1 RmTP5vWL32Wzp1EZVpQ7v0SIx5pV8qDIyHFqELmVAtVKVdoyTaPt2cCpKDsJFhR/B2Tj Q7Rj8a+d05L0mDjVgh3UAexUP0FQ/PRIkCF3HoRHC+wHaee7eomS6C8BCOciFhnqWaYq q5wgd133yNygeQmVVeoJJ1tHemIgxvuUxvELbgkDq0q7p9HiYgE+/f6nLbS+6Wmxm0/f mmTn5F9PJWpRTr3gHqrF3pDflVEiCatZ4MoPDIGo3Ra9WlpiiEfJiAnUZzhhrUUtH187 9iLg== 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=b2o7qpESFEhyJrsVjX10Hj6Qps7553sca1RMhYqI+zo=; b=HIdc71hV9ow2C9U3l2hN81pyUplb77AbFTfUjtcp8uW3PaLxUHnrPbiKGPwopgvSfS SFwxG4Hzi8VnLICMr3HMBz/MYsZroJTsuwv1/K7l+AmkNaenfbTSbXwc5iyOqXWzI7N1 Mq3UEsCk5wzn1iQHRw5VtsxQto3/bLRpdFUQYje9a630iSvCAmG9YhykbXuP6nuSii4X mvlsL+nbeUwKyBcdg8O457DlEWPcLnr6W218fvQzjNhvLc9IfgKbUG0rVmzHcbCOtIkP +Yfz/KRUvW0arow6KoT4AGy1e0LL0dCEeZJWlo0XrRQwZu0ZOaQ7lniBHtSwqWwC7+co GK4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b="SFCfOL/K"; 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 i17-20020a170902e49100b0017ae43612d9si13465120ple.324.2023.02.14.22.28.39; Tue, 14 Feb 2023 22:28:52 -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="SFCfOL/K"; 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 S232959AbjBOG2L (ORCPT + 99 others); Wed, 15 Feb 2023 01:28:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229793AbjBOG2I (ORCPT ); Wed, 15 Feb 2023 01:28:08 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FB2135259; Tue, 14 Feb 2023 22:27:40 -0800 (PST) X-UUID: d2db6330acf911eda06fc9ecc4dadd91-20230215 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=b2o7qpESFEhyJrsVjX10Hj6Qps7553sca1RMhYqI+zo=; b=SFCfOL/KnPUgrGzJrwhgSGm646ZF+V+UBLdBEUqK6VUF7gsHwbSeUl4HbYsGWOWSToeRehw/l95YCaEC9DKSqbiYUE7m77Is9yueh5VhBnPWdS/c2hk/h7xxR0HCnIZaiN72FkQ5j8b2tBX0AWDXdni9PvIjJffGsP4ThqtIy9E=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:65e69150-4987-48c2-a36c-6fd83b56ef58,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:334b9f25-564d-42d9-9875-7c868ee415ec,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: d2db6330acf911eda06fc9ecc4dadd91-20230215 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1541447990; Wed, 15 Feb 2023 14:27:30 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.194) by mtkmbs11n2.mediatek.inc (172.21.101.187) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Wed, 15 Feb 2023 14:27:29 +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; Wed, 15 Feb 2023 14:27:27 +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 v4 07/11] iommu/mediatek: mt8186: Add iova_region_larb_msk Date: Wed, 15 Feb 2023 14:25:40 +0800 Message-ID: <20230215062544.8677-8-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230215062544.8677-1-yong.wu@mediatek.com> References: <20230215062544.8677-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?1757877404781352268?= X-GMAIL-MSGID: =?utf-8?q?1757877404781352268?= Add iova_region_larb_msk for mt8186. We separate the 16GB iova regions by each device's larbid/portid. Note: larb5/6/10/12/14/15/18 connect nothing in this SoC. Refer to include/dt-bindings/memory/mt8186-memory-port.h Signed-off-by: Yong Wu Reviewed-by: AngeloGioacchino Del Regno --- drivers/iommu/mtk_iommu.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index 0e387345e1c3..fbfc5e4e56a8 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -1529,6 +1529,18 @@ static const struct mtk_iommu_plat_data mt8183_data = { .larbid_remap = {{0}, {4}, {5}, {6}, {7}, {2}, {3}, {1}}, }; +static const unsigned int mt8186_larb_region_msk[MT8192_MULTI_REGION_NR_MAX][MTK_LARB_NR_MAX] = { + [0] = {~0, ~0, ~0}, /* Region0: all ports for larb0/1/2 */ + [1] = {0, 0, 0, 0, ~0, 0, 0, ~0}, /* Region1: larb4/7 */ + [2] = {0, 0, 0, 0, 0, 0, 0, 0, /* Region2: larb8/9/11/13/16/17/19/20 */ + ~0, ~0, 0, ~0, 0, ~(u32)(BIT(9) | BIT(10)), 0, 0, + /* larb13: the other ports except port9/10 */ + ~0, ~0, 0, ~0, ~0}, + [3] = {0}, + [4] = {[13] = BIT(9) | BIT(10)}, /* larb13 port9/10 */ + [5] = {[14] = ~0}, /* larb14 */ +}; + static const struct mtk_iommu_plat_data mt8186_data_mm = { .m4u_plat = M4U_MT8186, .flags = HAS_BCLK | HAS_SUB_COMM_2BITS | OUT_ORDER_WR_EN | @@ -1541,6 +1553,7 @@ static const struct mtk_iommu_plat_data mt8186_data_mm = { .banks_enable = {true}, .iova_region = mt8192_multi_dom, .iova_region_nr = ARRAY_SIZE(mt8192_multi_dom), + .iova_region_larb_msk = mt8186_larb_region_msk, }; static const unsigned int mt8192_larb_region_msk[MT8192_MULTI_REGION_NR_MAX][MTK_LARB_NR_MAX] = {