Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp502992pxb; Thu, 23 Sep 2021 05:04:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2cM+DDtNFdYMJvJBXl7+TpRFI4NISEjOa29zlgh2x4bSDaw4rOTM7adoNhUnkL7YW7zLy X-Received: by 2002:a50:e04e:: with SMTP id g14mr5117734edl.168.1632398686161; Thu, 23 Sep 2021 05:04:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632398686; cv=none; d=google.com; s=arc-20160816; b=iffmfUTJc/n2i+duuO8OAGUemSNcanGMX41qBf5+ftls73Azkirgq3afFN1uZwO6xn RKyV6t52pigru4pZgvYVpIG+0b/rSUBcYCBw91JPHfD9LsYAFP1GkMeqKcP0uojgJB7T eQ6Ni9AjeOO5WsKpRIFLCJv/kVo9+8mJBqiTgv0+JQ1vfunjY6KC+/FrLTU33ua+Hr7W Srzz3FL6WE4ZhBBNJaibfh1e/eU3atLBEtYyRwPHB3Wav5IQUu0D41ybAPQ1/WzudGAE iiaOMl34uAWyg2LMqe4TAUHBxPasaC9VgUdKZos3qvUZRWAFvhth4R44hTJkVZqHUBcT tjNg== 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=nBoVHuPqDbdm+ibrLf7Gc5cC1mi+kzHx2ZyjoaXJy60=; b=G65uI3gUCZUSMqYT+NNkjMyYZyr/ByEOdPrdZj3NfizuLWPBE91Mv21Lii8cAGHt2x l16JTQZ7QIBhKOWV8LUGX7Hl9fnLF/SaPF4+/AhicMMq5L/g3ZlZSXDXpn9TkdhDxrOU N9L0tFW4xwj5fGIjRvkkchyvzQukk+HGS8G5OjPHHgLkKmtomw3DWJw5qBComwLE8PfW bqQOkJS5X4m2L6Cj1cdyzULO4ZxIFhsZlux04VnVOUJs9jUV6dQZQY0v8k19sBd8xg+T OKUG+jiP3QdF58ABr3LSqKSKS7J2AgI0dOg/tNT6mYMN4lXg/iycFZ81gaRrDkwYMMgA 3LeQ== 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 r21si7144908ejo.665.2021.09.23.05.04.19; Thu, 23 Sep 2021 05:04:46 -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 S240775AbhIWMCH (ORCPT + 99 others); Thu, 23 Sep 2021 08:02:07 -0400 Received: from mailgw01.mediatek.com ([60.244.123.138]:50698 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S240808AbhIWMCE (ORCPT ); Thu, 23 Sep 2021 08:02:04 -0400 X-UUID: 9946125921834084ba84c4265b28f6bc-20210923 X-UUID: 9946125921834084ba84c4265b28f6bc-20210923 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1747031869; Thu, 23 Sep 2021 20:00:30 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 23 Sep 2021 20:00:28 +0800 Received: from localhost.localdomain (10.17.3.154) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 23 Sep 2021 20:00:27 +0800 From: Yong Wu To: Joerg Roedel , Rob Herring , Matthias Brugger , Will Deacon , Robin Murphy CC: Krzysztof Kozlowski , Tomasz Figa , , , , , , , Hsin-Yi Wang , , , , , Subject: [PATCH v3 09/33] iommu/mediatek: Remove for_each_m4u in tlb_sync_all Date: Thu, 23 Sep 2021 19:58:16 +0800 Message-ID: <20210923115840.17813-10-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210923115840.17813-1-yong.wu@mediatek.com> References: <20210923115840.17813-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: When 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 6f4f6624e3ac..0b4c30baa864 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -206,19 +206,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