From patchwork Tue Mar 7 08:05:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yong Wu X-Patchwork-Id: 65323 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2309204wrd; Tue, 7 Mar 2023 00:19:20 -0800 (PST) X-Google-Smtp-Source: AK7set/PRRmiTJEBXiVbkefU2VLmlIN8AAjLDi9o356FW2nL8o4B3JUdWl8DhlpzTnpurR98Wveu X-Received: by 2002:a05:6a20:cc5f:b0:cc:3da8:63a7 with SMTP id hq31-20020a056a20cc5f00b000cc3da863a7mr11404239pzb.44.1678177160028; Tue, 07 Mar 2023 00:19:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678177160; cv=none; d=google.com; s=arc-20160816; b=AdRyl/TNpAhHuABzjczCjEEA3kgokJVQqc6Z3HR94nkF94cR7gRelu3HQ0d2Of2Y1u G7AzveisOKfokEs/ElA9T6Ax4usNhrRA062KjCSq7bekzxC06SMaJlMZdtd1ybsVn5/I tT/iy7lXQDFjiW0PtLuOumnjolV8hjr+0wOoasmqcEMdnPhWijWDYcVr5tVYmpI7NggN oB0gD1+Gm4pM09v1kbovR3WavSsfsomS9ITRbaiBfxAwADtqXJjWuwnO9VTjZi0v9EiK K7DZfq52aMXBX23tx+75NwlZr9P8guwFZE9GE2dWDnuWR25L+YGgkW6Luhjbj2eCVpjD F1DQ== 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=FjBHmRxprSsiUmoCbFbBZKR1yp9tOMy5ZFNVKi6vHHk=; b=0ZBDj5Oh48+VKq2oxBzUcZPytK6NGNY4Ft1aC/nbBpMHhbycgRipjL6kopaLGoJ4rH tjMJidrqMMYRtOqUtrwkttdjWPxRV+rUJHsIS4E4dK5HrW9ZPtZm8omRFvnkj9mtESYg S3itE3GTEO9ZRSQiWfxfGVVLDFRBjWjBcbKj/zDH3/nUzQeNnBEx28qa08IUzcSjC577 a3IPQBcR/9KEWjwui1Hvo2DVvWhgKHZCum98rKuUdFiSxuXstSch3d4BoQ50VqXANB58 D0tFFxpkpvlJkRaNDBJ3ffXyya+kVnUhjBOiTxA051xHRwJrxj9YacOOFgJMc8uAi0Mh CxsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=HtsjVDOS; 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 201-20020a6307d2000000b004ff6f80f6c4si11789799pgh.285.2023.03.07.00.19.06; Tue, 07 Mar 2023 00:19:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=HtsjVDOS; 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 S229850AbjCGIHG (ORCPT + 99 others); Tue, 7 Mar 2023 03:07:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229840AbjCGIHE (ORCPT ); Tue, 7 Mar 2023 03:07:04 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FF3388EF5; Tue, 7 Mar 2023 00:06:50 -0800 (PST) X-UUID: 00081338bcbf11ed945fc101203acc17-20230307 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=FjBHmRxprSsiUmoCbFbBZKR1yp9tOMy5ZFNVKi6vHHk=; b=HtsjVDOSETWvVL1umkJSl4ewU1wQIRTAQ0boY1QyhZFz9SGA0dTDwafM/1DJSabrhv0cTw9yuw4nTGBqJ0HcyAc1Kj65YHc2yGtBwtqqc4MMMPGE1WSsbNMxYm3vbMJKxzQ7058D9olfS4/HZ4XdAglgkdSWaLqtjB2tGMZwDnE=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.20,REQID:507ed4bf-048f-4f93-98a9-fa8c85cc9ea2,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:25b5999,CLOUDID:0e7774b2-beed-4dfc-bd9c-e1b22fa6ccc4,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0 X-CID-BVR: 0,NGT X-UUID: 00081338bcbf11ed945fc101203acc17-20230307 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 1072675638; Tue, 07 Mar 2023 16:06:44 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.25; Tue, 7 Mar 2023 16:06:42 +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; Tue, 7 Mar 2023 16:06:42 +0800 From: Yong Wu To: Joerg Roedel , Will Deacon , Rob Herring , Matthias Brugger CC: Robin Murphy , Krzysztof Kozlowski , Yong Wu , AngeloGioacchino Del Regno , , , , , , , , , , Subject: [PATCH v8 2/7] iommu/mediatek: Set dma_mask for PGTABLE_PA_35_EN Date: Tue, 7 Mar 2023 16:05:50 +0800 Message-ID: <20230307080555.14399-3-yong.wu@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230307080555.14399-1-yong.wu@mediatek.com> References: <20230307080555.14399-1-yong.wu@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759696293648570389?= X-GMAIL-MSGID: =?utf-8?q?1759696293648570389?= 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 --- 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 e0264d5f1c9a..f2716896fee4 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -1297,6 +1297,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)) {