Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / drivers / infiniband / hw / mlx5 / dm.h
blob9674a80d8d7028b8ef7710894c6966aaff522d42
1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2 /*
3 * Copyright (c) 2021, Mellanox Technologies inc. All rights reserved.
4 */
6 #ifndef _MLX5_IB_DM_H
7 #define _MLX5_IB_DM_H
9 #include "mlx5_ib.h"
11 extern const struct ib_device_ops mlx5_ib_dev_dm_ops;
12 extern const struct uapi_definition mlx5_ib_dm_defs[];
14 struct mlx5_ib_dm {
15 struct ib_dm ibdm;
16 u32 type;
17 phys_addr_t dev_addr;
18 size_t size;
21 struct mlx5_ib_dm_op_entry {
22 struct mlx5_user_mmap_entry mentry;
23 phys_addr_t op_addr;
24 struct mlx5_ib_dm_memic *dm;
25 u8 op;
28 struct mlx5_ib_dm_memic {
29 struct mlx5_ib_dm base;
30 struct mlx5_user_mmap_entry mentry;
31 struct xarray ops;
32 struct mutex ops_xa_lock;
33 struct kref ref;
34 size_t req_length;
37 struct mlx5_ib_dm_icm {
38 struct mlx5_ib_dm base;
39 u32 obj_id;
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,
64 u64 length);
65 void mlx5_cmd_dealloc_memic_op(struct mlx5_dm *dm, phys_addr_t addr,
66 u8 operation);
68 #endif /* _MLX5_IB_DM_H */