[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <310cc809-ac74-7048-8718-c65c815a1faa@arm.com>
Date: Mon, 18 Jan 2021 16:18:05 +0000
From: Robin Murphy <robin.murphy@....com>
To: Yong Wu <yong.wu@...iatek.com>, Joerg Roedel <joro@...tes.org>,
Will Deacon <will@...nel.org>
Cc: Matthias Brugger <matthias.bgg@...il.com>,
Krzysztof Kozlowski <krzk@...nel.org>,
Tomasz Figa <tfiga@...gle.com>,
linux-mediatek@...ts.infradead.org, srv_heupstream@...iatek.com,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
iommu@...ts.linux-foundation.org, youlin.pei@...iatek.com,
Nicolas Boichat <drinkcat@...omium.org>, anan.sun@...iatek.com,
chao.hao@...iatek.com, Greg Kroah-Hartman <gregkh@...gle.com>,
kernel-team@...roid.com
Subject: Re: [PATCH v3 5/7] iommu: Allow io_pgtable_tlb ops optional
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 <robin.murphy@....com>
> Signed-off-by: Yong Wu <yong.wu@...iatek.com>
> ---
> 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);
> }
>
>
Powered by blists - more mailing lists