Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2188251pxb; Mon, 11 Jan 2021 03:24:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJylcSbQPKK5G9GIrGjFFGvE/NkeZtDtlLVy2ZCh1GpBgAg82A11+9R2rTjPjidfEZwUB1xx X-Received: by 2002:a17:906:c45a:: with SMTP id ck26mr10575580ejb.200.1610364294797; Mon, 11 Jan 2021 03:24:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610364294; cv=none; d=google.com; s=arc-20160816; b=aipDftW47jXGL/Ts+m+XmE0CN3aZs0KbMnb8q6porYfV48X0onVJmicx7NZITbVThZ 2hIsi4Xkki2baKjZ8m02TPmcNVihV6F5bkiE0sKglXRBRIOMug8TmVl5+IRzaTjAflol gR38GfpRJ3aQs1gcv7bXFbHPuIgJTX3X9/yMrwJ3lJVwzHE9ULd2azDk22DfP4t9i1j7 zFGqsp72F9DgrPuQ+shgWa9IdApRks5sBTJlM0vOEjMFlhiASjmbKg8UFz1RRWU8Ywko BddPdrvAGx4NNuPuGjT2QGtvP9ePCZuuv2uu4MCVKU2xnekGeeTdfufMVEc85KuuYor+ TpHg== 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=/SldfP+PMnRJKgEHVkzr8LDZmrtZ46Y69zVLgQO/fAU=; b=ymcIVIg6VfkZ7ahVFHpQPnkKAXKJaAENoDETjzci/H7Vv6+9vYnXplR+EsXGME75qK RKR0zcNQIe/UVvXOMVumjHcGIGwNMU9AHOrQpcn+wrD2Mxqv551DpbnvSOauoGwIObyP YE+RqjIqiZsUUGPt6cQkpHtB6Lagmn3EPXrHmJ6TaEyb2jv1lh0ZoeawHf+kmCKmQr4U WMaq2jrx86e628hGoYqeD+Z5Rm5fZwjbRUAYkpmPz/IRBQcp/RoPzB0RBvuzyE8ja8FN uueZKh5EJAlAcdxH79xj1LiOGcQi0/Pvj0h+P86zizUzsQL677O79VdIb6oTe+pOOxgW 9apg== 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 ca4si6814676edb.559.2021.01.11.03.24.31; Mon, 11 Jan 2021 03:24:54 -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 S1729564AbhAKLWT (ORCPT + 99 others); Mon, 11 Jan 2021 06:22:19 -0500 Received: from mailgw01.mediatek.com ([210.61.82.183]:60030 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728305AbhAKLWQ (ORCPT ); Mon, 11 Jan 2021 06:22:16 -0500 X-UUID: ead796f87a234db98adcfa260547b4ab-20210111 X-UUID: ead796f87a234db98adcfa260547b4ab-20210111 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw01.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 1851271556; Mon, 11 Jan 2021 19:21:48 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 11 Jan 2021 19:21:46 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 11 Jan 2021 19:21:46 +0800 From: Yong Wu To: Joerg Roedel , Rob Herring , Matthias Brugger , Will Deacon , Robin Murphy CC: Krzysztof Kozlowski , Evan Green , Tomasz Figa , , , , , , , , , Nicolas Boichat , , Subject: [PATCH v6 14/33] iommu/mediatek: Add a flag for iova 34bits case Date: Mon, 11 Jan 2021 19:18:55 +0800 Message-ID: <20210111111914.22211-15-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210111111914.22211-1-yong.wu@mediatek.com> References: <20210111111914.22211-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 485f3b6d1a21..bf1277d58121 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)) @@ -299,7 +300,7 @@ static int mtk_iommu_domain_finalise(struct mtk_iommu_domain *dom) IO_PGTABLE_QUIRK_NO_PERMS | 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, .iommu_dev = data->dev, }; -- 2.18.0