Skip to content

Commit 212c439

Browse files
mblenczewski-armctmarinas
authored andcommitted
iommu/arm: Add BBM Level 2 smmu feature
For supporting BBM Level 2 for userspace mappings, we want to ensure that the smmu also supports its own version of BBM Level 2. Luckily, the smmu spec (IHI 0070G 3.21.1.3) is stricter than the aarch64 spec (DDI 0487K.a D8.16.2), so already guarantees that no aborts are raised when BBM level 2 is claimed. Add the feature and testing for it under arm_smmu_sva_supported(). Signed-off-by: Mikołaj Lenczewski <[email protected]> Reviewed-by: Catalin Marinas <[email protected]> Reviewed-by: Robin Murphy <[email protected]> Reviewed-by: Ryan Roberts <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent 5aa4b62 commit 212c439

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,9 @@ bool arm_smmu_sva_supported(struct arm_smmu_device *smmu)
220220
feat_mask |= ARM_SMMU_FEAT_VAX;
221221
}
222222

223+
if (system_supports_bbml2_noabort())
224+
feat_mask |= ARM_SMMU_FEAT_BBML2;
225+
223226
if ((smmu->features & feat_mask) != feat_mask)
224227
return false;
225228

drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4457,6 +4457,9 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
44574457
if (FIELD_GET(IDR3_FWB, reg))
44584458
smmu->features |= ARM_SMMU_FEAT_S2FWB;
44594459

4460+
if (FIELD_GET(IDR3_BBM, reg) == 2)
4461+
smmu->features |= ARM_SMMU_FEAT_BBML2;
4462+
44604463
/* IDR5 */
44614464
reg = readl_relaxed(smmu->base + ARM_SMMU_IDR5);
44624465

drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ struct arm_smmu_device;
6060
#define ARM_SMMU_IDR3 0xc
6161
#define IDR3_FWB (1 << 8)
6262
#define IDR3_RIL (1 << 10)
63+
#define IDR3_BBM GENMASK(12, 11)
6364

6465
#define ARM_SMMU_IDR5 0x14
6566
#define IDR5_STALL_MAX GENMASK(31, 16)
@@ -755,6 +756,7 @@ struct arm_smmu_device {
755756
#define ARM_SMMU_FEAT_HA (1 << 21)
756757
#define ARM_SMMU_FEAT_HD (1 << 22)
757758
#define ARM_SMMU_FEAT_S2FWB (1 << 23)
759+
#define ARM_SMMU_FEAT_BBML2 (1 << 24)
758760
u32 features;
759761

760762
#define ARM_SMMU_OPT_SKIP_PREFETCH (1 << 0)

0 commit comments

Comments
 (0)