linux/drivers/accel/habanalabs/common/context.c

// SPDX-License-Identifier: GPL-2.0

/*
 * Copyright 2016-2021 HabanaLabs, Ltd.
 * All Rights Reserved.
 */

#include "habanalabs.h"

#include <linux/slab.h>

static void encaps_handle_do_release(struct hl_cs_encaps_sig_handle *handle, bool put_hw_sob,
					bool put_ctx)
{}

void hl_encaps_release_handle_and_put_ctx(struct kref *ref)
{}

static void hl_encaps_release_handle_and_put_sob(struct kref *ref)
{}

void hl_encaps_release_handle_and_put_sob_ctx(struct kref *ref)
{}

static void hl_encaps_sig_mgr_init(struct hl_encaps_signals_mgr *mgr)
{}

static void hl_encaps_sig_mgr_fini(struct hl_device *hdev, struct hl_encaps_signals_mgr *mgr)
{}

static void hl_ctx_fini(struct hl_ctx *ctx)
{}

void hl_ctx_do_release(struct kref *ref)
{}

int hl_ctx_create(struct hl_device *hdev, struct hl_fpriv *hpriv)
{}

int hl_ctx_init(struct hl_device *hdev, struct hl_ctx *ctx, bool is_kernel_ctx)
{}

static int hl_ctx_get_unless_zero(struct hl_ctx *ctx)
{}

void hl_ctx_get(struct hl_ctx *ctx)
{}

int hl_ctx_put(struct hl_ctx *ctx)
{}

struct hl_ctx *hl_get_compute_ctx(struct hl_device *hdev)
{}

/*
 * hl_ctx_get_fence_locked - get CS fence under CS lock
 *
 * @ctx: pointer to the context structure.
 * @seq: CS sequences number
 *
 * @return valid fence pointer on success, NULL if fence is gone, otherwise
 *         error pointer.
 *
 * NOTE: this function shall be called with cs_lock locked
 */
static struct hl_fence *hl_ctx_get_fence_locked(struct hl_ctx *ctx, u64 seq)
{}

struct hl_fence *hl_ctx_get_fence(struct hl_ctx *ctx, u64 seq)
{}

/*
 * hl_ctx_get_fences - get multiple CS fences under the same CS lock
 *
 * @ctx: pointer to the context structure.
 * @seq_arr: array of CS sequences to wait for
 * @fence: fence array to store the CS fences
 * @arr_len: length of seq_arr and fence_arr
 *
 * @return 0 on success, otherwise non 0 error code
 */
int hl_ctx_get_fences(struct hl_ctx *ctx, u64 *seq_arr,
				struct hl_fence **fence, u32 arr_len)
{}

/*
 * hl_ctx_mgr_init - initialize the context manager
 *
 * @ctx_mgr: pointer to context manager structure
 *
 * This manager is an object inside the hpriv object of the user process.
 * The function is called when a user process opens the FD.
 */
void hl_ctx_mgr_init(struct hl_ctx_mgr *ctx_mgr)
{}

/*
 * hl_ctx_mgr_fini - finalize the context manager
 *
 * @hdev: pointer to device structure
 * @ctx_mgr: pointer to context manager structure
 *
 * This function goes over all the contexts in the manager and frees them.
 * It is called when a process closes the FD.
 */
void hl_ctx_mgr_fini(struct hl_device *hdev, struct hl_ctx_mgr *ctx_mgr)
{}