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 | * address range. | 25 | * address range. |
| 26 | * @tlb_flush_leaf: Synchronously invalidate all leaf TLB state for a virtual | 26 | * @tlb_flush_leaf: Synchronously invalidate all leaf TLB state for a virtual |
| 27 | * address range. | 27 | * address range. |
| 28 | * @tlb_add_flush: Optional callback to queue up leaf TLB invalidation for a | 28 | * @tlb_add_page: Optional callback to queue up leaf TLB invalidation for a |
| 29 | * virtual address range. This function exists purely as an | 29 | * single page. This function exists purely as an optimisation |
| 30 | * optimisation for IOMMUs that cannot batch TLB invalidation | 30 | * for IOMMUs that cannot batch TLB invalidation operations |
| 31 | * operations efficiently and are therefore better suited to | 31 | * efficiently and are therefore better suited to issuing them |
| 32 | * issuing them early rather than deferring them until | 32 | * early rather than deferring them until iommu_tlb_sync(). |
| 33 | * iommu_tlb_sync(). | ||
| 34 | * @tlb_sync: Ensure any queued TLB invalidation has taken effect, and | 33 | * @tlb_sync: Ensure any queued TLB invalidation has taken effect, and |
| 35 | * any corresponding page table updates are visible to the | 34 | * any corresponding page table updates are visible to the |
| 36 | * IOMMU. | 35 | * IOMMU. |
| @@ -44,8 +43,7 @@ struct iommu_flush_ops { · 7 unmodified lines | |||
| 44 | void *cookie); | 43 | void *cookie); |
| 45 | void (*tlb_flush_leaf)(unsigned long iova, size_t size, size_t granule, | 44 | void (*tlb_flush_leaf)(unsigned long iova, size_t size, size_t granule, |
| 46 | void *cookie); | 45 | void *cookie); |
| 47 | void (*tlb_add_flush)(unsigned long iova, size_t size, size_t granule, | 46 | void (*tlb_add_page)(unsigned long iova, size_t granule, void *cookie); |
| 48 | bool leaf, void *cookie); | ||
| 49 | void (*tlb_sync)(void *cookie); | 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 | iop->cfg.tlb->tlb_flush_leaf(iova, size, granule, iop->cookie); | 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, | 213 | static inline void |
| 216 | unsigned long iova, size_t size, size_t granule, bool leaf) | 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 | static inline void io_pgtable_tlb_sync(struct io_pgtable *iop) | 221 | static inline void io_pgtable_tlb_sync(struct io_pgtable *iop) |