Re: [PATCH v11 12/16] iommu/tegra241-cmdqv: Add a helper to quiesce VCMDQs

From: Nicolin Chen

Date: Wed Sep 30 2026 - 15:24:10 EST


On Tue, Sep 29, 2026 at 03:45:06AM +0000, Pranjal Shrivastava wrote:
> The tegra241-cmdqv driver supports vCMDQs which need to be quiesced using
> the STOP_FLAG. The current driver implementation only uses VINTF0 for
> vCMDQs owned by the kernel which need to be stopped. Add a helper that
> sets the CMDQ_PROD_STOP_FLAG on these vCMDQs.
>
> Consolidate this logic by renaming the implementation hook to
> quiesce_and_drain_queues and ensuring that the tegra241-cmdqv driver
> gates all active local virtual queues before starting the drain loop.
> Additionally, clear the STOP_FLAG in tegra241_vcmdq_hw_init() as a part
> of tegra241_cmdqv_hw_reset().

This whole suspend routine is missing the CMDQV flags.

vintf->enabled and vcmdq->enabled must be cleared when the system
does suspend, via tegra241_vintf_hw_deinit(vintf0).

So, instead of quiesce_and_drain_queues, perhaps we need a suspend
callback that:
- set stop flags to all lvcmdqs
- wait for all lvcmdqs being drained
- hw_deinit vintf0 and its lvcmdqs

> @@ -566,7 +632,6 @@ static int tegra241_vcmdq_hw_init(struct tegra241_vcmdq *vcmdq)
>
> /* Configure and enable VCMDQ */
> writeq_relaxed(vcmdq->cmdq.q.q_base, REG_VCMDQ_PAGE1(vcmdq, BASE));
> -
> /*
> * HW Registers reset to 0 when power-cycled. Restore them from their
> * SW copies to prevent executing stale/ghost commands after resume.

Meaningless line removal.

Nicolin