Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4902684pxv; Tue, 29 Jun 2021 19:38:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7myFu06Oidi7Cb7xlI7bwO1W4M/s6g2v2/3BBWKT0rLl02FcSY2b/AH+NdWmzZEUfxlGZ X-Received: by 2002:a17:906:ae42:: with SMTP id lf2mr29256702ejb.325.1625020712447; Tue, 29 Jun 2021 19:38:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625020712; cv=none; d=google.com; s=arc-20160816; b=ynPyh9Y/eJcSMBgNV9IcCworrgQVwPLTwx2AO8EU6z8OuJ/zmiN5vdRf0ciN7TL1gZ AncYmXDEIwO4b7z/1bwvcdGYVqXBm6ClICL8ik+mPny6Y+By0ASP9RNN/GESpEM2mKhq K/uxEHwcHivKvjxQQ8NdC/IUXqktn+2gs4/YkT5vxQj/hDckr4iA4R6+/M3SXcT+gNlc vbkmPH6t10jeYgtNkJX9gxYpCFmc47xWyABZDt2W7GrTPFlMoSLsRmnGG1oKRmDj6B8n xeznlg8kFKtvPA5IXWC+twsgF85SVgA+Hw7hYFRfJxaYSs6dTDP6BBbJmuTAbASMYP2e xjIQ== 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=ogT3+HNFUEQtBnbkvV8M22Bly6vzFWvWOzKbuqGTOEg=; b=qw3UYTPhuDIb+8Qfl0mmqB9+IzJfTml8qX26nKbE4oxQTpTE7GkM33qF+etY8rwkJ7 ADBsSthUpCJg/dMB3loc+xgn1drCfWZyxWvVhBaOrxnaEH3YUL6MvFZDl46Uw3M09Qr+ G1n40mPh9TNYjoiBVKyoBBD2jHN0n/GPBnlOOCSsCTMsVfrrTZCKA8GajDDlnZF5ctPR zcsdAttJf9aUMt6K/f6kJjzTFt697LL6I2tyE/4UzA5ZUb2LJl2jBuug8DxhrNnJMkWo IVM6h+N8foNmehHfDtHSkoV5TDx+EK5HhiZWOyYjJw00pTwgwBmQno2yM0osP+fdpdYs r77A== 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 5si18480574ejl.332.2021.06.29.19.38.09; Tue, 29 Jun 2021 19:38:32 -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 S233071AbhF3Ci5 (ORCPT + 99 others); Tue, 29 Jun 2021 22:38:57 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:34332 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S233014AbhF3Ci5 (ORCPT ); Tue, 29 Jun 2021 22:38:57 -0400 X-UUID: da1d11cc0dd543538bfc0cd9d22b515d-20210630 X-UUID: da1d11cc0dd543538bfc0cd9d22b515d-20210630 Received: from mtkmbs10n2.mediatek.inc [(172.21.101.183)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 405164280; Wed, 30 Jun 2021 10:36:26 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 30 Jun 2021 10:36:25 +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; Wed, 30 Jun 2021 10:36:23 +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 08/24] iommu/mediatek: Remove for_each_m4u in tlb_sync_all Date: Wed, 30 Jun 2021 10:34:48 +0800 Message-ID: <20210630023504.18177-9-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210630023504.18177-1-yong.wu@mediatek.com> References: <20210630023504.18177-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 only is called in a) flush_iotlb_all: it will called for each iommu HW. b) tlb_flush_range_sync: it already has for_each_m4u. c) in irq: it has already fail. no need for_each_m4u to flush thus, No need for_each_m4u in this tlb_sync_all. This patch 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 7fe9ebd879fe..ed3455b5cef0 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -208,19 +208,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