dm.h 1.3 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
/*
 * Copyright (c) 2021, Mellanox Technologies inc. All rights reserved.
 */

#ifndef _MLX5_IB_DM_H
#define _MLX5_IB_DM_H

#include "mlx5_ib.h"

extern const struct ib_device_ops mlx5_ib_dev_dm_ops;
extern const struct uapi_definition mlx5_ib_dm_defs[];

struct mlx5_ib_dm {
	struct ib_dm		ibdm;
	u32			type;
17
	phys_addr_t		dev_addr;
18
	size_t			size;
19 20 21 22
};

struct mlx5_ib_dm_memic {
	struct mlx5_ib_dm           base;
23 24 25
	struct mlx5_user_mmap_entry mentry;
};

26 27 28 29 30
struct mlx5_ib_dm_icm {
	struct mlx5_ib_dm      base;
	u32                    obj_id;
};

31 32 33 34 35
static inline struct mlx5_ib_dm *to_mdm(struct ib_dm *ibdm)
{
	return container_of(ibdm, struct mlx5_ib_dm, ibdm);
}

36 37 38 39 40 41 42 43 44 45
static inline struct mlx5_ib_dm_memic *to_memic(struct ib_dm *ibdm)
{
	return container_of(ibdm, struct mlx5_ib_dm_memic, base.ibdm);
}

static inline struct mlx5_ib_dm_icm *to_icm(struct ib_dm *ibdm)
{
	return container_of(ibdm, struct mlx5_ib_dm_icm, base.ibdm);
}

46 47 48 49 50 51
struct ib_dm *mlx5_ib_alloc_dm(struct ib_device *ibdev,
			       struct ib_ucontext *context,
			       struct ib_dm_alloc_attr *attr,
			       struct uverbs_attr_bundle *attrs);
void mlx5_cmd_dealloc_memic(struct mlx5_dm *dm, phys_addr_t addr,
			    u64 length);
52 53
void mlx5_cmd_dealloc_memic_op(struct mlx5_dm *dm, phys_addr_t addr,
			       u8 operation);
54 55

#endif /* _MLX5_IB_DM_H */