diff options
-rw-r--r-- | arch/x86/kernel/pci-dma.c | 8 | ||||
-rw-r--r-- | include/asm-x86/iommu.h | 2 | ||||
-rw-r--r-- | include/linux/iommu-helper.h | 1 | ||||
-rw-r--r-- | lib/iommu-helper.c | 8 |
4 files changed, 10 insertions, 9 deletions
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c index 8dbffb846de9..87d4d6964ec2 100644 --- a/arch/x86/kernel/pci-dma.c +++ b/arch/x86/kernel/pci-dma.c | |||
@@ -123,6 +123,14 @@ void __init pci_iommu_alloc(void) | |||
123 | 123 | ||
124 | pci_swiotlb_init(); | 124 | pci_swiotlb_init(); |
125 | } | 125 | } |
126 | |||
127 | unsigned long iommu_num_pages(unsigned long addr, unsigned long len) | ||
128 | { | ||
129 | unsigned long size = roundup((addr & ~PAGE_MASK) + len, PAGE_SIZE); | ||
130 | |||
131 | return size >> PAGE_SHIFT; | ||
132 | } | ||
133 | EXPORT_SYMBOL(iommu_num_pages); | ||
126 | #endif | 134 | #endif |
127 | 135 | ||
128 | /* | 136 | /* |
diff --git a/include/asm-x86/iommu.h b/include/asm-x86/iommu.h index ecc8061904a9..5f888cc5be49 100644 --- a/include/asm-x86/iommu.h +++ b/include/asm-x86/iommu.h | |||
@@ -7,6 +7,8 @@ extern struct dma_mapping_ops nommu_dma_ops; | |||
7 | extern int force_iommu, no_iommu; | 7 | extern int force_iommu, no_iommu; |
8 | extern int iommu_detected; | 8 | extern int iommu_detected; |
9 | 9 | ||
10 | extern unsigned long iommu_num_pages(unsigned long addr, unsigned long len); | ||
11 | |||
10 | #ifdef CONFIG_GART_IOMMU | 12 | #ifdef CONFIG_GART_IOMMU |
11 | extern int gart_iommu_aperture; | 13 | extern int gart_iommu_aperture; |
12 | extern int gart_iommu_aperture_allowed; | 14 | extern int gart_iommu_aperture_allowed; |
diff --git a/include/linux/iommu-helper.h b/include/linux/iommu-helper.h index f8598f583944..c975caf75385 100644 --- a/include/linux/iommu-helper.h +++ b/include/linux/iommu-helper.h | |||
@@ -8,4 +8,3 @@ extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size, | |||
8 | unsigned long align_mask); | 8 | unsigned long align_mask); |
9 | extern void iommu_area_free(unsigned long *map, unsigned long start, | 9 | extern void iommu_area_free(unsigned long *map, unsigned long start, |
10 | unsigned int nr); | 10 | unsigned int nr); |
11 | extern unsigned long iommu_num_pages(unsigned long addr, unsigned long len); | ||
diff --git a/lib/iommu-helper.c b/lib/iommu-helper.c index 889ddce2021e..a3b8d4c3f77a 100644 --- a/lib/iommu-helper.c +++ b/lib/iommu-helper.c | |||
@@ -80,11 +80,3 @@ void iommu_area_free(unsigned long *map, unsigned long start, unsigned int nr) | |||
80 | } | 80 | } |
81 | } | 81 | } |
82 | EXPORT_SYMBOL(iommu_area_free); | 82 | EXPORT_SYMBOL(iommu_area_free); |
83 | |||
84 | unsigned long iommu_num_pages(unsigned long addr, unsigned long len) | ||
85 | { | ||
86 | unsigned long size = roundup((addr & ~PAGE_MASK) + len, PAGE_SIZE); | ||
87 | |||
88 | return size >> PAGE_SHIFT; | ||
89 | } | ||
90 | EXPORT_SYMBOL(iommu_num_pages); | ||