mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 03:36:19 +00:00
introduce generic iommu_num_pages function
This patch introduces the generic iommu_num_pages function. It can be used by a given memory area. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Richard Henderson <rth@twiddle.net> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Ingo Molnar <mingo@elte.hu> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Cc: Muli Ben-Yehuda <muli@il.ibm.com> Cc: Dave Airlie <airlied@linux.ie> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
3400001c53
commit
56d9366074
2 changed files with 12 additions and 0 deletions
|
@ -23,4 +23,7 @@ extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size,
|
||||||
extern void iommu_area_free(unsigned long *map, unsigned long start,
|
extern void iommu_area_free(unsigned long *map, unsigned long start,
|
||||||
unsigned int nr);
|
unsigned int nr);
|
||||||
|
|
||||||
|
extern unsigned long iommu_num_pages(unsigned long addr, unsigned long len,
|
||||||
|
unsigned long io_page_size);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -79,3 +79,12 @@ void iommu_area_free(unsigned long *map, unsigned long start, unsigned int nr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(iommu_area_free);
|
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);
|
||||||
|
|
Loading…
Reference in a new issue