Re: [PATCH v2 03/11] iommu/arm-smmu-v3: Add arm_smmu_drain_queue_for_iopf() helper

From: Nicolin Chen

Date: Tue Jul 28 2026 - 18:18:02 EST


On Tue, Jul 28, 2026 at 09:16:49PM +0000, Pranjal Shrivastava wrote:
> The following is a unified drain_queue helper, that also attempts to
> address Sashiko's concerns. This applies on top of my runtime PM v9
> series [1], please see if it works for you:
>
> Subject: [PATCH] iommu/arm-smmu-v3: Add a unified arm_smmu_drain_queue() helper
>
> Introduce a unified arm_smmu_drain_queue() helper to replace queue
> specific polling loops. The helper handles both snapshot-based cohort
> draining (for IOPF) and full queue draining (required for Runtime PM).
>
> The Runtime PM explicitly gates the CMDQ (via CMDQ_PROD_STOP_FLAG) prior
> to draining, this allows a single, snapshot-based target to natively
> handle all drain scenarios.

[..]
> queue_poll_init(smmu, &qp);
> + qp.wfe = is_cmdq;

The callers of this drain() will be RPM and PRI, either of which
needs busy-waiting. So, I have added a different drain() helper.
I run Sashiko locally; it also gives a clean result.

Commit:
https://github.com/nicolinc/iommufd/commit/d10325ff40fd45c476bc98d484d8dd2cdc7fdf95

This will be in my pri-v3 series:
https://github.com/nicolinc/iommufd/commits/smmuv3_pri-v3

We have too many SMMUv3 under review now. So, I will post it once
some of them are merged.

Nicolin