#include <uapi/drm/habanalabs_accel.h>
#include "habanalabs.h"
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
#define CB_VA_POOL_SIZE …
static int cb_map_mem(struct hl_ctx *ctx, struct hl_cb *cb)
{ … }
static void cb_unmap_mem(struct hl_ctx *ctx, struct hl_cb *cb)
{ … }
static void cb_fini(struct hl_device *hdev, struct hl_cb *cb)
{ … }
static void cb_do_release(struct hl_device *hdev, struct hl_cb *cb)
{ … }
static struct hl_cb *hl_cb_alloc(struct hl_device *hdev, u32 cb_size,
int ctx_id, bool internal_cb)
{ … }
struct hl_cb_mmap_mem_alloc_args { … };
static void hl_cb_mmap_mem_release(struct hl_mmap_mem_buf *buf)
{ … }
static int hl_cb_mmap_mem_alloc(struct hl_mmap_mem_buf *buf, gfp_t gfp, void *args)
{ … }
static int hl_cb_mmap(struct hl_mmap_mem_buf *buf,
struct vm_area_struct *vma, void *args)
{ … }
static struct hl_mmap_mem_buf_behavior cb_behavior = …;
int hl_cb_create(struct hl_device *hdev, struct hl_mem_mgr *mmg,
struct hl_ctx *ctx, u32 cb_size, bool internal_cb,
bool map_cb, u64 *handle)
{ … }
int hl_cb_destroy(struct hl_mem_mgr *mmg, u64 cb_handle)
{ … }
static int hl_cb_info(struct hl_mem_mgr *mmg,
u64 handle, u32 flags, u32 *usage_cnt, u64 *device_va)
{ … }
int hl_cb_ioctl(struct drm_device *ddev, void *data, struct drm_file *file_priv)
{ … }
struct hl_cb *hl_cb_get(struct hl_mem_mgr *mmg, u64 handle)
{ … }
void hl_cb_put(struct hl_cb *cb)
{ … }
struct hl_cb *hl_cb_kernel_create(struct hl_device *hdev, u32 cb_size,
bool internal_cb)
{ … }
int hl_cb_pool_init(struct hl_device *hdev)
{ … }
int hl_cb_pool_fini(struct hl_device *hdev)
{ … }
int hl_cb_va_pool_init(struct hl_ctx *ctx)
{ … }
void hl_cb_va_pool_fini(struct hl_ctx *ctx)
{ … }