aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2008-03-13 15:32:40 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-03-13 16:11:43 -0400
commitfd28841d2d0b1468b03288b331692769ad024b5e (patch)
tree1f06dcbe26d0ae74dec4f9e442eabb883f2a43f7 /arch
parent9efda797d60adbbe77aaf33cda0dfee161ac712c (diff)
alpha: use iommu_is_span_boundary helper function
iommu_is_span_boundary in lib/iommu-helper.c was exported for PARISC IOMMUs (commit 3715863aa142c4f4c5208f5f3e5e9bac06006d2f). Alpha's IOMMU can use it. This removes the check on the boundary size alignment because iommu_is_span_boundary does. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Cc: Richard Henderson <rth@twiddle.net> Acked-by: Ivan Kokshaysky <ink@jurassic.park.msu.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/Kconfig3
-rw-r--r--arch/alpha/kernel/pci_iommu.c12
2 files changed, 5 insertions, 10 deletions
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 002703b8c0b0..729cdbdf8036 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -330,6 +330,9 @@ config PCI_DOMAINS
330config PCI_SYSCALL 330config PCI_SYSCALL
331 def_bool PCI 331 def_bool PCI
332 332
333config IOMMU_HELPER
334 def_bool PCI
335
333config ALPHA_CORE_AGP 336config ALPHA_CORE_AGP
334 bool 337 bool
335 depends on ALPHA_GENERIC || ALPHA_TITAN || ALPHA_MARVEL 338 depends on ALPHA_GENERIC || ALPHA_TITAN || ALPHA_MARVEL
diff --git a/arch/alpha/kernel/pci_iommu.c b/arch/alpha/kernel/pci_iommu.c
index e07a23fc5b74..4e1c08636edd 100644
--- a/arch/alpha/kernel/pci_iommu.c
+++ b/arch/alpha/kernel/pci_iommu.c
@@ -10,6 +10,7 @@
10#include <linux/scatterlist.h> 10#include <linux/scatterlist.h>
11#include <linux/log2.h> 11#include <linux/log2.h>
12#include <linux/dma-mapping.h> 12#include <linux/dma-mapping.h>
13#include <linux/iommu-helper.h>
13 14
14#include <asm/io.h> 15#include <asm/io.h>
15#include <asm/hwrpb.h> 16#include <asm/hwrpb.h>
@@ -125,14 +126,6 @@ iommu_arena_new(struct pci_controller *hose, dma_addr_t base,
125 return iommu_arena_new_node(0, hose, base, window_size, align); 126 return iommu_arena_new_node(0, hose, base, window_size, align);
126} 127}
127 128
128static inline int is_span_boundary(unsigned int index, unsigned int nr,
129 unsigned long shift,
130 unsigned long boundary_size)
131{
132 shift = (shift + index) & (boundary_size - 1);
133 return shift + nr > boundary_size;
134}
135
136/* Must be called with the arena lock held */ 129/* Must be called with the arena lock held */
137static long 130static long
138iommu_arena_find_pages(struct device *dev, struct pci_iommu_arena *arena, 131iommu_arena_find_pages(struct device *dev, struct pci_iommu_arena *arena,
@@ -147,7 +140,6 @@ iommu_arena_find_pages(struct device *dev, struct pci_iommu_arena *arena,
147 base = arena->dma_base >> PAGE_SHIFT; 140 base = arena->dma_base >> PAGE_SHIFT;
148 if (dev) { 141 if (dev) {
149 boundary_size = dma_get_seg_boundary(dev) + 1; 142 boundary_size = dma_get_seg_boundary(dev) + 1;
150 BUG_ON(!is_power_of_2(boundary_size));
151 boundary_size >>= PAGE_SHIFT; 143 boundary_size >>= PAGE_SHIFT;
152 } else { 144 } else {
153 boundary_size = 1UL << (32 - PAGE_SHIFT); 145 boundary_size = 1UL << (32 - PAGE_SHIFT);
@@ -161,7 +153,7 @@ iommu_arena_find_pages(struct device *dev, struct pci_iommu_arena *arena,
161 153
162again: 154again:
163 while (i < n && p+i < nent) { 155 while (i < n && p+i < nent) {
164 if (!i && is_span_boundary(p, n, base, boundary_size)) { 156 if (!i && iommu_is_span_boundary(p, n, base, boundary_size)) {
165 p = ALIGN(p + 1, mask + 1); 157 p = ALIGN(p + 1, mask + 1);
166 goto again; 158 goto again;
167 } 159 }