Skip to content

Commit 910c440

Browse files
Isaac J. Manjarresjoergroedel
authored andcommitted
iommu: Add a map_pages() op for IOMMU drivers
Add a callback for IOMMU drivers to provide a path for the IOMMU framework to call into an IOMMU driver, which can call into the io-pgtable code, to map a physically contiguous rnage of pages of the same size. For IOMMU drivers that do not specify a map_pages() callback, the existing logic of mapping memory one page block at a time will be used. Signed-off-by: Isaac J. Manjarres <[email protected]> Suggested-by: Will Deacon <[email protected]> Acked-by: Lu Baolu <[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 ca073b5 commit 910c440

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

include/linux/iommu.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ struct iommu_iotlb_gather {
180180
* @attach_dev: attach device to an iommu domain
181181
* @detach_dev: detach device from an iommu domain
182182
* @map: map a physically contiguous memory region to an iommu domain
183+
* @map_pages: map a physically contiguous set of pages of the same size to
184+
* an iommu domain.
183185
* @unmap: unmap a physically contiguous memory region from an iommu domain
184186
* @unmap_pages: unmap a number of pages of the same size from an iommu domain
185187
* @flush_iotlb_all: Synchronously flush all hardware TLBs for this domain
@@ -230,6 +232,9 @@ struct iommu_ops {
230232
void (*detach_dev)(struct iommu_domain *domain, struct device *dev);
231233
int (*map)(struct iommu_domain *domain, unsigned long iova,
232234
phys_addr_t paddr, size_t size, int prot, gfp_t gfp);
235+
int (*map_pages)(struct iommu_domain *domain, unsigned long iova,
236+
phys_addr_t paddr, size_t pgsize, size_t pgcount,
237+
int prot, gfp_t gfp, size_t *mapped);
233238
size_t (*unmap)(struct iommu_domain *domain, unsigned long iova,
234239
size_t size, struct iommu_iotlb_gather *iotlb_gather);
235240
size_t (*unmap_pages)(struct iommu_domain *domain, unsigned long iova,

0 commit comments

Comments
 (0)