aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap/iovmm.c
diff options
context:
space:
mode:
authorDavid Cohen <dacohen@gmail.com>2011-03-09 04:17:33 -0500
committerTony Lindgren <tony@atomide.com>2011-03-14 12:17:07 -0400
commitd038aee24dcd5a2a0d8547f5396f67ae9698ac8e (patch)
tree43754b0d95f826ccaefe736d49e7d92a262d6091 /arch/arm/plat-omap/iovmm.c
parent4359d38d518c0dd72c03a3bc9918607ba8f2648a (diff)
omap: iovmm: don't check 'da' to set IOVMF_DA_FIXED flag
Currently IOVMM driver sets IOVMF_DA_FIXED/IOVMF_DA_ANON flags according to input 'da' address when mapping memory: da == 0: IOVMF_DA_ANON da != 0: IOVMF_DA_FIXED It prevents IOMMU to map first page with fixed 'da'. To avoid such issue, IOVMM will not automatically set IOVMF_DA_FIXED. It should now come from the user throught 'flags' parameter when mapping memory. As IOVMF_DA_ANON and IOVMF_DA_FIXED are mutually exclusive, IOVMF_DA_ANON can be removed. The driver will now check internally if IOVMF_DA_FIXED is set or not. Signed-off-by: David Cohen <dacohen@gmail.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/plat-omap/iovmm.c')
-rw-r--r--arch/arm/plat-omap/iovmm.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/arch/arm/plat-omap/iovmm.c b/arch/arm/plat-omap/iovmm.c
index ea7eab98a736..51ef43e8def6 100644
--- a/arch/arm/plat-omap/iovmm.c
+++ b/arch/arm/plat-omap/iovmm.c
@@ -279,7 +279,7 @@ static struct iovm_struct *alloc_iovm_area(struct iommu *obj, u32 da,
279 start = da; 279 start = da;
280 alignment = PAGE_SIZE; 280 alignment = PAGE_SIZE;
281 281
282 if (flags & IOVMF_DA_ANON) { 282 if (~flags & IOVMF_DA_FIXED) {
283 /* Don't map address 0 */ 283 /* Don't map address 0 */
284 start = obj->da_start ? obj->da_start : alignment; 284 start = obj->da_start ? obj->da_start : alignment;
285 285
@@ -304,7 +304,7 @@ static struct iovm_struct *alloc_iovm_area(struct iommu *obj, u32 da,
304 if (tmp->da_start > start && (tmp->da_start - start) >= bytes) 304 if (tmp->da_start > start && (tmp->da_start - start) >= bytes)
305 goto found; 305 goto found;
306 306
307 if (tmp->da_end >= start && flags & IOVMF_DA_ANON) 307 if (tmp->da_end >= start && ~flags & IOVMF_DA_FIXED)
308 start = roundup(tmp->da_end + 1, alignment); 308 start = roundup(tmp->da_end + 1, alignment);
309 309
310 prev_end = tmp->da_end; 310 prev_end = tmp->da_end;
@@ -651,7 +651,6 @@ u32 iommu_vmap(struct iommu *obj, u32 da, const struct sg_table *sgt,
651 flags &= IOVMF_HW_MASK; 651 flags &= IOVMF_HW_MASK;
652 flags |= IOVMF_DISCONT; 652 flags |= IOVMF_DISCONT;
653 flags |= IOVMF_MMIO; 653 flags |= IOVMF_MMIO;
654 flags |= (da ? IOVMF_DA_FIXED : IOVMF_DA_ANON);
655 654
656 da = __iommu_vmap(obj, da, sgt, va, bytes, flags); 655 da = __iommu_vmap(obj, da, sgt, va, bytes, flags);
657 if (IS_ERR_VALUE(da)) 656 if (IS_ERR_VALUE(da))
@@ -691,7 +690,7 @@ EXPORT_SYMBOL_GPL(iommu_vunmap);
691 * @flags: iovma and page property 690 * @flags: iovma and page property
692 * 691 *
693 * Allocate @bytes linearly and creates 1-n-1 mapping and returns 692 * Allocate @bytes linearly and creates 1-n-1 mapping and returns
694 * @da again, which might be adjusted if 'IOVMF_DA_ANON' is set. 693 * @da again, which might be adjusted if 'IOVMF_DA_FIXED' is not set.
695 */ 694 */
696u32 iommu_vmalloc(struct iommu *obj, u32 da, size_t bytes, u32 flags) 695u32 iommu_vmalloc(struct iommu *obj, u32 da, size_t bytes, u32 flags)
697{ 696{
@@ -710,7 +709,6 @@ u32 iommu_vmalloc(struct iommu *obj, u32 da, size_t bytes, u32 flags)
710 flags &= IOVMF_HW_MASK; 709 flags &= IOVMF_HW_MASK;
711 flags |= IOVMF_DISCONT; 710 flags |= IOVMF_DISCONT;
712 flags |= IOVMF_ALLOC; 711 flags |= IOVMF_ALLOC;
713 flags |= (da ? IOVMF_DA_FIXED : IOVMF_DA_ANON);
714 712
715 sgt = sgtable_alloc(bytes, flags, da, 0); 713 sgt = sgtable_alloc(bytes, flags, da, 0);
716 if (IS_ERR(sgt)) { 714 if (IS_ERR(sgt)) {
@@ -781,7 +779,7 @@ static u32 __iommu_kmap(struct iommu *obj, u32 da, u32 pa, void *va,
781 * @flags: iovma and page property 779 * @flags: iovma and page property
782 * 780 *
783 * Creates 1-1-1 mapping and returns @da again, which can be 781 * Creates 1-1-1 mapping and returns @da again, which can be
784 * adjusted if 'IOVMF_DA_ANON' is set. 782 * adjusted if 'IOVMF_DA_FIXED' is not set.
785 */ 783 */
786u32 iommu_kmap(struct iommu *obj, u32 da, u32 pa, size_t bytes, 784u32 iommu_kmap(struct iommu *obj, u32 da, u32 pa, size_t bytes,
787 u32 flags) 785 u32 flags)
@@ -800,7 +798,6 @@ u32 iommu_kmap(struct iommu *obj, u32 da, u32 pa, size_t bytes,
800 flags &= IOVMF_HW_MASK; 798 flags &= IOVMF_HW_MASK;
801 flags |= IOVMF_LINEAR; 799 flags |= IOVMF_LINEAR;
802 flags |= IOVMF_MMIO; 800 flags |= IOVMF_MMIO;
803 flags |= (da ? IOVMF_DA_FIXED : IOVMF_DA_ANON);
804 801
805 da = __iommu_kmap(obj, da, pa, va, bytes, flags); 802 da = __iommu_kmap(obj, da, pa, va, bytes, flags);
806 if (IS_ERR_VALUE(da)) 803 if (IS_ERR_VALUE(da))
@@ -839,7 +836,7 @@ EXPORT_SYMBOL_GPL(iommu_kunmap);
839 * @flags: iovma and page property 836 * @flags: iovma and page property
840 * 837 *
841 * Allocate @bytes linearly and creates 1-1-1 mapping and returns 838 * Allocate @bytes linearly and creates 1-1-1 mapping and returns
842 * @da again, which might be adjusted if 'IOVMF_DA_ANON' is set. 839 * @da again, which might be adjusted if 'IOVMF_DA_FIXED' is not set.
843 */ 840 */
844u32 iommu_kmalloc(struct iommu *obj, u32 da, size_t bytes, u32 flags) 841u32 iommu_kmalloc(struct iommu *obj, u32 da, size_t bytes, u32 flags)
845{ 842{
@@ -859,7 +856,6 @@ u32 iommu_kmalloc(struct iommu *obj, u32 da, size_t bytes, u32 flags)
859 flags &= IOVMF_HW_MASK; 856 flags &= IOVMF_HW_MASK;
860 flags |= IOVMF_LINEAR; 857 flags |= IOVMF_LINEAR;
861 flags |= IOVMF_ALLOC; 858 flags |= IOVMF_ALLOC;
862 flags |= (da ? IOVMF_DA_FIXED : IOVMF_DA_ANON);
863 859
864 da = __iommu_kmap(obj, da, pa, va, bytes, flags); 860 da = __iommu_kmap(obj, da, pa, va, bytes, flags);
865 if (IS_ERR_VALUE(da)) 861 if (IS_ERR_VALUE(da))