7 #ifndef HAP_COMPUTE_RES_H_ 8 #define HAP_COMPUTE_RES_H_ 20 #define HAP_COMPUTE_RES_NOT_SUPPORTED 0x80000404 22 #define HAP_COMPUTE_RES_MAX_NUM_THREADS 16 33 unsigned long long attributes[8];
71 #define HAP_COMPUTE_RES_COOPERATIVE_PREEMPTION 1 77 #define HAP_COMPUTE_RES_AUTONOMOUS_PREEMPTION 2 85 #define HAP_COMPUTE_RES_THREADS_FOR_AUTONOMOUS_PREEMPTION 4 120 void (*lock)(
void *mutex);
124 void (*unlock)(
void *mutex);
149 int __attribute__((weak)) compute_resource_attr_init(
152 int __attribute__((weak)) compute_resource_attr_set_serialize(
154 unsigned char b_enable);
156 int __attribute__((weak)) compute_resource_attr_set_hmx_param(
158 unsigned char b_enable);
160 int __attribute__((weak)) compute_resource_attr_set_vtcm_param(
162 unsigned int vtcm_size,
163 unsigned char b_single_page);
165 int __attribute__((weak)) compute_resource_attr_set_vtcm_param_v2(
167 unsigned int vtcm_size,
168 unsigned int min_page_size,
169 unsigned int min_vtcm_size);
171 int __attribute__((weak)) compute_resource_attr_set_app_type(
173 unsigned int application_id);
175 int __attribute__((weak)) compute_resource_attr_set_cache_mode(
177 unsigned char b_enable);
179 int __attribute__((weak)) compute_resource_attr_set_release_callback(
181 int (*release_callback)(
182 unsigned int context_id,
183 void* client_context),
184 void* client_context);
186 void* __attribute__((weak)) compute_resource_attr_get_vtcm_ptr(
189 int __attribute__((weak)) compute_resource_attr_get_vtcm_ptr_v2(
192 unsigned int* vtcm_size);
194 int __attribute__((weak)) compute_resource_query_VTCM(
195 unsigned int application_id,
196 unsigned int* total_block_size,
198 unsigned int* avail_block_size,
201 unsigned int __attribute__((weak)) compute_resource_acquire(
203 unsigned int timeout_us);
205 int __attribute__((weak)) compute_resource_release(
206 unsigned int context_id);
208 int __attribute__((weak)) compute_resource_acquire_cached(
209 unsigned int context_id,
210 unsigned int timeout_us);
212 int __attribute__((weak)) compute_resource_release_cached(
213 unsigned int context_id);
215 int __attribute__((weak)) compute_resource_hmx_lock(
216 unsigned int context_id);
218 int __attribute__((weak)) compute_resource_hmx_unlock(
219 unsigned int context_id);
221 int __attribute__((weak)) compute_resource_check_release_request(
222 unsigned int context_id);
224 int __attribute__((weak)) compute_resource_hmx_lock2(
225 unsigned int context_id,
228 int __attribute__((weak)) compute_resource_hmx_unlock2(
229 unsigned int context_id,
232 int __attribute__((weak)) compute_resource_update_priority(
233 unsigned int context_id,
234 unsigned short priority);
236 int __attribute__((weak)) crm_hmx_lock3(
unsigned int context_id,
239 unsigned int timeout_us);
241 int __attribute__((weak)) crm_hmx_unlock3(
unsigned int context_id,
245 int __attribute__ ((weak)) crm_attr_set_vtcm_backup(
248 unsigned int buffer_size);
250 int __attribute__ ((weak)) crm_attr_set_threads(
252 unsigned int *threads,
253 unsigned int num_threads);
255 int __attribute__ ((weak)) crm_attr_set_vtcm_clear_on_release(
257 unsigned char enable);
260 unsigned int context_id,
261 unsigned int *threads,
262 unsigned int num_threads);
267 int __attribute__((weak)) crm_get_preempt_data(
unsigned int context_id,
270 int __attribute__((weak)) crm_tid_preemption_lock(
void);
272 int __attribute__((weak)) crm_tid_preemption_unlock(
void);
299 if (compute_resource_attr_init)
300 return compute_resource_attr_init(attr);
332 unsigned char b_serialize)
334 if (compute_resource_attr_set_serialize)
336 return compute_resource_attr_set_serialize(attr,
366 unsigned int vtcm_size,
367 unsigned char b_single_page)
369 if (compute_resource_attr_set_vtcm_param)
371 return compute_resource_attr_set_vtcm_param(attr,
396 if (compute_resource_attr_get_vtcm_ptr)
398 return compute_resource_attr_get_vtcm_ptr(attr);
432 unsigned int vtcm_size,
433 unsigned int min_page_size,
434 unsigned int min_vtcm_size)
436 if (compute_resource_attr_set_vtcm_param_v2)
438 return compute_resource_attr_set_vtcm_param_v2(attr,
479 unsigned int buffer_size)
481 if (crm_attr_set_vtcm_backup)
483 return crm_attr_set_vtcm_backup(attr, buffer, buffer_size);
516 unsigned int *threads,
517 unsigned int num_threads)
519 if (crm_attr_set_threads)
521 return crm_attr_set_threads(attr, threads, num_threads);
561 unsigned int context_id,
562 unsigned int *threads,
563 unsigned int num_threads)
565 if (crm_cached_set_threads)
567 return crm_cached_set_threads(command, context_id, threads, num_threads);
596 unsigned char enable)
598 if (crm_attr_set_vtcm_clear_on_release)
600 return crm_attr_set_vtcm_clear_on_release(attr, enable);
628 unsigned int* vtcm_size)
630 if (compute_resource_attr_get_vtcm_ptr_v2)
632 return compute_resource_attr_get_vtcm_ptr_v2(attr,
658 unsigned char b_enable)
660 if (compute_resource_attr_set_hmx_param)
662 return compute_resource_attr_set_hmx_param(attr,
700 unsigned char b_enable)
702 if (compute_resource_attr_set_cache_mode)
704 return compute_resource_attr_set_cache_mode(attr,
734 unsigned int application_id)
736 if (compute_resource_attr_set_app_type)
738 return compute_resource_attr_set_app_type(attr,
776 unsigned int application_id,
777 unsigned int* total_block_size,
779 unsigned int* avail_block_size,
782 if (compute_resource_query_VTCM)
784 return compute_resource_query_VTCM(application_id,
828 unsigned int context_id)
830 if (compute_resource_check_release_request)
832 return compute_resource_check_release_request(context_id);
856 unsigned int timeout_us)
858 if (compute_resource_acquire)
860 return compute_resource_acquire(attr, timeout_us);
881 if (compute_resource_release)
883 return compute_resource_release(context_id);
908 unsigned int context_id,
909 unsigned int timeout_us)
911 if (compute_resource_acquire_cached)
913 return compute_resource_acquire_cached(context_id, timeout_us);
937 if (compute_resource_release_cached)
939 return compute_resource_release_cached(context_id);
976 int (*release_callback)(
977 unsigned int context_id,
978 void* client_context),
979 void* client_context)
981 if (compute_resource_attr_set_release_callback)
983 return compute_resource_attr_set_release_callback(attr,
1019 unsigned short priority)
1021 if (compute_resource_update_priority)
1023 return compute_resource_update_priority(context_id, priority);
1076 if (crm_tid_preemption_lock)
1078 return crm_tid_preemption_lock();
1095 if (crm_tid_preemption_unlock)
1097 return crm_tid_preemption_unlock();
1132 if (crm_query_capability)
1134 return crm_query_capability(capability_id, data);
1161 if (crm_get_preempt_data)
1163 return crm_get_preempt_data(context_id, data);
1203 if (compute_resource_hmx_lock)
1205 return compute_resource_hmx_lock(context_id);
1230 if (compute_resource_hmx_unlock)
1232 return compute_resource_hmx_unlock(context_id);
1267 if (compute_resource_hmx_lock2)
1269 return compute_resource_hmx_lock2(context_id, type);
1297 if (compute_resource_hmx_unlock2)
1299 return compute_resource_hmx_unlock2(context_id, type);
1365 unsigned int timeout_us)
1369 return crm_hmx_lock3(context_id, type, hmx_mutex, timeout_us);
1398 if (crm_hmx_unlock3)
1400 return crm_hmx_unlock3(context_id, type, hmx_mutex);
1414 #endif //HAP_COMPUTE_RES_H_ unsigned int num_preemptions
Definition: HAP_compute_res.h:134
unsigned int num_pages
Definition: HAP_compute_res.h:41
void * mutex
Definition: HAP_compute_res.h:116
Definition: HAP_compute_res.h:39
Definition: HAP_compute_res.h:57
static int HAP_compute_res_attr_set_vtcm_backup(compute_res_attr_t *attr, void *buffer, unsigned int buffer_size)
Definition: HAP_compute_res.h:476
static int HAP_compute_res_hmx_lock2(unsigned int context_id, compute_res_hmx_type_t type)
Definition: HAP_compute_res.h:1264
unsigned long long preemption_overhead
Definition: HAP_compute_res.h:138
unsigned int block_size
Definition: HAP_compute_res.h:48
static int HAP_compute_res_cached_set_threads(compute_res_threads_cmd_id command, unsigned int context_id, unsigned int *threads, unsigned int num_threads)
Definition: HAP_compute_res.h:560
Definition: HAP_compute_res.h:102
Definition: HAP_compute_res.h:115
unsigned int page_list_len
Definition: HAP_compute_res.h:49
static unsigned int HAP_compute_res_acquire(compute_res_attr_t *attr, unsigned int timeout_us)
Definition: HAP_compute_res.h:854
static int HAP_compute_res_update_priority(unsigned int context_id, unsigned short priority)
Definition: HAP_compute_res.h:1018
static int HAP_compute_res_hmx_lock(unsigned int context_id)
Definition: HAP_compute_res.h:1201
static int HAP_compute_res_tid_preemption_lock(void)
Definition: HAP_compute_res.h:1074
static void * HAP_compute_res_attr_get_vtcm_ptr(compute_res_attr_t *attr)
Definition: HAP_compute_res.h:394
Definition: HAP_compute_res.h:58
static int HAP_compute_res_attr_set_serialize(compute_res_attr_t *attr, unsigned char b_serialize)
Definition: HAP_compute_res.h:330
Definition: HAP_compute_res.h:106
static int HAP_compute_res_hmx_lock3(unsigned int context_id, compute_res_hmx_type_t type, compute_res_hmx_mutex_t *hmx_mutex, unsigned int timeout_us)
Definition: HAP_compute_res.h:1362
static int HAP_compute_res_attr_set_release_callback(compute_res_attr_t *attr, int(*release_callback)(unsigned int context_id, void *client_context), void *client_context)
Definition: HAP_compute_res.h:974
static int HAP_compute_res_attr_set_threads(compute_res_attr_t *attr, unsigned int *threads, unsigned int num_threads)
Definition: HAP_compute_res.h:514
#define HAP_COMPUTE_RES_NOT_SUPPORTED
Definition: HAP_compute_res.h:20
static int HAP_compute_res_get_preempt_data(unsigned int context_id, compute_res_preempt_data_t *data)
Definition: HAP_compute_res.h:1158
static int HAP_compute_res_attr_get_vtcm_ptr_v2(compute_res_attr_t *attr, void **vtcm_ptr, unsigned int *vtcm_size)
Definition: HAP_compute_res.h:625
Definition: HAP_compute_res.h:65
static int HAP_compute_res_release_cached(unsigned int context_id)
Definition: HAP_compute_res.h:935
Definition: HAP_compute_res.h:47
static int HAP_compute_res_attr_set_vtcm_clear_on_release(compute_res_attr_t *attr, unsigned char enable)
Definition: HAP_compute_res.h:594
static int HAP_compute_res_attr_init(compute_res_attr_t *attr)
Definition: HAP_compute_res.h:297
static int HAP_compute_res_attr_set_vtcm_param(compute_res_attr_t *attr, unsigned int vtcm_size, unsigned char b_single_page)
Definition: HAP_compute_res.h:364
static int HAP_compute_res_attr_set_hmx_param(compute_res_attr_t *attr, unsigned char b_enable)
Definition: HAP_compute_res.h:656
static int HAP_compute_res_attr_set_app_type(compute_res_attr_t *attr, unsigned int application_id)
Definition: HAP_compute_res.h:732
Definition: HAP_compute_res.h:133
static int HAP_compute_res_attr_set_cache_mode(compute_res_attr_t *attr, unsigned char b_enable)
Definition: HAP_compute_res.h:698
compute_res_threads_cmd_id
Definition: HAP_compute_res.h:99
static int HAP_compute_res_hmx_unlock2(unsigned int context_id, compute_res_hmx_type_t type)
Definition: HAP_compute_res.h:1294
Definition: HAP_compute_res.h:32
static int HAP_compute_res_query_capability(compute_res_capability_id capability_id, unsigned int *data)
Definition: HAP_compute_res.h:1129
compute_res_hmx_type_t
Definition: HAP_compute_res.h:56
static int HAP_compute_res_hmx_unlock(unsigned int context_id)
Definition: HAP_compute_res.h:1228
static int HAP_compute_res_hmx_unlock3(unsigned int context_id, compute_res_hmx_type_t type, compute_res_hmx_mutex_t *hmx_mutex)
Definition: HAP_compute_res.h:1394
static int HAP_compute_res_query_VTCM(unsigned int application_id, unsigned int *total_block_size, compute_res_vtcm_page_t *total_block_layout, unsigned int *avail_block_size, compute_res_vtcm_page_t *avail_block_layout)
Definition: HAP_compute_res.h:775
static int HAP_compute_res_release(unsigned int context_id)
Definition: HAP_compute_res.h:879
unsigned int page_size
Definition: HAP_compute_res.h:40
static int HAP_compute_res_check_release_request(unsigned int context_id)
Definition: HAP_compute_res.h:827
unsigned long long preempted_duration
Definition: HAP_compute_res.h:136
compute_res_capability_id
Definition: HAP_compute_res.h:64
Definition: HAP_compute_res.h:100
static int HAP_compute_res_acquire_cached(unsigned int context_id, unsigned int timeout_us)
Definition: HAP_compute_res.h:907
static int HAP_compute_res_attr_set_vtcm_param_v2(compute_res_attr_t *attr, unsigned int vtcm_size, unsigned int min_page_size, unsigned int min_vtcm_size)
Definition: HAP_compute_res.h:430
static int HAP_compute_res_tid_preemption_unlock(void)
Definition: HAP_compute_res.h:1093