Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp321591pxb; Wed, 11 Nov 2020 04:44:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJwmjNECy8okQ9KRPPnUqhlF1K6S+fq8F2qi/la8zeA2cssEaGzN673qBVPTIArx48TDoiLE X-Received: by 2002:a17:906:7a11:: with SMTP id d17mr21426595ejo.153.1605098650992; Wed, 11 Nov 2020 04:44:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605098650; cv=none; d=google.com; s=arc-20160816; b=qWvsdnmxNaaDXTbUEEbG03o1licu+wGWUK6zMykTCdmTyFh8lyaGh86NWBPrsq9mYt ugs8hZSR7HP31lGEGsEVmR1M1mDCIhMZlbtjiWtzOxSgLYMaXibabNIGuCd9IwaXbuai Lxwm5P1DmufhpFV9gw2d7nbDzYySl2slh+0+Vy3ODmcKIu++BJHU0duYl1qVijiEySA5 CTuYwO6V2F1Ksl4n3oUZB+ouE+oqkQyowmP13ZPphd1ogbBrigZstkN8umC46BqvujJO mlbirAe8zozVUHxKtD/HjFFbpHl03gSd5CHdFIA1/vG/5BY0nTZ9SdaJiRIxuiW0vIOz EQxw== 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=mPYTc+WIL8UeS/3bMdMaYS/slR1NCzZIuR9DuoK9/xo=; b=T+yGuM2NTv/RCgveVKDtHHCFmpBQAPksOkBNpIDIakjmFJ8bgZCJGheDhYzMcwCq2Q Q+KLQ/aPhjwPu/Y72LY0vcaVPiIrBHo13Z/P4fp+1WuJ8FRrxxzDE38G47FgNU4OlvRq 6kocRBPNrLRPqZS5H5nwziEEgqMZDfQWe7R60Q4cMovSppqtqG8yl2Hx0c4iIFbMASCy gb88r8AmLpJvF94u2OXRy7SkDVy2I4OgqAFNdgmetHrBPa5MFoBca2YKfA15z8GRylnm RUd6P7nKMtjEk/lomasnLGjjqFrTfKENWho1M0uuLDyS8bOHI1/J98knUsWn8pti1FEx 8tDA== 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 i25si1231223ejy.626.2020.11.11.04.43.46; Wed, 11 Nov 2020 04:44:10 -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 S1726938AbgKKMla (ORCPT + 99 others); Wed, 11 Nov 2020 07:41:30 -0500 Received: from mailgw01.mediatek.com ([210.61.82.183]:34893 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726923AbgKKMl2 (ORCPT ); Wed, 11 Nov 2020 07:41:28 -0500 X-UUID: bc8fa4358de34e7cb2a9b8c141056f49-20201111 X-UUID: bc8fa4358de34e7cb2a9b8c141056f49-20201111 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] 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 31783035; Wed, 11 Nov 2020 20:41:25 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 11 Nov 2020 20:41:22 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 11 Nov 2020 20:41:21 +0800 From: Yong Wu To: Joerg Roedel , Matthias Brugger , Rob Herring , Will Deacon , Robin Murphy CC: Krzysztof Kozlowski , Evan Green , Tomasz Figa , , , , , , , , , Nicolas Boichat , , , Greg Kroah-Hartman , Subject: [PATCH v4 17/24] iommu/mediatek: Add single domain Date: Wed, 11 Nov 2020 20:38:31 +0800 Message-ID: <20201111123838.15682-18-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20201111123838.15682-1-yong.wu@mediatek.com> References: <20201111123838.15682-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 Defaultly the iova range is 0-4G. here we add a single-domain(0-4G) for the previous SoC. this also is a preparing patch for supporting multi-domains. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index bf3f4e0f4748..a7727a3899d1 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -161,6 +161,10 @@ struct mtk_iommu_iova_region { unsigned long long size; }; +static const struct mtk_iommu_iova_region single_domain[] = { + {.iova_base = 0, .size = SZ_4G}, +}; + /* * There may be 1 or 2 M4U HWs, But we always expect they are in the same domain * for the performance. @@ -922,6 +926,8 @@ static const struct mtk_iommu_plat_data mt2712_data = { .m4u_plat = M4U_MT2712, .flags = HAS_4GB_MODE | HAS_BCLK | HAS_VLD_PA_RNG, .inv_sel_reg = REG_MMU_INV_SEL_GEN1, + .iova_region = single_domain, + .iova_region_nr = ARRAY_SIZE(single_domain), .larbid_remap = {{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}}, }; @@ -929,6 +935,8 @@ static const struct mtk_iommu_plat_data mt6779_data = { .m4u_plat = M4U_MT6779, .flags = HAS_SUB_COMM | OUT_ORDER_WR_EN | WR_THROT_EN, .inv_sel_reg = REG_MMU_INV_SEL_GEN2, + .iova_region = single_domain, + .iova_region_nr = ARRAY_SIZE(single_domain), .larbid_remap = {{0}, {1}, {2}, {3}, {5}, {7, 8}, {10}, {9}}, }; @@ -944,6 +952,8 @@ static const struct mtk_iommu_plat_data mt8173_data = { .flags = HAS_4GB_MODE | HAS_BCLK | RESET_AXI | HAS_LEGACY_IVRP_PADDR, .inv_sel_reg = REG_MMU_INV_SEL_GEN1, + .iova_region = single_domain, + .iova_region_nr = ARRAY_SIZE(single_domain), .larbid_remap = {{0}, {1}, {2}, {3}, {4}, {5}}, /* Linear mapping. */ }; @@ -951,6 +961,8 @@ static const struct mtk_iommu_plat_data mt8183_data = { .m4u_plat = M4U_MT8183, .flags = RESET_AXI, .inv_sel_reg = REG_MMU_INV_SEL_GEN1, + .iova_region = single_domain, + .iova_region_nr = ARRAY_SIZE(single_domain), .larbid_remap = {{0}, {4}, {5}, {6}, {7}, {2}, {3}, {1}}, }; -- 2.18.0