Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp694203pxu; Thu, 26 Nov 2020 09:14:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJzeYLQHaDvciPPsHHAfu0lyho7PKsWUvYxn+LfxmhGcPPEokStX0PaZo6OyDiLPIifMpDpu X-Received: by 2002:a05:6402:170e:: with SMTP id y14mr3616751edu.115.1606410860046; Thu, 26 Nov 2020 09:14:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606410860; cv=none; d=google.com; s=arc-20160816; b=ZPF7EPxm9R4iFE9hW+CHKZsmWwwAKdUS9DIK+q8D5yINDw66tHILSIrXn/xgcmnWmo +cEWNr9IWmQorrNk9oJhMhUKdFPNkJ/jHp1F04tZsX5Y0TIDPRea3/su7wibZBsZzfFN gEHl2OkNh+HOhV6x+BjnL75yjkUcbXjR8TQSwL32mDhoNV3CMm+hz2VyfM7cUP33fLNP ycciIyunl0uuKQIUYWVy3JBQW325S/e1OyGMCSo0Zu+9sf2dz9W8l58NTuhee0ju2s/G HaD+GF2rVr0z70MJ86SjA1e2SU5BCkHn/QNI1SJ0MIdzwjXgVIOZCeA7YH5mlW2JKAgO iAKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=byv/NE7q1gRzZZxNd5jOLDkkGtugMhTSkwh51Ri6CSg=; b=iaEIQXOj6qLJhozdGd3R766cGD3uVEnasQkffpIAQ5hO94kqyaJ5hjv4JaMkcMfGDw tFX5zhR73iLTFELX6Q7BXvO+XPwAWfL8Gay8h6dTYiLlUzW5VNN1uLRpRRAPZgP4M8RV tfHTNTHqzPQ05iR88L8SHuapM3RCPPxD41C0vglbwnMYxog8Lg5hja+vsAvq4XKNQSsM JAyGx49eDPjvnkYK7UWx/EQhPYL5ToHzqHJqPae0yGD1s2Cvn/Lzfag85ZbTPnxI9gTT uxpKxSCImz1Q5n5LAUdIHj8stnDLcm8SIYil8U02w8nxbyZinV2i7fHCPJx66rknOuc5 0Gag== 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=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d5si3502445ejr.394.2020.11.26.09.13.53; Thu, 26 Nov 2020 09:14:20 -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=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404387AbgKZRMH (ORCPT + 99 others); Thu, 26 Nov 2020 12:12:07 -0500 Received: from foss.arm.com ([217.140.110.172]:40684 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404379AbgKZRMG (ORCPT ); Thu, 26 Nov 2020 12:12:06 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1E7DB31B; Thu, 26 Nov 2020 09:12:06 -0800 (PST) Received: from [10.57.59.159] (unknown [10.57.59.159]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 472113F23F; Thu, 26 Nov 2020 09:12:02 -0800 (PST) Subject: Re: [PATCH v4 17/24] iommu/mediatek: Add single domain To: Yong Wu , Joerg Roedel , Matthias Brugger , Rob Herring , Will Deacon Cc: Krzysztof Kozlowski , Evan Green , Tomasz Figa , linux-mediatek@lists.infradead.org, srv_heupstream@mediatek.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, youlin.pei@mediatek.com, Nicolas Boichat , anan.sun@mediatek.com, chao.hao@mediatek.com, Greg Kroah-Hartman , kernel-team@android.com References: <20201111123838.15682-1-yong.wu@mediatek.com> <20201111123838.15682-18-yong.wu@mediatek.com> From: Robin Murphy Message-ID: <22e49f08-6d23-86cf-bb9c-79d54ce55beb@arm.com> Date: Thu, 26 Nov 2020 17:11:58 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <20201111123838.15682-18-yong.wu@mediatek.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-11-11 12:38, Yong Wu wrote: > 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}, > +}; Hang on, given how the previous patch works, surely this means you're now going to *reserve* the entire address space? That doesn't seem right... :/ Robin. > + > /* > * 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}}, > }; > >