From patchwork Thu Mar 16 10:14:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yong Wu X-Patchwork-Id: 70716 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp401275wrt; Thu, 16 Mar 2023 03:32:30 -0700 (PDT) X-Google-Smtp-Source: AK7set88wLLIr6HDEx5jw0QFA5C9EIaPFEifPBihLYgkT9kP+bIQ7T1Gafc+L4Y35YXPQZrr71PY X-Received: by 2002:aa7:9f96:0:b0:623:e5fa:24ba with SMTP id z22-20020aa79f96000000b00623e5fa24bamr2315491pfr.10.1678962750426; Thu, 16 Mar 2023 03:32:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678962750; cv=none; d=google.com; s=arc-20160816; b=aRmzciSIEjbpo74M5I3zcPHdr6tIr+zlQCJSD5epsiAUDIG0BO2fWmv0I2EqzSvcRM E4wYBBUAWQXTJTANlepUR4CB/8b62+vJ6Bgv3oi17dsrF+Y01orZK3RlSn417Nf8i2M2 LqqG0n8cxJn8pPmr3FKNyIKqbh6/UiicvER0Iz7XCeCo0ONu2Zfgb9I2SUau5PFsbVb0 hC3IaXjpBfx+qZMqcPp9Ufb7BewNGO42cCEx0YgBYfLzbdZv3+RiDTJBpRfYTZ4jtGIC nPLXvyg/canQPMfTQUrBmWZ2VlYCfih/ZFBGs11sc/D1H+N+4fEnmm3Ch26kLBEWNcw/ Ie3g== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=SIJTB2iw2ZKbVZypN9eh4Lmwq+P7EW/KvxfnNL94MRc=; b=DipEKX1j7e2/SamL/7OfClx10cGF0QIdJoJaux3/AlnBSHF6ek3C5xK63xYcMMrCF7 Ddj+CNMAmuvZZ9RMe8roxclFfQUjAe2YtozIRtijXCW8rdQn5+EPef3xJCulKURi0IwA qD+0CmCDlQVcnSRaiSs7O5Xkvix8eNOmImHqPN1WYGJgI3gWscBtiMFwGu9+sLG2FJeQ LlPsQqSPW+h04h+AOPAAeL0G69kjS7bHGV3qIMFZQXIR+7DniSsYucchaNoEdPscXhyb pHVJWnHYe4tS4I4B+3LPFt4Ltu8l1yrWNyUtn6bnjVj+qRFs9zD+0ysYqV0Sc6CAEHBE fwKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=eeHeASbf; 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 v10-20020a63610a000000b0050bf24ecd08si1413609pgb.688.2023.03.16.03.32.15; Thu, 16 Mar 2023 03:32:30 -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=eeHeASbf; 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 S229733AbjCPKP3 (ORCPT + 99 others); Thu, 16 Mar 2023 06:15:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229454AbjCPKPH (ORCPT ); Thu, 16 Mar 2023 06:15:07 -0400 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE0B0BDF2 for ; Thu, 16 Mar 2023 03:15:04 -0700 (PDT) X-UUID: 61f2fbbec3e311edbd2e61cc88cc8f98-20230316 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:Message-ID:Date:Subject:CC:To:From; bh=SIJTB2iw2ZKbVZypN9eh4Lmwq+P7EW/KvxfnNL94MRc=; b=eeHeASbfC77etrde7DA+MUitBUz4AhQT+i6P4ftH6QWPOLqQ98KaNFto29qQKpP0Y8n9lxjbtDy9G/4jFPil8L4c9557MwsIJBJuwOgSBGXaqlfKAMQxWng1xN7eWy1ezguQu9bid0mLikDBdXj9Q2n7U0BKf2lVnErL50mH2nA=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.21,REQID:98d48548-f0a5-4308-b904-9efd6eeb21ca,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:83295aa,CLOUDID:12a600f6-ddba-41c3-91d9-10eeade8eac7,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL: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: 61f2fbbec3e311edbd2e61cc88cc8f98-20230316 Received: from mtkmbs13n2.mediatek.inc [(172.21.101.108)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 183096444; Thu, 16 Mar 2023 18:14:48 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) 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; Thu, 16 Mar 2023 18:14:48 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.25 via Frontend Transport; Thu, 16 Mar 2023 18:14:47 +0800 From: Yong Wu To: Joerg Roedel , Will Deacon , Matthias Brugger CC: Robin Murphy , Krzysztof Kozlowski , Yong Wu , AngeloGioacchino Del Regno , , , Yunfei Wang , , , , Subject: [PATCH v3] iommu/mediatek: Set dma_mask for PGTABLE_PA_35_EN Date: Thu, 16 Mar 2023 18:14:45 +0800 Message-ID: <20230316101445.12443-1-yong.wu@mediatek.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,RDNS_NONE, SPF_HELO_PASS,SPF_PASS,UNPARSEABLE_RELAY autolearn=no 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?1760507331666801052?= X-GMAIL-MSGID: =?utf-8?q?1760520044884217683?= When we enable PGTABLE_PA_35_EN, the PA for pgtable may be 35bits. Thus add dma_mask for it. Fixes: 301c3ca12576 ("iommu/mediatek: Allow page table PA up to 35bit") Signed-off-by: Chengci.Xu Signed-off-by: Yong Wu Reviewed-by: AngeloGioacchino Del Regno --- v3: Sorry for a typo. Change from "if (!ret)" to "if (ret)". v2: Just move this out from mt8188 series. Nothing change. v1: https://lore.kernel.org/linux-mediatek/20230307080555.14399-3-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 d5a4955910ff..6a00ce208dc2 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -1258,6 +1258,14 @@ static int mtk_iommu_probe(struct platform_device *pdev) return PTR_ERR(data->bclk); } + if (MTK_IOMMU_HAS_FLAG(data->plat_data, PGTABLE_PA_35_EN)) { + ret = dma_set_mask(dev, DMA_BIT_MASK(35)); + if (ret) { + dev_err(dev, "Failed to set dma_mask 35.\n"); + return ret; + } + } + pm_runtime_enable(dev); if (MTK_IOMMU_IS_TYPE(data->plat_data, MTK_IOMMU_TYPE_MM)) {