Skip to content

Commit ee79e5f

Browse files
committed
Merge tag 'arm-smmu-updates' of git://git.kernel.org/pub/scm/linux/kernel/git/will/linux into arm/smmu
Arm SMMU updates for 5.9 - Support for SMMU-500 implementation in Marvell Armada-AP806 SoC - Support for SMMU-500 implementation in NVIDIA Tegra194 SoC - DT compatible string updates - Remove unused IOMMU_SYS_CACHE_ONLY flag
2 parents 9ebcfad + aa7ec73 commit ee79e5f

File tree

11 files changed

+403
-30
lines changed

11 files changed

+403
-30
lines changed

Documentation/arm64/silicon-errata.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ stable kernels.
125125
| Cavium | ThunderX2 Core | #219 | CAVIUM_TX2_ERRATUM_219 |
126126
+----------------+-----------------+-----------------+-----------------------------+
127127
+----------------+-----------------+-----------------+-----------------------------+
128+
| Marvell | ARM-MMU-500 | #582743 | N/A |
129+
+----------------+-----------------+-----------------+-----------------------------+
130+
+----------------+-----------------+-----------------+-----------------------------+
128131
| Freescale/NXP | LS2080A/LS1043A | A-008585 | FSL_ERRATUM_A008585 |
129132
+----------------+-----------------+-----------------+-----------------------------+
130133
+----------------+-----------------+-----------------+-----------------------------+

Documentation/devicetree/bindings/iommu/arm,smmu.yaml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,18 @@ properties:
3737
- enum:
3838
- qcom,sc7180-smmu-500
3939
- qcom,sdm845-smmu-500
40+
- qcom,sm8150-smmu-500
41+
- qcom,sm8250-smmu-500
4042
- const: arm,mmu-500
43+
- description: Marvell SoCs implementing "arm,mmu-500"
44+
items:
45+
- const: marvell,ap806-smmu-500
46+
- const: arm,mmu-500
47+
- description: NVIDIA SoCs that program two ARM MMU-500s identically
48+
items:
49+
- enum:
50+
- nvidia,tegra194-smmu
51+
- const: nvidia,smmu-500
4152
- items:
4253
- const: arm,mmu-500
4354
- const: arm,smmu-v2
@@ -55,7 +66,8 @@ properties:
5566
- cavium,smmu-v2
5667

5768
reg:
58-
maxItems: 1
69+
minItems: 1
70+
maxItems: 2
5971

6072
'#global-interrupts':
6173
description: The number of global interrupts exposed by the device.
@@ -138,6 +150,23 @@ required:
138150

139151
additionalProperties: false
140152

153+
allOf:
154+
- if:
155+
properties:
156+
compatible:
157+
contains:
158+
enum:
159+
- nvidia,tegra194-smmu
160+
then:
161+
properties:
162+
reg:
163+
minItems: 2
164+
maxItems: 2
165+
else:
166+
properties:
167+
reg:
168+
maxItems: 1
169+
141170
examples:
142171
- |+
143172
/* SMMU with stream matching or stream indexing */

MAINTAINERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16810,8 +16810,10 @@ F: drivers/i2c/busses/i2c-tegra.c
1681016810

1681116811
TEGRA IOMMU DRIVERS
1681216812
M: Thierry Reding <[email protected]>
16813+
R: Krishna Reddy <[email protected]>
1681316814
1681416815
S: Supported
16816+
F: drivers/iommu/arm-smmu-nvidia.c
1681516817
F: drivers/iommu/tegra*
1681616818

1681716819
TEGRA KBC DRIVER

drivers/iommu/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ obj-$(CONFIG_AMD_IOMMU) += amd/iommu.o amd/init.o amd/quirks.o
1515
obj-$(CONFIG_AMD_IOMMU_DEBUGFS) += amd/debugfs.o
1616
obj-$(CONFIG_AMD_IOMMU_V2) += amd/iommu_v2.o
1717
obj-$(CONFIG_ARM_SMMU) += arm_smmu.o
18-
arm_smmu-objs += arm-smmu.o arm-smmu-impl.o arm-smmu-qcom.o
18+
arm_smmu-objs += arm-smmu.o arm-smmu-impl.o arm-smmu-nvidia.o arm-smmu-qcom.o
1919
obj-$(CONFIG_ARM_SMMU_V3) += arm-smmu-v3.o
2020
obj-$(CONFIG_DMAR_TABLE) += intel/dmar.o
2121
obj-$(CONFIG_INTEL_IOMMU) += intel/iommu.o intel/pasid.o

