Skip to content

Commit 33f15da

Browse files
Luo bindavem330
authored andcommitted
hinic: fix out-of-order excution in arm cpu
add read barrier in driver code to keep from reading other fileds in dma memory which is writable for hw until we have verified the memory is valid for driver Signed-off-by: Luo bin <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 614eaa9 commit 33f15da

File tree

4 files changed

+9
-0
lines changed

4 files changed

+9
-0
lines changed

drivers/net/ethernet/huawei/hinic/hinic_hw_cmdq.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,8 @@ static int cmdq_cmd_ceq_handler(struct hinic_cmdq *cmdq, u16 ci,
623623
if (!CMDQ_WQE_COMPLETED(be32_to_cpu(ctrl->ctrl_info)))
624624
return -EBUSY;
625625

626+
dma_rmb();
627+
626628
errcode = CMDQ_WQE_ERRCODE_GET(be32_to_cpu(status->status_info), VAL);
627629

628630
cmdq_sync_cmd_handler(cmdq, ci, errcode);

drivers/net/ethernet/huawei/hinic/hinic_hw_eqs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,8 @@ static void aeq_irq_handler(struct hinic_eq *eq)
235235
if (HINIC_EQ_ELEM_DESC_GET(aeqe_desc, WRAPPED) == eq->wrapped)
236236
break;
237237

238+
dma_rmb();
239+
238240
event = HINIC_EQ_ELEM_DESC_GET(aeqe_desc, TYPE);
239241
if (event >= HINIC_MAX_AEQ_EVENTS) {
240242
dev_err(&pdev->dev, "Unknown AEQ Event %d\n", event);

drivers/net/ethernet/huawei/hinic/hinic_rx.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,9 @@ static int rxq_recv(struct hinic_rxq *rxq, int budget)
350350
if (!rq_wqe)
351351
break;
352352

353+
/* make sure we read rx_done before packet length */
354+
dma_rmb();
355+
353356
cqe = rq->cqe[ci];
354357
status = be32_to_cpu(cqe->status);
355358
hinic_rq_get_sge(rxq->rq, rq_wqe, ci, &sge);

drivers/net/ethernet/huawei/hinic/hinic_tx.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,8 @@ static int free_tx_poll(struct napi_struct *napi, int budget)
622622
do {
623623
hw_ci = HW_CONS_IDX(sq) & wq->mask;
624624

625+
dma_rmb();
626+
625627
/* Reading a WQEBB to get real WQE size and consumer index. */
626628
sq_wqe = hinic_sq_read_wqebb(sq, &skb, &wqe_size, &sw_ci);
627629
if ((!sq_wqe) ||

0 commit comments

Comments
 (0)