Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2490265pxb; Mon, 18 Jan 2021 21:01:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJyLGE9vHQQOu2jkuCu0Gv06+T7lqDTRGPvOIrNpzfv0ranTlTQxtHx6CaGnujaaot0HZvK7 X-Received: by 2002:aa7:c2c7:: with SMTP id m7mr1482173edp.134.1611032463230; Mon, 18 Jan 2021 21:01:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611032463; cv=none; d=google.com; s=arc-20160816; b=U9POMpi9dFlf+q2xqJxrxJKfnaMOAly/TDUt36ZpBvkKC3+uQR+wzB52ChFQLU5otD vETf0FcbM6wt5s2VCaGAtY4Ik9zy6A6wqUOn5ndQzzJT4i2fX1V619B8pU+MnYAy4MaL fjn5OFTzWqw6H5eVRN4zG9emjFfkxNkiRsTuzSg/sAMvJe2jA084HHiYlB0nrVrHqoXO JWJeDIRxXfiRDWIcpHwbpZUI5my4BQW2x7vEQ2tMy4dYbVNzfpXVFPFV6gusrbPxKQY3 lmypduDpY/fWVh99f6VVNX2AfPKNpf77dxHd+f1ZwipAvTI4o/5fCSmrv9frbym+C10A fEeQ== 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=/xl7sZLUlyIi5vOUP1SnItF/YsnN5jWzkqSBsKjEAk0=; b=AWwAAt/sGSsFTajuvq6J8GD2e6x0GuWEcbrVE9+4jUB5Bqgv1JNi6fmvlKx7bZAkFf 63GT43UYHxEEu5ly1X7TY8Rk5PLafMDPAQ4SdRwviecMDrw4IOURGeL1IAgdFI5kgWBq 3F+7x+YEYwhvE/JmTvWDPjRDFjuQ/YSwMAYa6kaUpd0ICPbVSAlozQaz2f2pEmS1TRUU +OaZcWy+bI74f9D5EQdNFcejZna5xzuU1GZQZ/QeMBeZs+GXLohL1SrGLnf9gAbfnjN9 ss8AHV4JRAOE90zx2TgRJKBGQCaqS2Naodi6Rs6V5MRLN2U2sV1CrtfgfAbrcmC1e6Ak 38Gw== 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 ze12si482731ejb.221.2021.01.18.21.00.40; Mon, 18 Jan 2021 21:01:03 -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 S2407464AbhARSr2 (ORCPT + 99 others); Mon, 18 Jan 2021 13:47:28 -0500 Received: from foss.arm.com ([217.140.110.172]:42198 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407540AbhARSnb (ORCPT ); Mon, 18 Jan 2021 13:43:31 -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 A6A17D6E; Mon, 18 Jan 2021 10:42:45 -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 3AF993F719; Mon, 18 Jan 2021 10:42:42 -0800 (PST) Subject: Re: [PATCH v4 5/7] iommu/io-pgtable: Allow io_pgtable_tlb ops optional To: Yong Wu , Joerg Roedel , Will Deacon Cc: Matthias Brugger , Krzysztof Kozlowski , 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, chao.hao@mediatek.com, Greg Kroah-Hartman , kernel-team@android.com, Christoph Hellwig , David Laight References: <20210107122909.16317-1-yong.wu@mediatek.com> <20210107122909.16317-6-yong.wu@mediatek.com> From: Robin Murphy Message-ID: <9b51058a-f636-e2b3-b5ee-0b48e4bccfc9@arm.com> Date: Mon, 18 Jan 2021 18:42: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-6-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: > This patch allows io_pgtable_tlb ops could be null since the IOMMU drivers > may use the tlb ops from iommu framework. For the reasons I gave on v3, 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 ea727eb1a1a9..2a5686ca2ba3 100644 > --- a/include/linux/io-pgtable.h > +++ b/include/linux/io-pgtable.h > @@ -214,14 +214,16 @@ struct io_pgtable_domain_attr { > > 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 > @@ -229,7 +231,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); > } > >