The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=43767135124c9f4c2c0308aaa787135c699a8370
commit 43767135124c9f4c2c0308aaa787135c699a8370 Author: Ariel Ehrenberg <[email protected]> AuthorDate: 2026-07-28 10:39:02 +0000 Commit: Konstantin Belousov <[email protected]> CommitDate: 2026-09-16 14:12:08 +0000 fixup! libmlx5: Fix ABI break from revising the UAR pointer Actually provide the two ABI versions this commit describes: export mlx5dv_init_obj@@MLX5_1.2 with the current behaviour and a compat mlx5dv_init_obj@MLX5_1.0 that restores the historical 'void **' value, and list the symbol under both versions in libmlx5.map. Binaries linked against the old version keep resolving. Sponsored by: NVidia networking MFC after: 1 month --- contrib/ofed/libmlx5/libmlx5.map | 1 + contrib/ofed/libmlx5/mlx5.c | 32 +++++++++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/contrib/ofed/libmlx5/libmlx5.map b/contrib/ofed/libmlx5/libmlx5.map index 976b8cf35849..e7fe9f416970 100644 --- a/contrib/ofed/libmlx5/libmlx5.map +++ b/contrib/ofed/libmlx5/libmlx5.map @@ -3,6 +3,7 @@ MLX5_1.0 { global: mlx5dv_query_device; + mlx5dv_init_obj; local: *; }; diff --git a/contrib/ofed/libmlx5/mlx5.c b/contrib/ofed/libmlx5/mlx5.c index ef6c833c5a31..b3eba331d89f 100644 --- a/contrib/ofed/libmlx5/mlx5.c +++ b/contrib/ofed/libmlx5/mlx5.c @@ -750,7 +750,7 @@ static int mlx5dv_get_srq(struct ibv_srq *srq_in, return 0; } -int mlx5dv_init_obj(struct mlx5dv_obj *obj, uint64_t obj_type) +static int _mlx5dv_init_obj(struct mlx5dv_obj *obj, uint64_t obj_type) { int ret = 0; @@ -766,6 +766,36 @@ int mlx5dv_init_obj(struct mlx5dv_obj *obj, uint64_t obj_type) return ret; } +/* + * mlx5dv_init_obj is exported with two ABI versions so that binaries linked + * against the historical symbol keep working after the mlx5dv_cq UAR field was + * revised. The current implementation (MLX5_1.2) leaves mlx5dv_cq.cq_uar set + * to the CQ's UAR register (a 'void *'). The MLX5_1.0 compat wrapper restores + * the historical 'void **' value at that location. + */ +int mlx5dv_init_obj_1_2(struct mlx5dv_obj *obj, uint64_t obj_type); +int mlx5dv_init_obj_1_0(struct mlx5dv_obj *obj, uint64_t obj_type); + +int mlx5dv_init_obj_1_2(struct mlx5dv_obj *obj, uint64_t obj_type) +{ + return _mlx5dv_init_obj(obj, obj_type); +} + +int mlx5dv_init_obj_1_0(struct mlx5dv_obj *obj, uint64_t obj_type) +{ + int ret; + + ret = _mlx5dv_init_obj(obj, obj_type); + if (!ret && (obj_type & MLX5DV_OBJ_CQ)) { + /* ABI version 1.0 returns the 'void **' at this location. */ + obj->cq.out->cq_uar = to_mctx(obj->cq.in->context)->uar; + } + return ret; +} + +__asm__(".symver mlx5dv_init_obj_1_2, mlx5dv_init_obj@@MLX5_1.2"); +__asm__(".symver mlx5dv_init_obj_1_0, mlx5dv_init_obj@MLX5_1.0"); + static void adjust_uar_info(struct mlx5_device *mdev, struct mlx5_context *context, struct mlx5_alloc_ucontext_resp resp)
