According to the ib spec:
If the CI supports the Base Memory Management Extensions defined in this
specification, the L_Key format must consist of:
24 bit index in the most significant bits of the R_Key, and
8 bit key in the least significant bits of the R_Key
Through a successful Allocate L_Key verb invocation, the CI must let the
consumer own the key portion of the returned R_Key
Therefore, when creating a mkey using DEVX, the consumer is allowed to
change the key part. The kernel should compare only the index part of a
R_Key to determine equality with another R_Key.
Adding capability in order not to break backward compatibility.
Fixes: 534fd7aac56a ("IB/mlx5: Manage indirection mkey upon DEVX flow for ODP")
Link: https://lore.kernel.org/r/3d669aacea85a3a15c3b3b953b3eaba3f80ef9be.1659255945.git.leonro@nvidia.com
Signed-off-by: Aharon Landau <aharonl@nvidia.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
        if (MLX5_CAP_GEN(dev->mdev, drain_sigerr))
                resp->comp_mask |= MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_SQD2RTS;
 
+       resp->comp_mask |=
+               MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_MKEY_UPDATE_TAG;
+
        return 0;
 }
 
 
 {
        if (!mmkey)
                return false;
-       if (mmkey->type == MLX5_MKEY_MW)
+       if (mmkey->type == MLX5_MKEY_MW ||
+           mmkey->type == MLX5_MKEY_INDIRECT_DEVX)
                return mlx5_base_mkey(mmkey->key) == mlx5_base_mkey(key);
        return mmkey->key == key;
 }
 
        MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_ECE               = 1UL << 2,
        MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_SQD2RTS           = 1UL << 3,
        MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_REAL_TIME_TS      = 1UL << 4,
+       MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_MKEY_UPDATE_TAG   = 1UL << 5,
 };
 
 enum mlx5_user_cmds_supp_uhw {