git: 96d9a91d6aaf - main - iw_cxgbe: use __raw_write*() to allow write-combining

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Tue, 15 Sep 2026 14:47:51 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=96d9a91d6aafa862f6e0740bbaa6cbc936ad5e19

commit 96d9a91d6aafa862f6e0740bbaa6cbc936ad5e19
Author:     Steve Wise <swise@opengridcomputing.com>
AuthorDate: 2018-03-10 20:37:56 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2026-09-15 14:22:39 +0000

    iw_cxgbe: use __raw_write*() to allow write-combining
    
    pio_copy() is suppose to be used for write-combining work requests.
    However, for some architectures like powerpc and arm64, write[ql]()
    include an explicit memory barrier which will flush the WC buffer and
    render this path useless. To prevent that use the relaxed variant.
    
    Sponsored by:   Chelsio Communications
---
 sys/dev/cxgbe/iw_cxgbe/t4.h | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/sys/dev/cxgbe/iw_cxgbe/t4.h b/sys/dev/cxgbe/iw_cxgbe/t4.h
index 88089213c22b..67efd3effe4b 100644
--- a/sys/dev/cxgbe/iw_cxgbe/t4.h
+++ b/sys/dev/cxgbe/iw_cxgbe/t4.h
@@ -490,7 +490,7 @@ static inline void pio_copy(u64 __iomem *dst, u64 *src)
 	int count = 8;
 
 	while (count) {
-		writeq(*src, dst);
+		__raw_writeq(*src, dst);
 		src++;
 		dst++;
 		count--;
@@ -512,9 +512,8 @@ t4_ring_sq_db(struct t4_wq *wq, u16 inc, union t4_wr *wqe, u8 wc)
 	} else {
 		CTR2(KTR_IW_CXGBE, "%s: DB wq->sq.pidx = %d",
 				__func__, wq->sq.pidx);
-		writel(V_PIDX_T5(inc) | V_QID(wq->sq.bar2_qid),
-				(void __iomem *)((u64)wq->sq.bar2_va +
-					SGE_UDB_KDOORBELL));
+		__raw_writel(V_PIDX_T5(inc) | V_QID(wq->sq.bar2_qid),
+			     (char __iomem *)wq->sq.bar2_va + SGE_UDB_KDOORBELL);
 	}
 
 	/* Flush user doorbell area writes. */
@@ -536,9 +535,8 @@ t4_ring_rq_db(struct t4_wq *wq, u16 inc, union t4_recv_wr *wqe, u8 wc)
 	} else {
 		CTR2(KTR_IW_CXGBE, "%s: DB wq->rq.pidx = %d",
 				__func__, wq->rq.pidx);
-		writel(V_PIDX_T5(inc) | V_QID(wq->rq.bar2_qid),
-				(void __iomem *)((u64)wq->rq.bar2_va +
-					SGE_UDB_KDOORBELL));
+		__raw_writel(V_PIDX_T5(inc) | V_QID(wq->rq.bar2_qid),
+			     (char __iomem *)wq->rq.bar2_va + SGE_UDB_KDOORBELL);
 	}
 
 	/* Flush user doorbell area writes. */