aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/irdma/puda.c
diff options
context:
space:
mode:
authorShiraz Saleem <[email protected]>2023-07-11 17:52:51 +0000
committerLeon Romanovsky <[email protected]>2023-07-17 05:01:22 +0000
commit4984eb51453ff7eddee9e5ce816145be39c0ec5c (patch)
treef9d69baeb34327823104ff9c0dab987876faf0e0 /drivers/infiniband/hw/irdma/puda.c
parentRDMA/mlx4: Make check for invalid flags stricter (diff)
downloadkernel-4984eb51453ff7eddee9e5ce816145be39c0ec5c.tar.gz
kernel-4984eb51453ff7eddee9e5ce816145be39c0ec5c.zip
RDMA/irdma: Add missing read barriers
On code inspection, there are many instances in the driver where CEQE and AEQE fields written to by HW are read without guaranteeing that the polarity bit has been read and checked first. Add a read barrier to avoid reordering of loads on the CEQE/AEQE fields prior to checking the polarity bit. Fixes: 3f49d6842569 ("RDMA/irdma: Implement HW Admin Queue OPs") Signed-off-by: Shiraz Saleem <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Leon Romanovsky <[email protected]>
Diffstat (limited to 'drivers/infiniband/hw/irdma/puda.c')
-rw-r--r--drivers/infiniband/hw/irdma/puda.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/irdma/puda.c b/drivers/infiniband/hw/irdma/puda.c
index 4ec9639f1bdb..562531712ea4 100644
--- a/drivers/infiniband/hw/irdma/puda.c
+++ b/drivers/infiniband/hw/irdma/puda.c
@@ -230,6 +230,9 @@ static int irdma_puda_poll_info(struct irdma_sc_cq *cq,
if (valid_bit != cq_uk->polarity)
return -ENOENT;
+ /* Ensure CQE contents are read after valid bit is checked */
+ dma_rmb();
+
if (cq->dev->hw_attrs.uk_attrs.hw_rev >= IRDMA_GEN_2)
ext_valid = (bool)FIELD_GET(IRDMA_CQ_EXTCQE, qword3);
@@ -243,6 +246,9 @@ static int irdma_puda_poll_info(struct irdma_sc_cq *cq,
if (polarity != cq_uk->polarity)
return -ENOENT;
+ /* Ensure ext CQE contents are read after ext valid bit is checked */
+ dma_rmb();
+
IRDMA_RING_MOVE_HEAD_NOCHECK(cq_uk->cq_ring);
if (!IRDMA_RING_CURRENT_HEAD(cq_uk->cq_ring))
cq_uk->polarity = !cq_uk->polarity;