aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-msm
diff options
context:
space:
mode:
authorStepan Moskovchenko <stepanm@codeaurora.org>2011-02-24 21:00:41 -0500
committerDavid Brown <davidb@codeaurora.org>2011-03-08 17:40:58 -0500
commit2e8c8ba98376459e73d03a285f5d3406b630ea2d (patch)
tree774f957b4aab21d8799f9d42d761eb7b1f624ba8 /arch/arm/mach-msm
parentb61401adf38f56dbfdac91f31425edf60595ed30 (diff)
msm: iommu: Use ASID tagging instead of VMID tagging
Use ASID tags in the TLB instead of VMID tags in preparation for changes to the secure environment. Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org> Signed-off-by: David Brown <davidb@codeaurora.org>
Diffstat (limited to 'arch/arm/mach-msm')
-rw-r--r--arch/arm/mach-msm/include/mach/iommu_hw-8xxx.h4
-rw-r--r--arch/arm/mach-msm/iommu.c9
-rw-r--r--arch/arm/mach-msm/iommu_dev.c11
3 files changed, 14 insertions, 10 deletions
diff --git a/arch/arm/mach-msm/include/mach/iommu_hw-8xxx.h b/arch/arm/mach-msm/include/mach/iommu_hw-8xxx.h
index c2c3da9444f4..bbd397cff6c8 100644
--- a/arch/arm/mach-msm/include/mach/iommu_hw-8xxx.h
+++ b/arch/arm/mach-msm/include/mach/iommu_hw-8xxx.h
@@ -1,4 +1,4 @@
1/* Copyright (c) 2010, Code Aurora Forum. All rights reserved. 1/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
2 * 2 *
3 * This program is free software; you can redistribute it and/or modify 3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and 4 * it under the terms of the GNU General Public License version 2 and
@@ -68,6 +68,7 @@ do { \
68#define FL_CACHEABLE (1 << 3) 68#define FL_CACHEABLE (1 << 3)
69#define FL_TEX0 (1 << 12) 69#define FL_TEX0 (1 << 12)
70#define FL_OFFSET(va) (((va) & 0xFFF00000) >> 20) 70#define FL_OFFSET(va) (((va) & 0xFFF00000) >> 20)
71#define FL_NG (1 << 17)
71 72
72/* Second-level page table bits */ 73/* Second-level page table bits */
73#define SL_BASE_MASK_LARGE 0xFFFF0000 74#define SL_BASE_MASK_LARGE 0xFFFF0000
@@ -81,6 +82,7 @@ do { \
81#define SL_CACHEABLE (1 << 3) 82#define SL_CACHEABLE (1 << 3)
82#define SL_TEX0 (1 << 6) 83#define SL_TEX0 (1 << 6)
83#define SL_OFFSET(va) (((va) & 0xFF000) >> 12) 84#define SL_OFFSET(va) (((va) & 0xFF000) >> 12)
85#define SL_NG (1 << 11)
84 86
85/* Memory type and cache policy attributes */ 87/* Memory type and cache policy attributes */
86#define MT_SO 0 88#define MT_SO 0
diff --git a/arch/arm/mach-msm/iommu.c b/arch/arm/mach-msm/iommu.c
index cde3cd0f8c0c..9c087405c635 100644
--- a/arch/arm/mach-msm/iommu.c
+++ b/arch/arm/mach-msm/iommu.c
@@ -137,7 +137,6 @@ static void __reset_context(void __iomem *base, int ctx)
137 SET_TLBLKCR(base, ctx, 0); 137 SET_TLBLKCR(base, ctx, 0);
138 SET_PRRR(base, ctx, 0); 138 SET_PRRR(base, ctx, 0);
139 SET_NMRR(base, ctx, 0); 139 SET_NMRR(base, ctx, 0);
140 SET_CONTEXTIDR(base, ctx, 0);
141} 140}
142 141
143static void __program_context(void __iomem *base, int ctx, phys_addr_t pgtable) 142static void __program_context(void __iomem *base, int ctx, phys_addr_t pgtable)
@@ -418,11 +417,11 @@ static int msm_iommu_map(struct iommu_domain *domain, unsigned long va,
418 for (i = 0; i < 16; i++) 417 for (i = 0; i < 16; i++)
419 *(fl_pte+i) = (pa & 0xFF000000) | FL_SUPERSECTION | 418 *(fl_pte+i) = (pa & 0xFF000000) | FL_SUPERSECTION |
420 FL_AP_READ | FL_AP_WRITE | FL_TYPE_SECT | 419 FL_AP_READ | FL_AP_WRITE | FL_TYPE_SECT |
421 FL_SHARED | pgprot; 420 FL_SHARED | FL_NG | pgprot;
422 } 421 }
423 422
424 if (len == SZ_1M) 423 if (len == SZ_1M)
425 *fl_pte = (pa & 0xFFF00000) | FL_AP_READ | FL_AP_WRITE | 424 *fl_pte = (pa & 0xFFF00000) | FL_AP_READ | FL_AP_WRITE | FL_NG |
426 FL_TYPE_SECT | FL_SHARED | pgprot; 425 FL_TYPE_SECT | FL_SHARED | pgprot;
427 426
428 /* Need a 2nd level table */ 427 /* Need a 2nd level table */
@@ -447,7 +446,7 @@ static int msm_iommu_map(struct iommu_domain *domain, unsigned long va,
447 446
448 447
449 if (len == SZ_4K) 448 if (len == SZ_4K)
450 *sl_pte = (pa & SL_BASE_MASK_SMALL) | SL_AP0 | SL_AP1 | 449 *sl_pte = (pa & SL_BASE_MASK_SMALL) | SL_AP0 | SL_AP1 | SL_NG |
451 SL_SHARED | SL_TYPE_SMALL | pgprot; 450 SL_SHARED | SL_TYPE_SMALL | pgprot;
452 451
453 if (len == SZ_64K) { 452 if (len == SZ_64K) {
@@ -455,7 +454,7 @@ static int msm_iommu_map(struct iommu_domain *domain, unsigned long va,
455 454
456 for (i = 0; i < 16; i++) 455 for (i = 0; i < 16; i++)
457 *(sl_pte+i) = (pa & SL_BASE_MASK_LARGE) | SL_AP0 | 456 *(sl_pte+i) = (pa & SL_BASE_MASK_LARGE) | SL_AP0 |
458 SL_AP1 | SL_SHARED | SL_TYPE_LARGE | pgprot; 457 SL_NG | SL_AP1 | SL_SHARED | SL_TYPE_LARGE | pgprot;
459 } 458 }
460 459
461 ret = __flush_iotlb(domain); 460 ret = __flush_iotlb(domain);
diff --git a/arch/arm/mach-msm/iommu_dev.c b/arch/arm/mach-msm/iommu_dev.c
index 79ade0b3b326..0e240c9d6e71 100644
--- a/arch/arm/mach-msm/iommu_dev.c
+++ b/arch/arm/mach-msm/iommu_dev.c
@@ -330,14 +330,17 @@ static int msm_iommu_ctx_probe(struct platform_device *pdev)
330 SET_M2VCBR_N(drvdata->base, mid, 0); 330 SET_M2VCBR_N(drvdata->base, mid, 0);
331 SET_CBACR_N(drvdata->base, c->num, 0); 331 SET_CBACR_N(drvdata->base, c->num, 0);
332 332
333 /* Set VMID = MID */ 333 /* Set VMID = 0 */
334 SET_VMID(drvdata->base, mid, mid); 334 SET_VMID(drvdata->base, mid, 0);
335 335
336 /* Set the context number for that MID to this context */ 336 /* Set the context number for that MID to this context */
337 SET_CBNDX(drvdata->base, mid, c->num); 337 SET_CBNDX(drvdata->base, mid, c->num);
338 338
339 /* Set MID associated with this context bank */ 339 /* Set MID associated with this context bank to 0*/
340 SET_CBVMID(drvdata->base, c->num, mid); 340 SET_CBVMID(drvdata->base, c->num, 0);
341
342 /* Set the ASID for TLB tagging for this context */
343 SET_CONTEXTIDR_ASID(drvdata->base, c->num, c->num);
341 344
342 /* Set security bit override to be Non-secure */ 345 /* Set security bit override to be Non-secure */
343 SET_NSCFG(drvdata->base, mid, 3); 346 SET_NSCFG(drvdata->base, mid, 3);