From patchwork Tue Apr 11 09:31:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yong Wu X-Patchwork-Id: 81836 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2442533vqo; Tue, 11 Apr 2023 02:35:23 -0700 (PDT) X-Google-Smtp-Source: AKy350bVvYLkiKN8wUSglceM9By3OMrXgV+elWEAATWqDOkOuKVokA37Wz2kP3A9lavgZ8oS6IOa X-Received: by 2002:a05:6a20:6ca5:b0:dd:df53:434e with SMTP id em37-20020a056a206ca500b000dddf53434emr1669894pzb.51.1681205723089; Tue, 11 Apr 2023 02:35:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681205723; cv=none; d=google.com; s=arc-20160816; b=O3zdgpGUuFeiq4l68r0iqd6Kemu0MAPDr0SoNGXpzUXXGlsBuujIZtpFgrPLIn1YX0 t4s6UHwYPCNuXpRuOgaML8k/rwVC0+Oc6sfl3wX13yi1zrWdA4yWzG7Xyoc+Qz8dwINp mOQR3+Cj22CpRd/bkHmHbPd3DcqqyHyGWnANCKvdFvWCIX4/VYCTIFUxwnKQERVHC+N1 y8kVfWNjS48+cALjnU26LYfPXmJCklSN24TUvJH4ppddBs7hXSVmwU3CeGDAY1b5M3HW Du1VHBqjfefYgA1HTEVYzzkWZ1KTIcTiJXP64YWcgH6OxLrE7yK3XIeyFBZEUiIUZnqF hFwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=mT6zoSr+t/iCCp0pVyrrFXyfIgwNSVzrgEpFp7/K0K4=; b=m+MWXYfukl9mI000fAhZJkIhndR+v6tPh0BRhm0QvH4HjLR65WvN5aDU5/iGjc7TYp ZviDGIno/NXBGcCaXVPirQhuj61dZN4+kNh80u/y6UmUhBPR7aRPBlVpR1nPETDh/W7U seEzr7QJr2CNvVPT6nXn/wENuyNPDJ0AboQp1M7Q1HRbYmmVoE4luIzEO2/Ni2yLP9Sv 995r7z6HOGMR2Azw0/qTQTblVzTVGSl6+5Nc3qh1z9xYw0+ss+AT4i+K70v58XnKlbxj Hz5LyoW124rInNHr0+95HnGDKFDcf/5NUPx2eOsG8ZJkMgmG186xbkPHZoqysiPOOaqc YX8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=p1kfKTM9; 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 184-20020a6309c1000000b005141a94819asi13190033pgj.99.2023.04.11.02.35.06; Tue, 11 Apr 2023 02:35:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=p1kfKTM9; 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 S229900AbjDKJcY (ORCPT + 99 others); Tue, 11 Apr 2023 05:32:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229652AbjDKJcR (ORCPT ); Tue, 11 Apr 2023 05:32:17 -0400 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DF3B26AE; Tue, 11 Apr 2023 02:32:14 -0700 (PDT) X-UUID: bacae360d84b11edb6b9f13eb10bd0fe-20230411 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=mT6zoSr+t/iCCp0pVyrrFXyfIgwNSVzrgEpFp7/K0K4=; b=p1kfKTM91wnf6JvxSkAd/lInT36yXrs6JIdnWPHuxiJPTQmmV8vezzOZ+Rjto08t7O2lTETH+evUd8Md7ztXySyB8WtvL4BcyAceoB7mnktZ1f7CAlnUJAWiYkRXwXyqh/a9gQvzc/+JAn/fC38Exg1p5I/bA39rc+trgNa7LJo=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.22,REQID:d6fc6903-c02e-4df0-9658-2f54b3e457b1,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.22,REQID:d6fc6903-c02e-4df0-9658-2f54b3e457b1,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:120426c,CLOUDID:1e62ae83-cd9c-45f5-8134-710979e3df0e,B ulkID:230411173208T2HU8R5K,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-CID-BAS: 0,_,0,_ X-UUID: bacae360d84b11edb6b9f13eb10bd0fe-20230411 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 998718804; Tue, 11 Apr 2023 17:32:08 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) 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.1118.25; Tue, 11 Apr 2023 17:32:07 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.25 via Frontend Transport; Tue, 11 Apr 2023 17:32:06 +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 , Rob Herring , Hans Verkuil Subject: [PATCH v7 01/14] dt-bindings: media: mediatek,vcodec: Remove dma-ranges property Date: Tue, 11 Apr 2023 17:31:31 +0800 Message-ID: <20230411093144.2690-2-yong.wu@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230411093144.2690-1-yong.wu@mediatek.com> References: <20230411093144.2690-1-yong.wu@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762871971829391594?= X-GMAIL-MSGID: =?utf-8?q?1762871971829391594?= 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. 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. 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 Acked-by: Hans Verkuil --- .../devicetree/bindings/media/mediatek,vcodec-decoder.yaml | 5 ----- .../devicetree/bindings/media/mediatek,vcodec-encoder.yaml | 5 ----- 2 files changed, 10 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: From patchwork Tue Apr 11 09:31:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yong Wu X-Patchwork-Id: 81851 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2450361vqo; Tue, 11 Apr 2023 02:55:25 -0700 (PDT) X-Google-Smtp-Source: AKy350b8hpUcj72vXlisGHVYaTjdUnYzENqVAQkYvrEI0flh51xsl5fmJXl+hzjHOB7EVsVc8thB X-Received: by 2002:a17:906:2b97:b0:931:6921:bdb7 with SMTP id m23-20020a1709062b9700b009316921bdb7mr8567843ejg.60.1681206924860; Tue, 11 Apr 2023 02:55:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681206924; cv=none; d=google.com; s=arc-20160816; b=hii3LfQfCxgZ8uusjkEMgAKgZdNxlIxdtbJ9NFlypDMJHxMaWBudTRNN7tuhmF8PZa IiOzXPSoWqWY9IG9gPC/jmTFeHJ94m3K3u77AfEmMLqqyBue92lWa8Pd9Vm8UZopIQTr ALe23ZRYxXwO+4yJxBXUmVUJtMM/co7YZKudThW8igfgYNrtRmtMBsOge0HvTrCzs6ms 3PsSim+MifsRcc3X65cqoneyq42otFKrdKocgwaHG05RBOmxn9OmrIBjgYfTH5U0A+iX tA9JpeIF2XqYk+XCrbNQB7UDSnotjmWP6E6SYk0jUsBAyAwdf2XrKsc0Y6uqo3cOv3LR OJhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=sVX80DfFg2daBLzlRJDcb0JyO44mTDPu7coLHRXXZFQ=; b=odaaZgZUYr9uq+HaXyaLqCdmLYRbjYsZyP5Q1BAqUjyFyi7vhutVyG18gPA2+/F6bw 8nqCMx92yBKu3ghsuux59faqBBz5UDTSTfZLwq5kYB/xzKUVZZyh9i9bqDl5XL+5eet6 7GxTvtVW80mTVUg7/YyzLT+WxmfvkZzGVKQZlggSlDNgHkG0cPXj9gKiHBkGoOKYmhAx k6rze22dv3DIN891+UCOpm9wnHkSMvC/pHAxgM9CH+HZiK7e9a0L1HDFMgYd6GbWwvUU CXv+0/uICX5rsKfaOgN3flc/Yu9j5gMCkCAPOnOTO+BukTTBj1unTeZ6yCqZA+IXyOXM zA6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=qwS1e8Ly; 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 q7-20020a170906770700b008d0a9a403f8si1175764ejm.796.2023.04.11.02.55.01; Tue, 11 Apr 2023 02:55:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=qwS1e8Ly; 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 S230019AbjDKJcs (ORCPT + 99 others); Tue, 11 Apr 2023 05:32:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229910AbjDKJcn (ORCPT ); Tue, 11 Apr 2023 05:32:43 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B763C3AB4; Tue, 11 Apr 2023 02:32:26 -0700 (PDT) X-UUID: c35b5744d84b11eda9a90f0bb45854f4-20230411 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=sVX80DfFg2daBLzlRJDcb0JyO44mTDPu7coLHRXXZFQ=; b=qwS1e8LyW9Wh/eHFudrKK9hwAVASz3Lv/2FEcD0ZAVKaxJIW5kg2A3LicBsOFmISYE/YCugO57H4HwaHtYRb9JOcupI8PodRDRxwpzTsdvaupih5tBMSMrCpqCQ/b//JlhRj+SohHwrQVONRlAqfuGkIPGh/9m/HYH7yFfR5nBw=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.22,REQID:7369dcce-ec45-4f45-a2cc-90f392f11a00,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:120426c,CLOUDID:4c64ae83-cd9c-45f5-8134-710979e3df0e,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-CID-BAS: 0,_,0,_ X-UUID: c35b5744d84b11eda9a90f0bb45854f4-20230411 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 1566683259; Tue, 11 Apr 2023 17:32:23 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) 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.1118.25; Tue, 11 Apr 2023 17:32:21 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.25 via Frontend Transport; Tue, 11 Apr 2023 17:32:20 +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 , Rob Herring , Hans Verkuil Subject: [PATCH v7 02/14] dt-bindings: media: mediatek,jpeg: Remove dma-ranges property Date: Tue, 11 Apr 2023 17:31:32 +0800 Message-ID: <20230411093144.2690-3-yong.wu@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230411093144.2690-1-yong.wu@mediatek.com> References: <20230411093144.2690-1-yong.wu@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762873232627887721?= X-GMAIL-MSGID: =?utf-8?q?1762873232627887721?= 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 Reviewed-by: Hans Verkuil --- .../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 Tue Apr 11 09:31:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yong Wu X-Patchwork-Id: 81843 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2448759vqo; Tue, 11 Apr 2023 02:51:11 -0700 (PDT) X-Google-Smtp-Source: AKy350aEHd7Y0jyfJmG598MfSNENn7Eezzpg9A2p3J8i2G/ZNm/SUMvQ8IxM79xiK+TFSCZbbTTS X-Received: by 2002:a17:906:6417:b0:926:fce:c080 with SMTP id d23-20020a170906641700b009260fcec080mr1790062ejm.17.1681206671510; Tue, 11 Apr 2023 02:51:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681206671; cv=none; d=google.com; s=arc-20160816; b=BNFrLDRwgkY8E8W+OiF5gn4wVO8EiJMtyzJs+VOY1YyyZJa9s3gr/eYxXNgDsmES+K uNBF7n8opZcBV/AQFIUUhebS2zVIi6c04qCNBdE50DZ35y1Kzu7Gffe54x7PRkyaIhm7 5WWu/rQ3FYfvcVmkT08jD9cQHJ1QlMyNwGxT5PyQ8kN1K8M8A1HdsbK3n9GLC6XCS9Qx Q8chfqF7XQdsfXWQW7+NvI185HMT9wxIehHO9rZvDADsHHZzrLlli9f29R3dSsrCIFBc 5JfOUa2I2VAqrie4PmtcdU0/bwR9KTW77atHIqIJcHndvhfArWYwsTLMzd18cul6jYui Fz0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=XNsNsqm+tac4TqBDM7eY2YSHOJMel3hNuiOtLlMEMKY=; b=dUO5rB76zm7hQzbigwLUKmu+yci4vknkYtCl7kBnkkajGRfZIul356w4oJMzWYwUOb jgGiPyBxDY/GDKxWnJ3h3aYOdFiBWuTyO+ijSwYBTeGs4h6tfEvrE/UxxB3xSgYtiM07 xZpMxSLAuA8kvgfukMf7SMgcISFvrCUP8TzZMhVwl8u3bLgb407OevIg6og6MY/ZLqNU NT1xDyU4TJivRYnOvdAwSEr5HQEZJBBV+1nJHv+lluZVSTZnziSpJN9t8HMGe6CatIfy dLFXHrGj69vU/qvj847lXtBPlbIWqW902TDqnZCJiLPeELtCzvgg97PNd27LZudvNwxU Vytw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=AztxEkaP; 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 cb2-20020a170906a44200b0094596ff820dsi1534471ejb.1025.2023.04.11.02.50.47; Tue, 11 Apr 2023 02:51:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=AztxEkaP; 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 S229776AbjDKJdU (ORCPT + 99 others); Tue, 11 Apr 2023 05:33:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229676AbjDKJdK (ORCPT ); Tue, 11 Apr 2023 05:33:10 -0400 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7F312D57; Tue, 11 Apr 2023 02:32:44 -0700 (PDT) X-UUID: cccdcdcad84b11edb6b9f13eb10bd0fe-20230411 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=XNsNsqm+tac4TqBDM7eY2YSHOJMel3hNuiOtLlMEMKY=; b=AztxEkaPWfUjOaSoZrlx+yfgKsWi4c8uXjuIx2PzoVJC63h42rB+en7fmX4SnLTusVqhcs5+Rn5oBkDK32/ZUYwyb1pUjhcBpvFC/XzX7qrEwX42tW4+gTWuUf5++7fhzpryhmYJGy7LqdTpGSaDPXd6AhGocavouz1HPuiR0Pk=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.22,REQID:3e99b252-d57b-4afd-9413-f75406b4d520,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.22,REQID:3e99b252-d57b-4afd-9413-f75406b4d520,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:120426c,CLOUDID:1c0495ea-db6f-41fe-8b83-13fe7ed1ef52,B ulkID:230411173241FQC2FI2N,BulkQuantity:0,Recheck:0,SF:48|38|29|28|17|19,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-CID-BAS: 0,_,0,_ X-UUID: cccdcdcad84b11edb6b9f13eb10bd0fe-20230411 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 572185833; Tue, 11 Apr 2023 17:32:38 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) 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.1118.25; Tue, 11 Apr 2023 17:32:37 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.25 via Frontend Transport; Tue, 11 Apr 2023 17:32:36 +0800 From: Yong Wu To: Joerg Roedel , Matthias Brugger , Mauro Carvalho Chehab , Rob Herring CC: Will Deacon , Robin Murphy , Krzysztof Kozlowski , Hans Verkuil , , , , , , , , AngeloGioacchino Del Regno , , , , Yunfei Dong , kyrie wu , , , , Yong Wu Subject: [PATCH v7 03/14] iommu/mediatek: Improve comment for the current region/bank Date: Tue, 11 Apr 2023 17:31:33 +0800 Message-ID: <20230411093144.2690-4-yong.wu@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230411093144.2690-1-yong.wu@mediatek.com> References: <20230411093144.2690-1-yong.wu@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762872967086947369?= X-GMAIL-MSGID: =?utf-8?q?1762872967086947369?= 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 Tue Apr 11 09:31: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: 81847 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2449606vqo; Tue, 11 Apr 2023 02:53:19 -0700 (PDT) X-Google-Smtp-Source: AKy350ZE8vjG7s3654aK83gg4Hf+Vebt8rQS04ZhyQ1HIVe+mR9CxtUvavduW9O61RGnomEKjjhF X-Received: by 2002:aa7:d5d5:0:b0:504:9346:11d3 with SMTP id d21-20020aa7d5d5000000b00504934611d3mr1658982eds.29.1681206799627; Tue, 11 Apr 2023 02:53:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681206799; cv=none; d=google.com; s=arc-20160816; b=HSXoOQUpCASd4Ke+AqBy+WATbcx3/0I1Hapexr7SKdTa2dv8wPWFIhkUyoyg/q8Ic4 Cg57U2oVvOl2rgT3xBgQ2APdIJzkqeFLteC61MU2k6512yZGf0/UbqpOTZ5I2buPWn99 QnVO087y4ySSQ+jmo5DpgkjEJMwxzbTSK7tmFiBVdcrj5uMdwMmd7HS+Lr0dNQ+Q1nzs sYZYeSReCxDmajczkbhcrl6+iJQi7Cjy/EMRF6Z5Lrx87Lq+DQWPILWKtGNQh1XMkDFu K4W3jO438IA3VQfyOP/zAqfAlzTcCRneer+xWFOztmkQG5h63V3UjrL67qqbD1lgbHzb Cxdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=gimoFjkCbz3U2vcY95/BcNhpuUtVRuGsti4VYEfbRRc=; b=cqESo8kL0xPP/HNUKJgc+C1CZ8KyJ7GEht69n3i0NMD1vV/fOoOXT7KHRmY8Xd3YiQ jC43GwQXnNa1Jzisw10KeTswMM31Yf3X7NvS9tOOAel6sRQvxV15MClQWm6GwdODrKaw 3fVbe7BaZUfIqZvg1FH1nF7GmFVUF19pxT6+ftUR1fxY175/Zt5BEFlhEGVrLkX2pZPX WnYXu0w/gtH6qHj+3l+JoUEdfouyrRVG0VRaGUgStGAoNOFFbcQAQottu/YjAp7L2DuP EsYTUQxvBD6UDkMl9lDeXkz7BUzoHF+yoOtcKZG+AdKGqTby7ylscpOz0wY9HivFl1DZ xiZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=OSjPvTg7; 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 s26-20020a056402165a00b004fb1e94e874si12262260edx.361.2023.04.11.02.52.54; Tue, 11 Apr 2023 02:53:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=OSjPvTg7; 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 S230052AbjDKJdc (ORCPT + 99 others); Tue, 11 Apr 2023 05:33:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229615AbjDKJdW (ORCPT ); Tue, 11 Apr 2023 05:33:22 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E12294681; Tue, 11 Apr 2023 02:32:53 -0700 (PDT) X-UUID: d2f88514d84b11eda9a90f0bb45854f4-20230411 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=gimoFjkCbz3U2vcY95/BcNhpuUtVRuGsti4VYEfbRRc=; b=OSjPvTg77Jdpm8inGveyVQfkek39X5gt+eDjHWOcC9PZJlV1vJdjCEiWyY4sr6LMUb+t9IcF6nBN8IAgwuU0DfEmAVrxAcxTnQoEjPqpl/+j5hQy+wNHb0eUHfGjhKNmL4Ut+j9cBVO7mG4qxOTNG3JW0UaL3nZaXlSyOUMQzdw=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.22,REQID:810ada41-23de-4cdf-b2a4-3060b295059c,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:120426c,CLOUDID:fc67ae83-cd9c-45f5-8134-710979e3df0e,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-CID-BAS: 0,_,0,_ X-UUID: d2f88514d84b11eda9a90f0bb45854f4-20230411 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 2049180591; Tue, 11 Apr 2023 17:32:49 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) by mtkmbs11n1.mediatek.inc (172.21.101.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.25; Tue, 11 Apr 2023 17:32:47 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.25 via Frontend Transport; Tue, 11 Apr 2023 17:32:46 +0800 From: Yong Wu To: Joerg Roedel , Matthias Brugger , Mauro Carvalho Chehab , Rob Herring CC: Will Deacon , Robin Murphy , Krzysztof Kozlowski , Hans Verkuil , , , , , , , , AngeloGioacchino Del Regno , , , , Yunfei Dong , kyrie wu , , , , Yong Wu Subject: [PATCH v7 04/14] iommu/mediatek: Get regionid from larb/port id Date: Tue, 11 Apr 2023 17:31:34 +0800 Message-ID: <20230411093144.2690-5-yong.wu@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230411093144.2690-1-yong.wu@mediatek.com> References: <20230411093144.2690-1-yong.wu@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762873101198495479?= X-GMAIL-MSGID: =?utf-8?q?1762873101198495479?= 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 | 45 ++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index aa4bdcb65ea7..bc936709fbe6 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,29 @@ 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; - 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) + 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) 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; } - 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); + dev_err(dev, "Can NOT find the region for larb(%d-%x).\n", + larbid, portidmsk); return -EINVAL; } From patchwork Tue Apr 11 09:31: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: 81850 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2450352vqo; Tue, 11 Apr 2023 02:55:23 -0700 (PDT) X-Google-Smtp-Source: AKy350ZfjRd4xmM+ybfbp24zl8gEVOI8z+9f4kimmF2vHUaA5fylwwuoD0ZiUwlNsBkK0fySLeWt X-Received: by 2002:a17:907:31cd:b0:94a:5d7e:d455 with SMTP id xf13-20020a17090731cd00b0094a5d7ed455mr7714466ejb.34.1681206923716; Tue, 11 Apr 2023 02:55:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681206923; cv=none; d=google.com; s=arc-20160816; b=P57Ym+w7WvnizpMAuafjkaniFNWRw7oFV4JTLXZd9fDidWqRyiLd9GzazS8I/F3TYr YiL/6t0skQ7K2Ys9lvNjD2HzYOEW9Qk7hGNNle6bU+auxMDPACPjWpGySZi+EJxajxsl jS0kfHqe3vnp/JrNB30bZ336uczabNMKHjJJeVbmzf1CWN4IT4lGmeb5/9RHAUzqJwSl 3ABm3LOBYGcn0cTLJDJgvtPF0y9vBtDoC/6eLukgi5fIN64ZPTyJROj+Tyl02EjeZFtm bnxvyP9vN2IwAGX01RfI4Ibsp8ACty6npwGjp9Q9dIBzcaEZ7+CfPtmimNjAoYJDAYZG HKAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lpfNQKTfP2YyAAu6CpD43JhcPlq1HIOIhM6xNel8+1I=; b=r4xKzVX7jkAMJF/VSeiGTT20kSgSoRZkYG61amIPvsFDB9drOp64TRiuDs/+dqdRNB egcyYQRlg9HMYrMqxh8yKHFaTWISyNrIe+kkAoYD3yrgyd9VC1sDVS1E5VmHizpeXhz9 PZptS+ZpCLtEh1iv1EbyWyWTU0Bsdtf1t8eYOJA51mIiV/d3s1SbnfX1GptT9cyl40Bh vN38IQi2jLP8kSdAAdx/npyzdOwp1LHm9FmCqPRnAcmBua0rTJYoPNOQxh8FF0tSKUTy tL0U/mR5qVyzNmu9hj22/PmNCvPz05uykGbha8p5ROsvxw5EXdmNTA/wa2v8gnS5NSr4 +slQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b="cdyQ/dgv"; 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 h6-20020a1709060f4600b009475bf88f7dsi3241049ejj.910.2023.04.11.02.54.58; Tue, 11 Apr 2023 02:55:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b="cdyQ/dgv"; 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 S229806AbjDKJdo (ORCPT + 99 others); Tue, 11 Apr 2023 05:33:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229911AbjDKJd3 (ORCPT ); Tue, 11 Apr 2023 05:33:29 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A939940C6; Tue, 11 Apr 2023 02:33:02 -0700 (PDT) X-UUID: d88200e6d84b11eda9a90f0bb45854f4-20230411 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=lpfNQKTfP2YyAAu6CpD43JhcPlq1HIOIhM6xNel8+1I=; b=cdyQ/dgvhWVB021hzk0NMf/sn0lJlPzaCDb2JoMXed0wQ3RNcsIqH4fNhBW+M4JoWQOEOCdExHUfLAN4SQi3luit8K8QKu9TyneCGyQtLUpp6/nBn5UYeOLsP03wSlfYQe5qav55MC7LDcIn7vm+SawoTziKJvX/xAwm2pTcAPM=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.22,REQID:4d02fddd-7c48-4277-bea3-e1c48385d2d0,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:120426c,CLOUDID:b80695ea-db6f-41fe-8b83-13fe7ed1ef52,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-CID-BAS: 0,_,0,_ X-UUID: d88200e6d84b11eda9a90f0bb45854f4-20230411 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 422454516; Tue, 11 Apr 2023 17:32:58 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) 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.1118.25; Tue, 11 Apr 2023 17:32:57 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.25 via Frontend Transport; Tue, 11 Apr 2023 17:32:56 +0800 From: Yong Wu To: Joerg Roedel , Matthias Brugger , Mauro Carvalho Chehab , Rob Herring CC: Will Deacon , Robin Murphy , Krzysztof Kozlowski , Hans Verkuil , , , , , , , , AngeloGioacchino Del Regno , , , , Yunfei Dong , kyrie wu , , , , Yong Wu Subject: [PATCH v7 05/14] iommu/mediatek: mt8192: Add iova_region_larb_msk Date: Tue, 11 Apr 2023 17:31:35 +0800 Message-ID: <20230411093144.2690-6-yong.wu@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230411093144.2690-1-yong.wu@mediatek.com> References: <20230411093144.2690-1-yong.wu@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762873230974052411?= X-GMAIL-MSGID: =?utf-8?q?1762873230974052411?= 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 bc936709fbe6..672059f9e0b7 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 */ @@ -1534,6 +1539,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 | @@ -1543,6 +1559,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 Tue Apr 11 09:31: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: 81846 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2449459vqo; Tue, 11 Apr 2023 02:52:58 -0700 (PDT) X-Google-Smtp-Source: AKy350ZKSr9ZgRMXORronqC1bJcmMSM2g0GJUT9XX8d/rMuW7xVrJtclySaJjbooARPMIgrfGFa6 X-Received: by 2002:a17:906:f9c2:b0:921:7e42:2777 with SMTP id lj2-20020a170906f9c200b009217e422777mr10228359ejb.69.1681206778378; Tue, 11 Apr 2023 02:52:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681206778; cv=none; d=google.com; s=arc-20160816; b=m7Ffyn+kjugZfCP7EKhOJdvho+jk8zlszlGeST9tcnJq+2nuGtoF0JTwda+PbI0WTM f2uwf7bSw7UKPh1fCRHuyZR+mTURXJIjYiTD8iVWrEdrGF/4e6/UXb5jYpmXks3+Y5Qu i9xNmnj/jzzdDuPz0DqyUqPbCrh4SuWPsE0Uh16HNDlv9QF7Wk3MsWBQ6i1LJRQrQ1GC 7t89NScMfRHeKqJ4X02+1XnxIn9SqxxFEuCyDSqD4CJsw1KwuZKmhmlMgpjIRFEm7xwj 68us5qg+NW90H6ST/qkO30kHlfMz0ES9i2J74z9i2h81WVgOkxaJVufrGJAeSnFA+Odm XiJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Gbacnh4qt5DCcPUzPDRzUSmOnmUijCnl8GTEcmOfwW0=; b=G2NuT/zl9YCCFyokF9LBnxODHxRFubXrz7oh5Q2kuG+Xbnd4Hyt7dDs2MeJ5qNBaRw sWepZb4FclSnfdUo2JO6GN4fmTmgPFi/TX+DYDCNZ0uxd/Gofo3O+u5n0OSAEG9GOXbJ CmrVV68xNo85Y51rXnqo8FwdwWMkMq0QdhmT0TQ38dOivHikUqZAU1RsXMB/47Apx1vQ XgiCNmdSsjbvtoPioxtBOA9x+3KrDZRkhmMLWWe6KvDCp/knDroCCoKIF1ts/MR3uMGZ Ahb4o2WnVJAN9VntYhVVMq5h7/B8EZRWu2mWFqtj8AvoadzHttmDdmiTMAlEMtS69j10 7Oig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=rcJg4iun; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gl8-20020a170906e0c800b0094a619e8109si2415915ejb.1011.2023.04.11.02.52.34; Tue, 11 Apr 2023 02:52:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=rcJg4iun; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229998AbjDKJdu (ORCPT + 99 others); Tue, 11 Apr 2023 05:33:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229548AbjDKJdj (ORCPT ); Tue, 11 Apr 2023 05:33:39 -0400 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E018A2D60; Tue, 11 Apr 2023 02:33:16 -0700 (PDT) X-UUID: e047fd80d84b11edb6b9f13eb10bd0fe-20230411 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=Gbacnh4qt5DCcPUzPDRzUSmOnmUijCnl8GTEcmOfwW0=; b=rcJg4iunB9vIHcEoLDrWjjQdQQjdQhWTy/XhiGP0/CNg8XdgLxLDyETHMeocQM5ZP+GcrZggnCnpB8klafS/DYcacURog+oszdi507H6Lxa1VLSQ6ott1B58AXlSJpfFVWhj5DKdE8LIm2wxiC89uUHmfPLhuzh43E7EJW3UXfY=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.22,REQID:a07a08fe-86b0-4ef2-bc62-233ae6b33d12,IP:0,U RL:0,TC:0,Content:-20,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-20 X-CID-META: VersionHash:120426c,CLOUDID:3c79f3a0-8fcb-430b-954a-ba3f00fa94a5,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:1,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-UUID: e047fd80d84b11edb6b9f13eb10bd0fe-20230411 Received: from mtkmbs10n2.mediatek.inc [(172.21.101.183)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 717596227; Tue, 11 Apr 2023 17:33:11 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) by mtkmbs11n1.mediatek.inc (172.21.101.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.25; Tue, 11 Apr 2023 17:33:10 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.25 via Frontend Transport; Tue, 11 Apr 2023 17:33:09 +0800 From: Yong Wu To: Joerg Roedel , Matthias Brugger , Mauro Carvalho Chehab , Rob Herring CC: Will Deacon , Robin Murphy , Krzysztof Kozlowski , Hans Verkuil , , , , , , , , AngeloGioacchino Del Regno , , , , Yunfei Dong , kyrie wu , , , , Yong Wu Subject: [PATCH v7 06/14] iommu/mediatek: mt8195: Add iova_region_larb_msk Date: Tue, 11 Apr 2023 17:31:36 +0800 Message-ID: <20230411093144.2690-7-yong.wu@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230411093144.2690-1-yong.wu@mediatek.com> References: <20230411093144.2690-1-yong.wu@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762873078458407908?= X-GMAIL-MSGID: =?utf-8?q?1762873078458407908?= Add iova_region_larb_msk for mt8195. We separate the 16GB iova regions by each device's larbid/portid. Refer to include/dt-bindings/memory/mt8195-memory-port.h Signed-off-by: Yong Wu Reviewed-by: AngeloGioacchino Del Regno --- drivers/iommu/mtk_iommu.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index 672059f9e0b7..bb3734378934 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -1579,6 +1579,21 @@ static const struct mtk_iommu_plat_data mt8195_data_infra = { .iova_region_nr = ARRAY_SIZE(single_domain), }; +static const unsigned int mt8195_larb_region_msk[MT8192_MULTI_REGION_NR_MAX][MTK_LARB_NR_MAX] = { + [0] = {~0, ~0, ~0, ~0}, /* Region0: all ports for larb0/1/2/3 */ + [1] = {0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, ~0, ~0, ~0, ~0, ~0, /* Region1: larb19/20/21/22/23/24 */ + ~0}, + [2] = {0, 0, 0, 0, ~0, ~0, ~0, ~0, /* Region2: the other larbs. */ + ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, + ~0, ~0, 0, 0, 0, 0, 0, 0, + 0, ~0, ~0, ~0, ~0}, + [3] = {0}, + [4] = {[18] = BIT(0) | BIT(1)}, /* Only larb18 port0/1 */ + [5] = {[18] = BIT(2) | BIT(3)}, /* Only larb18 port2/3 */ +}; + static const struct mtk_iommu_plat_data mt8195_data_vdo = { .m4u_plat = M4U_MT8195, .flags = HAS_BCLK | HAS_SUB_COMM_2BITS | OUT_ORDER_WR_EN | @@ -1589,6 +1604,7 @@ static const struct mtk_iommu_plat_data mt8195_data_vdo = { .banks_enable = {true}, .iova_region = mt8192_multi_dom, .iova_region_nr = ARRAY_SIZE(mt8192_multi_dom), + .iova_region_larb_msk = mt8195_larb_region_msk, .larbid_remap = {{2, 0}, {21}, {24}, {7}, {19}, {9, 10, 11}, {13, 17, 15/* 17b */, 25}, {5}}, }; @@ -1603,6 +1619,7 @@ static const struct mtk_iommu_plat_data mt8195_data_vpp = { .banks_enable = {true}, .iova_region = mt8192_multi_dom, .iova_region_nr = ARRAY_SIZE(mt8192_multi_dom), + .iova_region_larb_msk = mt8195_larb_region_msk, .larbid_remap = {{1}, {3}, {22, MTK_INVALID_LARBID, MTK_INVALID_LARBID, MTK_INVALID_LARBID, 23}, {8}, {20}, {12}, From patchwork Tue Apr 11 09:31: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: 81845 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2449330vqo; Tue, 11 Apr 2023 02:52:36 -0700 (PDT) X-Google-Smtp-Source: AKy350ZFZ957tiaQmNb2QJitDdz+TwY63iofiJet44146pl47OJrSDEpzzt+ujzM+Pc0xiujMViS X-Received: by 2002:a17:906:208b:b0:930:e634:3d52 with SMTP id 11-20020a170906208b00b00930e6343d52mr1970996ejq.24.1681206756685; Tue, 11 Apr 2023 02:52:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681206756; cv=none; d=google.com; s=arc-20160816; b=Q783A8URYIo5hNh5U4y9lNqmLrzRmFVjC2FHtm5hWl1OSusN1mSwqSt/XCeWfroOBN UutL2xtcfcq750ctHuWGSnLvhxMqNvhPqIAR7MMtmuO8ogxNV4jN0sHgSjdnl4c4Y+l4 4JYcG63DWsbtxmEqte4ymJ99/AFkczwWuZvW8/8YKIX1BQgAmM1WHPkn238T6U97AUPZ JCJBFL1XhqNDQk0G3xRy3/Z5Z4h/20/lPEADESBWyosQDImiY+IdJ6IrivxPACgtGPSI 13xNLC1V+URHEENSAtUC/opaF5cohbg/wZNMYpZ3TEkZ9dNSFxgoF9kmZvxNveDe1Pxp pR3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5TzwrGm8MDwxREZVxNarlcOBJfzC0Abb3wd33GfWDz4=; b=LlSqrsFxyqyXkmJcj57B/JGwGoKpj+NT5NNJXQu23TbmFRvKHXTCx+E99XNGtecZZG LHh+nbUEhgRlg5GChGaoToWQ28yGKI7eWcTSPnI47SWyT9/ADNRVtMIY0tE6qFkPr+kZ jnrta+CBCHMzp0PEmU9MZqxpUWevPRo2FKn6L9nzJdPBYdxD4BHamQz9QD/+XfL3IExf IYcpCRwKHkfo3RzhuogzoNLCVmkPDvKqaj/QjGOkpE4ZYumTVnzfhDZIS/WZiFh2XKsq J6s16otsm+D6qi2N86x6k+VXQxac5UqaCYl9FI+r8kEHUwev5RuhaNJlFKsNDPowi1U0 a6eQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=bbcKZviR; 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 jg11-20020a170907970b00b0094a38a9d599si7299740ejc.628.2023.04.11.02.52.09; Tue, 11 Apr 2023 02:52:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=bbcKZviR; 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 S230058AbjDKJd7 (ORCPT + 99 others); Tue, 11 Apr 2023 05:33:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230026AbjDKJdq (ORCPT ); Tue, 11 Apr 2023 05:33:46 -0400 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96C653C0C; Tue, 11 Apr 2023 02:33:25 -0700 (PDT) X-UUID: e500594ed84b11edb6b9f13eb10bd0fe-20230411 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=5TzwrGm8MDwxREZVxNarlcOBJfzC0Abb3wd33GfWDz4=; b=bbcKZviRCE/rngFKkW2wzWlxn2bIiMkH5VibDZQXrFShmDuq1yyjdO+0jKURP2R/8OzejPCD0p/kzQLC6pIgNzT1Ys/Nr1n/ARt2mDw6nl1OsQ2ViBkZxtsIFEPmLlLDZ0rURF++Ms9ePaDnCaBLRlOKDL1t2PPxEnoLpt4D0G8=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.22,REQID:6d6a3152-5f04-4de4-98af-b546c7d22f17,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:120426c,CLOUDID:8d0995ea-db6f-41fe-8b83-13fe7ed1ef52,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-CID-BAS: 0,_,0,_ X-UUID: e500594ed84b11edb6b9f13eb10bd0fe-20230411 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 1731459184; Tue, 11 Apr 2023 17:33:19 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) 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.1118.25; Tue, 11 Apr 2023 17:33:18 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.25 via Frontend Transport; Tue, 11 Apr 2023 17:33: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 Subject: [PATCH v7 07/14] iommu/mediatek: mt8186: Add iova_region_larb_msk Date: Tue, 11 Apr 2023 17:31:37 +0800 Message-ID: <20230411093144.2690-8-yong.wu@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230411093144.2690-1-yong.wu@mediatek.com> References: <20230411093144.2690-1-yong.wu@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762873056173840570?= X-GMAIL-MSGID: =?utf-8?q?1762873056173840570?= 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 bb3734378934..2c2a64c1712a 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -1525,6 +1525,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 | @@ -1537,6 +1549,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 Tue Apr 11 09:31: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: 81837 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2442752vqo; Tue, 11 Apr 2023 02:35:56 -0700 (PDT) X-Google-Smtp-Source: AKy350YAccN2nZbg9OLGBsBKZgFSrVFc0zxXZ9UicZ/kIHvj2rhy696NEhM6nsiD5hl29P8gukKj X-Received: by 2002:a05:6a20:b92f:b0:d9:76fa:3502 with SMTP id fe47-20020a056a20b92f00b000d976fa3502mr10931953pzb.36.1681205756404; Tue, 11 Apr 2023 02:35:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681205756; cv=none; d=google.com; s=arc-20160816; b=ClCKJrOyX67y7KlO26f8c0Ncf4m7hWurat2kVt7Rd6SlA5m2f4pFhksJ6deU8ia8el wBAfy8Q+J8OKRpT8Z6W2cnST03ZjWwz3iOWkn1o3WQiXP5qXgRH9/bZt4hlh6bLW7G3E mjP9dPTu7MxS4rulb6Nf3OLCe58HcvCG8DjfcWo2VwcE5osvPmRX9Qxnn7NBd+Z3lIqv itWjIMYTR2RpGrIJ5wCDbDurNsxJD2izmXfaU1p4J0qIkmfyQ1dBmdYygkXQ89I+k6Vj aydC+OBz/C6YOBC3QYgKv2/DQW8GTabIZdfnvh8ALwD8Zmhc2O4qgSVzpcDKE/ZhVZbM fonw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4RaT+9nrF2MCl8+ZR9wc/aV9OmM6fg58sYHW4ls9iwI=; b=ghzBOXmfyJZ1A75Vu+YguFylwAIyk7CjTrlZ++D3vUNXRQtH0jfam7ivtYsRma1W+/ /D9TOn6/DrWaPGYillS2bjD1JV5nv9PXFLCXCC+ROxkXs5yVjs15vRgTeXE2bOg0LxfQ CYUexXU8GK9vDb8lXhnqrzTZrhodhv2kXtuFLl8vh+NpYxllQs4e63rdUrqHZz0GXerk lIX81Um/55i0CLfrHe0fMzBrq5AVhQi1dqTRPAWBJGmhnIS1h5W7G2AQ5YEX4QpAtGLz QrkESuphxQRVksSTcDIm3ceW5JgBu14uvFk2r1Kx/DShchwDSashI9sh5zf9C8k/3YMa RFAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=saccAJwN; 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 f1-20020aa79d81000000b0062624d7193dsi3512613pfq.70.2023.04.11.02.35.44; Tue, 11 Apr 2023 02:35:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=saccAJwN; 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 S230237AbjDKJeI (ORCPT + 99 others); Tue, 11 Apr 2023 05:34:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230113AbjDKJdv (ORCPT ); Tue, 11 Apr 2023 05:33:51 -0400 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB08C4218; Tue, 11 Apr 2023 02:33:31 -0700 (PDT) X-UUID: e8d2b7e2d84b11edb6b9f13eb10bd0fe-20230411 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=4RaT+9nrF2MCl8+ZR9wc/aV9OmM6fg58sYHW4ls9iwI=; b=saccAJwNvBUERSxJI4EmJyIn8nj2zlvfFwsDj8vdGWZMQG5M6Y8i8/QYnuF/2pRvveotz4SCP6TXxTAwc57XrZLfiTGi+5dHde7H0GXyjANwBrOKmo5kAwi29WTPSRuW/wYLYnpF6c/OABEvndjS9T1IAN+CqyVzM/iwbmNZieE=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.22,REQID:5064716e-da08-47f6-a45e-b35562215621,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.22,REQID:5064716e-da08-47f6-a45e-b35562215621,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:120426c,CLOUDID:3e7bf3a0-8fcb-430b-954a-ba3f00fa94a5,B ulkID:2304111733269YG265MO,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-CID-BAS: 0,_,0,_ X-UUID: e8d2b7e2d84b11edb6b9f13eb10bd0fe-20230411 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1809009958; Tue, 11 Apr 2023 17:33:25 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) 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.1118.25; Tue, 11 Apr 2023 17:33:24 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.25 via Frontend Transport; Tue, 11 Apr 2023 17:33:23 +0800 From: Yong Wu To: Joerg Roedel , Matthias Brugger , Mauro Carvalho Chehab , Rob Herring CC: Will Deacon , Robin Murphy , Krzysztof Kozlowski , Hans Verkuil , , , , , , , , "AngeloGioacchino Del Regno" , , , , Yunfei Dong , kyrie wu , , , , Yong Wu Subject: [PATCH v7 08/14] iommu/mediatek: Add a gap for the iova regions Date: Tue, 11 Apr 2023 17:31:38 +0800 Message-ID: <20230411093144.2690-9-yong.wu@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230411093144.2690-1-yong.wu@mediatek.com> References: <20230411093144.2690-1-yong.wu@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762872006965798906?= X-GMAIL-MSGID: =?utf-8?q?1762872006965798906?= 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 --- 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 2c2a64c1712a..0e104bb27010 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 Tue Apr 11 09:31: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: 81838 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2443106vqo; Tue, 11 Apr 2023 02:36:48 -0700 (PDT) X-Google-Smtp-Source: AKy350bGgGBL4tOvDsO02PSrws0NqcqGL/pgzQqbaS3cBQXBrntjqZZFeXAg+SeTp2w3/hWkx8r3 X-Received: by 2002:a17:90a:1a47:b0:246:b06c:adc8 with SMTP id 7-20020a17090a1a4700b00246b06cadc8mr7315113pjl.9.1681205808407; Tue, 11 Apr 2023 02:36:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681205808; cv=none; d=google.com; s=arc-20160816; b=F9kKz6NHWFP8DKWq/mLW0ruVrVv0aBGIQM6D55U7xhvZkGOuTaJV+es7F42t84L3z4 8CApEO5mmsGJWHf+X4HpqCiGtT1F3jUeujBCIgpCNUtKi6n0AJnyExtr8gt6LLoTvral auy7xl+A3u+GvOZH5rGhAbJNe61hF9G5bXs5ohJWsKlrn71Cxf5PwDvESwJMTFSrUzdw EQT/uoFZjHo5bQ4LSLi/JJdlF2c3oZ6khtCieoNchethy1WuuRe+KpeBvllzlzs0Rtut vZehJ2eXnF207ziyROnSgqowZCJuW06J36vzw6EnMkyCEiBMLfMGrULaOpcDbbxeIw2g yT+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ikbJp6d90IXVw0sxspdPpFbtjqXNe1M7Eau6Eu2D3DM=; b=AvXJGr0218w5v5EYTHxMzket0Ha5ZZgHSi+jINfi39tzlEdpWOiyD9iZ3btUaALdfi e1Hejz4B3CGH8d+vpg0McN23CiN8v3WZCetOgQ9dyQE2Yg7JkPuIKjL+h7eB/N1FX2rG NFKEfyjAc6XqBrMM7w2qy7El0on9dXKFF/Gaxw4fbd0zoKRcqeCWECjRDsuQkfwV1Mck ZawLYtY245b06BCPXT7RQfPVajWPXeYh4MwjvyvWcV77v1UIeBQhZAAB/3Jz4xaMMZ7Z Nq5rUpxJCapoph1eQA/z2Qek+JaeIYmY3K3Xhb/KVQEuZc/nKe5n61dASUfCIuXSCwJC 2UXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=f9pTAfbq; 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 m11-20020a17090ab78b00b00246a135eda4si5029528pjr.27.2023.04.11.02.36.36; Tue, 11 Apr 2023 02:36:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=f9pTAfbq; 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 S230010AbjDKJeO (ORCPT + 99 others); Tue, 11 Apr 2023 05:34:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230001AbjDKJdx (ORCPT ); Tue, 11 Apr 2023 05:33:53 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A54F2448D; Tue, 11 Apr 2023 02:33:36 -0700 (PDT) X-UUID: ecc3a29ed84b11eda9a90f0bb45854f4-20230411 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=ikbJp6d90IXVw0sxspdPpFbtjqXNe1M7Eau6Eu2D3DM=; b=f9pTAfbq28w5eWLoj77qyWV5xNn/RoL/i4QfkoyezqCNIQZ7Fi/xY2Z3g8cVkkL7cIQpMyIf7Bcm3VwYnZvX5xydpgyQQIqyKqKIvmKyVH++BukxiOis3cSwxWvO8pMpdSSGoWVO4fe6XvP0AK2i9IyodwySzfmFZ7/0SIr7tVc=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.22,REQID:e4ac7712-56ea-4127-9061-527a628af346,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:120426c,CLOUDID:fd7bf3a0-8fcb-430b-954a-ba3f00fa94a5,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-CID-BAS: 0,_,0,_ X-UUID: ecc3a29ed84b11eda9a90f0bb45854f4-20230411 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 1093196087; Tue, 11 Apr 2023 17:33:32 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) 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.1118.25; Tue, 11 Apr 2023 17:33:31 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.25 via Frontend Transport; Tue, 11 Apr 2023 17:33: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 v7 09/14] iommu/mediatek: Set dma_mask for the master devices Date: Tue, 11 Apr 2023 17:31:39 +0800 Message-ID: <20230411093144.2690-10-yong.wu@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230411093144.2690-1-yong.wu@mediatek.com> References: <20230411093144.2690-1-yong.wu@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762872061911227621?= X-GMAIL-MSGID: =?utf-8?q?1762872061911227621?= MediaTek iommu arranges dma ranges for all the masters, this patch is to help them set dma mask. This is to avoid each master setting their own mask, but also to avoid a real issue, such as JPEG uses "mediatek,mtk-jpgenc" for 2701/8183/8186/8188, then JPEG could ignore its different dma_mask in different SoC to achieve common code. Signed-off-by: Yong Wu Reviewed-by: AngeloGioacchino Del Regno --- drivers/iommu/mtk_iommu.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index 0e104bb27010..f58b970dccf2 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -738,6 +738,14 @@ static int mtk_iommu_attach_device(struct iommu_domain *domain, } mutex_unlock(&data->mutex); + if (region_id > 0) { + ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(34)); + if (ret) { + dev_err(m4udev, "Failed to set dma_mask for %s(%d).\n", dev_name(dev), ret); + return ret; + } + } + return mtk_iommu_config(data, dev, true, region_id); err_unlock: From patchwork Tue Apr 11 09:31: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: 81849 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2449776vqo; Tue, 11 Apr 2023 02:53:50 -0700 (PDT) X-Google-Smtp-Source: AKy350Y0bQHr0ZLtLTNXdl4Bx9idsSobotAGUvXPvM0dcZW3PIJxFTe/k3UEJdE8aA9OTMYp7kBu X-Received: by 2002:a17:906:2d2:b0:932:3d1b:b69d with SMTP id 18-20020a17090602d200b009323d1bb69dmr2092608ejk.47.1681206830332; Tue, 11 Apr 2023 02:53:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681206830; cv=none; d=google.com; s=arc-20160816; b=JJkLzyygTI6MBoABfQU2ISN/xUWoTm2CiE0oXNwXFPvx6HBX7gznLnqhZeQHQ+DNeP h55WiLrdQalOkEYcOJPfrULYJhSrzw9PAGs8HvNoZ72suujxivjKVbzy6bpnw/VmLRPz LLFXR1+oiVkSFMYun7/V7bES4/DLC4wDZ1JRHAHDYqALACYVC4RsNKHEdHZoBapLlc2B A/rfJaxhmhi33s7R+vFxfKzufSZaNBIgJvaVMDWBHSg9F3YyjycKKPNz1aOU1Ra6p9CC y3yE7LaulNfG28uoW1q6nwxTwbQxzj0NjaBsiti23AnU0xrGr3PZtpHWyC168V5ZaLoO dd2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tFB5+TDegZ2t6qK9NrZoRPZ2/IQBCygYDbpoNSt9KtE=; b=ha4MPOKCUwmXb4XG9exFcGy6wjgqQagEtLAPPAMLNXEOG4A583bkUitSj0FiHEoMWH bISTeVzb4ECL5VQC1hnFiv9D0prZlbtbUSdfWPFHYW+NU3pqHoK0wojGPs+n+a9aOi2F VrZ3T8k1z6rzJwZCuvGiZrIHgx5OKBCkhwsG5JuXVIcOQHlU+oysmlMeFX4xHUVow+VF IrTyToTYM58vcIF+9v4a8F4v9sivtqGJiKM6jO3XWayFSvJkSUh41B04nqMoxUFTetps +zH3L5hNgS2PIIXPEmN/znMvQU6q10uBdkbHh/AleGhtDU5ZN7XGrjQxoWd72QJAJ5Yt V61A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=pV+naLgG; 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 io3-20020a17090780c300b0093f3cd5628asi7797649ejc.684.2023.04.11.02.53.25; Tue, 11 Apr 2023 02:53:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=pV+naLgG; 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 S230303AbjDKJee (ORCPT + 99 others); Tue, 11 Apr 2023 05:34:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230227AbjDKJeH (ORCPT ); Tue, 11 Apr 2023 05:34:07 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADF613C10; Tue, 11 Apr 2023 02:33:48 -0700 (PDT) X-UUID: f3025d6cd84b11eda9a90f0bb45854f4-20230411 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=tFB5+TDegZ2t6qK9NrZoRPZ2/IQBCygYDbpoNSt9KtE=; b=pV+naLgGJriNjqfMwpcxe9/gdwKN0tAsOp/Gs30Oih4tYKOrdEi+0fTJY5Hr4eSMU5ihEGT7q4U9ZClHzq44y9Q4hCdfeHA3J4jkNsB3WsdXIODfC3BNGYx1hfMs8e6q8YNOIjXVHJ5r4LZ+FbcCqvHRTmGcQQrI4B96FF9SGas=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.22,REQID:61df390b-34ce-4048-a5b0-e07a00750186,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:120426c,CLOUDID:a70c95ea-db6f-41fe-8b83-13fe7ed1ef52,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-CID-BAS: 0,_,0,_ X-UUID: f3025d6cd84b11eda9a90f0bb45854f4-20230411 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 1667052521; Tue, 11 Apr 2023 17:33:42 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) 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.1118.25; Tue, 11 Apr 2023 17:33:41 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.25 via Frontend Transport; Tue, 11 Apr 2023 17:33:40 +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 , kyrie wu Subject: [PATCH v7 10/14] media: mtk-jpegdec: Remove the setting for dma_mask Date: Tue, 11 Apr 2023 17:31:40 +0800 Message-ID: <20230411093144.2690-11-yong.wu@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230411093144.2690-1-yong.wu@mediatek.com> References: <20230411093144.2690-1-yong.wu@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762873133556618928?= X-GMAIL-MSGID: =?utf-8?q?1762873133556618928?= In order to simplify the masters to set their respective dma masks, MTK IOMMU helps to centralize the processing. Because all the dma ranges is set in IOMMU, IOMMU knows well the dma mask requirements of masters. After this patch, the masters code does not need care dma-ranges/dma_mask related information. Cc: Bin Liu Cc: Mauro Carvalho Chehab Cc: kyrie wu Signed-off-by: Yong Wu Reviewed-by: AngeloGioacchino Del Regno Acked-by: Hans Verkuil --- drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c index 969516a940ba..9b96d2436311 100644 --- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c +++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c @@ -1757,9 +1757,6 @@ static int mtk_jpeg_probe(struct platform_device *pdev) jpeg->vdev->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_M2M_MPLANE; - if (of_get_property(pdev->dev.of_node, "dma-ranges", NULL)) - dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(34)); - ret = video_register_device(jpeg->vdev, VFL_TYPE_VIDEO, -1); if (ret) { v4l2_err(&jpeg->v4l2_dev, "Failed to register video device\n"); From patchwork Tue Apr 11 09:31: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: 81839 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2443390vqo; Tue, 11 Apr 2023 02:37:28 -0700 (PDT) X-Google-Smtp-Source: AKy350aTDaYHseKgz+cOiSkUTSOqRQD0EKWBkfNj/3w4btI/HQO8N3gl2LxTmNw2Nkt6Pfr7VAiP X-Received: by 2002:a17:902:da90:b0:1a6:47aa:dbd7 with SMTP id j16-20020a170902da9000b001a647aadbd7mr5482144plx.53.1681205848395; Tue, 11 Apr 2023 02:37:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681205848; cv=none; d=google.com; s=arc-20160816; b=zE5w4bKiW/NS7ySWqORBjBDn5BHqQpqYYjBuel/66BPc59O6CKQ7jAOR4CxycLY8qx /xwlUHuhj5Zy4s3D1ZBeqK5DVQWW2GjbV/Un/EA5kT5MBBuucsZqzkih5O4lPyVjadLf vomsozIOOpDrhhfHhDNGtrRqH3n55tPEHu4ovO9907xJAWubuCcFcmUeIdL1+ihVZ5Xk mFGsnekDNpO48N9lCSC6+aFE7TcJV9P93q6mzsf1vNWyEVnI3TYxznnnMeGepS/gnvw2 7tL3q1Mp6H68bRzWNjzwAYQbTk7Sbekv7UZ8TiX9y9JIa116a3Ix1vqsqPrQi1QdLzUw mz0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=R0k5lQHHRLml/ji++14oXkm9cmht5KGHr7AnrObcMd4=; b=ImhJ+IGp8s/iNoBDmUoIs/4Zy8vMSK4+hUDdPyV6w8FlC0AxcxMUK4pOv9QNMMei5k dDoSitaCdfgwMY89YmqYQCh8oaaR0gJIcJCGTj9Xb+3Zan8016h9GpUlCqGh5V4Uo7n0 18q53VGoATp5mV3arL1xfWiXc7ocFvjr/e0DrnvW3pgQ3HfKcQqbb+SN3oMJodsRrtf8 M3i6Tvp0UwLArQKADBRcXtuyrSsJELbArXzbtj9F1U8USnIFjoDYxhBLk2PGxOa5r/85 OhL1eCA0hz1X0yL6zcXB27vrgFJgG0/0eDI8mWXBTQoISGyVUKoS5YovzeNQ6QvJ6eml 6hAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=UOyxwXL8; 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 l11-20020a170903120b00b001a1b5dc97f0si14532820plh.270.2023.04.11.02.37.16; Tue, 11 Apr 2023 02:37:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=UOyxwXL8; 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 S229478AbjDKJew (ORCPT + 99 others); Tue, 11 Apr 2023 05:34:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230145AbjDKJeQ (ORCPT ); Tue, 11 Apr 2023 05:34:16 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADDB93C25; Tue, 11 Apr 2023 02:33:57 -0700 (PDT) X-UUID: f97ced10d84b11eda9a90f0bb45854f4-20230411 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=R0k5lQHHRLml/ji++14oXkm9cmht5KGHr7AnrObcMd4=; b=UOyxwXL88mhRAvK3zmw+lbZBjPtgAOXHO3PZMhye+TysyK2pOQXdgJmfOUUAwxAZY9wAAx5AT2Q0PK95TAHasoilJ3VrBFV5PFQo+T0xshqMFCmyrWfxN+esexQxevEiKxAMcmGOLnb/XXIkCCCGlh+aPftlRT45B/UgQsw5Twg=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.22,REQID:a0fea9d4-b872-423d-bddb-f33fda861715,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:120426c,CLOUDID:5270ae83-cd9c-45f5-8134-710979e3df0e,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:11|1,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-UUID: f97ced10d84b11eda9a90f0bb45854f4-20230411 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 264596907; Tue, 11 Apr 2023 17:33:53 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) 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.1118.25; Tue, 11 Apr 2023 17:33:52 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.25 via Frontend Transport; Tue, 11 Apr 2023 17:33:51 +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 , irui wang Subject: [PATCH v7 11/14] media: mediatek: vcodec: Remove the setting for dma_mask Date: Tue, 11 Apr 2023 17:31:41 +0800 Message-ID: <20230411093144.2690-12-yong.wu@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230411093144.2690-1-yong.wu@mediatek.com> References: <20230411093144.2690-1-yong.wu@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762872103356656545?= X-GMAIL-MSGID: =?utf-8?q?1762872103356656545?= In order to simplify the masters to set their respective dma masks, MTK IOMMU helps to centralize the processing. Because all the dma ranges is set in IOMMU, IOMMU knows well the dma mask requirements of masters. After this patch, the masters(codec here) code does not need care dma-ranges/dma_mask related information. Cc: Tiffany Lin Cc: Andrew-CT Chen Cc: Yunfei Dong Cc: Mauro Carvalho Chehab Cc: irui wang Signed-off-by: Yong Wu Reviewed-by: AngeloGioacchino Del Regno Acked-by: Hans Verkuil --- .../media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c | 8 -------- .../media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c | 3 --- 2 files changed, 11 deletions(-) diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c index 174a6eec2f54..11583405cf61 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c @@ -321,14 +321,6 @@ static int mtk_vcodec_probe(struct platform_device *pdev) } } - if (of_get_property(pdev->dev.of_node, "dma-ranges", NULL)) { - ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(34)); - if (ret) { - mtk_v4l2_err("Failed to set mask"); - goto err_core_workq; - } - } - for (i = 0; i < MTK_VDEC_HW_MAX; i++) mutex_init(&dev->dec_mutex[i]); mutex_init(&dev->dev_mutex); diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c index 9095186d5495..50e5571608cd 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c @@ -344,9 +344,6 @@ static int mtk_vcodec_probe(struct platform_device *pdev) goto err_event_workq; } - if (of_get_property(pdev->dev.of_node, "dma-ranges", NULL)) - dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(34)); - ret = video_register_device(vfd_enc, VFL_TYPE_VIDEO, -1); if (ret) { mtk_v4l2_err("Failed to register video device"); From patchwork Tue Apr 11 09:31: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: 81844 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2448846vqo; Tue, 11 Apr 2023 02:51:25 -0700 (PDT) X-Google-Smtp-Source: AKy350bmnlopwx+RtedHi7k6JeWRFaYVawaidC8LYq7U6Xpxp0RqrMgNWJ7ibrpep8ORcUwwRQw6 X-Received: by 2002:aa7:df02:0:b0:504:94b9:f21 with SMTP id c2-20020aa7df02000000b0050494b90f21mr1819450edy.27.1681206684822; Tue, 11 Apr 2023 02:51:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681206684; cv=none; d=google.com; s=arc-20160816; b=sHGWdPYPtwN/hevXMtAIjuw0kcsF9WqHIGcN9qzD8P2Havy8RdrCnQpwFyBSpqVCLN 5L+cfE5fghjUeqLacNqIw1Q5S46mfzHAQ0Y69SIAjRkvVBIYfSn4XnoI+i1AlHIVkbC8 n/XqGeKTmwBMgFU91HHmcJGDhcdp2IjKR6FaHIxA24FAE3r51ShIoXdLBjY5Gb1hZfSD 0xQhVGCUeASeQpLrkAPgJCRFNLWseOmi8Ot9zbdUGp73pRjVHB0QDcCm3LOWf/5Vtw85 IbkosOu/MQo53jXH95w9zZMpjxW1n8PAb8u3dPnBo327uAhjCjk4v4TR5IYTEL8sldh6 fHIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tah2dAHbxREASTnvJuJls1whJtxCEwW9tPvWPYuqkMo=; b=FEoMZ6u93PnNFXq5g2nEZNm1Yzd4GnDNIU3dWK3zxCfTbKA/oLnOgdXhzBRbdfgLGa uqYcTTf9Xmh8EVCU3n9nsXSTuDT7gwviurwvMrLMzVOVUL3adCCq1DVDDmAMeYqBlrYQ Ft1LEJe3iK9Lb+zGMI8KfKxELNFQXzQBGS5oYWBOsChZlBUDFlK0mBtNiIUarRzL9ffI 7fjd2dU0rBYchnkwTnyonGlkW+8vUAHpNdYyTpzpdfgGTepMHfEa+VQViaerBFd85C/c GcxSEyt+edhrlUFFz/a9JW09rwqppL6SzVTrg2xi9Y6ls9Y7zJJvvlQOPOR/CGSusQx3 bETA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=QbR8mNcE; 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 i9-20020a50fc09000000b0050471651c06si2116213edr.147.2023.04.11.02.51.00; Tue, 11 Apr 2023 02:51:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=QbR8mNcE; 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 S230190AbjDKJfE (ORCPT + 99 others); Tue, 11 Apr 2023 05:35:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230213AbjDKJec (ORCPT ); Tue, 11 Apr 2023 05:34:32 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A78584214; Tue, 11 Apr 2023 02:34:09 -0700 (PDT) X-UUID: ff2affd6d84b11eda9a90f0bb45854f4-20230411 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=tah2dAHbxREASTnvJuJls1whJtxCEwW9tPvWPYuqkMo=; b=QbR8mNcE+jZuM+PiT6wQZLjt0GveBogC1IzTT9YOfLyPCWefJ6JyJZc31hxlBXCiVwP/QrN91rhqArNZDr1XuX4jUM89M0Pxe//QI1IdmuTPDKq82wqoCb7/6jTgF6LQBBjFsoparFhD1poPvKPqp03CuygbC+MqQGb9stI7FkI=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.22,REQID:4f534479-4fad-4205-8491-b4152ad7bdc4,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:120426c,CLOUDID:6880f3a0-8fcb-430b-954a-ba3f00fa94a5,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-CID-BAS: 0,_,0,_ X-UUID: ff2affd6d84b11eda9a90f0bb45854f4-20230411 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 1493374876; Tue, 11 Apr 2023 17:34:03 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) by mtkmbs11n1.mediatek.inc (172.21.101.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.25; Tue, 11 Apr 2023 17:34:02 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.25 via Frontend Transport; Tue, 11 Apr 2023 17:34:00 +0800 From: Yong Wu To: Joerg Roedel , Matthias Brugger , Mauro Carvalho Chehab , Rob Herring CC: Will Deacon , Robin Murphy , Krzysztof Kozlowski , Hans Verkuil , , , , , , , , AngeloGioacchino Del Regno , , , , Yunfei Dong , kyrie wu , , , , Yong Wu Subject: [PATCH v7 12/14] arm64: dts: mt8195: Remove the unnecessary dma-ranges Date: Tue, 11 Apr 2023 17:31:42 +0800 Message-ID: <20230411093144.2690-13-yong.wu@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230411093144.2690-1-yong.wu@mediatek.com> References: <20230411093144.2690-1-yong.wu@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762872980853147397?= X-GMAIL-MSGID: =?utf-8?q?1762872980853147397?= 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 8f1264d5290b..89f469ba9f6c 100644 --- a/arch/arm64/boot/dts/mediatek/mt8195.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8195.dtsi @@ -2299,7 +2299,6 @@ venc: video-codec@1a020000 { power-domains = <&spm MT8195_POWER_DOMAIN_VENC>; #address-cells = <2>; #size-cells = <2>; - dma-ranges = <0x1 0x0 0x0 0x40000000 0x0 0xfff00000>; }; jpgdec-master { @@ -2311,7 +2310,6 @@ jpgdec-master { <&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; @@ -2383,7 +2381,6 @@ jpgenc-master { <&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 Tue Apr 11 09:31: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: 81848 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2449683vqo; Tue, 11 Apr 2023 02:53:32 -0700 (PDT) X-Google-Smtp-Source: AKy350bOvx1+tblGgCxhP13j5JtdP1ctEA7NE5hb3ggZY4yzAUpQrLfZfBghE3gUqYz7n/NsAxYg X-Received: by 2002:a17:907:7fab:b0:94a:8a80:3f4d with SMTP id qk43-20020a1709077fab00b0094a8a803f4dmr7358284ejc.50.1681206812413; Tue, 11 Apr 2023 02:53:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681206812; cv=none; d=google.com; s=arc-20160816; b=k9q4/kZj3aSQmRb+PbaKphih97cHeh+WjIEutZJYf3xlYoPW/jt5BNoPxwp7V26CnJ rdq0a6TFItk4TFnfbc2HkCNpdEZ5yiKFrofzjxEWAEkrb3cJyvKSeY4VHPrwOtsZTXmb XYXsI7zZSSvMLzD7TvjJ3DleBzn0FYXcaCJqCiJOi+0LmHLunSvxT6FvzQ4owGBku1Y2 vHjg64oYepGD6PqsOAS+UJb6UPQYkdymuqB+0qIvs89rvDug9xbcib6+92PZHBj8Z9C3 lsKzJKDyb+WZjHbXQYZUpMkwbv1jYeQ8k8AGOetmV9yrNT20QK37DoxAbLaZ+x+PSbts 2T2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=w7h1+V4mSmpmxgEEvepRAQu3Berq17NW7THqwLhQ31g=; b=N1rps78cdofuja64PBvgHIQJoeV5l0ama6OgEzuuNqO38qTQhm978GgsIK/e82jaYX yJLtvBjE+lhfVVhOdPZY8NCMiK0e0fJfrQPWIlPFRHWQxmw/hr8a3C6EpYV7c19hCZiR /nZduAQqWMOimEIk7FNV0aPXDqjukQtC0kOuDeOyTwn+9bwD2ZzPsrJEE2fRD5qpOkaV lPjGssae8fBr9Hiu6aaMiPD04TuR3m6ESfXRuHnmg/uMFZaS2CLl2gCzXFYINPJtSNuQ MLa2DgE8xt7YEDxE7U1VsRQYWOeAg7DsTv95EmpVo8zcdSW93WjPb0CtnxFlCnYNuUma Giyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b="LAtaM/fA"; 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 h6-20020a1709060f4600b009475bf88f7dsi3241049ejj.910.2023.04.11.02.53.07; Tue, 11 Apr 2023 02:53:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b="LAtaM/fA"; 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 S230113AbjDKJfG (ORCPT + 99 others); Tue, 11 Apr 2023 05:35:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229906AbjDKJeg (ORCPT ); Tue, 11 Apr 2023 05:34:36 -0400 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE6F9469D; Tue, 11 Apr 2023 02:34:11 -0700 (PDT) X-UUID: 01d9debed84c11edb6b9f13eb10bd0fe-20230411 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=w7h1+V4mSmpmxgEEvepRAQu3Berq17NW7THqwLhQ31g=; b=LAtaM/fAQzpqhL86UXiy+HcgUt9FEqXWWuSgPx6P3QSoS6iQz1cI4ufR715dVu4SZb8aViLnIKT3V00Z7ND7vQgrLaSrRJ2QdATcTY89UYLTigXYP/8THYhj3wB+V1fzylwyuyG+GaF82hfF1yzs32P6O3Fwg2B0rP2rERJmThk=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.22,REQID:5aa54102-4d94-4abc-9e0c-ad842da9c9d0,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:95 X-CID-INFO: VERSION:1.1.22,REQID:5aa54102-4d94-4abc-9e0c-ad842da9c9d0,IP:0,URL :0,TC:0,Content:0,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTION :quarantine,TS:95 X-CID-META: VersionHash:120426c,CLOUDID:d50f95ea-db6f-41fe-8b83-13fe7ed1ef52,B ulkID:230411173408ZZEMV5F7,BulkQuantity:0,Recheck:0,SF:48|38|29|28|17|19,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,NGT X-CID-BAS: 0,NGT,0,_ X-UUID: 01d9debed84c11edb6b9f13eb10bd0fe-20230411 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 2001983924; Tue, 11 Apr 2023 17:34:07 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) 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.1118.25; Tue, 11 Apr 2023 17:34:06 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.25 via Frontend Transport; Tue, 11 Apr 2023 17:34:05 +0800 From: Yong Wu To: Joerg Roedel , Matthias Brugger , Mauro Carvalho Chehab , Rob Herring CC: Will Deacon , Robin Murphy , Krzysztof Kozlowski , Hans Verkuil , , , , , , , , AngeloGioacchino Del Regno , , , , Yunfei Dong , kyrie wu , , , , Yong Wu Subject: [PATCH v7 13/14] arm64: dts: mt8195: Add dma-ranges for the parent "soc" node Date: Tue, 11 Apr 2023 17:31:43 +0800 Message-ID: <20230411093144.2690-14-yong.wu@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230411093144.2690-1-yong.wu@mediatek.com> References: <20230411093144.2690-1-yong.wu@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762873114539973667?= X-GMAIL-MSGID: =?utf-8?q?1762873114539973667?= 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 89f469ba9f6c..7d87cbabc9f1 100644 --- a/arch/arm64/boot/dts/mediatek/mt8195.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8195.dtsi @@ -364,6 +364,7 @@ soc { #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 Tue Apr 11 09:31: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: 81840 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2443526vqo; Tue, 11 Apr 2023 02:37:49 -0700 (PDT) X-Google-Smtp-Source: AKy350YDjDavbWl7rtsNMY6HNRn/GPoILGhim92XXCrjdEG0UoC15koEWp5NTZ99iapFYg5nd1zH X-Received: by 2002:a05:6a20:aea5:b0:d6:91f5:2b10 with SMTP id do37-20020a056a20aea500b000d691f52b10mr12683630pzb.58.1681205869096; Tue, 11 Apr 2023 02:37:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681205869; cv=none; d=google.com; s=arc-20160816; b=KpBu4pdb6iqP8WeJHqVgdOkT5fLdSEzSESjfJnrg0iIXC4xGvDVsYwFGCybNqkRoLu 7ETHVLfBhhnRsUYafvHyYUFEYpYjIHBqokPnP98Eu3nzy4mzQ4Hz9GjlDzvD5XLW5pOm /JK5o+XQj1wCOxtNk8z0IxbES3I6IMFTQ2kruuanip7VCwC2iqjUKK5RYQJh0YNC5+pS z8Uby0u6tWkddePhngOh5W/h6jONaKisfXQQY3TxnVRVjj1JsuaWLPbqs/fJtg3oXZMY fEvNhgEjJYj2wdB+sm1R3tYtpNR+KZUKY/HcvCAuzudD07HPR5LB5dtX3xXEs6fSFpEb XjjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FJB8NsPpg9GUe4KvEeOfItKIQWjs0rG8Qvtk+6JhZk4=; b=ehl5F7STQi4NZKa+hQjUez6k2Jp/JfB5G7Otoudd8PK+DjpjpiGAZiNZFRINHcerMQ 9lq10nmdG9OqiRWqSD84ESO6NtT7HLIGviD4KNghjcUaorDlF4pNFzRzc4IFDv6fVgAZ 5s4Z5QhyH9PtsnJHpSPJ35WZ4PmH69YyNtgEmObYRJVGiKuu+73G1Xu2d23D6J0Y8ZMJ iVP0JeKsN3JohA3TxxYmaRIXh431LOQMHkqqZKbT6Dmj/M6/v1+AeypnrpzoEO9WH+3Q lWWp+A0jUS8AgkwUUJyJt0XMf135W1HKegGDYPp7fT4eR+t5IyDTptGb32OWf44AbyA4 UTaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=b+AMT+Xn; 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 e9-20020aa798c9000000b0062dabed8063si13464925pfm.337.2023.04.11.02.37.37; Tue, 11 Apr 2023 02:37:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=b+AMT+Xn; 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 S229477AbjDKJfd (ORCPT + 99 others); Tue, 11 Apr 2023 05:35:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230195AbjDKJfE (ORCPT ); Tue, 11 Apr 2023 05:35:04 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DF4049DC; Tue, 11 Apr 2023 02:34:27 -0700 (PDT) X-UUID: 08362470d84c11eda9a90f0bb45854f4-20230411 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=FJB8NsPpg9GUe4KvEeOfItKIQWjs0rG8Qvtk+6JhZk4=; b=b+AMT+XnvAGPT88F9pHhoTWnDTBlEUXAdInQrRV2sREYk5JZgvDKio7QES4foLcdSbH9Y1u8BG9cn1dytsLGFa15t4BKJk+/QlegX5/9EEZFIxsxarw+S1udKr9hXtjlN1h0U5DLKe/FhU6A2u/fwarWeSQ7wzrjNDYTjhbVLik=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.22,REQID:6742e78a-7dda-4b0d-bea4-557ea5522031,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:95 X-CID-INFO: VERSION:1.1.22,REQID:6742e78a-7dda-4b0d-bea4-557ea5522031,IP:0,URL :0,TC:0,Content:0,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTION :quarantine,TS:95 X-CID-META: VersionHash:120426c,CLOUDID:6282f3a0-8fcb-430b-954a-ba3f00fa94a5,B ulkID:230411173421R9C3OIDW,BulkQuantity:0,Recheck:0,SF:19|48|38|29|28|17,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-CID-BAS: 0,_,0,_ X-UUID: 08362470d84c11eda9a90f0bb45854f4-20230411 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 527929262; Tue, 11 Apr 2023 17:34:18 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) 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.1118.25; Tue, 11 Apr 2023 17:34:17 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.25 via Frontend Transport; Tue, 11 Apr 2023 17:34:16 +0800 From: Yong Wu To: Joerg Roedel , Matthias Brugger , Mauro Carvalho Chehab , Rob Herring CC: Will Deacon , Robin Murphy , Krzysztof Kozlowski , Hans Verkuil , , , , , , , , AngeloGioacchino Del Regno , , , , Yunfei Dong , kyrie wu , , , , Yong Wu Subject: [PATCH v7 14/14] arm64: dts: mt8186: Add dma-ranges for the parent "soc" node Date: Tue, 11 Apr 2023 17:31:44 +0800 Message-ID: <20230411093144.2690-15-yong.wu@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230411093144.2690-1-yong.wu@mediatek.com> References: <20230411093144.2690-1-yong.wu@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762872125393663521?= X-GMAIL-MSGID: =?utf-8?q?1762872125393663521?= 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 @@ soc { #address-cells = <2>; #size-cells = <2>; compatible = "simple-bus"; + dma-ranges = <0x0 0x0 0x0 0x0 0x4 0x0>; ranges; gic: interrupt-controller@c000000 {