From 5e2a1b8a763d573391a45f03035b31acfcb6ec7c Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Tue, 4 Mar 2008 14:29:27 -0800 Subject: [PATCH] --- yaml --- r: 86837 b: refs/heads/master c: 3715863aa142c4f4c5208f5f3e5e9bac06006d2f h: refs/heads/master i: 86835: fcacaa99024bbcde920e393d4de1c370751245be v: v3 --- [refs] | 2 +- trunk/include/linux/iommu-helper.h | 3 +++ trunk/lib/iommu-helper.c | 10 ++++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/[refs] b/[refs] index d7e3e3e00882..3ceadd452d6f 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 7eb701dc7779794d46e02a7fa1380289cb730d46 +refs/heads/master: 3715863aa142c4f4c5208f5f3e5e9bac06006d2f diff --git a/trunk/include/linux/iommu-helper.h b/trunk/include/linux/iommu-helper.h index 4dd4c04ff2f4..c975caf75385 100644 --- a/trunk/include/linux/iommu-helper.h +++ b/trunk/include/linux/iommu-helper.h @@ -1,3 +1,6 @@ +extern int iommu_is_span_boundary(unsigned int index, unsigned int nr, + unsigned long shift, + unsigned long boundary_size); extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size, unsigned long start, unsigned int nr, unsigned long shift, diff --git a/trunk/lib/iommu-helper.c b/trunk/lib/iommu-helper.c index 495575a59ca6..a3b8d4c3f77a 100644 --- a/trunk/lib/iommu-helper.c +++ b/trunk/lib/iommu-helper.c @@ -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;