Skip to content

Commit bbf29f6

Browse files
Maxim MikityanskiySaeed Mahameed
authored andcommitted
net/mlx5: Remove spinlock support from mlx5_write64
As there is no user of mlx5_write64 that passes a spinlock to mlx5_write64, remove this functionality and simplify the function. Signed-off-by: Maxim Mikityanskiy <maximmi@mellanox.com> Reviewed-by: Eran Ben Elisha <eranbe@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
1 parent 38702cc commit bbf29f6

5 files changed

Lines changed: 13 additions & 26 deletions

File tree

‎drivers/infiniband/hw/mlx5/qp.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5015,7 +5015,7 @@ static int _mlx5_ib_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr,
50155015
wmb();
50165016

50175017
/* currently we support only regular doorbells */
5018-
mlx5_write64((__be32 *)ctrl, bf->bfreg->map + bf->offset, NULL);
5018+
mlx5_write64((__be32 *)ctrl, bf->bfreg->map + bf->offset);
50195019
/* Make sure doorbells don't leak out of SQ spinlock
50205020
* and reach the HCA out of order.
50215021
*/

‎drivers/net/ethernet/mellanox/mlx5/core/en.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ void mlx5e_notify_hw(struct mlx5_wq_cyc *wq, u16 pc,
916916
*/
917917
wmb();
918918

919-
mlx5_write64((__be32 *)ctrl, uar_map, NULL);
919+
mlx5_write64((__be32 *)ctrl, uar_map);
920920
}
921921

922922
static inline void mlx5e_cq_arm(struct mlx5e_cq *cq)

‎drivers/net/ethernet/mellanox/mlx5/core/fpga/conn.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ static void mlx5_fpga_conn_notify_hw(struct mlx5_fpga_conn *conn, void *wqe)
135135
*conn->qp.wq.sq.db = cpu_to_be32(conn->qp.sq.pc);
136136
/* Make sure that doorbell record is visible before ringing */
137137
wmb();
138-
mlx5_write64(wqe, conn->fdev->conn_res.uar->map + MLX5_BF_OFFSET, NULL);
138+
mlx5_write64(wqe, conn->fdev->conn_res.uar->map + MLX5_BF_OFFSET);
139139
}
140140

141141
static void mlx5_fpga_conn_post_send(struct mlx5_fpga_conn *conn,

‎include/linux/mlx5/cq.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ static inline void mlx5_cq_arm(struct mlx5_core_cq *cq, u32 cmd,
170170
doorbell[0] = cpu_to_be32(sn << 28 | cmd | ci);
171171
doorbell[1] = cpu_to_be32(cq->cqn);
172172

173-
mlx5_write64(doorbell, uar_page + MLX5_CQ_DOORBELL, NULL);
173+
mlx5_write64(doorbell, uar_page + MLX5_CQ_DOORBELL);
174174
}
175175

176176
static inline void mlx5_cq_hold(struct mlx5_core_cq *cq)

‎include/linux/mlx5/doorbell.h‎

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -36,38 +36,25 @@
3636
#define MLX5_BF_OFFSET 0x800
3737
#define MLX5_CQ_DOORBELL 0x20
3838

39-
#if BITS_PER_LONG == 64
4039
/* Assume that we can just write a 64-bit doorbell atomically. s390
4140
* actually doesn't have writeq() but S/390 systems don't even have
4241
* PCI so we won't worry about it.
42+
*
43+
* Note that the write is not atomic on 32-bit systems! In contrast to 64-bit
44+
* ones, it requires proper locking. mlx5_write64 doesn't do any locking, so use
45+
* it at your own discretion, protected by some kind of lock on 32 bits.
46+
*
47+
* TODO: use write{q,l}_relaxed()
4348
*/
4449

45-
static inline void mlx5_write64(__be32 val[2], void __iomem *dest,
46-
spinlock_t *doorbell_lock)
50+
static inline void mlx5_write64(__be32 val[2], void __iomem *dest)
4751
{
52+
#if BITS_PER_LONG == 64
4853
__raw_writeq(*(u64 *)val, dest);
49-
}
50-
5154
#else
52-
53-
/* Just fall back to a spinlock to protect the doorbell if
54-
* BITS_PER_LONG is 32 -- there's no portable way to do atomic 64-bit
55-
* MMIO writes.
56-
*/
57-
58-
static inline void mlx5_write64(__be32 val[2], void __iomem *dest,
59-
spinlock_t *doorbell_lock)
60-
{
61-
unsigned long flags;
62-
63-
if (doorbell_lock)
64-
spin_lock_irqsave(doorbell_lock, flags);
6555
__raw_writel((__force u32) val[0], dest);
6656
__raw_writel((__force u32) val[1], dest + 4);
67-
if (doorbell_lock)
68-
spin_unlock_irqrestore(doorbell_lock, flags);
69-
}
70-
7157
#endif
58+
}
7259

7360
#endif /* MLX5_DOORBELL_H */

0 commit comments

Comments
 (0)