From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50C22C433E0 for ; Mon, 18 Jan 2021 16:19:36 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1A8E920715 for ; Mon, 18 Jan 2021 16:19:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1A8E920715 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=wHJTGcqwaNETQqxqjWLZgWlUPu5mc7IOBlrXIBndqJs=; b=yc6ZDiCbWRc4uB3ANiL9ooyhD diC6VQH3t+OxmGrKJCFyRKtI/xa4Ob2MTe0pzG2C0lBNkLco+vbQOV/9r4WXMfOsqBnlfRhAbOXqh nnx4v7vTKG/XPgaAz5QcduNJ7ox3pCQzylVc6Qno7LU7pVXAe1ATzERimsiR9OEGxt5YHvwyzS1YA bGI9ryR2LqIweFNG4WIpKhHV30iwJicroMnPtSGSmCW0I90UdxjTqilRcQ8YfiuOfnh6ctbrAXOZ8 ISwqcVushYgowyM045j4XwCmwzzeIprYQMteRKp51/Ny57sCKC32wE0GyOo0ZUvCNQmndJLTfVNd2 SmBEqD2Cw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l1XEJ-0003ap-71; Mon, 18 Jan 2021 16:18:11 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l1XEG-0003Zn-Ot; Mon, 18 Jan 2021 16:18:09 +0000 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 5CF3C31B; Mon, 18 Jan 2021 08:18:07 -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 E86073F68F; Mon, 18 Jan 2021 08:18:04 -0800 (PST) Subject: Re: [PATCH v3 5/7] iommu: Allow io_pgtable_tlb ops optional To: Yong Wu , Joerg Roedel , Will Deacon References: <20201216103607.23050-1-yong.wu@mediatek.com> <20201216103607.23050-6-yong.wu@mediatek.com> From: Robin Murphy Message-ID: <310cc809-ac74-7048-8718-c65c815a1faa@arm.com> Date: Mon, 18 Jan 2021 16:18:05 +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: <20201216103607.23050-6-yong.wu@mediatek.com> Content-Language: en-GB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210118_111808_871740_E5440865 X-CRM114-Status: GOOD ( 17.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 , 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 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2020-12-16 10:36, Yong Wu wrote: > This patch allows io_pgtable_tlb ops could be null since the IOMMU drivers > may use the tlb ops from iommu framework. There's not much in it, but I guess this does make more sense overall than just making .tlb_flush_all optional and drivers having to provide a full set of NULL callbacks. Reviewed-by: Robin Murphy > Signed-off-by: Yong Wu > --- > include/linux/io-pgtable.h | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/include/linux/io-pgtable.h b/include/linux/io-pgtable.h > index adde9e49be08..c81796814afa 100644 > --- a/include/linux/io-pgtable.h > +++ b/include/linux/io-pgtable.h > @@ -206,14 +206,16 @@ struct io_pgtable { > > static inline void io_pgtable_tlb_flush_all(struct io_pgtable *iop) > { > - iop->cfg.tlb->tlb_flush_all(iop->cookie); > + if (iop->cfg.tlb && iop->cfg.tlb->tlb_flush_all) > + iop->cfg.tlb->tlb_flush_all(iop->cookie); > } > > static inline void > io_pgtable_tlb_flush_walk(struct io_pgtable *iop, unsigned long iova, > size_t size, size_t granule) > { > - iop->cfg.tlb->tlb_flush_walk(iova, size, granule, iop->cookie); > + if (iop->cfg.tlb && iop->cfg.tlb->tlb_flush_walk) > + iop->cfg.tlb->tlb_flush_walk(iova, size, granule, iop->cookie); > } > > static inline void > @@ -221,7 +223,7 @@ io_pgtable_tlb_add_page(struct io_pgtable *iop, > struct iommu_iotlb_gather * gather, unsigned long iova, > size_t granule) > { > - if (iop->cfg.tlb->tlb_add_page) > + if (iop->cfg.tlb && iop->cfg.tlb->tlb_add_page) > iop->cfg.tlb->tlb_add_page(gather, iova, granule, iop->cookie); > } > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel