1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
3 * Copyright (c) 2021, Mellanox Technologies inc. All rights reserved.
11 extern const struct ib_device_ops mlx5_ib_dev_dm_ops;
12 extern const struct uapi_definition mlx5_ib_dm_defs[];
21 struct mlx5_ib_dm_op_entry {
22 struct mlx5_user_mmap_entry mentry;
24 struct mlx5_ib_dm_memic *dm;
28 struct mlx5_ib_dm_memic {
29 struct mlx5_ib_dm base;
30 struct mlx5_user_mmap_entry mentry;
32 struct mutex ops_xa_lock;
37 struct mlx5_ib_dm_icm {
38 struct mlx5_ib_dm base;
42 static inline struct mlx5_ib_dm *to_mdm(struct ib_dm *ibdm)
44 return container_of(ibdm, struct mlx5_ib_dm, ibdm);
47 static inline struct mlx5_ib_dm_memic *to_memic(struct ib_dm *ibdm)
49 return container_of(ibdm, struct mlx5_ib_dm_memic, base.ibdm);
52 static inline struct mlx5_ib_dm_icm *to_icm(struct ib_dm *ibdm)
54 return container_of(ibdm, struct mlx5_ib_dm_icm, base.ibdm);
57 struct ib_dm *mlx5_ib_alloc_dm(struct ib_device *ibdev,
58 struct ib_ucontext *context,
59 struct ib_dm_alloc_attr *attr,
60 struct uverbs_attr_bundle *attrs);
61 void mlx5_ib_dm_mmap_free(struct mlx5_ib_dev *dev,
62 struct mlx5_user_mmap_entry *mentry);
63 void mlx5_cmd_dealloc_memic(struct mlx5_dm *dm, phys_addr_t addr,
65 void mlx5_cmd_dealloc_memic_op(struct mlx5_dm *dm, phys_addr_t addr,
68 #endif /* _MLX5_IB_DM_H */