Received: by 2002:a05:6a10:8a4d:0:0:0:0 with SMTP id dn13csp528323pxb; Thu, 12 Aug 2021 23:57:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjDt9Wze/VBmM0Gyb/X5/XU9xI/WPCqipQ/QoHccVn0cBriTpr+0cUo9CErWsHmLMiARsx X-Received: by 2002:a05:6e02:1566:: with SMTP id k6mr800985ilu.112.1628837847399; Thu, 12 Aug 2021 23:57:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628837847; cv=none; d=google.com; s=arc-20160816; b=ezsIigK+1h68qioBQn2zbdtpCjnl0bVQa0eCgkXOE1khxpl4njJV6lOU4WnwRSD1XG fcoAkhpkghIY8H3nt4PG4DRmPVHXs/TCvraRzzlDW0QEvI9YsIQyEOiXotQ4WoBjdLks AF4Q7bNM6Sok/PNAxINZFZ9wm8EStEPpgZNKIgrz9p7xEA6Uuz+sYTViZ3lPDBbSSBfe eQa78g3yIEWg9F+SxDcKGpuqvxFVH+q8OZzAoPrNrbc1YbbgJ36kaZJnent2TZcgn4G0 RKh+H/alDVVdcXUcIvhAVijxLmjcHwxvjoDtw0EqlQvMNgD1ZY2utM52bMxn3JFnaZX5 f0tw== 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=cKg7nXu+HUYW4cxmNfcOFjFhVL8g43lrAOMH89Ic+uE=; b=Y8O76XXKBzQHOnJHU5xWAQHrtFm4NEUIjDbl/8ythkq0YizDUMtcgP+LcNzBEcez4c iA28dpyCTtL6AO97lNPQCMChYDKF/jpCycRedh2jq5AZ3LOikIN/6SqujDewWFcoV3jT mkCumAXzdiaSs/65SOgPILyH3CUQ0lPS4qDUq3FpA4sX3GiorU9JqMTj4YCxRDJT8zWB 4daiQehWxF8NfM6GgwN8QvUEQVwGwCbdiOj2bIbTeMPjOvc3nnJm7LyrEBXDoPlnITHS LgZh2Mb8A81LwFdrjzyUAx7TI+KL99JyHPxvazebh00bPoJA2I/1MNZnHyaM9qhsPB3B bQ7A== 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 v9si822503ilu.149.2021.08.12.23.57.17; Thu, 12 Aug 2021 23:57:27 -0700 (PDT) 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 S239071AbhHMGzO (ORCPT + 99 others); Fri, 13 Aug 2021 02:55:14 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:59478 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S239057AbhHMGzM (ORCPT ); Fri, 13 Aug 2021 02:55:12 -0400 X-UUID: 90841cd5836f4ed9b1eb1e92419fb548-20210813 X-UUID: 90841cd5836f4ed9b1eb1e92419fb548-20210813 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 361292937; Fri, 13 Aug 2021 14:54:42 +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; Fri, 13 Aug 2021 14:54:40 +0800 Received: from localhost.localdomain (10.17.3.154) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 13 Aug 2021 14:54:39 +0800 From: Yong Wu To: Joerg Roedel , Rob Herring , Matthias Brugger , Will Deacon , Robin Murphy CC: Krzysztof Kozlowski , Evan Green , Tomasz Figa , Tomasz Figa , , , , , , , , , Nicolas Boichat , , Subject: [PATCH v2 08/29] iommu/mediatek: Remove for_each_m4u in tlb_sync_all Date: Fri, 13 Aug 2021 14:53:03 +0800 Message-ID: <20210813065324.29220-9-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210813065324.29220-1-yong.wu@mediatek.com> References: <20210813065324.29220-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 The tlb_sync_all is called from these three functions: a) flush_iotlb_all: it will be called for each a iommu HW. b) tlb_flush_range_sync: it already has for_each_m4u. c) in irq: some IOMMU HW translation fault, Only need flush itself. Thus, No need for_each_m4u in this tlb_sync_all. Remove it. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index 175065b76509..1e18fff76e61 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -207,19 +207,15 @@ static struct mtk_iommu_domain *to_mtk_domain(struct iommu_domain *dom) static void mtk_iommu_tlb_flush_all(struct mtk_iommu_data *data) { - struct list_head *head = data->hw_list; - - for_each_m4u(data, head) { - if (pm_runtime_get_if_in_use(data->dev) <= 0) - continue; + if (pm_runtime_get_if_in_use(data->dev) <= 0) + return; - writel_relaxed(F_INVLD_EN1 | F_INVLD_EN0, - data->base + data->plat_data->inv_sel_reg); - writel_relaxed(F_ALL_INVLD, data->base + REG_MMU_INVALIDATE); - wmb(); /* Make sure the tlb flush all done */ + writel_relaxed(F_INVLD_EN1 | F_INVLD_EN0, + data->base + data->plat_data->inv_sel_reg); + writel_relaxed(F_ALL_INVLD, data->base + REG_MMU_INVALIDATE); + wmb(); /* Make sure the tlb flush all done */ - pm_runtime_put(data->dev); - } + pm_runtime_put(data->dev); } static void mtk_iommu_tlb_flush_range_sync(unsigned long iova, size_t size, -- 2.18.0