Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2490370pxb; Mon, 18 Jan 2021 21:01:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJyWDi9h2/9Y7VOaY4I7CVilRIT8Iw2H+Q4wQ0MDz3yBU3dSO+IVkJOBot+SZc5/S1Xd2kC5 X-Received: by 2002:a05:6402:3585:: with SMTP id y5mr1944259edc.97.1611032474556; Mon, 18 Jan 2021 21:01:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611032474; cv=none; d=google.com; s=arc-20160816; b=j7xTdnntkAGmU3hIhWm8LDRMN9r8h3prnyXGCCip5go8yrUZTJF2ssZMmMoQskEEhk Wr4nnO+lm1J6yMmCiNAks2xbKaIfuI+2YfTN7FpDaodvMKoRQVIvXm9FOUIC/FzdwZzj aGSS2+6IH0SpG9lW3qABKOwhjpd/UJYCwCXVYqstaR8Hq1qWZsUEcEresjV9XQGDt07b 8GeyXcpBfFiSNEz+e4eGAf6aMkZ3U59m5W/vungm+e8eizqjjcgvFFlDkZ0bjqmULMEr hZRvefCGdspwUbpsCRYcf9CO8YotfiKhzhg2ipC/se4v2N6Pma65gWLpp4uZQ9S6KcMN okcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=OJvkkpz9qbFKOB1gHIqM16PoniNEfqfFFQcAcfEa5EY=; b=qc+pnifVm2BJnWuLT3XfVGqa0hbmKSWM3Um6HXugNL4f2mXQ3xg9CdKcda/uf5abGL 8fuQsg9R+atBfMGwWq3mg4l2Q7BLfZDzGIPgAFfzXOvsjX7RWrfX4htStaxxNM/yf1tD I/OjqZt0SkzVQOJdryBeyF0KoSbTjg5h95QgtepIpMYuMZXArcEiqnkNa/235gtiuAq2 CxeTouagxyhH5zGyhx5H4tS0SbBDXlhoXLfrVA6tTAGyHDKPThBqis7N3Wi94mNyr4e4 KFcK0dVaWjMXrOKKH1T6j+fIDmjvLuCpm0Pud/rYnNLJqceZOtPCUuXZxjh5DjqP0GWE 6Tbg== 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=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p17si5634221ejy.489.2021.01.18.21.00.51; Mon, 18 Jan 2021 21:01:14 -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=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393776AbhARStG (ORCPT + 99 others); Mon, 18 Jan 2021 13:49:06 -0500 Received: from foss.arm.com ([217.140.110.172]:42302 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436896AbhARSrd (ORCPT ); Mon, 18 Jan 2021 13:47:33 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 857F331B; Mon, 18 Jan 2021 10:46:47 -0800 (PST) Received: from [10.57.39.58] (unknown [10.57.39.58]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2C90F3F719; Mon, 18 Jan 2021 10:46:42 -0800 (PST) Subject: Re: [PATCH v4 7/7] iommu/mediatek: Remove the tlb-ops for v7s To: Yong Wu , Joerg Roedel , Will Deacon Cc: youlin.pei@mediatek.com, anan.sun@mediatek.com, Nicolas Boichat , srv_heupstream@mediatek.com, chao.hao@mediatek.com, linux-kernel@vger.kernel.org, Krzysztof Kozlowski , Christoph Hellwig , Tomasz Figa , iommu@lists.linux-foundation.org, David Laight , linux-mediatek@lists.infradead.org, Matthias Brugger , Greg Kroah-Hartman , kernel-team@android.com, linux-arm-kernel@lists.infradead.org References: <20210107122909.16317-1-yong.wu@mediatek.com> <20210107122909.16317-8-yong.wu@mediatek.com> From: Robin Murphy Message-ID: <520e2eab-7ee8-6bfd-4b98-f89ec2f9aaea@arm.com> Date: Mon, 18 Jan 2021 18:46:42 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <20210107122909.16317-8-yong.wu@mediatek.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-01-07 12:29, Yong Wu wrote: > 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. Reviewed-by: Robin Murphy > 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, > }; > >