Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2189345pxb; Mon, 11 Jan 2021 03:26:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJzlSQWwCvBIkKzbxPNVk2htWW2DuHtWEyW5xUsvyBb0Bbirh5fMSUViHuU9n8DTT/arkmv8 X-Received: by 2002:a17:906:cd06:: with SMTP id oz6mr10565624ejb.25.1610364412140; Mon, 11 Jan 2021 03:26:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610364412; cv=none; d=google.com; s=arc-20160816; b=h12PT3efg/qVfTtjxAOMjY5Kcu/nAeak4RttxKQqvQNajKBxaRFOs37zAjDcyw1JBi Hx6dx5Z1I6KTAWOrc8VvaMgmFHkvdHNBVJBoqNbNJgbjeKl/9h39SBZ1Pfft2Vtl0S5G 4x13fv8AKTQTvp0854dwrNUwSQL2vnAL7rtUemkkoZFGN2rDURy1ghO/othSFtf66Gx3 PjTcbgvNm4mhoVFk0N7IZJwxzJxi5q/lKIXOtU+91nipcoMnHAoPAcgHZRdMuayaffPS agXNAqRsLT3Skc2IE1ivZcMtaA3zl0PK+iqRrGU115ytUkrBAy1/7Kv4xKTo1CfxIXEY hO9w== 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=yPnp23nSDANvJHLVvmAF0Sje+8v9DFBVdO45GhIqYII=; b=edjW+FAZ6ZbMLGJTWCcNpFgLlbZGHra9NcA30xzuQvG6WKqr9+MSt25qYJzJnFzCbG 4SyCoHqLIT6L4gCiHwTDUrZjPuFt4Aqx4mbD1+sH6cWgQgORFTWrtnkq2W+ThLuzjqp5 fubV5bTqogqkzSVuscova0mUCX45d82BDYoY+VGp9tzl6L7uP9zdn6Kx9wnF4JpuMgX3 TmB5Ze1FWfXLiNQAlWYkahhbzUJ9Xkczf9s9zRuUIWC6/xr3S2+Ha+tHGUNHKB3jlAWL RyPp3xK6OYXOTSjrUz8q6y4jQr7eJ7/XYypvNDM80LzLj8MfmTqGGoY5k4GU9Iza0NHD DqOA== 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 i23si5519661ejj.531.2021.01.11.03.26.28; Mon, 11 Jan 2021 03:26:52 -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 S1730022AbhAKLYK (ORCPT + 99 others); Mon, 11 Jan 2021 06:24:10 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:46628 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1730018AbhAKLYH (ORCPT ); Mon, 11 Jan 2021 06:24:07 -0500 X-UUID: 2684e0b424714e63a0a9a492f75671d0-20210111 X-UUID: 2684e0b424714e63a0a9a492f75671d0-20210111 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] 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 549006637; Mon, 11 Jan 2021 19:23:22 +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:23:21 +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:23:20 +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 25/33] iommu/mediatek: Move geometry.aperture updating into domain_finalise Date: Mon, 11 Jan 2021 19:19:06 +0800 Message-ID: <20210111111914.22211-26-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 Move the domain geometry.aperture updating into domain_finalise. This is a preparing patch for updating the domain region. We know the detailed iova region in the attach_device. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index d321d09ac4c2..309b06d5e1f9 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -353,6 +353,10 @@ static int mtk_iommu_domain_finalise(struct mtk_iommu_domain *dom, /* Update our support page sizes bitmap */ dom->domain.pgsize_bitmap = dom->cfg.pgsize_bitmap; + + dom->domain.geometry.aperture_start = 0; + dom->domain.geometry.aperture_end = DMA_BIT_MASK(32); + dom->domain.geometry.force_aperture = true; return 0; } @@ -372,9 +376,6 @@ static struct iommu_domain *mtk_iommu_domain_alloc(unsigned type) return NULL; } - dom->domain.geometry.aperture_start = 0; - dom->domain.geometry.aperture_end = DMA_BIT_MASK(32); - dom->domain.geometry.force_aperture = true; return &dom->domain; } -- 2.18.0