aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/parisc/ccio-dma.c8
-rw-r--r--drivers/parisc/iommu-helpers.h4
-rw-r--r--drivers/parisc/sba_iommu.c6
3 files changed, 8 insertions, 10 deletions
diff --git a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c
index 894fdb9d44c0..1459ca8fffc7 100644
--- a/drivers/parisc/ccio-dma.c
+++ b/drivers/parisc/ccio-dma.c
@@ -32,6 +32,7 @@
32*/ 32*/
33 33
34#include <linux/types.h> 34#include <linux/types.h>
35#include <linux/kernel.h>
35#include <linux/init.h> 36#include <linux/init.h>
36#include <linux/mm.h> 37#include <linux/mm.h>
37#include <linux/spinlock.h> 38#include <linux/spinlock.h>
@@ -292,7 +293,6 @@ static int ioc_count;
292#define PDIR_INDEX(iovp) ((iovp)>>IOVP_SHIFT) 293#define PDIR_INDEX(iovp) ((iovp)>>IOVP_SHIFT)
293#define MKIOVP(pdir_idx) ((long)(pdir_idx) << IOVP_SHIFT) 294#define MKIOVP(pdir_idx) ((long)(pdir_idx) << IOVP_SHIFT)
294#define MKIOVA(iovp,offset) (dma_addr_t)((long)iovp | (long)offset) 295#define MKIOVA(iovp,offset) (dma_addr_t)((long)iovp | (long)offset)
295#define ROUNDUP(x,y) ((x + ((y)-1)) & ~((y)-1))
296 296
297/* 297/*
298** Don't worry about the 150% average search length on a miss. 298** Don't worry about the 150% average search length on a miss.
@@ -668,7 +668,7 @@ ccio_mark_invalid(struct ioc *ioc, dma_addr_t iova, size_t byte_cnt)
668 size_t saved_byte_cnt; 668 size_t saved_byte_cnt;
669 669
670 /* round up to nearest page size */ 670 /* round up to nearest page size */
671 saved_byte_cnt = byte_cnt = ROUNDUP(byte_cnt, IOVP_SIZE); 671 saved_byte_cnt = byte_cnt = ALIGN(byte_cnt, IOVP_SIZE);
672 672
673 while(byte_cnt > 0) { 673 while(byte_cnt > 0) {
674 /* invalidate one page at a time */ 674 /* invalidate one page at a time */
@@ -751,7 +751,7 @@ ccio_map_single(struct device *dev, void *addr, size_t size,
751 offset = ((unsigned long) addr) & ~IOVP_MASK; 751 offset = ((unsigned long) addr) & ~IOVP_MASK;
752 752
753 /* round up to nearest IOVP_SIZE */ 753 /* round up to nearest IOVP_SIZE */
754 size = ROUNDUP(size + offset, IOVP_SIZE); 754 size = ALIGN(size + offset, IOVP_SIZE);
755 spin_lock_irqsave(&ioc->res_lock, flags); 755 spin_lock_irqsave(&ioc->res_lock, flags);
756 756
757#ifdef CCIO_MAP_STATS 757#ifdef CCIO_MAP_STATS
@@ -814,7 +814,7 @@ ccio_unmap_single(struct device *dev, dma_addr_t iova, size_t size,
814 814
815 iova ^= offset; /* clear offset bits */ 815 iova ^= offset; /* clear offset bits */
816 size += offset; 816 size += offset;
817 size = ROUNDUP(size, IOVP_SIZE); 817 size = ALIGN(size, IOVP_SIZE);
818 818
819 spin_lock_irqsave(&ioc->res_lock, flags); 819 spin_lock_irqsave(&ioc->res_lock, flags);
820 820
diff --git a/drivers/parisc/iommu-helpers.h b/drivers/parisc/iommu-helpers.h
index 38d9e1aba1d0..0a1f99a2e93e 100644
--- a/drivers/parisc/iommu-helpers.h
+++ b/drivers/parisc/iommu-helpers.h
@@ -138,7 +138,7 @@ iommu_coalesce_chunks(struct ioc *ioc, struct scatterlist *startsg, int nents,
138 ** exceed DMA_CHUNK_SIZE if we coalesce the 138 ** exceed DMA_CHUNK_SIZE if we coalesce the
139 ** next entry. 139 ** next entry.
140 */ 140 */
141 if(unlikely(ROUNDUP(dma_len + dma_offset + startsg->length, 141 if(unlikely(ALIGN(dma_len + dma_offset + startsg->length,
142 IOVP_SIZE) > DMA_CHUNK_SIZE)) 142 IOVP_SIZE) > DMA_CHUNK_SIZE))
143 break; 143 break;
144 144
@@ -158,7 +158,7 @@ iommu_coalesce_chunks(struct ioc *ioc, struct scatterlist *startsg, int nents,
158 ** Allocate space for DMA stream. 158 ** Allocate space for DMA stream.
159 */ 159 */
160 sg_dma_len(contig_sg) = dma_len; 160 sg_dma_len(contig_sg) = dma_len;
161 dma_len = ROUNDUP(dma_len + dma_offset, IOVP_SIZE); 161 dma_len = ALIGN(dma_len + dma_offset, IOVP_SIZE);
162 sg_dma_address(contig_sg) = 162 sg_dma_address(contig_sg) =
163 PIDE_FLAG 163 PIDE_FLAG
164 | (iommu_alloc_range(ioc, dma_len) << IOVP_SHIFT) 164 | (iommu_alloc_range(ioc, dma_len) << IOVP_SHIFT)
diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c
index 322957ac2ad1..d044c48323e6 100644
--- a/drivers/parisc/sba_iommu.c
+++ b/drivers/parisc/sba_iommu.c
@@ -113,8 +113,6 @@ module_param(sba_reserve_agpgart, int, 0444);
113MODULE_PARM_DESC(sba_reserve_agpgart, "Reserve half of IO pdir as AGPGART"); 113MODULE_PARM_DESC(sba_reserve_agpgart, "Reserve half of IO pdir as AGPGART");
114#endif 114#endif
115 115
116#define ROUNDUP(x,y) ((x + ((y)-1)) & ~((y)-1))
117
118 116
119/************************************ 117/************************************
120** SBA register read and write support 118** SBA register read and write support
@@ -352,7 +350,7 @@ sba_search_bitmap(struct ioc *ioc, unsigned long bits_wanted)
352 ** SBA HW features in the unmap path. 350 ** SBA HW features in the unmap path.
353 */ 351 */
354 unsigned long o = 1 << get_order(bits_wanted << PAGE_SHIFT); 352 unsigned long o = 1 << get_order(bits_wanted << PAGE_SHIFT);
355 uint bitshiftcnt = ROUNDUP(ioc->res_bitshift, o); 353 uint bitshiftcnt = ALIGN(ioc->res_bitshift, o);
356 unsigned long mask; 354 unsigned long mask;
357 355
358 if (bitshiftcnt >= BITS_PER_LONG) { 356 if (bitshiftcnt >= BITS_PER_LONG) {
@@ -779,7 +777,7 @@ sba_unmap_single(struct device *dev, dma_addr_t iova, size_t size,
779 offset = iova & ~IOVP_MASK; 777 offset = iova & ~IOVP_MASK;
780 iova ^= offset; /* clear offset bits */ 778 iova ^= offset; /* clear offset bits */
781 size += offset; 779 size += offset;
782 size = ROUNDUP(size, IOVP_SIZE); 780 size = ALIGN(size, IOVP_SIZE);
783 781
784 spin_lock_irqsave(&ioc->res_lock, flags); 782 spin_lock_irqsave(&ioc->res_lock, flags);
785 783