drivers/iommu/arm-smmu-impl.c

Lines changed: 55 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,16 +147,57 @@ static const struct arm_smmu_impl arm_mmu500_impl = {
147147
.reset = arm_mmu500_reset,
148148
};
149149

150+
static u64 mrvl_mmu500_readq(struct arm_smmu_device *smmu, int page, int off)
151+
{
152+
/*
153+
* Marvell Armada-AP806 erratum #582743.
154+
* Split all the readq to double readl
155+
*/
156+
return hi_lo_readq_relaxed(arm_smmu_page(smmu, page) + off);
157+
}
158+
159+
static void mrvl_mmu500_writeq(struct arm_smmu_device *smmu, int page, int off,
160+
u64 val)
161+
{
162+
/*
163+
* Marvell Armada-AP806 erratum #582743.
164+
* Split all the writeq to double writel
165+
*/
166+
hi_lo_writeq_relaxed(val, arm_smmu_page(smmu, page) + off);
167+
}
168+
169+
static int mrvl_mmu500_cfg_probe(struct arm_smmu_device *smmu)
170+
{
171+
172+
/*
173+
* Armada-AP806 erratum #582743.
174+
* Hide the SMMU_IDR2.PTFSv8 fields to sidestep the AArch64
175+
* formats altogether and allow using 32 bits access on the
176+
* interconnect.
177+
*/
178+
smmu->features &= ~(ARM_SMMU_FEAT_FMT_AARCH64_4K |
179+
ARM_SMMU_FEAT_FMT_AARCH64_16K |
180+
ARM_SMMU_FEAT_FMT_AARCH64_64K);
181+
182+
return 0;
183+
}
184+
185+
static const struct arm_smmu_impl mrvl_mmu500_impl = {
186+
.read_reg64 = mrvl_mmu500_readq,
187+
.write_reg64 = mrvl_mmu500_writeq,
188+
.cfg_probe = mrvl_mmu500_cfg_probe,
189+
.reset = arm_mmu500_reset,
190+
};
191+
150192

151193
struct arm_smmu_device *arm_smmu_impl_init(struct arm_smmu_device *smmu)
152194
{
153195
const struct device_node *np = smmu->dev->of_node;
154196

155197
/*
156-
* We will inevitably have to combine model-specific implementation
157-
* quirks with platform-specific integration quirks, but everything
158-
* we currently support happens to work out as straightforward
159-
* mutually-exclusive assignments.
198+
* Set the impl for model-specific implementation quirks first,
199+
* such that platform integration quirks can pick it up and
200+
* inherit from it if necessary.
160201
*/
161202
switch (smmu->model) {
162203
case ARM_MMU500:
@@ -168,12 +209,21 @@ struct arm_smmu_device *arm_smmu_impl_init(struct arm_smmu_device *smmu)
168209
break;
169210
}
170211

212+
/* This is implicitly MMU-400 */
171213
if (of_property_read_bool(np, "calxeda,smmu-secure-config-access"))
172214
smmu->impl = &calxeda_impl;
173215

216+
if (of_device_is_compatible(np, "nvidia,tegra194-smmu"))
217+
return nvidia_smmu_impl_init(smmu);
218+
174219
if (of_device_is_compatible(np, "qcom,sdm845-smmu-500") ||
175-
of_device_is_compatible(np, "qcom,sc7180-smmu-500"))
220+
of_device_is_compatible(np, "qcom,sc7180-smmu-500") ||
221+
of_device_is_compatible(np, "qcom,sm8150-smmu-500") ||
222+
of_device_is_compatible(np, "qcom,sm8250-smmu-500"))
176223
return qcom_smmu_impl_init(smmu);
177224

225+
if (of_device_is_compatible(np, "marvell,ap806-smmu-500"))
226+
smmu->impl = &mrvl_mmu500_impl;
227+
178228
return smmu;
179229
}

0 commit comments

Comments
 (0)