diff options
author | Robin Murphy <robin.murphy@arm.com> | 2016-04-13 13:12:58 -0400 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2016-05-03 13:23:02 -0400 |
commit | e086d912d4d78781652669618e7fb01a4d466703 (patch) | |
tree | 62c6f3a338ef1a07f1bd3b7fac2f252353b8350e /drivers/iommu/arm-smmu.c | |
parent | 67b65a3fb8e658d00ad1bb06e341f09b1f93a25c (diff) |
iommu/arm-smmu: Convert ThunderX workaround to new method
With a framework for implementation-specific funtionality in place, the
currently-FDT-dependent ThunderX workaround gets to be the first user.
Acked-by: Tirumalesh Chalamarla <tchalamarla@caviumnetworks.com>
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'drivers/iommu/arm-smmu.c')
-rw-r--r-- | drivers/iommu/arm-smmu.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 2d5f357de69c..d8bc20a0efb9 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c | |||
@@ -280,6 +280,7 @@ enum arm_smmu_arch_version { | |||
280 | 280 | ||
281 | enum arm_smmu_implementation { | 281 | enum arm_smmu_implementation { |
282 | GENERIC_SMMU, | 282 | GENERIC_SMMU, |
283 | CAVIUM_SMMUV2, | ||
283 | }; | 284 | }; |
284 | 285 | ||
285 | struct arm_smmu_smr { | 286 | struct arm_smmu_smr { |
@@ -1686,6 +1687,17 @@ static int arm_smmu_device_cfg_probe(struct arm_smmu_device *smmu) | |||
1686 | } | 1687 | } |
1687 | dev_notice(smmu->dev, "\t%u context banks (%u stage-2 only)\n", | 1688 | dev_notice(smmu->dev, "\t%u context banks (%u stage-2 only)\n", |
1688 | smmu->num_context_banks, smmu->num_s2_context_banks); | 1689 | smmu->num_context_banks, smmu->num_s2_context_banks); |
1690 | /* | ||
1691 | * Cavium CN88xx erratum #27704. | ||
1692 | * Ensure ASID and VMID allocation is unique across all SMMUs in | ||
1693 | * the system. | ||
1694 | */ | ||
1695 | if (smmu->model == CAVIUM_SMMUV2) { | ||
1696 | smmu->cavium_id_base = | ||
1697 | atomic_add_return(smmu->num_context_banks, | ||
1698 | &cavium_smmu_context_count); | ||
1699 | smmu->cavium_id_base -= smmu->num_context_banks; | ||
1700 | } | ||
1689 | 1701 | ||
1690 | /* ID2 */ | 1702 | /* ID2 */ |
1691 | id = readl_relaxed(gr0_base + ARM_SMMU_GR0_ID2); | 1703 | id = readl_relaxed(gr0_base + ARM_SMMU_GR0_ID2); |
@@ -1750,6 +1762,7 @@ static struct arm_smmu_match_data name = { .version = ver, .model = imp } | |||
1750 | 1762 | ||
1751 | ARM_SMMU_MATCH_DATA(smmu_generic_v1, ARM_SMMU_V1, GENERIC_SMMU); | 1763 | ARM_SMMU_MATCH_DATA(smmu_generic_v1, ARM_SMMU_V1, GENERIC_SMMU); |
1752 | ARM_SMMU_MATCH_DATA(smmu_generic_v2, ARM_SMMU_V2, GENERIC_SMMU); | 1764 | ARM_SMMU_MATCH_DATA(smmu_generic_v2, ARM_SMMU_V2, GENERIC_SMMU); |
1765 | ARM_SMMU_MATCH_DATA(cavium_smmuv2, ARM_SMMU_V2, CAVIUM_SMMUV2); | ||
1753 | 1766 | ||
1754 | static const struct of_device_id arm_smmu_of_match[] = { | 1767 | static const struct of_device_id arm_smmu_of_match[] = { |
1755 | { .compatible = "arm,smmu-v1", .data = &smmu_generic_v1 }, | 1768 | { .compatible = "arm,smmu-v1", .data = &smmu_generic_v1 }, |
@@ -1757,7 +1770,7 @@ static const struct of_device_id arm_smmu_of_match[] = { | |||
1757 | { .compatible = "arm,mmu-400", .data = &smmu_generic_v1 }, | 1770 | { .compatible = "arm,mmu-400", .data = &smmu_generic_v1 }, |
1758 | { .compatible = "arm,mmu-401", .data = &smmu_generic_v1 }, | 1771 | { .compatible = "arm,mmu-401", .data = &smmu_generic_v1 }, |
1759 | { .compatible = "arm,mmu-500", .data = &smmu_generic_v2 }, | 1772 | { .compatible = "arm,mmu-500", .data = &smmu_generic_v2 }, |
1760 | { .compatible = "cavium,smmu-v2", .data = &smmu_generic_v2 }, | 1773 | { .compatible = "cavium,smmu-v2", .data = &cavium_smmuv2 }, |
1761 | { }, | 1774 | { }, |
1762 | }; | 1775 | }; |
1763 | MODULE_DEVICE_TABLE(of, arm_smmu_of_match); | 1776 | MODULE_DEVICE_TABLE(of, arm_smmu_of_match); |
@@ -1871,18 +1884,6 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev) | |||
1871 | } | 1884 | } |
1872 | } | 1885 | } |
1873 | 1886 | ||
1874 | /* | ||
1875 | * Cavium CN88xx erratum #27704. | ||
1876 | * Ensure ASID and VMID allocation is unique across all SMMUs in | ||
1877 | * the system. | ||
1878 | */ | ||
1879 | if (of_device_is_compatible(dev->of_node, "cavium,smmu-v2")) { | ||
1880 | smmu->cavium_id_base = | ||
1881 | atomic_add_return(smmu->num_context_banks, | ||
1882 | &cavium_smmu_context_count); | ||
1883 | smmu->cavium_id_base -= smmu->num_context_banks; | ||
1884 | } | ||
1885 | |||
1886 | INIT_LIST_HEAD(&smmu->list); | 1887 | INIT_LIST_HEAD(&smmu->list); |
1887 | spin_lock(&arm_smmu_devices_lock); | 1888 | spin_lock(&arm_smmu_devices_lock); |
1888 | list_add(&smmu->list, &arm_smmu_devices); | 1889 | list_add(&smmu->list, &arm_smmu_devices); |