mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
iommu: add iommu_num_pages helper function
Calculating the number of pages from given address and length numbers is a task required in multiple IOMMU implementations. So implement this as a generic function into the IOMMU helper code. Signed-off-by: Joerg Roedel <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: FUJITA Tomonori <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
This commit is contained in:
parent
024e8ac044
commit
3bc9f79ee1
2 changed files with 9 additions and 0 deletions
|
|
@ -80,3 +80,11 @@ 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 size = roundup((addr & ~PAGE_MASK) + len, PAGE_SIZE);
|
||||
|
||||
return size >> PAGE_SHIFT;
|
||||
}
|
||||
EXPORT_SYMBOL(iommu_num_pages);
|
||||
|
|
|
|||
Loading…
Reference in a new issue