diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/iommu-helper.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/iommu-helper.c b/lib/iommu-helper.c index 5d90074dca7..75dbda03f4f 100644 --- a/lib/iommu-helper.c +++ b/lib/iommu-helper.c @@ -79,3 +79,12 @@ void iommu_area_free(unsigned long *map, unsigned long start, unsigned int nr) } } EXPORT_SYMBOL(iommu_area_free); + +unsigned long iommu_num_pages(unsigned long addr, unsigned long len, + unsigned long io_page_size) +{ + unsigned long size = (addr & (io_page_size - 1)) + len; + + return DIV_ROUND_UP(size, io_page_size); +} +EXPORT_SYMBOL(iommu_num_pages); |