summaryrefslogtreecommitdiffstats
path: root/drivers/iommu/io-pgtable-arm.c
diff options
context:
space:
mode:
authorWill Deacon <will.deacon@arm.com>2015-03-18 06:22:18 -0400
committerWill Deacon <will.deacon@arm.com>2015-03-27 09:39:36 -0400
commit63979b8da30013ce58d8447f34dde60802d1ccba (patch)
treefd89677dbeb65221c7840733e8d033a4a664d4ed /drivers/iommu/io-pgtable-arm.c
parent03edb2264cadddc38ca9030887c2902affbfca3f (diff)
iommu/io-pgtable-arm: avoid speculative walks through TTBR1
Although we set TCR.T1SZ to 0, the input address range covered by TTBR1 is actually calculated using T0SZ in this case on the ARM SMMU. This could theoretically lead to speculative table walks through physical address zero, leading to all sorts of fun and games if we have MMIO regions down there. This patch avoids the issue by setting EPD1 to disable walks through the unused TTBR1 register. Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'drivers/iommu/io-pgtable-arm.c')
-rw-r--r--drivers/iommu/io-pgtable-arm.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c
index b610a8dee238..4e460216bd16 100644
--- a/drivers/iommu/io-pgtable-arm.c
+++ b/drivers/iommu/io-pgtable-arm.c
@@ -116,6 +116,8 @@
116#define ARM_32_LPAE_TCR_EAE (1 << 31) 116#define ARM_32_LPAE_TCR_EAE (1 << 31)
117#define ARM_64_LPAE_S2_TCR_RES1 (1 << 31) 117#define ARM_64_LPAE_S2_TCR_RES1 (1 << 31)
118 118
119#define ARM_LPAE_TCR_EPD1 (1 << 23)
120
119#define ARM_LPAE_TCR_TG0_4K (0 << 14) 121#define ARM_LPAE_TCR_TG0_4K (0 << 14)
120#define ARM_LPAE_TCR_TG0_64K (1 << 14) 122#define ARM_LPAE_TCR_TG0_64K (1 << 14)
121#define ARM_LPAE_TCR_TG0_16K (2 << 14) 123#define ARM_LPAE_TCR_TG0_16K (2 << 14)
@@ -621,6 +623,9 @@ arm_64_lpae_alloc_pgtable_s1(struct io_pgtable_cfg *cfg, void *cookie)
621 } 623 }
622 624
623 reg |= (64ULL - cfg->ias) << ARM_LPAE_TCR_T0SZ_SHIFT; 625 reg |= (64ULL - cfg->ias) << ARM_LPAE_TCR_T0SZ_SHIFT;
626
627 /* Disable speculative walks through TTBR1 */
628 reg |= ARM_LPAE_TCR_EPD1;
624 cfg->arm_lpae_s1_cfg.tcr = reg; 629 cfg->arm_lpae_s1_cfg.tcr = reg;
625 630
626 /* MAIRs */ 631 /* MAIRs */