Skip to contentSkip to conversation

iommu/arm-smmu-v3: Skip prefetch cmd for MMU-600, MMU-700

PATCH In review Daniel Mentz 2 participants 3 messages May 13, 2024 – May 21, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iommu/arm-smmu-v3: Skip prefetch cmd for MMU-600, MMU-700

Arm CoreLink MMU-600 and MMU-700 both silently ignore the CMD_PREFETCH_CONFIG command. Let's not waste cycles adding this command to the command queue if it is ignored anyway.

---
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +4 -0
index aa62f0ecd053..98f1c4b44ef3 100644
@@ -3684,6 +3684,8 @@ static void arm_smmu_device_iidr_probe(struct arm_smmu_device *smmu)
 	case IIDR_IMPLEMENTER_ARM:
 		switch (productid) {
 		case IIDR_PRODUCTID_ARM_MMU_600:
+			/* MMU-600 silently ignores CMD_PREFETCH_CONFIG */
+			smmu->options |= ARM_SMMU_OPT_SKIP_PREFETCH;
 			/* Arm erratum 1076982 */
 			if (variant == 0 && revision <= 2)
 				smmu->features &= ~ARM_SMMU_FEAT_SEV;
@@ -3692,6 +3694,8 @@ static void arm_smmu_device_iidr_probe(struct arm_smmu_device *smmu)
 				smmu->features &= ~ARM_SMMU_FEAT_NESTING;
 			break;
 		case IIDR_PRODUCTID_ARM_MMU_700:
+			/* MMU-700 silently ignores CMD_PREFETCH_CONFIG */
+			smmu->options |= ARM_SMMU_OPT_SKIP_PREFETCH;
 			/* Arm erratum 2812531 */
 			smmu->features &= ~ARM_SMMU_FEAT_BTM;
 			smmu->options |= ARM_SMMU_OPT_CMDQ_FORCE_SYNC;
Signature · 1 line
2.45.0.118.g7fe29c98d7-goog
reviewer
#1 lore raw

Hi Daniel,

Quoted 3 lines · Daniel Mentz

Arm CoreLink MMU-600 and MMU-700 both silently ignore the CMD_PREFETCH_CONFIG command. Let's not waste cycles adding this command to the command queue if it is ignored anyway.

It is true that our implementations don't do anything with prefetch commands so far, however this is a valid architectural behaviour, and the intent of the quirk is really for buggy implementations where the commands erroneously fault.

TBH if saving cycles in arm_smmu_attach_dev() matters to you, then you're probably not going to like what's now queued in next that makes it absurdly overcomplicated with loads of indirect function calls...

Thanks,
Robin.

Quoted 27 lines
---
  drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +4 -0
index aa62f0ecd053..98f1c4b44ef3 100644
@@ -3684,6 +3684,8 @@ static void arm_smmu_device_iidr_probe(struct arm_smmu_device *smmu)
  	case IIDR_IMPLEMENTER_ARM:
  		switch (productid) {
  		case IIDR_PRODUCTID_ARM_MMU_600:
+			/* MMU-600 silently ignores CMD_PREFETCH_CONFIG */
+			smmu->options |= ARM_SMMU_OPT_SKIP_PREFETCH;
  			/* Arm erratum 1076982 */
  			if (variant == 0 && revision <= 2)
  				smmu->features &= ~ARM_SMMU_FEAT_SEV;
@@ -3692,6 +3694,8 @@ static void arm_smmu_device_iidr_probe(struct arm_smmu_device *smmu)
  				smmu->features &= ~ARM_SMMU_FEAT_NESTING;
  			break;
  		case IIDR_PRODUCTID_ARM_MMU_700:
+			/* MMU-700 silently ignores CMD_PREFETCH_CONFIG */
+			smmu->options |= ARM_SMMU_OPT_SKIP_PREFETCH;
  			/* Arm erratum 2812531 */
  			smmu->features &= ~ARM_SMMU_FEAT_BTM;
  			smmu->options |= ARM_SMMU_OPT_CMDQ_FORCE_SYNC;
#2 lore raw
Quoted 8 lines · Robin Murphy

Hi Daniel,

Quoted 3 lines · Daniel Mentz

Arm CoreLink MMU-600 and MMU-700 both silently ignore the CMD_PREFETCH_CONFIG command. Let's not waste cycles adding this command to the command queue if it is ignored anyway.

Quoted 8 lines

It is true that our implementations don't do anything with prefetch commands so far, however this is a valid architectural behaviour, and the intent of the quirk is really for buggy implementations where the commands erroneously fault.

TBH if saving cycles in arm_smmu_attach_dev() matters to you, then you're probably not going to like what's now queued in next that makes it absurdly overcomplicated with loads of indirect function calls...

Hi Robin,

That's fair. Given the low frequency with which arm_smmu_attach_dev() is called, it might not be worth the added complexity. Thanks for the feedback, though.

Quoted 31 lines

Thanks,
Robin.

Quoted 27 lines
---
  drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +4 -0
index aa62f0ecd053..98f1c4b44ef3 100644
@@ -3684,6 +3684,8 @@ static void arm_smmu_device_iidr_probe(struct arm_smmu_device *smmu)
      case IIDR_IMPLEMENTER_ARM:
              switch (productid) {
              case IIDR_PRODUCTID_ARM_MMU_600:
+                     /* MMU-600 silently ignores CMD_PREFETCH_CONFIG */
+                     smmu->options |= ARM_SMMU_OPT_SKIP_PREFETCH;
                      /* Arm erratum 1076982 */
                      if (variant == 0 && revision <= 2)
                              smmu->features &= ~ARM_SMMU_FEAT_SEV;
@@ -3692,6 +3694,8 @@ static void arm_smmu_device_iidr_probe(struct arm_smmu_device *smmu)
                              smmu->features &= ~ARM_SMMU_FEAT_NESTING;
                      break;
              case IIDR_PRODUCTID_ARM_MMU_700:
+                     /* MMU-700 silently ignores CMD_PREFETCH_CONFIG */
+                     smmu->options |= ARM_SMMU_OPT_SKIP_PREFETCH;
                      /* Arm erratum 2812531 */
                      smmu->features &= ~ARM_SMMU_FEAT_BTM;
                      smmu->options |= ARM_SMMU_OPT_CMDQ_FORCE_SYNC;