Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3794730pxu; Wed, 9 Dec 2020 00:11:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJwF7fcuZmlIShnrCcOIzL39JzOlbVn2Mc+BiqOUxKsRP+6PFZVvBY95w6GmbL+hPTOi3wZ5 X-Received: by 2002:a50:f9cc:: with SMTP id a12mr875930edq.335.1607501476514; Wed, 09 Dec 2020 00:11:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607501476; cv=none; d=google.com; s=arc-20160816; b=cpc2XvyetzKxzqG7rO8Jufu5Ge3LYpVJJXEPT51IQu5ex9K45grJVlguMRnhJcqnqM 6KLKOLbCNtiy+4HgdZ2uRYWNwx3kEOeNsnKmCSdRRTW7jZ5fckfqdIvvRL2NvRsxNf17 FuOTrFeeEwwYXgJy2N+jZsOeGL+BVJLRvhwzOM1wrQ93Is48pFCnwAplAjrwaK6ygbBS cV7yINQcuTsk6cENFCUXO0tUuMDb/LzeZLbJxLi7scfWO6nVhArIaAc8KLpAZhmmQkku N0GdwKc4eZZsIXCNUil89O2/C5o5R0lq+wJGwF7GKEcoleGkLEWhU8nJuAeLwKdA7R2K 3vzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=xOV5EpavCZdHWoEN0FeyWseHcBsAdxpiUdmQBfdRYoA=; b=aSfEWtK03qIA0fNNoKIHMp085nJdqVk8bJp4SellXXRyc4OHnjSy0UykWHDV8PPlcC BlOgoXpvDvW0GAMrJLmi23LGZQwQenPgy9R3RC/nJes44LWg9d81FYfMnS8amlxVdBa6 BlcmipGSPYQV7gKGk3gf5hlULbQlrjTsXpLWybgnYs6Sua/VG3EuA72ES5v6/EV68eVp 8MOE2ps7xFqrqmBGz7OS2ffw6J37UhlW337P16Bjy8QnI9/Gf3JfBcZFYaaLtUvn/PF3 1FPSTckwn9IEgu5T6Wdqva/lDzuLkalFmGJyAe9xJ5S2mYnLiRsPrrkq9lFcoNa5ssv3 vxbA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l9si455387edi.199.2020.12.09.00.10.54; Wed, 09 Dec 2020 00:11:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727894AbgLIIEU (ORCPT + 99 others); Wed, 9 Dec 2020 03:04:20 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:46613 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728082AbgLIIEL (ORCPT ); Wed, 9 Dec 2020 03:04:11 -0500 X-UUID: 7fc7868c12544669b8eb792985ebb7f4-20201209 X-UUID: 7fc7868c12544669b8eb792985ebb7f4-20201209 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1390104510; Wed, 09 Dec 2020 16:03:26 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 9 Dec 2020 16:03:21 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 9 Dec 2020 16:03:24 +0800 From: Yong Wu To: Joerg Roedel , Matthias Brugger , Rob Herring , Will Deacon , Robin Murphy CC: Krzysztof Kozlowski , Evan Green , Tomasz Figa , , , , , , , , , Nicolas Boichat , , Subject: [PATCH v5 13/27] iommu/mediatek: Add a flag for iova_34 bit case Date: Wed, 9 Dec 2020 16:00:48 +0800 Message-ID: <20201209080102.26626-14-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20201209080102.26626-1-yong.wu@mediatek.com> References: <20201209080102.26626-1-yong.wu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a HW flag for if the HW support 34bit IOVA. the previous SoC still use 32bit. normally the lvl1 pgtable size is 16KB when ias == 32. if ias == 34, lvl1 pgtable size is 16KB * 4. The purpose of this patch is to save 16KB*3 continuous memory for the previous SoC. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index ec3c87d4b172..1bc5e881951c 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -112,6 +112,7 @@ #define HAS_SUB_COMM BIT(5) #define WR_THROT_EN BIT(6) #define HAS_LEGACY_IVRP_PADDR BIT(7) +#define IOVA_34_EN BIT(8) #define MTK_IOMMU_HAS_FLAG(pdata, _x) \ ((((pdata)->flags) & (_x)) == (_x)) @@ -319,7 +320,7 @@ static int mtk_iommu_domain_finalise(struct mtk_iommu_domain *dom) IO_PGTABLE_QUIRK_TLBI_ON_MAP | IO_PGTABLE_QUIRK_ARM_MTK_EXT, .pgsize_bitmap = mtk_iommu_ops.pgsize_bitmap, - .ias = 32, + .ias = MTK_IOMMU_HAS_FLAG(data->plat_data, IOVA_34_EN) ? 34 : 32, .oas = 35, .tlb = &mtk_iommu_flush_ops, .iommu_dev = data->dev, -- 2.18.0