From patchwork Wed Feb 15 06:25:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yong Wu X-Patchwork-Id: 57376 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp30908wrn; Tue, 14 Feb 2023 22:27:45 -0800 (PST) X-Google-Smtp-Source: AK7set+oFfz7Xll3PYeeCOmsp5XHrZmHWZo1ey9SzOoNac1kozUhQxCjtDX0TnjruiPSWXl5vNfH X-Received: by 2002:a05:6a20:6a9e:b0:b8:a0e1:2739 with SMTP id bi30-20020a056a206a9e00b000b8a0e12739mr733211pzb.3.1676442464895; Tue, 14 Feb 2023 22:27:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676442464; cv=none; d=google.com; s=arc-20160816; b=oHgNuOKWKV51zzP9L8vv7KbiXynkFXhdxqM75pnIa/CPnfCXzEVy0jAQ+C05b69NiI SmZuEPjo4DJomQ7bmOgZIciHuHkv09uBUeedLVItqVuaV981RiHtJvt846+2TnvkNmqS FPyG/KnScdRvN9ZUHs5LrghR3WKRYVbFwjfUlEIN+c1wItv8GM2StgIwh+Lk6KnIg1H2 ZCFfEufBX/FPfR/stGmSRLJgiDrTOhzNMcirW46jqlkhGX29EkfmnYL/ghPwF0MAmboA NtuU0q2BGWwAL1ObodmKZ1pPgQ0qyarE73gVGIMK5DQgWPZSoNFIPwZFbTUpnaecxGdU Ftuw== 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=Tj7gc9/ETJfThMX11/SvkW6RSCkvj56c1pXVSNQqS0I=; b=rk6FP4KouJJoGb2dCWmcakRvyE/6FVevvIxGoOXlbP5GKttcWtdNWfO6Cvo1St7uyZ 0z5UfhW00wN5RT8/ongj47Qt+SIEhS0FM9AGRnknkajUKidmKxTiritaoiLeEXphHhqc KQYbznIVizPz/4WlLamtQfa35Jw29sxutdSsfhN5rY4uMHh7lqHWJw+oYqJLrI0pkyZx TATqG0QaC/+diyoYji40iBOfeuAvfk+hz2UUXi0u2l815Xy6sHY3F6coUAEY2axyhkft 8E1ET7U90oFkytpOja25r6aBGfSeScV51YGICQZr+albNvl4QAHvO29wngqsTnBKts+A lX7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=IWIuv3M7; 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 l12-20020a63700c000000b004df3ece2141si16577928pgc.788.2023.02.14.22.27.32; Tue, 14 Feb 2023 22:27:44 -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=IWIuv3M7; 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 S233116AbjBOG0R (ORCPT + 99 others); Wed, 15 Feb 2023 01:26:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233111AbjBOG0N (ORCPT ); Wed, 15 Feb 2023 01:26:13 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23C9E3430E; Tue, 14 Feb 2023 22:26:11 -0800 (PST) X-UUID: a07667b4acf911eda06fc9ecc4dadd91-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=Tj7gc9/ETJfThMX11/SvkW6RSCkvj56c1pXVSNQqS0I=; b=IWIuv3M7q5I3dMccMc+w5CAIQ084gVGTpDRjWqE8kp1F4scGqidZxhb7iWFR0gGY9i/YBipbihO+tSQdHTl+AIBAHOXJuK9e7sTec0eUyCCOq9m3GJfs6dRQG4w9Se2JAokjgJUTH56VZrRr8sukEHCrm5KF/SyqPdjzA2dCoPY=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:7e0446b2-64b7-475e-9b25-49e424f9796f,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:4c3e9f25-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: a07667b4acf911eda06fc9ecc4dadd91-20230215 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 459445041; Wed, 15 Feb 2023 14:26:05 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) 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, 15 Feb 2023 14:26:04 +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:26:03 +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 , Tiffany Lin , Andrew-CT Chen Subject: [PATCH v4 01/11] dt-bindings: media: mediatek,vcodec: Remove dma-ranges property Date: Wed, 15 Feb 2023 14:25:34 +0800 Message-ID: <20230215062544.8677-2-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?1757877334104148215?= X-GMAIL-MSGID: =?utf-8?q?1757877334104148215?= After commit f1ad5338a4d5 ("of: Fix "dma-ranges" handling for bus controllers"), the dma-ranges of the leaf node doesn't work. Remove it for vcodec here. 1) For mediatek,vcodec-decoder.yaml and mediatek,vcodec-encoder.yaml, this property is in the leaf node, it is invalid as the above comment. Currently there is only mt8195 VENC node has this property in upstream. Indeed, VENC is affected, but it is not a fatal issue. Originally it expects its iova range locate at 4GB-8GB. However after that commit, its expectation doesn't come true, it will fall back to 0-4GB iova and also could work well. 2) For mediatek,vcodec-subdev-decoder.yaml, It already uses parent-child node, this property works. Instead, MediaTek iommu will control the masters' iova ranges by the master's larb/port id internally, then the dma-ranges property is unnecessary for the master's node. Cc: Tiffany Lin Cc: Andrew-CT Chen Cc: Yunfei Dong Cc: Mauro Carvalho Chehab Cc: Matthias Brugger Signed-off-by: Yong Wu Reviewed-by: AngeloGioacchino Del Regno Acked-by: Rob Herring --- .../devicetree/bindings/media/mediatek,vcodec-decoder.yaml | 5 ----- .../devicetree/bindings/media/mediatek,vcodec-encoder.yaml | 5 ----- .../bindings/media/mediatek,vcodec-subdev-decoder.yaml | 7 ------- 3 files changed, 17 deletions(-) diff --git a/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml b/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml index aa55ca65d6ed..fad59b486d5d 100644 --- a/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml +++ b/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml @@ -56,11 +56,6 @@ properties: List of the hardware port in respective IOMMU block for current Socs. Refer to bindings/iommu/mediatek,iommu.yaml. - dma-ranges: - maxItems: 1 - description: | - Describes the physical address space of IOMMU maps to memory. - mediatek,vpu: $ref: /schemas/types.yaml#/definitions/phandle description: diff --git a/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml b/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml index 0f2ea8d9a10c..a2051b31fa29 100644 --- a/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml +++ b/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml @@ -49,11 +49,6 @@ properties: List of the hardware port in respective IOMMU block for current Socs. Refer to bindings/iommu/mediatek,iommu.yaml. - dma-ranges: - maxItems: 1 - description: | - Describes the physical address space of IOMMU maps to memory. - mediatek,vpu: $ref: /schemas/types.yaml#/definitions/phandle description: diff --git a/Documentation/devicetree/bindings/media/mediatek,vcodec-subdev-decoder.yaml b/Documentation/devicetree/bindings/media/mediatek,vcodec-subdev-decoder.yaml index c4f20acdc1f8..290594bc91cc 100644 --- a/Documentation/devicetree/bindings/media/mediatek,vcodec-subdev-decoder.yaml +++ b/Documentation/devicetree/bindings/media/mediatek,vcodec-subdev-decoder.yaml @@ -76,11 +76,6 @@ properties: The node of system control processor (SCP), using the remoteproc & rpmsg framework. - dma-ranges: - maxItems: 1 - description: | - Describes the physical address space of IOMMU maps to memory. - "#address-cells": const: 2 @@ -203,7 +198,6 @@ required: - reg - iommus - mediatek,scp - - dma-ranges - ranges if: @@ -236,7 +230,6 @@ examples: compatible = "mediatek,mt8192-vcodec-dec"; mediatek,scp = <&scp>; iommus = <&iommu0 M4U_PORT_L4_VDEC_MC_EXT>; - dma-ranges = <0x1 0x0 0x0 0x40000000 0x0 0xfff00000>; #address-cells = <2>; #size-cells = <2>; ranges = <0 0 0 0x16000000 0 0x40000>; From patchwork Wed Feb 15 06:25:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yong Wu X-Patchwork-Id: 57377 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp30940wrn; Tue, 14 Feb 2023 22:27:51 -0800 (PST) X-Google-Smtp-Source: AK7set+uBCTjaS5H5oFBajkzzegzSHrct9pyBswz3lFVDHyc4+fG/9pcis9FrlvwOpuzbvHD3GbV X-Received: by 2002:a17:90b:3ec9:b0:233:d4a5:d89c with SMTP id rm9-20020a17090b3ec900b00233d4a5d89cmr1624639pjb.17.1676442471433; Tue, 14 Feb 2023 22:27:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676442471; cv=none; d=google.com; s=arc-20160816; b=sjsR6urTqtykhRpfl60FDIdir+P6SQLQalZ24J+Zh5azSeHTjCEzccv0YJderLAQAs /HnvCVe3ruDPTU05dTUO2NiF1RzpTkLU9Dg4YYWpulOG9WXTtXlOQRI00niysjzY9ULJ BsjuYyHMA3x9ImM4jQI8ovN0s8M50J0g2NEEVLB/Uzw1634oIiQhH+B9WUlRxjIGfNID /88+5e14ftvgd2c3rtaxQ4AdPQTFWgy34EGd+D0RCaeQMk7T+U3pDg+G546MnKwI8I86 HBIXJVbjwfl4R9L27BlQZCNSJoBj/szShuAIUtsrBnka0rENjZsQ5wa6aAR/WF4Bqc// PamA== 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=gVKL4KJqwisyrDGjjim13i1bSfcD5JMtp94Ihfda32A=; b=wX8ZTG22axygILuWiRL3I5QVgUPgHyCUZL4NLt6B35Vl8P8mt5QcqQADBPgxl+vwx+ /M8zy3n13bzNQeixMRBx54rHoF7yvCb1yr7cQpS8QT/+7bmlSZ/pK1HqVkJXF7kobWkW dxtC0k35Eyoth71jmyK8tIlwVDy0KnbxZUO6rtT/BlTg+xleHPsYgDtd07rZpTC122cE S2hgS6eIbscrUkz1VM8SfwWAYWwCogkij1jMwbs1LZ5RnPT/xyaqE4lvuApj+el9/x6B TnBt32TK2ofXjOvDpG0s58YaCe2e5US7a0Pg/9+94OvyLkTwHmkiOzTSqt1BqqyPmSz4 JVgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=aTXLtSvL; 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 u19-20020a17090a891300b002312812e917si1126131pjn.63.2023.02.14.22.27.39; Tue, 14 Feb 2023 22:27:51 -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=aTXLtSvL; 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 S229618AbjBOG0c (ORCPT + 99 others); Wed, 15 Feb 2023 01:26:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233098AbjBOG03 (ORCPT ); Wed, 15 Feb 2023 01:26:29 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EEFFEB6D; Tue, 14 Feb 2023 22:26:24 -0800 (PST) X-UUID: a8bfdd06acf911eda06fc9ecc4dadd91-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=gVKL4KJqwisyrDGjjim13i1bSfcD5JMtp94Ihfda32A=; b=aTXLtSvL3Fbg3RvvhS1D+kgW2lUj+6vqTbm5sjGFAWexp2W6kznFSTsUAEn4l8HWaLdGoCDdaL1cvmtOxA4H8/OCoPYuZndmAeRCsO/K0VPcaP5XlpHWBWPDfuoPtPwOaoXnQQezUxDxJFPVfjZARt6ze/mz2fmxwZzo9coDsdM=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:b4b375ad-5979-4b97-aace-20d3040d4b40,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:-5 X-CID-META: VersionHash:885ddb2,CLOUDID:bae87fb0-beed-4dfc-bd9c-e1b22fa6ccc4,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: a8bfdd06acf911eda06fc9ecc4dadd91-20230215 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 1828904972; Wed, 15 Feb 2023 14:26:19 +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:26:18 +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:26:17 +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 , Bin Liu , Xia Jiang Subject: [PATCH v4 02/11] dt-bindings: media: mediatek,jpeg: Remove dma-ranges property Date: Wed, 15 Feb 2023 14:25:35 +0800 Message-ID: <20230215062544.8677-3-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?1757877340441883757?= X-GMAIL-MSGID: =?utf-8?q?1757877340441883757?= After commit f1ad5338a4d5 ("of: Fix "dma-ranges" handling for bus controllers"), the dma-ranges of the leaf node doesn't work. Remove it for jpeg here. Currently there is only mt8195 jpeg node has this property in upstream, and it already uses parent-child node, this property did work. But instead, MediaTek iommu will control the masters' iova ranges by the master's larb/port id internally, then this property is unnecessary. Cc: Mauro Carvalho Chehab Cc: Matthias Brugger Cc: Bin Liu Cc: kyrie wu Cc: Xia Jiang Signed-off-by: Yong Wu Reviewed-by: AngeloGioacchino Del Regno Acked-by: Rob Herring --- .../devicetree/bindings/media/mediatek,mt8195-jpegdec.yaml | 7 ------- .../devicetree/bindings/media/mediatek,mt8195-jpegenc.yaml | 7 ------- .../devicetree/bindings/media/mediatek-jpeg-encoder.yaml | 5 ----- 3 files changed, 19 deletions(-) diff --git a/Documentation/devicetree/bindings/media/mediatek,mt8195-jpegdec.yaml b/Documentation/devicetree/bindings/media/mediatek,mt8195-jpegdec.yaml index 71595c013dbb..e5448c60e3eb 100644 --- a/Documentation/devicetree/bindings/media/mediatek,mt8195-jpegdec.yaml +++ b/Documentation/devicetree/bindings/media/mediatek,mt8195-jpegdec.yaml @@ -26,11 +26,6 @@ properties: Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml for details. Ports are according to the HW. - dma-ranges: - maxItems: 1 - description: | - Describes the physical address space of IOMMU maps to memory. - "#address-cells": const: 2 @@ -89,7 +84,6 @@ required: - compatible - power-domains - iommus - - dma-ranges - ranges additionalProperties: false @@ -115,7 +109,6 @@ examples: <&iommu_vpp M4U_PORT_L19_JPGDEC_BSDMA1>, <&iommu_vpp M4U_PORT_L19_JPGDEC_BUFF_OFFSET1>, <&iommu_vpp M4U_PORT_L19_JPGDEC_BUFF_OFFSET0>; - dma-ranges = <0x1 0x0 0x0 0x40000000 0x0 0xfff00000>; #address-cells = <2>; #size-cells = <2>; ranges; diff --git a/Documentation/devicetree/bindings/media/mediatek,mt8195-jpegenc.yaml b/Documentation/devicetree/bindings/media/mediatek,mt8195-jpegenc.yaml index 95990539f7c0..596186497b68 100644 --- a/Documentation/devicetree/bindings/media/mediatek,mt8195-jpegenc.yaml +++ b/Documentation/devicetree/bindings/media/mediatek,mt8195-jpegenc.yaml @@ -26,11 +26,6 @@ properties: Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml for details. Ports are according to the HW. - dma-ranges: - maxItems: 1 - description: | - Describes the physical address space of IOMMU maps to memory. - "#address-cells": const: 2 @@ -89,7 +84,6 @@ required: - compatible - power-domains - iommus - - dma-ranges - ranges additionalProperties: false @@ -113,7 +107,6 @@ examples: <&iommu_vpp M4U_PORT_L20_JPGENC_C_RDMA>, <&iommu_vpp M4U_PORT_L20_JPGENC_Q_TABLE>, <&iommu_vpp M4U_PORT_L20_JPGENC_BSDMA>; - dma-ranges = <0x1 0x0 0x0 0x40000000 0x0 0xfff00000>; #address-cells = <2>; #size-cells = <2>; ranges; diff --git a/Documentation/devicetree/bindings/media/mediatek-jpeg-encoder.yaml b/Documentation/devicetree/bindings/media/mediatek-jpeg-encoder.yaml index c8412e8ab353..37800e1908cc 100644 --- a/Documentation/devicetree/bindings/media/mediatek-jpeg-encoder.yaml +++ b/Documentation/devicetree/bindings/media/mediatek-jpeg-encoder.yaml @@ -44,11 +44,6 @@ properties: Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml for details. Ports are according to the HW. - dma-ranges: - maxItems: 1 - description: | - Describes the physical address space of IOMMU maps to memory. - required: - compatible - reg From patchwork Wed Feb 15 06:25:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yong Wu X-Patchwork-Id: 57378 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp30997wrn; Tue, 14 Feb 2023 22:28:04 -0800 (PST) X-Google-Smtp-Source: AK7set8MGY/YemQ83yPrW7sF7IFGVEueqDUK6XsYX0K3Dx4g+KIRKkYSPomz7DoagmDMCabeAhyL X-Received: by 2002:a17:902:f9c4:b0:196:89c9:20f4 with SMTP id kz4-20020a170902f9c400b0019689c920f4mr1144121plb.7.1676442483882; Tue, 14 Feb 2023 22:28:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676442483; cv=none; d=google.com; s=arc-20160816; b=FseYe+jdInwfoTqsjKIZy3+YjXXtMVOmAtnl3PYq176cMaKKRGSpGQYa9DgfgugVj+ 5lijAHxwcOPQp8ZYqPYNHYGkJO/RsOoeawa9t7KdxD/XBQisrSxftP/XnvcAIBqDWLzY C3Iv7pgBAvyq/BJ5CDPkeAz/5SHSHohpGs3KKRsMJ0asrdBesO1W8dXXyaLy4oXsg3KL J4/UM73N3zoaZkDnSUZbFKTqJBcKAS9c+dpn4yGPq2IkMV64/pSl+W89r/+woMR7iz38 rScPczhCZSRaodwwlLwTYCYmMHH3C9MpXmHWNh8dB50QFaTsp6uzT8rpnMps3ZIJbvjz XVnQ== 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=1CSrx+zCSBkyvjy4KRaBV0IuYXilNNdpDy6Avu7acRg=; b=AHknuooidUnuPXlUhytWkfGyE5G1rI/z665E7TeyGOX3nXCGy5zFPVprt6fbaJYE5M xUi0yCzNDDHQh/R4ZHaxBnPaFN7I68eYNfCWfrixbmDVzyT2IjvHJHoDlh3gUJxxvInB FcnJNwN5f6hU8n1mQjdfqqTCawJdnDXSUHkfRBlWPohxh5F+5Vs/ldkBD5ufqh9tLK9S LGnL8XRBV42zRBh5E/M0TnURe4LHvylPjfVEz6gXWA8OxwUtSNenXlpVZ6ji7eBOnJJy zfaKzaEUq9c++fqKJaVrLqBQ5LiSa/8mtgIlSbvuu3sFUKo4MwHHValOd/il2rD64/yd XsXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=Riipnc09; 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 b5-20020a170902e94500b00194a2575c84si16411157pll.596.2023.02.14.22.27.51; Tue, 14 Feb 2023 22:28:03 -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=Riipnc09; 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 S231923AbjBOG0y (ORCPT + 99 others); Wed, 15 Feb 2023 01:26:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233098AbjBOG0u (ORCPT ); Wed, 15 Feb 2023 01:26:50 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BCE33524C; Tue, 14 Feb 2023 22:26:36 -0800 (PST) X-UUID: b05a934eacf911eda06fc9ecc4dadd91-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=1CSrx+zCSBkyvjy4KRaBV0IuYXilNNdpDy6Avu7acRg=; b=Riipnc09WxnpdkbvH0Pz5f8DfVIKvQhENWTPsda5iIkGICbxhlKg50cQcdCoI+1AlE0X6n1TZsofBdYOJmRojTv9Cp/4ieqMWo2i77Ld1tg4A2xpWjtkAwEqzVR7jxYedwhyB+Zt1GMSuap9zGEGzbW/jNg4nYI884b8A131EMM=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:bc711064-e87e-4976-8996-93c1394e07ed,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:70 X-CID-INFO: VERSION:1.1.19,REQID:bc711064-e87e-4976-8996-93c1394e07ed,IP:0,URL :0,TC:0,Content:-25,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTI ON:quarantine,TS:70 X-CID-META: VersionHash:885ddb2,CLOUDID:aa490df3-ddba-41c3-91d9-10eeade8eac7,B ulkID:230215142633RLEPW8JG,BulkQuantity:0,Recheck:0,SF:38|29|28|17|19|48,T C:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 ,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-UUID: b05a934eacf911eda06fc9ecc4dadd91-20230215 Received: from mtkmbs13n1.mediatek.inc [(172.21.101.193)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1108693227; Wed, 15 Feb 2023 14:26:32 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.194) 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.792.15; Wed, 15 Feb 2023 14:26:31 +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:26:30 +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 03/11] iommu/mediatek: Improve comment for the current region/bank Date: Wed, 15 Feb 2023 14:25:36 +0800 Message-ID: <20230215062544.8677-4-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?1757877354122055330?= X-GMAIL-MSGID: =?utf-8?q?1757877354122055330?= No functional change. Just add more comment about the current region/bank in the code. Signed-off-by: Yong Wu Reviewed-by: AngeloGioacchino Del Regno --- drivers/iommu/mtk_iommu.c | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index d5a4955910ff..aa4bdcb65ea7 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -197,12 +197,33 @@ struct mtk_iommu_plat_data { char *pericfg_comp_str; struct list_head *hw_list; - unsigned int iova_region_nr; - const struct mtk_iommu_iova_region *iova_region; - u8 banks_num; - bool banks_enable[MTK_IOMMU_BANK_MAX]; - unsigned int banks_portmsk[MTK_IOMMU_BANK_MAX]; + /* + * The IOMMU HW may support 16GB iova. In order to balance the IOVA ranges, + * different masters will be put in different iova ranges, for example vcodec + * is in 4G-8G and cam is in 8G-12G. Meanwhile, some masters may have the + * special IOVA range requirement, like CCU can only support the address + * 0x40000000-0x44000000. + * Here list the iova ranges this SoC supports and which larbs/ports are in + * which region. + * + * 16GB iova all use one pgtable, but each a region is a iommu group. + */ + struct { + unsigned int iova_region_nr; + const struct mtk_iommu_iova_region *iova_region; + }; + + /* + * The IOMMU HW may have 5 banks. Each bank has a independent pgtable. + * Here list how many banks this SoC supports/enables and which ports are in which bank. + */ + struct { + u8 banks_num; + bool banks_enable[MTK_IOMMU_BANK_MAX]; + unsigned int banks_portmsk[MTK_IOMMU_BANK_MAX]; + }; + unsigned char larbid_remap[MTK_LARB_COM_MAX][MTK_LARB_SUBCOM_MAX]; }; From patchwork Wed Feb 15 06:25:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yong Wu X-Patchwork-Id: 57379 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp31031wrn; Tue, 14 Feb 2023 22:28:10 -0800 (PST) X-Google-Smtp-Source: AK7set9JoJ7ppp2o3p3yLLRBLylox0GNfhumA6M+yQ++EBJmJMthEJ8XU9bGtQPk7bPExvvUc1sh X-Received: by 2002:a17:903:18a:b0:19a:924f:e509 with SMTP id z10-20020a170903018a00b0019a924fe509mr1601052plg.57.1676442490267; Tue, 14 Feb 2023 22:28:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676442490; cv=none; d=google.com; s=arc-20160816; b=RTnMJIXFVkncfgVzviwYhjirfuFU9c0vzH0zOhL7D+1NrHwEIUKKbd2OKHmMjdnZtX uqtHVkuuJ4GkbVRxkVepsOMoUeuINXxW29wWrfe+xoabrIsWgwYKhUgyLGzL8+MoBitB sD3zuuIVR7MGHMY2hc017TDDCFSmzWw2sl2smlJqkXajtDRZ3YsUFag8B6D95sjRi0+U O/5tbptz7SpCehbk1/8cI6oAJpEVGLOAwJSgbpaX6punK+xo1JpgWIH0a7ueeb8bPaDz bMDTUEkgLK+oTwH8JQOfeHXn7EbGvQUSXSrV1YS+9wJI9j3dP29St0HWSK38q36CLVIk voPA== 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=PZn06kHtNrW2DKGvB71iOae3G6AC0W50hnWxBP3UDj0=; b=M2spbwrIKtCttifabHMCJ5k1A96g9VU5eHzhk3EQpOP37VZlZQje6BVCBezMWDiesn L/AtYClAJi2FgL9DCk5m7Nqc0OMnl1GBYYmunMer0orP6MhtxiFCmsPmVK850suyAPEx nuezuZuujfomdp6NNR8xI9QMC7vQLuAWkCGOXlsoIfFU6jKHKD8hAXvYohbNiegqrylI +vPpgXEtfwymm62UVC0wbA7KsO8jkyIROIleI4EqBW5b83qzQzagMU6XX/xIta91UCi/ iH48PVnAgNkrDxdRPWGuHWT496gKIJSpP5YuIDPQ+C8sa/efIvilWNaquvOPgBteiAwW nDoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=m+MIIZ6m; 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 e15-20020a17090301cf00b001867ea919bdsi3632856plh.25.2023.02.14.22.27.57; Tue, 14 Feb 2023 22:28:10 -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=m+MIIZ6m; 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 S233197AbjBOG1K (ORCPT + 99 others); Wed, 15 Feb 2023 01:27:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229809AbjBOG1I (ORCPT ); Wed, 15 Feb 2023 01:27:08 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43E7731E0E; Tue, 14 Feb 2023 22:26:48 -0800 (PST) X-UUID: b7769bd2acf911ed945fc101203acc17-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=PZn06kHtNrW2DKGvB71iOae3G6AC0W50hnWxBP3UDj0=; b=m+MIIZ6mgvLFSbc+0L9IUvHms3lqgO9eNdN1Dby9rhH/v1cfnPCNgvWMY5ba2ZBKoavmMYNSYJO0K7iGjvZvkR6/sjYqxFMmXhfi4GoIYGpyXgtnzKiA8ehM6v9IKslnl7Jh96sVBPEelitSCcO1Q83EE1pV83yOY4JO8qFn8qg=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:caf46a67-b394-4f18-9300-0aebd795d0da,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:504b0df3-ddba-41c3-91d9-10eeade8eac7,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: b7769bd2acf911ed945fc101203acc17-20230215 Received: from mtkmbs11n2.mediatek.inc [(172.21.101.187)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 34493484; Wed, 15 Feb 2023 14:26:44 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) 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, 15 Feb 2023 14:26:43 +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:26:42 +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 04/11] iommu/mediatek: Get regionid from larb/port id Date: Wed, 15 Feb 2023 14:25:37 +0800 Message-ID: <20230215062544.8677-5-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?1757877360588131924?= X-GMAIL-MSGID: =?utf-8?q?1757877360588131924?= After commit f1ad5338a4d5 ("of: Fix "dma-ranges" handling for bus controllers"), the dma-ranges is not allowed for dts leaf node. but we still would like to separate to different masters into different iova regions. Thus we have to separate it by the HW larbid and portid. For example, larb1/2 are in region2 and larb3 is in region3. The problem is that some ports inside a larb are in region4 while some ports inside this larb are in region5. Therefore I define a "iova_region_larb_msk" to help record the information for each a port. Take a example for a larb: [1] = ~0: means all ports in this larb are in region1; [2] = BIT(3) | BIT(4): means port3/4 in this larb are region2; [3] = ~(BIT(3) | BIT(4)): means all the other ports except port3/4 in this larb are region3. This method also avoids the users forget/abuse the iova regions. Signed-off-by: Yong Wu Reviewed-by: AngeloGioacchino Del Regno --- drivers/iommu/mtk_iommu.c | 51 ++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index aa4bdcb65ea7..89a80982b7d1 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -8,7 +8,6 @@ #include #include #include -#include #include #include #include @@ -212,6 +211,15 @@ struct mtk_iommu_plat_data { struct { unsigned int iova_region_nr; const struct mtk_iommu_iova_region *iova_region; + /* + * Indicate the correspondance between larbs, ports and regions. + * + * The index is the same as iova_region and larb port numbers are + * described as bit positions. + * For example, storing BIT(0) at index 2,1 means "larb 1, port0 is in region 2". + * [2] = { [1] = BIT(0) } + */ + const u32 (*iova_region_larb_msk)[MTK_LARB_NR_MAX]; }; /* @@ -529,30 +537,33 @@ static unsigned int mtk_iommu_get_bank_id(struct device *dev, static int mtk_iommu_get_iova_region_id(struct device *dev, const struct mtk_iommu_plat_data *plat_data) { - const struct mtk_iommu_iova_region *rgn = plat_data->iova_region; - const struct bus_dma_region *dma_rgn = dev->dma_range_map; - int i, candidate = -1; - dma_addr_t dma_end; + struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev); + unsigned int portidmsk = 0, larbid; + const u32 *rgn_larb_msk; + int i, region_id = -1; - if (!dma_rgn || plat_data->iova_region_nr == 1) + if (plat_data->iova_region_nr == 1) return 0; - dma_end = dma_rgn->dma_start + dma_rgn->size - 1; - for (i = 0; i < plat_data->iova_region_nr; i++, rgn++) { - /* Best fit. */ - if (dma_rgn->dma_start == rgn->iova_base && - dma_end == rgn->iova_base + rgn->size - 1) - return i; - /* ok if it is inside this region. */ - if (dma_rgn->dma_start >= rgn->iova_base && - dma_end < rgn->iova_base + rgn->size) - candidate = i; + larbid = MTK_M4U_TO_LARB(fwspec->ids[0]); + for (i = 0; i < fwspec->num_ids; i++) + portidmsk |= BIT(MTK_M4U_TO_PORT(fwspec->ids[i])); + + for (i = 0; i < plat_data->iova_region_nr; i++) { + rgn_larb_msk = plat_data->iova_region_larb_msk[i]; + if (!rgn_larb_msk) + continue; + + if ((rgn_larb_msk[larbid] & portidmsk) == portidmsk) { + region_id = i; + break; + } } - if (candidate >= 0) - return candidate; - dev_err(dev, "Can NOT find the iommu domain id(%pad 0x%llx).\n", - &dma_rgn->dma_start, dma_rgn->size); + if (region_id >= 0) + return region_id; + dev_err(dev, "Can NOT find the region for larb(%d-%x).\n", + larbid, portidmsk); return -EINVAL; } From patchwork Wed Feb 15 06:25:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yong Wu X-Patchwork-Id: 57380 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp31081wrn; Tue, 14 Feb 2023 22:28:17 -0800 (PST) X-Google-Smtp-Source: AK7set/zFN65EWFS/QDweD1iFtE+9/YyKBZlNHhPAq8wm2Bx88z5c5O2J411Azoy+FNrzRGaI8Rt X-Received: by 2002:a17:90a:df09:b0:234:6b7:6391 with SMTP id gp9-20020a17090adf0900b0023406b76391mr1667160pjb.19.1676442497460; Tue, 14 Feb 2023 22:28:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676442497; cv=none; d=google.com; s=arc-20160816; b=ZVw+SGRcYH6UuQVYLqpHS5qQwbgnouHE3+1pcXDg/W6p9qQc7xi5IhFzY/QzrcDdxX wN/jYTK6M/xHGoNN3xs8buqW4TjjwVUXKbz9s2/Mq78iDbF1fWgzes+hDxN9zV1wmV69 U+V8iXGnS6F9yyCFQ7+hyXLUMyLbS6NM2nd2nglcqmhc+PapfqXE52xY9zbhABsvWP9V 9wBlOtjOEm1e7IU//XBgUiw5ChtXiw8SRKa9bbhzexemyPPhiLEvItZ1CWqtDacFgYmt XjnRew5MjwSrrekSztQLaMSeGYCkBM+S+8hNRCX+J8dQC+NfOgpv/DZ9Yhnc6tNJfuf2 mgXw== 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=vUg60ZiSadtjnY2aJZUABOZJhEHAijhA6RbRthYA4cs=; b=0SEa1aKGfZ9byUiAoVgOwSfoAGj2Op1F9BczV2corK6VXXuTbowR4foXRcwRg2RmIy zARi8NI9LGEVeitcU8uG5WSZsn+EgMht++jgvI+U6Ne28WSZL5iOdUEAtpYWTrwgtLvd Of58iP8g5BRg4jimG9gw3ESSfTkgC6Z9zOo9ddrFYMWfIzzrzYGxAE/m6z+UTQFipioZ dPT/KvFHToZioyLlbeUeyqIJyZc/HTkWuhufqIF1Ie3cziDhwWpnjz+Eakx6mtKNyEfD /u5J9US473QISR6sbxxBNGQs4197lNrmdqS4q/t6cDJz9KhRcu8XNX7PbFdUhZ410eoK mLZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=TYoPDPX7; 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 c11-20020a17090a8d0b00b00230a19ce84asi1126969pjo.147.2023.02.14.22.28.04; Tue, 14 Feb 2023 22:28: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=TYoPDPX7; 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 S232704AbjBOG1X (ORCPT + 99 others); Wed, 15 Feb 2023 01:27:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230290AbjBOG1U (ORCPT ); Wed, 15 Feb 2023 01:27:20 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E4FE34C32; Tue, 14 Feb 2023 22:27:01 -0800 (PST) X-UUID: bdc2747aacf911eda06fc9ecc4dadd91-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=vUg60ZiSadtjnY2aJZUABOZJhEHAijhA6RbRthYA4cs=; b=TYoPDPX78TpEaSNRiTaQ1D/ewNb8rfu/gX3BsIAcNtKiD480aN5xckyBq+HSyf/AAz22I5zvghnlNUaQjn/wnBVRHlZKhO6UCt6mTCSy96uEjux+bCYXFYfhUhqmI8DhlsJAoFTeb/t1IWg2vVp1aN/2jtKNnvABNaM4smMfDpc=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:c6a6102e-df73-494f-8a4b-f5da49f035ba,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:70 X-CID-INFO: VERSION:1.1.19,REQID:c6a6102e-df73-494f-8a4b-f5da49f035ba,IP:0,URL :0,TC:0,Content:-25,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTI ON:quarantine,TS:70 X-CID-META: VersionHash:885ddb2,CLOUDID:1d4d0df3-ddba-41c3-91d9-10eeade8eac7,B ulkID:230215142657KSW2D7GB,BulkQuantity:0,Recheck:0,SF:38|29|28|17|19|48,T C:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 ,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-UUID: bdc2747aacf911eda06fc9ecc4dadd91-20230215 Received: from mtkmbs13n1.mediatek.inc [(172.21.101.193)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 587395742; Wed, 15 Feb 2023 14:26:54 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) 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, 15 Feb 2023 14:26: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; Wed, 15 Feb 2023 14:26: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 v4 05/11] iommu/mediatek: mt8192: Add iova_region_larb_msk Date: Wed, 15 Feb 2023 14:25:38 +0800 Message-ID: <20230215062544.8677-6-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?1757877367910709311?= X-GMAIL-MSGID: =?utf-8?q?1757877367910709311?= 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 Define a new macro MT8192_MULTI_REGION_NR_MAX to indicate the index of mt8xxx_larb_region_msk and "struct mtk_iommu_iova_region mt8192_multi_dom" are the same. Signed-off-by: Yong Wu Reviewed-by: AngeloGioacchino Del Regno --- drivers/iommu/mtk_iommu.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index 89a80982b7d1..710a3239fd3d 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -336,7 +336,12 @@ static const struct mtk_iommu_iova_region single_domain[] = { {.iova_base = 0, .size = SZ_4G}, }; -static const struct mtk_iommu_iova_region mt8192_multi_dom[] = { +#define MT8192_MULTI_REGION_NR_MAX 6 + +#define MT8192_MULTI_REGION_NR (IS_ENABLED(CONFIG_ARCH_DMA_ADDR_T_64BIT) ? \ + MT8192_MULTI_REGION_NR_MAX : 1) + +static const struct mtk_iommu_iova_region mt8192_multi_dom[MT8192_MULTI_REGION_NR] = { { .iova_base = 0x0, .size = SZ_4G}, /* 0 ~ 4G */ #if IS_ENABLED(CONFIG_ARCH_DMA_ADDR_T_64BIT) { .iova_base = SZ_4G, .size = SZ_4G}, /* 4G ~ 8G */ @@ -1538,6 +1543,17 @@ static const struct mtk_iommu_plat_data mt8186_data_mm = { .iova_region_nr = ARRAY_SIZE(mt8192_multi_dom), }; +static const unsigned int mt8192_larb_region_msk[MT8192_MULTI_REGION_NR_MAX][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 | @@ -1547,6 +1563,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}}, }; From patchwork Wed Feb 15 06:25: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: 57381 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp31182wrn; Tue, 14 Feb 2023 22:28:42 -0800 (PST) X-Google-Smtp-Source: AK7set95dKZIt49eve4UyFGPist+uZAk2pmYb0/sfxby5W/UoPGiptrJLgDbh0p++7Fs+CeHMdfj X-Received: by 2002:a17:903:2342:b0:19a:ae30:3a42 with SMTP id c2-20020a170903234200b0019aae303a42mr1377552plh.21.1676442521755; Tue, 14 Feb 2023 22:28:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676442521; cv=none; d=google.com; s=arc-20160816; b=CS594HT9GjxNWPkVn/U1WqUb+5DrGo65XrOkKwrPVBjXu6iQ/f9aAcqqvdOJngsUrb qzru/VWDQBh8VfQsbIkpGiNU/U0JVJivpmckgoEUTcqnNID65+IiVsPaz/pe+9ScpmcT gEMW/+WVDj5ovhSzFEGPVqly4QvdXT2b4ErKIfWVt3G4bZLJ+TeUBB+yB6aYOpJhFO4B zHKuwTRuu23XPPqfHlGA4hL9Jj5wrvfcGYibOpRXwEhfoW3wY0tKHddddW4O0g645iTx s6njQXzzwTBSpRe7p3Ujy4u0bH7Nw3+Lb/NjgS+KO0zxXSm5YUF7Vha41UXujtiwPIZr GLOA== 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=hwGBTMOVQ2wBigdtMArkLUWDMnuEE+1K/VPuqH+/3SA=; b=DhHe0IB2BePVK9H02dh/RmfHt3jWjTiC89ApqSjgTZAbR2FFXaOxF3QmGl3WFJWp6X N6U7io5LIKMMXw9vF2WIiuhnsQSfJoHJ3R/CYzbh9+ypRMEw3AUjSjabhr0Pv8sGQplh TuQqIcgLYjWNBl72E7U7xVhpkEsFKlgObcn7UNWmStCrap/wi1VQE+sepxWU5nGmbZ2e nkeQ0mkhHYEUF8al6QQavfVFMpaSO9yCqa1uSu+OI6B35V+C/VhLh6RjsW4myqQ/yux2 HJ2iwvq/3A6pfOLRdpGTRA4cktqQfpVzcIy8mewJgutrh9HfIFtNEDPOfaBRBI5gg5A2 xbrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b="i2max/JT"; 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 g13-20020a63374d000000b004fb40593898si17692948pgn.374.2023.02.14.22.28.29; Tue, 14 Feb 2023 22:28:41 -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="i2max/JT"; 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 S231788AbjBOG1i (ORCPT + 99 others); Wed, 15 Feb 2023 01:27:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233245AbjBOG1f (ORCPT ); Wed, 15 Feb 2023 01:27:35 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F4A735244; Tue, 14 Feb 2023 22:27:13 -0800 (PST) X-UUID: c4b50cf2acf911eda06fc9ecc4dadd91-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=hwGBTMOVQ2wBigdtMArkLUWDMnuEE+1K/VPuqH+/3SA=; b=i2max/JTcrMfBSr6AfvMytccovNkuaVcddVYW4yWWZQnDDJlnWJFEePXW7XiccEY9Sq7Qe38m1EsBW+lMKPIDko7uiY1s5Ek2gFLRyVfTNSNFzeGpY26rB/sR2w7B6WJ8Ody71CsZSm6M+0Ymt0yJ6iHRHZq086nycEJJCgP8nU=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:51f5adab-e7d2-4f23-ab11-775c5f2cb843,IP:0,U RL:0,TC:0,Content:-20,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:75 X-CID-INFO: VERSION:1.1.19,REQID:51f5adab-e7d2-4f23-ab11-775c5f2cb843,IP:0,URL :0,TC:0,Content:-20,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTI ON:quarantine,TS:75 X-CID-META: VersionHash:885ddb2,CLOUDID:3d4f0df3-ddba-41c3-91d9-10eeade8eac7,B ulkID:2302151427098GXQP203,BulkQuantity:0,Recheck:0,SF:38|29|28|17|19|48,T C:nil,Content:1,EDM:-3,IP:nil,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 ,OSI:0,OSA:0,AV:0 X-CID-BVR: 0,NGT X-UUID: c4b50cf2acf911eda06fc9ecc4dadd91-20230215 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 544965444; Wed, 15 Feb 2023 14:27:06 +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; Wed, 15 Feb 2023 14:27:05 +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:04 +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 06/11] iommu/mediatek: mt8195: Add iova_region_larb_msk Date: Wed, 15 Feb 2023 14:25:39 +0800 Message-ID: <20230215062544.8677-7-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?1757877393831614816?= X-GMAIL-MSGID: =?utf-8?q?1757877393831614816?= 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 710a3239fd3d..0e387345e1c3 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -1583,6 +1583,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 | @@ -1593,6 +1608,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}}, }; @@ -1607,6 +1623,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}, 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] = { From patchwork Wed Feb 15 06:25:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yong Wu X-Patchwork-Id: 57383 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp31263wrn; Tue, 14 Feb 2023 22:28:53 -0800 (PST) X-Google-Smtp-Source: AK7set/k0mLoJpV9uNTKRoW/itvZHN1ANlQaHNrD/RRwayGCaSDXnF2S3jNRwW+XfUfiFXaRYWpN X-Received: by 2002:a17:90a:347:b0:233:e4f6:43d1 with SMTP id 7-20020a17090a034700b00233e4f643d1mr1447936pjf.45.1676442533449; Tue, 14 Feb 2023 22:28:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676442533; cv=none; d=google.com; s=arc-20160816; b=SAw7UgqAasCV5JB7su+J6+KclH+0+doVpuWtI7U2RBJIImW0+Fdtvn6EqfXybiOosD HBYW74uVAXMw6Xe6RbORH9qRBAnaZRMR2ph6MqOcqdq9Lv7T9eHSekwxgbPOL237SV9X cXisVPyRW16JaZbeyyiom4DbOF4SF9bUkWfV1KcRL1bYH42uLRnuBgso2RvTqrNgvAkU lY5jlXZZv7mS745MTbzcnPsOhClnROw2tazw0YPY0EF4S5y4/uPBLI8ZgZCapQ+DUWgm eMNaHgGSO5Ct9BdlJm5EPTkuwcUj/FGGroZ/VuKvkXe/UVYO5kDf3QObovHFFHkTrNVw uF4Q== 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=E1eYIKz4FedKViyC8BBRJuxfo8KJJrAGDyq9yzdbtXw=; b=ooFzO+UODl7O0LsiBSl1o9Z6JC21HlrgWImhbEPrSV9+SJxml/4AVDbxNIAtDrqRq5 KOEHgBpC2/m1I+u7Lv3GrNJRIPRnMOaQ0mCoM8J4rML3q91bqWKKjfpwN9bmZhLj2cv9 87sKScZBj64NVEvkoQwiQu8UWc2vvEN4nz8pNJ1GmTT1odcpCpGl/a12QGZOT87WCSCO 0ot7wbvVVGF4kMmQI91i8vhULh5dfD7QIf9KY2nbjjTL8RBN3G/Eds0dn+7JqymAp57H M4Tip6Nezkx/47GbqJLOpKQjgcyTCRn322Q1AWnX+EhTVnG1rC5rye9y4IT977XJYW4B jkCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=inB1nYFL; 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 q13-20020a638c4d000000b004fbb2e0e960si7138607pgn.738.2023.02.14.22.28.41; Tue, 14 Feb 2023 22:28:53 -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=inB1nYFL; 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 S233325AbjBOG21 (ORCPT + 99 others); Wed, 15 Feb 2023 01:28:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233245AbjBOG2Z (ORCPT ); Wed, 15 Feb 2023 01:28:25 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 283A334006; Tue, 14 Feb 2023 22:28:10 -0800 (PST) X-UUID: d8616ad4acf911eda06fc9ecc4dadd91-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=E1eYIKz4FedKViyC8BBRJuxfo8KJJrAGDyq9yzdbtXw=; b=inB1nYFLXsP6xDTgqTnW6gaH+CAxuO/JApLwnycIE5N6jMJI3Zk2B+O1V6wmBAbZ1nyVX5k2NXl8Lj5HGEe9eSHFatWUfDMHkrSktg+0zmXsaC/ccTteQNbPfh/l70PIMM0eQBm86VPEyQ5baFTXYHI6IpT6QQCcgMOWIV7gKfg=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:7bcd89a6-e738-484f-8541-5c83c798c7d4,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:044d9f25-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: d8616ad4acf911eda06fc9ecc4dadd91-20230215 Received: from mtkmbs10n2.mediatek.inc [(172.21.101.183)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1290366785; Wed, 15 Feb 2023 14:27:39 +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:38 +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:37 +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 08/11] iommu/mediatek: Add a gap for the iova regions Date: Wed, 15 Feb 2023 14:25:41 +0800 Message-ID: <20230215062544.8677-9-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?1757877405941246702?= X-GMAIL-MSGID: =?utf-8?q?1757877405941246702?= As the removed property in the vcodec dt-binding, the property is: dma-ranges = <0x1 0x0 0x0 0x40000000 0x0 0xfff00000>; The length is 0xfff0_0000 rather than 0x1_0000_0000, this means it requires 1M as a gap. This is because the end address for some vcodec HW is (address + size). If the size is 4G, the end address may be 0x2_0000_0000, and the width for vcodec register only is 32, then the HW may get the ZERO address. Currently the consumer's dma-ranges property doesn't work, IOMMU has to consider this case. Add a bigger gap(8M) for all the regions to avoid it. Signed-off-by: Yong Wu Reviewed-by: AngeloGioacchino Del Regno --- Hi AngeloGioacchino, I define a new macro for this, I think it is a small change, thus keep you R-b. Thanks. --- drivers/iommu/mtk_iommu.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index fbfc5e4e56a8..e0264d5f1c9a 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -332,8 +332,10 @@ static LIST_HEAD(m4ulist); /* List all the M4U HWs */ #define for_each_m4u(data, head) list_for_each_entry(data, head, list) +#define MTK_IOMMU_IOVA_SZ_4G (SZ_4G - SZ_8M) /* 8M as gap */ + static const struct mtk_iommu_iova_region single_domain[] = { - {.iova_base = 0, .size = SZ_4G}, + {.iova_base = 0, .size = MTK_IOMMU_IOVA_SZ_4G}, }; #define MT8192_MULTI_REGION_NR_MAX 6 @@ -342,11 +344,11 @@ static const struct mtk_iommu_iova_region single_domain[] = { MT8192_MULTI_REGION_NR_MAX : 1) static const struct mtk_iommu_iova_region mt8192_multi_dom[MT8192_MULTI_REGION_NR] = { - { .iova_base = 0x0, .size = SZ_4G}, /* 0 ~ 4G */ + { .iova_base = 0x0, .size = MTK_IOMMU_IOVA_SZ_4G}, /* 0 ~ 4G, */ #if IS_ENABLED(CONFIG_ARCH_DMA_ADDR_T_64BIT) - { .iova_base = SZ_4G, .size = SZ_4G}, /* 4G ~ 8G */ - { .iova_base = SZ_4G * 2, .size = SZ_4G}, /* 8G ~ 12G */ - { .iova_base = SZ_4G * 3, .size = SZ_4G}, /* 12G ~ 16G */ + { .iova_base = SZ_4G, .size = MTK_IOMMU_IOVA_SZ_4G}, /* 4G ~ 8G */ + { .iova_base = SZ_4G * 2, .size = MTK_IOMMU_IOVA_SZ_4G}, /* 8G ~ 12G */ + { .iova_base = SZ_4G * 3, .size = MTK_IOMMU_IOVA_SZ_4G}, /* 12G ~ 16G */ { .iova_base = 0x240000000ULL, .size = 0x4000000}, /* CCU0 */ { .iova_base = 0x244000000ULL, .size = 0x4000000}, /* CCU1 */ From patchwork Wed Feb 15 06:25:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yong Wu X-Patchwork-Id: 57384 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp31343wrn; Tue, 14 Feb 2023 22:29:08 -0800 (PST) X-Google-Smtp-Source: AK7set/yDwiQXBac3ui/RncrsKpubf7edMxmgo2+1anyHupMKBiaq2CZMfm1xufct0x2AUA3MkZk X-Received: by 2002:a17:90b:1b04:b0:234:6a1:635d with SMTP id nu4-20020a17090b1b0400b0023406a1635dmr1511945pjb.49.1676442548340; Tue, 14 Feb 2023 22:29:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676442548; cv=none; d=google.com; s=arc-20160816; b=I8T5Lef4VILN7NPiDGZxoG4PmJsDNUM2kgi1HIF3I13JGyAldwBO9m2s0ZrwNt/mRm V10SScQ5FVra7Ix+Klf1qkd617P97lUoVACb7IMKYr0oD3/y51JoSo/wILF3feqT234n GiJXe+ZeRbfccANT2ftUNYaOT5iokFZwRQXP54e4m+3FFPBKeeaS/lUdJpyb+wfgkjSC IC6L4vxm3UEN8VY/QDHz/lrZ7ZCTgULsZqJxD6Gug9rFu4jUJ5VP7Ui/D/gUvASJ9LnR Xudkm/116FzLMGmHXghJ2/EFcXdmSX81gTK01UtFEjfR59jmIUKGQr5StbGfPPSgUung N+Iw== 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=PyGFaiQpYwvJRNsu5FUdDc+UhFlL928fq4ghNZboUsU=; b=c2QMJnQqhSl3nBixr6zYh/5j9KPOuwAxCjK3hkZqE1TQXxInGQ9+QJTx2slYdY+KqP GNVSG/8pH5Y8oaSaavQWVIHWJ9KkpJ5iGv0oCP6rxB1nJzJ94p717iTBLK5fKyQhIcpc jEZ6vhcwqU8F79wCUTHI/q0EkQn23aBYhCfWDfUS3SvakiLYK/xc9n+hPe7Yhp+8G1Cc JzKzDiciZRA/AKqv24ir4wPumLxuyERzDbrLKAwf/Ber12SFfYdnQZwbqzVh0x6vY1ej iibTeFcJW73q9dXwRW/sQ/8foulE3CRQ6Wj0REDXR63XzKAXK5jYgxRgDPDTCEHAw7S8 TMzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=Ut3xO7Pl; 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 x20-20020a17090a531400b00230ba341251si1093845pjh.82.2023.02.14.22.28.55; Tue, 14 Feb 2023 22:29:08 -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=Ut3xO7Pl; 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 S233345AbjBOG2g (ORCPT + 99 others); Wed, 15 Feb 2023 01:28:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233329AbjBOG2c (ORCPT ); Wed, 15 Feb 2023 01:28:32 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCD3931E0E; Tue, 14 Feb 2023 22:28:11 -0800 (PST) X-UUID: de9aa03cacf911eda06fc9ecc4dadd91-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=PyGFaiQpYwvJRNsu5FUdDc+UhFlL928fq4ghNZboUsU=; b=Ut3xO7PlofUlK56RkypAIDi+Ih3I9OZJqUKWOt/Jlr7FJ2AUpm61oOgQJvUyVRbHGiDnro9BTuXFIQm9T0aU+O0HVcIQ/Sjd9dw9kj3TCrHmr4AGfZgJyC68FAS7sN2cjNPS8LYD5b5+3/TmOMoURICSsaiWjasbIOdf7227wt0=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:a1059094-fcaf-4b22-8b51-cbf51cd335e7,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:70f67fb0-beed-4dfc-bd9c-e1b22fa6ccc4,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,NGT X-UUID: de9aa03cacf911eda06fc9ecc4dadd91-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 628930939; Wed, 15 Feb 2023 14:27:49 +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; Wed, 15 Feb 2023 14:27:48 +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:47 +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 09/11] arm64: dts: mt8195: Add dma-ranges for the parent "soc" node Date: Wed, 15 Feb 2023 14:25:42 +0800 Message-ID: <20230215062544.8677-10-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?1757877421825173137?= X-GMAIL-MSGID: =?utf-8?q?1757877421825173137?= After commit f1ad5338a4d5 ("of: Fix "dma-ranges" handling for bus controllers"), the dma-ranges property is not allowed for the leaf node. But our iommu/dma-ranges is 16GB, we still expect separate the 16GB dma-range like: a) display is in 0 - 4GB; b) vcodec is in 4GB - 8GB; c) camera is in 8GB - 12GB. We can not expect all the masters add a parent node for them, especial for the existed drivers/nodes. Thus, we add whole the 16GB dma-ranges in the parent "soc" node. Signed-off-by: Yong Wu Reviewed-by: AngeloGioacchino Del Regno --- arch/arm64/boot/dts/mediatek/mt8195.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/mediatek/mt8195.dtsi b/arch/arm64/boot/dts/mediatek/mt8195.dtsi index 8f1264d5290b..0f5a31ca1b70 100644 --- a/arch/arm64/boot/dts/mediatek/mt8195.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8195.dtsi @@ -364,6 +364,7 @@ #size-cells = <2>; compatible = "simple-bus"; ranges; + dma-ranges = <0x0 0x0 0x0 0x0 0x4 0x0>; gic: interrupt-controller@c000000 { compatible = "arm,gic-v3"; From patchwork Wed Feb 15 06:25:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yong Wu X-Patchwork-Id: 57385 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp32903wrn; Tue, 14 Feb 2023 22:33:31 -0800 (PST) X-Google-Smtp-Source: AK7set9WksPkzGb49CaaqaQNMrf1T2ApssPEl44lCdgch3AX9Y3cTTM8nLQ1Ll20HHbcBs9VmHuI X-Received: by 2002:aa7:9dc3:0:b0:5a8:b37e:bb5 with SMTP id g3-20020aa79dc3000000b005a8b37e0bb5mr697675pfq.12.1676442811002; Tue, 14 Feb 2023 22:33:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676442810; cv=none; d=google.com; s=arc-20160816; b=CkM/h+ykBd0TyWfZswlBnTJzmvfu2OPiOhgtZnApgKeBPRGugfnMMtd34DYqO5fxXe nKCjd5vJvvq4ZgQcj3yPn7mx7M6xqMy8gmYD0A7L18WAR4Yuz0B4P48Xrw0Y9upjgXKu 4CWyfWyPOmCMci1ZtJmkUwztMFd5QOyc/BAlzqzQgAyReP0qG8PveIH+eTm/OUH2YD1d DbWvMupyikibmaHm/EoOoJ40BsjZsi0ZFHRZCqjI75BgtJGyX5BAjac5BqE3to2b4qSl ajh28kxzt1Bu3SevILR8ij1GQX1OSH7tWVdPl3c+IPp1L1rh9QDdaeoFhc0gRTzyDkvf zkDQ== 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=6NHS2KCzcmLYPt4o9uTG7GnDL5CYjHINzLfnsbF5K0Q=; b=GGddqbjmm3U/FbZQFCCOTsC7jVpSV5RvuFNdh8hvuc+ikuzy7tA9s9YVClkDBKVzYs dHCOOFDavvdgQwDjaQBFIHGpSmnU43bzb9YvwOUjaCig2mEB8/VhrToNF8mG1epjQZnH bKa6kl0yXPoxphJGoQ8QmEQToAzc1JYaa6oobIu3RVljhEFPJE5EajIRhLyVEc5E2TDo oyrPvsC8Z448/Yh0Z+oN/hIP119ZbgGJymL7hd8LP0uEwKuCgjCg7nbvNQWI/4M8V45F VnXam/SEBu1m6EX5n2FJVMgR0csB3EofdBXGSztigBtkrovZwGISZHafl9+KCv60L2Ap c5XA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=TMfFQLtT; 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 b186-20020a621bc3000000b00593f89f0efcsi1258914pfb.269.2023.02.14.22.33.16; Tue, 14 Feb 2023 22:33:30 -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=TMfFQLtT; 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 S233365AbjBOG2j (ORCPT + 99 others); Wed, 15 Feb 2023 01:28:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233358AbjBOG2h (ORCPT ); Wed, 15 Feb 2023 01:28:37 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA8B235260; Tue, 14 Feb 2023 22:28:12 -0800 (PST) X-UUID: e5173b96acf911eda06fc9ecc4dadd91-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=6NHS2KCzcmLYPt4o9uTG7GnDL5CYjHINzLfnsbF5K0Q=; b=TMfFQLtTepVJ+rvaTkniEpsegec/tWgRaaEJN1D3gbxjw0dmPWMFX8pIblNUbv1Sz62ch8xlxK1HSZi7vUbj9p3h8dmqk3Irr6BBEQJHOQVDL0AZ9KjGCiu0MucGzwU6/R3dT3wDv7nZesVJuNZj4oDIXjGadw8lgmzhLSFKwVA=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:8ca4a74c-8424-4eea-a8f4-b0d568567776,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:78f87fb0-beed-4dfc-bd9c-e1b22fa6ccc4,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: e5173b96acf911eda06fc9ecc4dadd91-20230215 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 1529838230; Wed, 15 Feb 2023 14:28:00 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.194) by mtkmbs10n1.mediatek.inc (172.21.101.34) 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:59 +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:58 +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 10/11] arm64: dts: mt8195: Remove the unnecessary dma-ranges Date: Wed, 15 Feb 2023 14:25:43 +0800 Message-ID: <20230215062544.8677-11-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?1757877696958426870?= X-GMAIL-MSGID: =?utf-8?q?1757877696958426870?= After we add the dma-ranges in the parent "soc" node, this property is unnecessary for the leaf node. Signed-off-by: Yong Wu Reviewed-by: AngeloGioacchino Del Regno --- arch/arm64/boot/dts/mediatek/mt8195.dtsi | 3 --- 1 file changed, 3 deletions(-) diff --git a/arch/arm64/boot/dts/mediatek/mt8195.dtsi b/arch/arm64/boot/dts/mediatek/mt8195.dtsi index 0f5a31ca1b70..7d87cbabc9f1 100644 --- a/arch/arm64/boot/dts/mediatek/mt8195.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8195.dtsi @@ -2300,7 +2300,6 @@ power-domains = <&spm MT8195_POWER_DOMAIN_VENC>; #address-cells = <2>; #size-cells = <2>; - dma-ranges = <0x1 0x0 0x0 0x40000000 0x0 0xfff00000>; }; jpgdec-master { @@ -2312,7 +2311,6 @@ <&iommu_vdo M4U_PORT_L19_JPGDEC_BSDMA1>, <&iommu_vdo M4U_PORT_L19_JPGDEC_BUFF_OFFSET1>, <&iommu_vdo M4U_PORT_L19_JPGDEC_BUFF_OFFSET0>; - dma-ranges = <0x1 0x0 0x0 0x40000000 0x0 0xfff00000>; #address-cells = <2>; #size-cells = <2>; ranges; @@ -2384,7 +2382,6 @@ <&iommu_vpp M4U_PORT_L20_JPGENC_C_RDMA>, <&iommu_vpp M4U_PORT_L20_JPGENC_Q_TABLE>, <&iommu_vpp M4U_PORT_L20_JPGENC_BSDMA>; - dma-ranges = <0x1 0x0 0x0 0x40000000 0x0 0xfff00000>; #address-cells = <2>; #size-cells = <2>; ranges; From patchwork Wed Feb 15 06:25:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yong Wu X-Patchwork-Id: 57386 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp37535wrn; Tue, 14 Feb 2023 22:48:14 -0800 (PST) X-Google-Smtp-Source: AK7set8yP+Zes+kD3SUV2CSiRcVvcLy4LMOIBUX9GXOyJvYCYP6/bn3Lyes/C6Jz9eUAx1/OYlHi X-Received: by 2002:a17:906:ae50:b0:878:8249:bef6 with SMTP id lf16-20020a170906ae5000b008788249bef6mr1248311ejb.59.1676443694166; Tue, 14 Feb 2023 22:48:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676443694; cv=none; d=google.com; s=arc-20160816; b=ZP3d2i9bsqI/pT2NuhlVHg9834uCLxGJwZTSKC8EnLtxBmKphzUEqPqs9bKkNa6rkn f7BSzJvfyzZU/4s6N/uN8Lhofo7h4JrQFJRjPdcl/tIuQTMpVyR94RWdmuKDV0ynHK70 gYIcuDyzDM3k++9FIe8eBJTqgVe0vlEWlHhU8oHLvzUMMEPWGL/qRkDBaQfD420sCpos +w3rGtcCUy2hKjVy6qnOhson3qdC5jR37rOQz2ncFC1AqSrHg2vxawj+xyJFwOxrdKGt cN3T9gzv/t9SyE/nvRJi8auC37Z5HzaUN7AUGPNa+o934kiA6blU4eVf3ogdTIQxhRae kbew== 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=BZeA43XoOAkEaxyj8RL5V/54tyfKVdYzibdG9XTu4Dc=; b=BH0icRWffCzmHq4y0rfoRY/QtkgRAMmT48mCSREjof7jTSABv3SCYj4V+wMb+VKSQN LuxfBriAZy6VixySiSqshhJrAGWsotFJlOTl5oJVQqpjvdSI9LLqkjO9m9875lZur5Vc 5/vj2mfmrj0fNgL/RqI4Ay5W74ErgfwykuF0Ri3FSaDLrbsTglFqcwhHf1MtYXN3ZnZB GopYy6u/c0Le+SdWqkxlAl0NLcP+NAWE7EINF86u7hafpFYe778L4WF6gcCZBG2qV2qJ Z09BjayVpZ05B3omWIJeAuZhz1DcwosR6vC8hvQk7iYe9hdTu7CfCfZQcjRkTyY3L6fz zKrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=ZGRurWuj; 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 26-20020a170906009a00b008b147554303si797560ejc.991.2023.02.14.22.47.50; Tue, 14 Feb 2023 22:48:14 -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=ZGRurWuj; 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 S233148AbjBOG2z (ORCPT + 99 others); Wed, 15 Feb 2023 01:28:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233410AbjBOG2v (ORCPT ); Wed, 15 Feb 2023 01:28:51 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6427E311F5; Tue, 14 Feb 2023 22:28:28 -0800 (PST) X-UUID: eb163dd0acf911ed945fc101203acc17-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=BZeA43XoOAkEaxyj8RL5V/54tyfKVdYzibdG9XTu4Dc=; b=ZGRurWujtxttC3b1CTsAS9D4DsEJM62Sy3VqQgk3ygjZsoP8wlF1343tj9S9yUA25oOMc/H8wy22OV5BhxlwNw3bbQq2wtvRjzXrkRzrs9/Y4DFjRDKEQgbTtAGj1KnYHGNhSYk1tTkKUm03v/S3fJqxWrWySqOf8KfuVj128Ho=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:d31faf85-5213-4142-b3c1-909529df2372,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:bf519f25-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: eb163dd0acf911ed945fc101203acc17-20230215 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 107328126; Wed, 15 Feb 2023 14:28:10 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.194) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.3; Wed, 15 Feb 2023 14:28:09 +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:28:08 +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 11/11] arm64: dts: mt8186: Add dma-ranges for the parent "soc" node Date: Wed, 15 Feb 2023 14:25:44 +0800 Message-ID: <20230215062544.8677-12-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?1757878623079635201?= X-GMAIL-MSGID: =?utf-8?q?1757878623079635201?= Prepare for the MM nodes whose dma-ranges(iova range) is 16GB. Signed-off-by: Yong Wu Reviewed-by: AngeloGioacchino Del Regno --- arch/arm64/boot/dts/mediatek/mt8186.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/mediatek/mt8186.dtsi b/arch/arm64/boot/dts/mediatek/mt8186.dtsi index a0d3e1f731bd..251eace411c0 100644 --- a/arch/arm64/boot/dts/mediatek/mt8186.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8186.dtsi @@ -324,6 +324,7 @@ #address-cells = <2>; #size-cells = <2>; compatible = "simple-bus"; + dma-ranges = <0x0 0x0 0x0 0x0 0x4 0x0>; ranges; gic: interrupt-controller@c000000 {