The ->tlb_add_flush() callback in the io-pgtable API now looks a bit silly: - It takes a size and a granule, which are always the same - It takes a 'bool leaf', which is always true - It only ever flushes a single page With that in mind, replace it with an optional ->tlb_add_page() callback that drops the useless parameters.
Showing the changes to include/linux (1 of 10 files). Show all
Unified · Split
| @@ -25,12 +25,11 @@ enum io_pgtable_fmt { · 24 unmodified lines | ||
| 25 | 25 | * address range. |
| 26 | 26 | * @tlb_flush_leaf: Synchronously invalidate all leaf TLB state for a virtual |
| 27 | 27 | * address range. |
| 28 | − * @tlb_add_flush: Optional callback to queue up leaf TLB invalidation for a | |
| 29 | − * virtual address range. This function exists purely as an | |
| 30 | − * optimisation for IOMMUs that cannot batch TLB invalidation | |
| 31 | − * operations efficiently and are therefore better suited to | |
| 32 | − * issuing them early rather than deferring them until | |
| 33 | − * iommu_tlb_sync(). | |
| 28 | + * @tlb_add_page: Optional callback to queue up leaf TLB invalidation for a | |
| 29 | + * single page. This function exists purely as an optimisation | |
| 30 | + * for IOMMUs that cannot batch TLB invalidation operations | |
| 31 | + * efficiently and are therefore better suited to issuing them | |
| 32 | + * early rather than deferring them until iommu_tlb_sync(). | |
| 34 | 33 | * @tlb_sync: Ensure any queued TLB invalidation has taken effect, and |
| 35 | 34 | * any corresponding page table updates are visible to the |
| 36 | 35 | * IOMMU. |
| @@ -44,8 +43,7 @@ struct iommu_flush_ops { · 7 unmodified lines | ||
| 44 | 43 | void *cookie); |
| 45 | 44 | void (*tlb_flush_leaf)(unsigned long iova, size_t size, size_t granule, |
| 46 | 45 | void *cookie); |
| 47 | − void (*tlb_add_flush)(unsigned long iova, size_t size, size_t granule, | |
| 48 | − bool leaf, void *cookie); | |
| 46 | + void (*tlb_add_page)(unsigned long iova, size_t granule, void *cookie); | |
| 49 | 47 | void (*tlb_sync)(void *cookie); |
| 50 | 48 | }; |
| 51 | 49 | |
| @@ -212,10 +210,12 @@ io_pgtable_tlb_flush_leaf(struct io_pgtable *iop, unsigned long iova, · 160 unmodified lines | ||
| 212 | 210 | iop->cfg.tlb->tlb_flush_leaf(iova, size, granule, iop->cookie); |
| 213 | 211 | } |
| 214 | 212 | |
| 215 | −static inline void io_pgtable_tlb_add_flush(struct io_pgtable *iop, | |
| 216 | − unsigned long iova, size_t size, size_t granule, bool leaf) | |
| 213 | +static inline void | |
| 214 | +io_pgtable_tlb_add_page(struct io_pgtable *iop, unsigned long iova, | |
| 215 | + size_t granule) | |
| 217 | 216 | { |
| 218 | − iop->cfg.tlb->tlb_add_flush(iova, size, granule, leaf, iop->cookie); | |
| 217 | + if (iop->cfg.tlb->tlb_add_page) | |
| 218 | + iop->cfg.tlb->tlb_add_page(iova, granule, iop->cookie); | |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | static inline void io_pgtable_tlb_sync(struct io_pgtable *iop) |