hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
....@@ -162,6 +162,18 @@
162162 q->cons = Q_OVF(q->cons) | Q_WRP(q, cons) | Q_IDX(q, cons);
163163 }
164164
165
+static void queue_sync_cons_ovf(struct arm_smmu_queue *q)
166
+{
167
+ struct arm_smmu_ll_queue *llq = &q->llq;
168
+
169
+ if (likely(Q_OVF(llq->prod) == Q_OVF(llq->cons)))
170
+ return;
171
+
172
+ llq->cons = Q_OVF(llq->prod) | Q_WRP(llq, llq->cons) |
173
+ Q_IDX(llq, llq->cons);
174
+ queue_sync_cons_out(q);
175
+}
176
+
165177 static int queue_sync_prod_in(struct arm_smmu_queue *q)
166178 {
167179 u32 prod;
....@@ -1380,8 +1392,7 @@
13801392 } while (!queue_empty(llq));
13811393
13821394 /* Sync our overflow flag, as we believe we're up to speed */
1383
- llq->cons = Q_OVF(llq->prod) | Q_WRP(llq, llq->cons) |
1384
- Q_IDX(llq, llq->cons);
1395
+ queue_sync_cons_ovf(q);
13851396 return IRQ_HANDLED;
13861397 }
13871398
....@@ -1439,9 +1450,7 @@
14391450 } while (!queue_empty(llq));
14401451
14411452 /* Sync our overflow flag, as we believe we're up to speed */
1442
- llq->cons = Q_OVF(llq->prod) | Q_WRP(llq, llq->cons) |
1443
- Q_IDX(llq, llq->cons);
1444
- queue_sync_cons_out(q);
1453
+ queue_sync_cons_ovf(q);
14451454 return IRQ_HANDLED;
14461455 }
14471456