[PATCH rdma] IB/mlx5: Fix linkage failure on 32-bit arches
From: Alexander Lobakin
Date: Fri Feb 14 2020 - 14:13:30 EST
Commit f164be8c0366 ("IB/mlx5: Extend caps stage to handle VAR
capabilities") introduced a straight "/" division of the u64
variable "bar_size", which emits an __udivdi3() libgcc call on
32-bit arches and certain GCC versions:
error: "__udivdi3" [drivers/infiniband/hw/mlx5/mlx5_ib.ko] undefined! [1]
Replace it with the corresponding div_u64() call.
Compile-tested on ARCH=mips 32r2el_defconfig BOARDS=ocelot.
[1] https://lore.kernel.org/linux-mips/CAMuHMdXM9S1VkFMZ8eDAyZR6EE4WkJY215Lcn2qdOaPeadF+EQ@xxxxxxxxxxxxxx/
Fixes: f164be8c0366 ("IB/mlx5: Extend caps stage to handle VAR
capabilities")
Signed-off-by: Alexander Lobakin <alobakin@xxxxxxxx>
---
drivers/infiniband/hw/mlx5/main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index e874d688d040..c47530e4d202 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -6545,7 +6545,8 @@ static int mlx5_ib_init_var_table(struct mlx5_ib_dev *dev)
doorbell_bar_offset);
bar_size = (1ULL << log_doorbell_bar_size) * 4096;
var_table->stride_size = 1ULL << log_doorbell_stride;
- var_table->num_var_hw_entries = bar_size / var_table->stride_size;
+ var_table->num_var_hw_entries = div_u64(bar_size,
+ var_table->stride_size);
mutex_init(&var_table->bitmap_lock);
var_table->bitmap = bitmap_zalloc(var_table->num_var_hw_entries,
GFP_KERNEL);
--
2.25.0