@@ -351,6 +351,15 @@ static struct arm_smmu_cmdq *arm_smmu_get_cmdq(struct arm_smmu_device *smmu)
351
351
return & smmu -> cmdq ;
352
352
}
353
353
354
+ static bool arm_smmu_cmdq_needs_busy_polling (struct arm_smmu_device * smmu ,
355
+ struct arm_smmu_cmdq * cmdq )
356
+ {
357
+ if (cmdq == & smmu -> cmdq )
358
+ return false;
359
+
360
+ return smmu -> options & ARM_SMMU_OPT_TEGRA241_CMDQV ;
361
+ }
362
+
354
363
static void arm_smmu_cmdq_build_sync_cmd (u64 * cmd , struct arm_smmu_device * smmu ,
355
364
struct arm_smmu_cmdq * cmdq , u32 prod )
356
365
{
@@ -369,6 +378,8 @@ static void arm_smmu_cmdq_build_sync_cmd(u64 *cmd, struct arm_smmu_device *smmu,
369
378
}
370
379
371
380
arm_smmu_cmdq_build_cmd (cmd , & ent );
381
+ if (arm_smmu_cmdq_needs_busy_polling (smmu , cmdq ))
382
+ u64p_replace_bits (cmd , CMDQ_SYNC_0_CS_NONE , CMDQ_SYNC_0_CS );
372
383
}
373
384
374
385
void __arm_smmu_cmdq_skip_err (struct arm_smmu_device * smmu ,
@@ -423,6 +434,8 @@ void __arm_smmu_cmdq_skip_err(struct arm_smmu_device *smmu,
423
434
424
435
/* Convert the erroneous command into a CMD_SYNC */
425
436
arm_smmu_cmdq_build_cmd (cmd , & cmd_sync );
437
+ if (arm_smmu_cmdq_needs_busy_polling (smmu , cmdq ))
438
+ u64p_replace_bits (cmd , CMDQ_SYNC_0_CS_NONE , CMDQ_SYNC_0_CS );
426
439
427
440
queue_write (Q_ENT (q , cons ), cmd , q -> ent_dwords );
428
441
}
@@ -706,7 +719,8 @@ static int arm_smmu_cmdq_poll_until_sync(struct arm_smmu_device *smmu,
706
719
struct arm_smmu_cmdq * cmdq ,
707
720
struct arm_smmu_ll_queue * llq )
708
721
{
709
- if (smmu -> options & ARM_SMMU_OPT_MSIPOLL )
722
+ if (smmu -> options & ARM_SMMU_OPT_MSIPOLL &&
723
+ !arm_smmu_cmdq_needs_busy_polling (smmu , cmdq ))
710
724
return __arm_smmu_cmdq_poll_until_msi (smmu , cmdq , llq );
711
725
712
726
return __arm_smmu_cmdq_poll_until_consumed (smmu , cmdq , llq );
0 commit comments