Message ID | 495d0124-f5e4-04a4-f6e7-d0934bd38196@arm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 12cdc5e50675..78ba8269c44c 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c @@ -959,14 +959,14 @@ static u32 arm_smmu_cmdq_insert_cmd(struct arm_smmu_device *smmu, u64 *cmd) struct arm_smmu_queue *q = &smmu->cmdq.q; bool wfe = !!(smmu->features & ARM_SMMU_FEAT_SEV); + if (Q_IDX(q, q->prod + 1) == 0) + smmu->cmdq.generation++; + while (queue_insert_raw(q, cmd) == -ENOSPC) { if (queue_poll_cons(q, wfe)) dev_err_ratelimited(smmu->dev, "CMDQ timeout\n"); } - if (Q_IDX(q, q->prod) == 0) - smmu->cmdq.generation++; - return q->prod; }