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

Pranjal Shrivastava praan at google.com
Tue Jun 2 05:12:16 PDT 2026


On Mon, Jun 01, 2026 at 10:25:41PM -0700, Daniel Mentz wrote:
> 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
>

Hmm.. that wouldn't work for impl-specific CMDQs as we STOP and drain
them together in a single function.. maybe I'll factor out setting the
STOP_FLAG on impl-specific queues as another impl_op, gate the queues
first, wait for lock == 0 and then drain_queues?

> > +
> > +       /* 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");

Thanks,
Praan



More information about the linux-arm-kernel mailing list