Skip to content

Commit ca073b5

Browse files
Isaac J. Manjarresjoergroedel
authored andcommitted
iommu/io-pgtable: Introduce map_pages() as a page table op
Mapping memory into io-pgtables follows the same semantics that unmapping memory used to follow (i.e. a buffer will be mapped one page block per call to the io-pgtable code). This means that it can be optimized in the same way that unmapping memory was, so add a map_pages() callback to the io-pgtable ops structure, so that a range of pages of the same size can be mapped within the same call. Signed-off-by: Isaac J. Manjarres <[email protected]> Suggested-by: Will Deacon <[email protected]> Signed-off-by: Georgi Djakov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent cacffb7 commit ca073b5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

include/linux/io-pgtable.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ struct io_pgtable_cfg {
143143
* struct io_pgtable_ops - Page table manipulation API for IOMMU drivers.
144144
*
145145
* @map: Map a physically contiguous memory region.
146+
* @map_pages: Map a physically contiguous range of pages of the same size.
146147
* @unmap: Unmap a physically contiguous memory region.
147148
* @unmap_pages: Unmap a range of virtually contiguous pages of the same size.
148149
* @iova_to_phys: Translate iova to physical address.
@@ -153,6 +154,9 @@ struct io_pgtable_cfg {
153154
struct io_pgtable_ops {
154155
int (*map)(struct io_pgtable_ops *ops, unsigned long iova,
155156
phys_addr_t paddr, size_t size, int prot, gfp_t gfp);
157+
int (*map_pages)(struct io_pgtable_ops *ops, unsigned long iova,
158+
phys_addr_t paddr, size_t pgsize, size_t pgcount,
159+
int prot, gfp_t gfp, size_t *mapped);
156160
size_t (*unmap)(struct io_pgtable_ops *ops, unsigned long iova,
157161
size_t size, struct iommu_iotlb_gather *gather);
158162
size_t (*unmap_pages)(struct io_pgtable_ops *ops, unsigned long iova,

0 commit comments

Comments
 (0)