Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp264719pxu; Thu, 7 Jan 2021 04:33:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJwvtH2inBwfE4nWJRbTv/ogrqzlY7agciHBnGq0y44K1ff4TLAm+bzLqgFC1HPdDdDubDFO X-Received: by 2002:a17:906:5952:: with SMTP id g18mr5830198ejr.506.1610022818573; Thu, 07 Jan 2021 04:33:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610022818; cv=none; d=google.com; s=arc-20160816; b=RZHjk9kZDYAs2GyUCEGymNUTVc2MJoaO14671PF60LHPlJf0A1Y+F+fU/1AkIhGcw8 AIiVn/aWjJvesvmtu9ukN0fVnDrTc5T4LF08uYrF2KjRMIcTv0ayrB7wSMWdZNGwkgh0 td+5BnUs4rKwLHePyq8l5jjKuBqe/tnDQM23qLvfeZ6fmB8naXFF8q2lQ5j6SpZVxsgg IJU2LT+fn34sdKSrsCpDQLmZbN56vUOP+Bq7QJ1dn2z6bYiEswyooPMZGBW0vCDzQ1jl fNHLfoGxV/fUr3Ejo0HQXYdAqqpDRHlk+0ake+kQaOa49PsCPkTe7XWDwLVEWwjt2730 qVcw== 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=yjYZu4XM9pZp8bb9PQtEHZHZDhpsZKfo2Mxw9pB8ADo=; b=ShkrueoKeEuKC0svQBuZtJI4LQtANqoqCcE0L2OL3QU3vjieSszhtM4d8umexCGbhP E0+jifr9e8rm9y3qMm+9WAowyiR1kAXRgW1WwXJiHIzL+D5f4t6N4yUTHfmPpWNWpmt6 6zRoKFxMn+lkol+SqzqX60Cgwpv6Dd5Y6X97RpDhn4KldSH5khosm5liel/a7AWo1/Wr lTvsQbYzN+TwPwAw0rnmtpwu0RFmDDBJKk1hDpgc2Ge5APCuXVBeJUL3iVQaDRlxZEdl j9NhKuqpguiGSQiG0E2kO0ilPsAom7H6FxKjY4bPepwPo6bkNLITfgrlBp8KwWhserqs /Exg== 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 c6si2213714ejr.727.2021.01.07.04.33.15; Thu, 07 Jan 2021 04:33:38 -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 S1728247AbhAGMbA (ORCPT + 99 others); Thu, 7 Jan 2021 07:31:00 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:57299 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728223AbhAGMa5 (ORCPT ); Thu, 7 Jan 2021 07:30:57 -0500 X-UUID: 553a4b6a982248ce9fd2525244d4dcc4-20210107 X-UUID: 553a4b6a982248ce9fd2525244d4dcc4-20210107 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 285571440; Thu, 07 Jan 2021 20:30:35 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 7 Jan 2021 20:30:33 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 7 Jan 2021 20:30:32 +0800 From: Yong Wu To: Joerg Roedel , Will Deacon , Robin Murphy CC: Matthias Brugger , Krzysztof Kozlowski , Tomasz Figa , , , , , , , , Nicolas Boichat , , , Greg Kroah-Hartman , , Christoph Hellwig , David Laight Subject: [PATCH v4 7/7] iommu/mediatek: Remove the tlb-ops for v7s Date: Thu, 7 Jan 2021 20:29:09 +0800 Message-ID: <20210107122909.16317-8-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210107122909.16317-1-yong.wu@mediatek.com> References: <20210107122909.16317-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 Until now, we have already used the tlb operations from iommu framework, then the tlb operations for v7s can be removed. Correspondingly, Switch the paramenter "cookie" to the internal structure. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index d3b8a1649093..86ab577c9520 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -182,10 +182,8 @@ static struct mtk_iommu_domain *to_mtk_domain(struct iommu_domain *dom) return container_of(dom, struct mtk_iommu_domain, domain); } -static void mtk_iommu_tlb_flush_all(void *cookie) +static void mtk_iommu_tlb_flush_all(struct mtk_iommu_data *data) { - struct mtk_iommu_data *data = cookie; - for_each_m4u(data) { writel_relaxed(F_INVLD_EN1 | F_INVLD_EN0, data->base + data->plat_data->inv_sel_reg); @@ -195,9 +193,9 @@ static void mtk_iommu_tlb_flush_all(void *cookie) } static void mtk_iommu_tlb_flush_range_sync(unsigned long iova, size_t size, - size_t granule, void *cookie) + size_t granule, + struct mtk_iommu_data *data) { - struct mtk_iommu_data *data = cookie; unsigned long flags; int ret; u32 tmp; @@ -219,7 +217,7 @@ static void mtk_iommu_tlb_flush_range_sync(unsigned long iova, size_t size, if (ret) { dev_warn(data->dev, "Partial TLB flush timed out, falling back to full flush\n"); - mtk_iommu_tlb_flush_all(cookie); + mtk_iommu_tlb_flush_all(data); } /* Clear the CPE status */ writel_relaxed(0, data->base + REG_MMU_CPE_DONE); @@ -227,22 +225,6 @@ static void mtk_iommu_tlb_flush_range_sync(unsigned long iova, size_t size, } } -static void mtk_iommu_tlb_flush_page_nosync(struct iommu_iotlb_gather *gather, - unsigned long iova, size_t granule, - void *cookie) -{ - struct mtk_iommu_data *data = cookie; - struct iommu_domain *domain = &data->m4u_dom->domain; - - iommu_iotlb_gather_add_page(domain, gather, iova, granule); -} - -static const struct iommu_flush_ops mtk_iommu_flush_ops = { - .tlb_flush_all = mtk_iommu_tlb_flush_all, - .tlb_flush_walk = mtk_iommu_tlb_flush_range_sync, - .tlb_add_page = mtk_iommu_tlb_flush_page_nosync, -}; - static irqreturn_t mtk_iommu_isr(int irq, void *dev_id) { struct mtk_iommu_data *data = dev_id; @@ -326,7 +308,6 @@ static int mtk_iommu_domain_finalise(struct mtk_iommu_domain *dom) .pgsize_bitmap = mtk_iommu_ops.pgsize_bitmap, .ias = 32, .oas = 34, - .tlb = &mtk_iommu_flush_ops, .iommu_dev = data->dev, }; -- 2.18.0