diff options
author | Yong Wu <yong.wu@mediatek.com> | 2021-01-07 20:29:07 +0800 |
---|---|---|
committer | Will Deacon <will@kernel.org> | 2021-01-27 12:32:27 +0000 |
commit | 77e0992aee4e980e8c553e512a5dfa3e704cf030 (patch) | |
tree | 2178e719779169e6871d1e01474a5c74eac84d71 /include/linux/io-pgtable.h | |
parent | 862c3715de8f3e5350489240c951d697f04bd8c9 (diff) | |
download | lwn-77e0992aee4e980e8c553e512a5dfa3e704cf030.tar.gz lwn-77e0992aee4e980e8c553e512a5dfa3e704cf030.zip |
iommu/io-pgtable: Allow io_pgtable_tlb ops optional
This patch allows io_pgtable_tlb ops could be null since the IOMMU drivers
may use the tlb ops from iommu framework.
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Acked-by: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20210107122909.16317-6-yong.wu@mediatek.com
Signed-off-by: Will Deacon <will@kernel.org>
Diffstat (limited to 'include/linux/io-pgtable.h')
-rw-r--r-- | include/linux/io-pgtable.h | 8 |
1 files 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); } |