Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp5623520pxu; Wed, 23 Dec 2020 00:55:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJw+9QO3Hsi/qE+e67fgTS3fZIPuCezlpCk3WbB+1T84r74B0hdmqFrQDaqWOfYeZYbBUs8G X-Received: by 2002:a17:906:aacd:: with SMTP id kt13mr22905042ejb.527.1608713712916; Wed, 23 Dec 2020 00:55:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608713712; cv=none; d=google.com; s=arc-20160816; b=FHOXe55rX4DXJp5GqNfVxZQ56efIvxXSR5JlihNno/FZwtqyNfA0yRpD3E6S+Om2Zn +qBZR372aLB7dQKgPrCG6UyRvfecAj+wTXX25kBiW4SEZGU47Uh6QZjtRCGS3Vy+bA+D 4qwDn+BpvQ1QEHk9lQWYRJWoViVE4SwhqCoap3MmyNN4cRjDFJoWQkDr7jHMg8j4NZG1 nuIGi3t/oMHWz7zl75M7EKod0EEnks7Z38D5VoBAYCqQwvwofkl6POcQLu+n4iQZh8bv gHHRqbdysyLGy79XaDgB7iZ9UbTBGocxsAxv2y5a8F31eLxalYEvubAoV7x9ekylhoEQ NMGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=3mzr93rw3bP5ndgOkj2J3rKWLzLdUR7cBci5P56NY/A=; b=WTq7gExdvbThxk28eBCXP89gjewGNMbMzpqeOQ503gSfifDhxVz7lhWzBQI49tCYZf mph5MWH644JZZOcmAOaFaPO9DdRmezb1IjZN5vOWfi+lq9unefFD4j6ApaQIowM67vBX OpyI9Rs/6QWc6DkWAEKsFywN7Itz2nodcpc0/caJ6PshV7/u7EDGZQ+CCQQEZE10U46N UPNszZKOHq6IU37CzQ3sBmExs7F0D0aYd5uKhuACaCrgZYklVLxbB7liAorgCo3UUdHZ gG1PUYID0Ee/I123pQ1zmaB2SPw2AEwyY/A8lRwYOpuvACDMOXNCCESX2DJeykpjL9Dp SZEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=e7DvOMVG; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o11si11951632ejg.118.2020.12.23.00.54.48; Wed, 23 Dec 2020 00:55:12 -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; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=e7DvOMVG; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727940AbgLWIwr (ORCPT + 99 others); Wed, 23 Dec 2020 03:52:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727050AbgLWIwq (ORCPT ); Wed, 23 Dec 2020 03:52:46 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6675CC0613D3 for ; Wed, 23 Dec 2020 00:52:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=3mzr93rw3bP5ndgOkj2J3rKWLzLdUR7cBci5P56NY/A=; b=e7DvOMVGT/z24nyz8RevO5TNuL WdyEBLPTXKZhnYQ2+JVThOyNcxf1W5KmTwA5W+HXZ8RE0mSTFAIkiLI0qGI4zRULn4wEHAusY5Vbe D24ApPSkSgchloP395V8Td00Gs/g6HoEYWoOCASf4iAdUL3iFj2TNNS33xKjYQM6AaQA/TOVozKYh 1sDh3FDP4ocjoCLt1zgYr+7Khy+s/SqFXCFz4AQ2Ur0gzSqXXjkBfokXBTz1QUm1C1hgs0V+bSlqw PBsf/QGD/O0JyNCf9CiaF68I94p3AU25XOkvlee4xZxdJq3JNylV8r+FV5TvU99JNFVaeGRyMp2C4 W6+6dNow==; Received: from hch by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1krzs9-0008Rh-6Z; Wed, 23 Dec 2020 08:51:53 +0000 Date: Wed, 23 Dec 2020 08:51:53 +0000 From: Christoph Hellwig To: Yong Wu Cc: Joerg Roedel , Will Deacon , Robin Murphy , 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 , Tomasz Figa , iommu@lists.linux-foundation.org, linux-mediatek@lists.infradead.org, Matthias Brugger , Greg Kroah-Hartman , kernel-team@android.com, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v3 1/7] iommu: Move iotlb_sync_map out from __iommu_map Message-ID: <20201223085153.GA30643@infradead.org> References: <20201216103607.23050-1-yong.wu@mediatek.com> <20201216103607.23050-2-yong.wu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201216103607.23050-2-yong.wu@mediatek.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 16, 2020 at 06:36:01PM +0800, Yong Wu wrote: > In the end of __iommu_map, It alway call iotlb_sync_map. > This patch moves iotlb_sync_map out from __iommu_map since it is > unnecessary to call this for each sg segment especially iotlb_sync_map > is flush tlb all currently. > > Signed-off-by: Yong Wu > Reviewed-by: Robin Murphy What about adding a little helper that does the NULL check and method call instead of duplicating it all over?