diff options
author | Robin Murphy <robin.murphy@arm.com> | 2016-04-13 13:12:59 -0400 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2016-05-03 13:23:02 -0400 |
commit | f0cfffc48cac516e37711786227f6808491913a5 (patch) | |
tree | 889f2264c6e081e8778db9396b5a7c6adc4ebf37 | |
parent | e086d912d4d78781652669618e7fb01a4d466703 (diff) |
iommu/arm-smmu: Work around MMU-500 prefetch errata
MMU-500 erratum #841119 is tickled by a particular set of circumstances
interacting with the next-page prefetcher. Since said prefetcher is
quite dumb and actually detrimental to performance in some cases (by
causing unwanted TLB evictions for non-sequential access patterns), we
lose very little by turning it off, and what we gain is a guarantee that
the erratum is never hit.
As a bonus, the same workaround will also prevent erratum #826419 once
v7 short descriptor support is implemented.
CC: Catalin Marinas <catalin.marinas@arm.com>
CC: Will Deacon <will.deacon@arm.com>
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
-rw-r--r-- | Documentation/arm64/silicon-errata.txt | 1 | ||||
-rw-r--r-- | drivers/iommu/arm-smmu.c | 16 |
2 files changed, 16 insertions, 1 deletions
diff --git a/Documentation/arm64/silicon-errata.txt b/Documentation/arm64/silicon-errata.txt index 806f91cdd45d..c6938e50e71f 100644 --- a/Documentation/arm64/silicon-errata.txt +++ b/Documentation/arm64/silicon-errata.txt | |||
@@ -53,6 +53,7 @@ stable kernels. | |||
53 | | ARM | Cortex-A57 | #832075 | ARM64_ERRATUM_832075 | | 53 | | ARM | Cortex-A57 | #832075 | ARM64_ERRATUM_832075 | |
54 | | ARM | Cortex-A57 | #852523 | N/A | | 54 | | ARM | Cortex-A57 | #852523 | N/A | |
55 | | ARM | Cortex-A57 | #834220 | ARM64_ERRATUM_834220 | | 55 | | ARM | Cortex-A57 | #834220 | ARM64_ERRATUM_834220 | |
56 | | ARM | MMU-500 | #841119,#826419 | N/A | | ||
56 | | | | | | | 57 | | | | | | |
57 | | Cavium | ThunderX ITS | #22375, #24313 | CAVIUM_ERRATUM_22375 | | 58 | | Cavium | ThunderX ITS | #22375, #24313 | CAVIUM_ERRATUM_22375 | |
58 | | Cavium | ThunderX GICv3 | #23154 | CAVIUM_ERRATUM_23154 | | 59 | | Cavium | ThunderX GICv3 | #23154 | CAVIUM_ERRATUM_23154 | |
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index d8bc20a0efb9..085fc8d808a5 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c | |||
@@ -203,6 +203,7 @@ | |||
203 | #define ARM_SMMU_CB(smmu, n) ((n) * (1 << (smmu)->pgshift)) | 203 | #define ARM_SMMU_CB(smmu, n) ((n) * (1 << (smmu)->pgshift)) |
204 | 204 | ||
205 | #define ARM_SMMU_CB_SCTLR 0x0 | 205 | #define ARM_SMMU_CB_SCTLR 0x0 |
206 | #define ARM_SMMU_CB_ACTLR 0x4 | ||
206 | #define ARM_SMMU_CB_RESUME 0x8 | 207 | #define ARM_SMMU_CB_RESUME 0x8 |
207 | #define ARM_SMMU_CB_TTBCR2 0x10 | 208 | #define ARM_SMMU_CB_TTBCR2 0x10 |
208 | #define ARM_SMMU_CB_TTBR0 0x20 | 209 | #define ARM_SMMU_CB_TTBR0 0x20 |
@@ -234,6 +235,8 @@ | |||
234 | #define SCTLR_M (1 << 0) | 235 | #define SCTLR_M (1 << 0) |
235 | #define SCTLR_EAE_SBOP (SCTLR_AFE | SCTLR_TRE) | 236 | #define SCTLR_EAE_SBOP (SCTLR_AFE | SCTLR_TRE) |
236 | 237 | ||
238 | #define ARM_MMU500_ACTLR_CPRE (1 << 1) | ||
239 | |||
237 | #define CB_PAR_F (1 << 0) | 240 | #define CB_PAR_F (1 << 0) |
238 | 241 | ||
239 | #define ATSR_ACTIVE (1 << 0) | 242 | #define ATSR_ACTIVE (1 << 0) |
@@ -280,6 +283,7 @@ enum arm_smmu_arch_version { | |||
280 | 283 | ||
281 | enum arm_smmu_implementation { | 284 | enum arm_smmu_implementation { |
282 | GENERIC_SMMU, | 285 | GENERIC_SMMU, |
286 | ARM_MMU500, | ||
283 | CAVIUM_SMMUV2, | 287 | CAVIUM_SMMUV2, |
284 | }; | 288 | }; |
285 | 289 | ||
@@ -1517,6 +1521,15 @@ static void arm_smmu_device_reset(struct arm_smmu_device *smmu) | |||
1517 | cb_base = ARM_SMMU_CB_BASE(smmu) + ARM_SMMU_CB(smmu, i); | 1521 | cb_base = ARM_SMMU_CB_BASE(smmu) + ARM_SMMU_CB(smmu, i); |
1518 | writel_relaxed(0, cb_base + ARM_SMMU_CB_SCTLR); | 1522 | writel_relaxed(0, cb_base + ARM_SMMU_CB_SCTLR); |
1519 | writel_relaxed(FSR_FAULT, cb_base + ARM_SMMU_CB_FSR); | 1523 | writel_relaxed(FSR_FAULT, cb_base + ARM_SMMU_CB_FSR); |
1524 | /* | ||
1525 | * Disable MMU-500's not-particularly-beneficial next-page | ||
1526 | * prefetcher for the sake of errata #841119 and #826419. | ||
1527 | */ | ||
1528 | if (smmu->model == ARM_MMU500) { | ||
1529 | reg = readl_relaxed(cb_base + ARM_SMMU_CB_ACTLR); | ||
1530 | reg &= ~ARM_MMU500_ACTLR_CPRE; | ||
1531 | writel_relaxed(reg, cb_base + ARM_SMMU_CB_ACTLR); | ||
1532 | } | ||
1520 | } | 1533 | } |
1521 | 1534 | ||
1522 | /* Invalidate the TLB, just in case */ | 1535 | /* Invalidate the TLB, just in case */ |
@@ -1762,6 +1775,7 @@ static struct arm_smmu_match_data name = { .version = ver, .model = imp } | |||
1762 | 1775 | ||
1763 | ARM_SMMU_MATCH_DATA(smmu_generic_v1, ARM_SMMU_V1, GENERIC_SMMU); | 1776 | ARM_SMMU_MATCH_DATA(smmu_generic_v1, ARM_SMMU_V1, GENERIC_SMMU); |
1764 | ARM_SMMU_MATCH_DATA(smmu_generic_v2, ARM_SMMU_V2, GENERIC_SMMU); | 1777 | ARM_SMMU_MATCH_DATA(smmu_generic_v2, ARM_SMMU_V2, GENERIC_SMMU); |
1778 | ARM_SMMU_MATCH_DATA(arm_mmu500, ARM_SMMU_V2, ARM_MMU500); | ||
1765 | ARM_SMMU_MATCH_DATA(cavium_smmuv2, ARM_SMMU_V2, CAVIUM_SMMUV2); | 1779 | ARM_SMMU_MATCH_DATA(cavium_smmuv2, ARM_SMMU_V2, CAVIUM_SMMUV2); |
1766 | 1780 | ||
1767 | static const struct of_device_id arm_smmu_of_match[] = { | 1781 | static const struct of_device_id arm_smmu_of_match[] = { |
@@ -1769,7 +1783,7 @@ static const struct of_device_id arm_smmu_of_match[] = { | |||
1769 | { .compatible = "arm,smmu-v2", .data = &smmu_generic_v2 }, | 1783 | { .compatible = "arm,smmu-v2", .data = &smmu_generic_v2 }, |
1770 | { .compatible = "arm,mmu-400", .data = &smmu_generic_v1 }, | 1784 | { .compatible = "arm,mmu-400", .data = &smmu_generic_v1 }, |
1771 | { .compatible = "arm,mmu-401", .data = &smmu_generic_v1 }, | 1785 | { .compatible = "arm,mmu-401", .data = &smmu_generic_v1 }, |
1772 | { .compatible = "arm,mmu-500", .data = &smmu_generic_v2 }, | 1786 | { .compatible = "arm,mmu-500", .data = &arm_mmu500 }, |
1773 | { .compatible = "cavium,smmu-v2", .data = &cavium_smmuv2 }, | 1787 | { .compatible = "cavium,smmu-v2", .data = &cavium_smmuv2 }, |
1774 | { }, | 1788 | { }, |
1775 | }; | 1789 | }; |