Compute resource manager
Compute resource manager API
HMX lock and unlock

Functions

static int HAP_compute_res_hmx_lock (unsigned int context_id)
 
static int HAP_compute_res_hmx_unlock (unsigned int context_id)
 
static int HAP_compute_res_hmx_lock2 (unsigned int context_id, compute_res_hmx_type_t type)
 
static int HAP_compute_res_hmx_unlock2 (unsigned int context_id, compute_res_hmx_type_t type)
 

Detailed Description

Manage HMX lock once HMX has been acquired

Function Documentation

◆ HAP_compute_res_hmx_lock()

static int HAP_compute_res_hmx_lock ( unsigned int  context_id)
inlinestatic

Locks the HMX unit to the current thread and prepares the thread to execute HMX instructions. The client must have already acquired the HMX resource with HAP_compute_res_acquire() or HAP_compute_res_acquire_cached(), and context_id must refer to the corresponding resource manager context.

Before executing HMX instructions, a client must call this function from the same software thread used for HMX processing. Only the calling thread with a valid HMX lock may execute HMX instructions.

Supported starting with Lahaina.

Parameters
[in]context_idContext ID returned by HAP_compute_res_acquire().
Returns
0 upon success.
Nonzero upon failure.
HAP_COMPUTE_RES_NOT_SUPPORTED when not supported.

◆ HAP_compute_res_hmx_lock2()

static int HAP_compute_res_hmx_lock2 ( unsigned int  context_id,
compute_res_hmx_type_t  type 
)
inlinestatic

This function is an extension to HAP_compute_res_hmx_lock() with an additional option to lock HMX across multiple participating threads within a user process and timeshare the HMX resource (only one thread should be using HMX at a time).

Supported on latest chipsets(released after Palima).

Parameters
[in]context_idContext ID returned by HAP_compute_res_acquire().
[in]tyeHAP_COMPUTE_RES_HMX_NON_SHARED Analogous to HAP_compute_res_hmx_lock() HAP_COMPUTE_RES_HMX_SHARED Threads within a process can lock and timeshare the same HMX resource. When using this option, it is caller's responsibility to timeshare HMX (only one thread should use HMX at a time) among participating threads using HAP_COMPUTE_RES_HMX_SHARED option from the same process. Note that the sharing of HMX is allowed between the threads of the same user process. A single Context ID (context_id) should be used across the participating threads in a user process.
Returns
0 upon success.
Nonzero upon failure.
HAP_COMPUTE_RES_NOT_SUPPORTED when not supported.

◆ HAP_compute_res_hmx_unlock()

static int HAP_compute_res_hmx_unlock ( unsigned int  context_id)
inlinestatic

Unlocks the HMX unit from the calling thread. The HMX unit can then be locked to another thread or released with HAP_compute_res_release().

This function must be called from the same thread as the previous HMX_compute_res_hmx_lock() call.

Supported starting with Lahaina.

Parameters
[in]context_idContext ID returned by HAP_compute_res_acquire().
Returns
0 upon success.
Nonzero upon failure.
HAP_COMPUTE_RES_NOT_SUPPORTED when not supported.

◆ HAP_compute_res_hmx_unlock2()

static int HAP_compute_res_hmx_unlock2 ( unsigned int  context_id,
compute_res_hmx_type_t  type 
)
inlinestatic

To be used in conjunction with HAP_compute_res_hmx_lock2() to release a successfully locked HMX unit. 'type' provided should match with the type provided to a successful HAP_compute_res_hmx_lock2() call from this thread.

Supported on latest chipsets(released after Palima).

Parameters
[in]context_idContext ID returned by HAP_compute_res_acquire().
[in]typeShould be the same paramter used to lock HMX via HAP_compute_res_hmx_lock2()
Returns
0 upon success.
Nonzero upon failure.
HAP_COMPUTE_RES_NOT_SUPPORTED when not supported.