Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4590913ybp; Mon, 14 Oct 2019 07:06:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqxSKDZZSEa1Fx/sGMm72xgs+lpQ5n8bED0f0JGQB7phVkWpYlYuZWTrKhGJMHA6eT6fAl3b X-Received: by 2002:a17:906:b2d3:: with SMTP id cf19mr28986380ejb.118.1571061985803; Mon, 14 Oct 2019 07:06:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571061985; cv=none; d=google.com; s=arc-20160816; b=JariRsFBbqbNyXOGhMq1Y8OqKnEJ6GART1tfHoOJP+qELvrBw3zn5KnLsie0VaaVnk 33w2ugph91c+iiTsmnhU01bFmSLPbfh3JwrvQdeuNWj9Hk+I8akBATAQ1p8t1DDgY1DQ IIJDQ270sCwDU3oMeUT8ugXQM4+hY42XtcZP8ONHU77RjmZD8LIisHk8FiABV0UQAu14 fmv4JoUQCXwd1MLgY09i+1JU0Fh4gkhUHdU4T3XPhSwsIaDL4GIoR/k7kQvqBUfjYQRT InuNslKJQYC8AMGQCzQTYBfFeRTvdLdqegzhGwSXSbfL1tnlP7CH/XNU6wJepo8SzhK6 CKkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=xu2etKh35INqTwe3+C1cuowrfTkXSgih91Yfs34qw/8=; b=UTxYOlVdp4KE0/KJinaKcNQfTjK8WMNJ3l0317H9tq2tFdyfV7O3V9gxFuxt9UA6AL Y6o4a4W1IL/jYYBB1vkwxX4G+HBHQ1NNdLZeoKMDuC4KqWnzD3tirDNv1Em7q45WqONF n+HS4dKgAwcw+LjBn8LfEyltpuBZTlXQoaBJyWDSZRcF6K0F1xnlg222Iyx3k1PTkG7M yk8Ox+fMWQAWITJqPZLgABZlHEqTwaMBMiDGeHPlGlbzrnkChgyesQqhTFC4apf5BESK 5HWIyGyfKLjQ5Fr1uxqW2LAu9ReZIIf0exsneATUg9P5b96KgIzL7YMrTBh8VHlOGh3s NZGw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h12si10518946ejj.40.2019.10.14.07.06.00; Mon, 14 Oct 2019 07:06:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732457AbfJNOEr (ORCPT + 99 others); Mon, 14 Oct 2019 10:04:47 -0400 Received: from foss.arm.com ([217.140.110.172]:44988 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732121AbfJNOEr (ORCPT ); Mon, 14 Oct 2019 10:04:47 -0400 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 83EDF337; Mon, 14 Oct 2019 07:04:46 -0700 (PDT) Received: from [10.1.197.57] (e110467-lin.cambridge.arm.com [10.1.197.57]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 22A513F68E; Mon, 14 Oct 2019 07:04:43 -0700 (PDT) Subject: Re: [PATCH v3 6/7] iommu/mediatek: Use writel for TLB range invalidation To: Yong Wu , Matthias Brugger , Joerg Roedel , Will Deacon Cc: Evan Green , Tomasz Figa , linux-mediatek@lists.infradead.org, srv_heupstream@mediatek.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, youlin.pei@mediatek.com, Nicolas Boichat , anan.sun@mediatek.com, cui.zhang@mediatek.com, chao.hao@mediatek.com, edison.hsieh@mediatek.com References: <1571035101-4213-1-git-send-email-yong.wu@mediatek.com> <1571035101-4213-7-git-send-email-yong.wu@mediatek.com> From: Robin Murphy Message-ID: Date: Mon, 14 Oct 2019 15:04:42 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <1571035101-4213-7-git-send-email-yong.wu@mediatek.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 14/10/2019 07:38, Yong Wu wrote: > Use writel for the register F_MMU_INV_RANGE which is for triggering the > HW work. We expect all the setting(iova_start/iova_end...) have already > been finished before F_MMU_INV_RANGE. For Arm CPUs, these registers should be mapped as Device memory, therefore the same-peripheral rule should implicitly enforce that the accesses are made in program order, hence you're unlikely to have seen a problem in reality. However, the logical reasoning for the change seems valid in general, so I'd argue that it's still worth making if only for the sake of good practice: Acked-by: Robin Murphy > Signed-off-by: Anan.Sun > Signed-off-by: Yong Wu > --- > drivers/iommu/mtk_iommu.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c > index dbbacc3..d285457 100644 > --- a/drivers/iommu/mtk_iommu.c > +++ b/drivers/iommu/mtk_iommu.c > @@ -187,8 +187,7 @@ static void mtk_iommu_tlb_flush_range_sync(unsigned long iova, size_t size, > writel_relaxed(iova, data->base + REG_MMU_INVLD_START_A); > writel_relaxed(iova + size - 1, > data->base + REG_MMU_INVLD_END_A); > - writel_relaxed(F_MMU_INV_RANGE, > - data->base + REG_MMU_INVALIDATE); > + writel(F_MMU_INV_RANGE, data->base + REG_MMU_INVALIDATE); > > /* tlb sync */ > ret = readl_poll_timeout_atomic(data->base + REG_MMU_CPE_DONE, >