[PATCH v9 08/12] iommu/tegra241-cmdqv: Add a helper to quiesce VCMDQs

Jason Gunthorpe jgg at nvidia.com
Tue Aug 25 09:36:11 PDT 2026


> [ ... 73 lines skipped ... ]
> @@ -467,6 +487,14 @@ static int tegra241_cmdqv_drain_vintf0_lvcmdqs(struct arm_smmu_device *smmu)
>  	if (!READ_ONCE(vintf->enabled))
>  		return 0;
>  
> +	/*
> +	 * Gate all vCMDQs by setting the STOP_FLAG in a separate,
> +	 * initial loop to ensure no new commands can be submitted
> +	 * to any secondary queue while we are waiting to drain them.
> +	 */
> +	tegra241_cmdqv_quiesce_vintf0_lvcmdqs(smmu);
> +
> +	/* Now that all queues are safely gated, drain them sequentially. */
>  	for (lidx = 0; lidx < cmdqv->num_lvcmdqs_per_vintf; lidx++) {
>  		struct tegra241_vcmdq *vcmdq = vintf->lvcmdqs[lidx];
>  

 [Severity: High]
 If arm_smmu_queue_poll_until_empty() fails during this sequential drain, it
 returns an error without clearing the CMDQ_PROD_STOP_FLAG that was just set on
 all queues:

Make sense to me, the earlier patch added:

		ret = arm_smmu_queue_poll_until_empty(smmu, &vcmdq->cmdq.q);
		if (ret)
			break;

-- 
Jason



More information about the linux-arm-kernel mailing list