Message ID | 20230403091337.26745-10-yong.wu@mediatek.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2165844vqo; Mon, 3 Apr 2023 02:20:14 -0700 (PDT) X-Google-Smtp-Source: AKy350bV+i96Gj5rZj2Ds84lYUAn/zJ2jOJuoobCBByysNg86gsTB2YJf/2tpLr6jgNtMrG+LUNV X-Received: by 2002:a05:6402:2c6:b0:4fd:236f:7d4d with SMTP id b6-20020a05640202c600b004fd236f7d4dmr31647462edx.18.1680513614693; Mon, 03 Apr 2023 02:20:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680513614; cv=none; d=google.com; s=arc-20160816; b=iiTM5ofkX8BLqm5MmvYWjiBGWF58TWDB5tP7dOkFrwLPBZ4R1xETzelgGBUejyRRJp 4j6gr/XhxMBV1Fn8vQ0wc+5pa6TFbaB3bF4TYDCQxu/CIIb8+P70tbsFi0QdRQ5Qpgor pyxQM/j11c6Mt34k48t7E3bi//zPZkcf/o4HEG21yYqMQmncMdxU/oryzGnQhfYrLED8 ICsjjavfdL9cYFWtIkreZDVaOOHIe0GY2u99KuPIboVKKda7hkTrGwUB1eb0Odd3ea+V DCPYxyB21aZv2sFSpdBtNcJ7JFRy9t4+vukHUfdzUATiWGOBWtnvMiDQYViL4WlhLfhs +OIw== 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=wERd5oG1174Y8URxe6F/Q2o84/HIp2njb4cbhbVxM9n5bLyLII1gS7szORe1WNSMjv noEfs/BWzzEw2qSz1tTowDqXts6+tw7qkt63R2FD/ntGTGIdyaCSwy5eD98me6UpMoZ6 jDZzOsvc2rifPiFHp0OOsFTVuqbVBBzawm/MfUR6AypQql7Gg+OgT2hW8/36cDUTUtha XwFuG6CLFGxe8zaldNy6dHdLGU3FpeMu2PnSPSloLOOTyT0umqITnJ6/3tO9sA7zoOps w9zBQ1QC6Aj5qxBJO5rJM1BjuxdjBbUsl21HWfVf9x/RiRk58coNk81PuKtfy2LEUE6o rEHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b="anu/e93v"; 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 r18-20020aa7da12000000b005026895f258si7236222eds.398.2023.04.03.02.19.50; Mon, 03 Apr 2023 02:20:14 -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="anu/e93v"; 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 S231641AbjDCJQU (ORCPT <rfc822;winker.wchi@gmail.com> + 99 others); Mon, 3 Apr 2023 05:16:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231426AbjDCJQM (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 3 Apr 2023 05:16:12 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88C1810264; Mon, 3 Apr 2023 02:15:50 -0700 (PDT) X-UUID: 1cdeff98d20011eda9a90f0bb45854f4-20230403 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=anu/e93vtTmVrExRX0KTvCV0YMOuu8AH9hwJmUqaOQHvqMiscCbfJmxHGlo7H8Lsp2QiMK57zrGk1Na3Pu4pxGTqkvNoswWvL/eRaXrJv2qnULSGtL1R0FiTt/TObxHsg7Jqv1EDPort2Je9sDrgwHzvCSxVwJdGRJhYvYwonh0=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.22,REQID:37b1632b-69aa-4127-ba58-959018233d05,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:90 X-CID-INFO: VERSION:1.1.22,REQID:37b1632b-69aa-4127-ba58-959018233d05,IP:0,URL :0,TC:0,Content:-5,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTIO N:quarantine,TS:90 X-CID-META: VersionHash:120426c,CLOUDID:f2db23b5-beed-4dfc-bd9c-e1b22fa6ccc4,B ulkID:230403171547O6H131CU,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: 1cdeff98d20011eda9a90f0bb45854f4-20230403 Received: from mtkmbs13n1.mediatek.inc [(172.21.101.193)] by mailgw01.mediatek.com (envelope-from <yong.wu@mediatek.com>) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 319230404; Mon, 03 Apr 2023 17:15:44 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by mtkmbs13n2.mediatek.inc (172.21.101.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.25; Mon, 3 Apr 2023 17:15:43 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.25 via Frontend Transport; Mon, 3 Apr 2023 17:15:42 +0800 From: Yong Wu <yong.wu@mediatek.com> To: Joerg Roedel <joro@8bytes.org>, Matthias Brugger <matthias.bgg@gmail.com>, Mauro Carvalho Chehab <mchehab@kernel.org>, Rob Herring <robh+dt@kernel.org> CC: Will Deacon <will@kernel.org>, Robin Murphy <robin.murphy@arm.com>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Hans Verkuil <hverkuil@xs4all.nl>, <nfraprado@collabora.com>, <linux-media@vger.kernel.org>, <devicetree@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>, <linux-mediatek@lists.infradead.org>, <linux-kernel@vger.kernel.org>, <iommu@lists.linux.dev>, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>, <mingyuan.ma@mediatek.com>, <yf.wang@mediatek.com>, <jianjiao.zeng@mediatek.com>, Yunfei Dong <yunfei.dong@mediatek.com>, kyrie wu <kyrie.wu@mediatek.corp-partner.google.com>, <chengci.xu@mediatek.com>, <youlin.pei@mediatek.com>, <anan.sun@mediatek.com>, Yong Wu <yong.wu@mediatek.com> Subject: [PATCH v6 09/14] iommu/mediatek: Set dma_mask for the master devices Date: Mon, 3 Apr 2023 17:13:32 +0800 Message-ID: <20230403091337.26745-10-yong.wu@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230403091337.26745-1-yong.wu@mediatek.com> References: <20230403091337.26745-1-yong.wu@mediatek.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-MTK: N X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762146244168719653?= X-GMAIL-MSGID: =?utf-8?q?1762146244168719653?= |
Series |
Adjust the dma-ranges for MTK IOMMU
|
|
Commit Message
Yong Wu
April 3, 2023, 9:13 a.m. UTC
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 <yong.wu@mediatek.com>
---
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: