mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
iommu: export iommu_is_span_boundary helper function
iommu_is_span_boundary is used internally in the IOMMU helper (lib/iommu-helper.c), a primitive function that judges whether a memory area spans LLD's segment boundary or not. It's difficult to convert some IOMMUs to use the IOMMU helper but iommu_is_span_boundary is still useful for them. So this patch exports it. This is needed for the parisc iommu fixes. Signed-off-by: FUJITA Tomonori <[email protected]> Cc: Kyle McMartin <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: Grant Grundler <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
7eb701dc77
commit
3715863aa1
2 changed files with 9 additions and 4 deletions
|
|
@ -40,10 +40,12 @@ static inline void set_bit_area(unsigned long *map, unsigned long i,
|
|||
}
|
||||
}
|
||||
|
||||
static inline int is_span_boundary(unsigned int index, unsigned int nr,
|
||||
unsigned long shift,
|
||||
unsigned long boundary_size)
|
||||
int iommu_is_span_boundary(unsigned int index, unsigned int nr,
|
||||
unsigned long shift,
|
||||
unsigned long boundary_size)
|
||||
{
|
||||
BUG_ON(!is_power_of_2(boundary_size));
|
||||
|
||||
shift = (shift + index) & (boundary_size - 1);
|
||||
return shift + nr > boundary_size;
|
||||
}
|
||||
|
|
@ -57,7 +59,7 @@ unsigned long iommu_area_alloc(unsigned long *map, unsigned long size,
|
|||
again:
|
||||
index = find_next_zero_area(map, size, start, nr, align_mask);
|
||||
if (index != -1) {
|
||||
if (is_span_boundary(index, nr, shift, boundary_size)) {
|
||||
if (iommu_is_span_boundary(index, nr, shift, boundary_size)) {
|
||||
/* we could do more effectively */
|
||||
start = index + 1;
|
||||
goto again;
|
||||
|
|
|
|||
Loading…
Reference in a new issue