Lines Matching refs:core

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