[PATCH v8 09/12] iommu/arm-smmu-v3: Implement pm_runtime & system sleep ops

Daniel Mentz danielmentz at google.com
Mon Jun 1 22:25:41 PDT 2026


On Mon, Jun 1, 2026 at 2:59 PM Pranjal Shrivastava <praan at google.com> wrote:

> +       /* Drain the CMDQs */
> +       ret = arm_smmu_drain_queues(smmu);
> +       if (ret)
> +               dev_warn(smmu->dev, "failed to drain queues, forcing suspend\n");

Can arm_smmu_drain_queues() be called after cmdq->lock is 0? I think
that way we can be sure that no other thread updates smmu->cmdq.q.cons

> +
> +       /* Wait for cmdq->lock == 0 to ensure last CMDQ_CONS_REG is written */
> +       timeout = ARM_SMMU_SUSPEND_TIMEOUT_US;
> +       while (atomic_read(&cmdq->lock) != 0 && --timeout)
> +               udelay(1);
> +
> +       /* Timing out here implies misconfigured Runtime PM or broken devlinks */
> +       if (!timeout)
> +               dev_err(smmu->dev, "cmdq lock != 0, forcing suspend. Polling CPUs may fault.\n");



More information about the linux-arm-kernel mailing list