Lines Matching full:core

13 #include "core.h"
50 int hfi_core_init(struct venus_core *core) in hfi_core_init() argument
54 mutex_lock(&core->lock); in hfi_core_init()
56 if (core->state >= CORE_INIT) in hfi_core_init()
59 reinit_completion(&core->done); in hfi_core_init()
61 ret = core->ops->core_init(core); in hfi_core_init()
65 ret = wait_for_completion_timeout(&core->done, TIMEOUT); in hfi_core_init()
73 if (core->error != HFI_ERR_NONE) { in hfi_core_init()
78 core->state = CORE_INIT; in hfi_core_init()
80 mutex_unlock(&core->lock); in hfi_core_init()
84 int hfi_core_deinit(struct venus_core *core, bool blocking) in hfi_core_deinit() argument
88 mutex_lock(&core->lock); in hfi_core_deinit()
90 if (core->state == CORE_UNINIT) in hfi_core_deinit()
93 empty = list_empty(&core->instances); in hfi_core_deinit()
101 mutex_unlock(&core->lock); in hfi_core_deinit()
102 wait_var_event(&core->insts_count, in hfi_core_deinit()
103 !atomic_read(&core->insts_count)); in hfi_core_deinit()
104 mutex_lock(&core->lock); in hfi_core_deinit()
107 if (!core->ops) in hfi_core_deinit()
110 ret = core->ops->core_deinit(core); in hfi_core_deinit()
113 core->state = CORE_UNINIT; in hfi_core_deinit()
116 mutex_unlock(&core->lock); in hfi_core_deinit()
120 int hfi_core_suspend(struct venus_core *core) in hfi_core_suspend() argument
122 if (core->state != CORE_INIT) in hfi_core_suspend()
125 return core->ops->suspend(core); in hfi_core_suspend()
128 int hfi_core_resume(struct venus_core *core, bool force) in hfi_core_resume() argument
130 if (!force && core->state != CORE_INIT) in hfi_core_resume()
133 return core->ops->resume(core); in hfi_core_resume()
136 int hfi_core_trigger_ssr(struct venus_core *core, u32 type) in hfi_core_trigger_ssr() argument
138 return core->ops->core_trigger_ssr(core, type); in hfi_core_trigger_ssr()
141 int hfi_core_ping(struct venus_core *core) in hfi_core_ping() argument
145 mutex_lock(&core->lock); in hfi_core_ping()
147 ret = core->ops->core_ping(core, 0xbeef); in hfi_core_ping()
151 ret = wait_for_completion_timeout(&core->done, TIMEOUT); in hfi_core_ping()
157 if (core->error != HFI_ERR_NONE) in hfi_core_ping()
160 mutex_unlock(&core->lock); in hfi_core_ping()
180 struct venus_core *core = inst->core; in hfi_session_create() local
191 mutex_lock(&core->lock); in hfi_session_create()
193 if (test_bit(0, &inst->core->sys_error)) { in hfi_session_create()
198 max = atomic_add_unless(&core->insts_count, 1, in hfi_session_create()
199 core->max_sessions_supported); in hfi_session_create()
203 list_add_tail(&inst->list, &core->instances); in hfi_session_create()
208 mutex_unlock(&core->lock); in hfi_session_create()
216 struct venus_core *core = inst->core; in hfi_session_init() local
217 const struct hfi_ops *ops = core->ops; in hfi_session_init()
221 * If core shutdown is in progress or if we are in system in hfi_session_init()
225 mutex_lock(&core->lock); in hfi_session_init()
226 if (!core->ops || test_bit(0, &inst->core->sys_error)) { in hfi_session_init()
227 mutex_unlock(&core->lock); in hfi_session_init()
230 mutex_unlock(&core->lock); in hfi_session_init()
254 struct venus_core *core = inst->core; in hfi_session_destroy() local
256 mutex_lock(&core->lock); in hfi_session_destroy()
258 if (atomic_dec_and_test(&core->insts_count)) in hfi_session_destroy()
259 wake_up_var(&core->insts_count); in hfi_session_destroy()
260 mutex_unlock(&core->lock); in hfi_session_destroy()
266 const struct hfi_ops *ops = inst->core->ops; in hfi_session_deinit()
275 if (test_bit(0, &inst->core->sys_error)) in hfi_session_deinit()
297 const struct hfi_ops *ops = inst->core->ops; in hfi_session_start()
300 if (test_bit(0, &inst->core->sys_error)) in hfi_session_start()
324 const struct hfi_ops *ops = inst->core->ops; in hfi_session_stop()
327 if (test_bit(0, &inst->core->sys_error)) in hfi_session_stop()
351 struct venus_core *core = inst->core; in hfi_session_continue() local
353 if (test_bit(0, &inst->core->sys_error)) in hfi_session_continue()
356 if (core->res->hfi_version == HFI_VERSION_1XX) in hfi_session_continue()
359 return core->ops->session_continue(inst); in hfi_session_continue()
365 const struct hfi_ops *ops = inst->core->ops; in hfi_session_abort()
368 if (test_bit(0, &inst->core->sys_error)) in hfi_session_abort()
387 const struct hfi_ops *ops = inst->core->ops; in hfi_session_load_res()
390 if (test_bit(0, &inst->core->sys_error)) in hfi_session_load_res()
413 const struct hfi_ops *ops = inst->core->ops; in hfi_session_unload_res()
416 if (test_bit(0, &inst->core->sys_error)) in hfi_session_unload_res()
440 const struct hfi_ops *ops = inst->core->ops; in hfi_session_flush()
443 if (test_bit(0, &inst->core->sys_error)) in hfi_session_flush()
464 const struct hfi_ops *ops = inst->core->ops; in hfi_session_set_buffers()
466 if (test_bit(0, &inst->core->sys_error)) in hfi_session_set_buffers()
475 const struct hfi_ops *ops = inst->core->ops; in hfi_session_unset_buffers()
478 if (test_bit(0, &inst->core->sys_error)) in hfi_session_unset_buffers()
500 const struct hfi_ops *ops = inst->core->ops; in hfi_session_get_property()
503 if (test_bit(0, &inst->core->sys_error)) in hfi_session_get_property()
527 const struct hfi_ops *ops = inst->core->ops; in hfi_session_set_property()
529 if (test_bit(0, &inst->core->sys_error)) in hfi_session_set_property()
541 const struct hfi_ops *ops = inst->core->ops; in hfi_session_process_buf()
543 if (test_bit(0, &inst->core->sys_error)) in hfi_session_process_buf()
558 struct venus_core *core = dev_id; in hfi_isr_thread() local
560 return core->ops->isr_thread(core); in hfi_isr_thread()
565 struct venus_core *core = dev; in hfi_isr() local
567 return core->ops->isr(core); in hfi_isr()
570 int hfi_create(struct venus_core *core, const struct hfi_core_ops *ops) in hfi_create() argument
575 atomic_set(&core->insts_count, 0); in hfi_create()
576 core->core_ops = ops; in hfi_create()
577 core->state = CORE_UNINIT; in hfi_create()
578 init_completion(&core->done); in hfi_create()
579 pkt_set_version(core->res->hfi_version); in hfi_create()
581 return venus_hfi_create(core); in hfi_create()
584 void hfi_destroy(struct venus_core *core) in hfi_destroy() argument
586 venus_hfi_destroy(core); in hfi_destroy()
589 void hfi_reinit(struct venus_core *core) in hfi_reinit() argument
591 venus_hfi_queues_reinit(core); in hfi_reinit()