Compute resource manager
Compute resource manager API
Manage attributes

Functions

static int HAP_compute_res_attr_init (compute_res_attr_t *attr)
 
static int HAP_compute_res_attr_set_serialize (compute_res_attr_t *attr, unsigned char b_serialize)
 
static int HAP_compute_res_attr_set_vtcm_param (compute_res_attr_t *attr, unsigned int vtcm_size, unsigned char b_single_page)
 
static void * HAP_compute_res_attr_get_vtcm_ptr (compute_res_attr_t *attr)
 
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)
 
static int HAP_compute_res_attr_get_vtcm_ptr_v2 (compute_res_attr_t *attr, void **vtcm_ptr, unsigned int *vtcm_size)
 
static int HAP_compute_res_attr_set_hmx_param (compute_res_attr_t *attr, unsigned char b_enable)
 
static int HAP_compute_res_attr_set_cache_mode (compute_res_attr_t *attr, unsigned char b_enable)
 
static int HAP_compute_res_attr_set_app_type (compute_res_attr_t *attr, unsigned int application_id)
 

Detailed Description

Manage parameters affecting the requested shared resources

Function Documentation

◆ HAP_compute_res_attr_get_vtcm_ptr()

static void* HAP_compute_res_attr_get_vtcm_ptr ( compute_res_attr_t attr)
inlinestatic

Reads the VTCM memory pointer from the given attribute structure.

On a successful VTCM resource request placed via HAP_compute_res_acquire() using HAP_compute_res_attr_set_vtcm_param(), a user can invoke this helper function to retrieve the allocated VTCM address by passing the same attribute structure used in the respective HAP_compute_res_acquire() call.

Parameters
[in]attrPointer to compute the resource attribute structure compute_res_attr_t.
Returns
Void pointer to the allocated VTCM section.
0 signifies no allocation.

◆ HAP_compute_res_attr_get_vtcm_ptr_v2()

static int HAP_compute_res_attr_get_vtcm_ptr_v2 ( compute_res_attr_t attr,
void **  vtcm_ptr,
unsigned int *  vtcm_size 
)
inlinestatic

On a successful VTCM resource request placed via HAP_compute_res_acquire() or HAP_compute_res_acquire_cached() using HAP_compute_res_attr_set_vtcm_param_v2(), users invoke this helper function to retrieve the allocated VTCM address and size by passing the same attribute structure used in the respective acquire call.

Supported starting with Lahaina.

Parameters
[in]attrPointer to compute the resource attribute structure compute_res_attr_t.
[out]vtcm_ptrAssigned VTCM address; NULL for no allocation.
[out]vtcm_sizeSize of the allocated VTCM memory from the assigned pointer.
Returns
0 upon success.
Nonzero upon failure.
HAP_COMPUTE_RES_NOT_SUPPORTED when not supported.

◆ HAP_compute_res_attr_init()

static int HAP_compute_res_attr_init ( compute_res_attr_t attr)
inlinestatic

Initializes the attribute structure for a resource request.

The user must call this function before setting any specific resource property via other helper functions.

Parameters
[in]attrPointer to compute resource attribute structure, compute_res_attr_t.
Returns
0 upon success.
Nonzero upon failure.
HAP_COMPUTE_RES_NOT_SUPPORTED if unsupported.

◆ HAP_compute_res_attr_set_app_type()

static int HAP_compute_res_attr_set_app_type ( compute_res_attr_t attr,
unsigned int  application_id 
)
inlinestatic

Sets the application ID parameter in the resource structure used to select the appropriate VTCM partition.

If this application ID parameter is not explicitly set, the default partition is selected. The default application ID (0) is set when the attribute structure is initialized. Application IDs are defined in the kernel device tree configuration. If the given ID is not specified in the tree, the primary VTCM partition is selected.

Call this function after HAP_compute_res_attr_init().

Supported starting with Lahaina.

Parameters
[in]attrPointer to compute the resource attribute structure compute_res_attr_t.
[in]application_idApplication ID used to specify the VTCM partition.
Returns
0 upon success.
Nonzero upon failure.

◆ HAP_compute_res_attr_set_cache_mode()

static int HAP_compute_res_attr_set_cache_mode ( compute_res_attr_t attr,
unsigned char  b_enable 
)
inlinestatic

Sets or resets cacheable mode in the attribute structure.

A cacheable request allows users to allocate and release based on the context ID of the request. On a successful cacheable request via HAP_compute_res_acquire(), users get the same VTCM address and size across calls of HAP_compute_res_acquire_cached() and HAP_compute_res_release_cached() until the context is explicitly released via HAP_compute_res_release().

After a successful cacheable request via HAP_compute_res_acquire(), users can get the assigned VTCM pointer (if requested) by passing the attribute structure to HAP_compute_res_attr_get_vtcm_ptr() for v1 and HAP_compute_res_attr_get_vtcm_ptr_v2() for v2, and they must call HAP_compute_res_acquire_cached() before using the assigned resources.

Supported starting with Lahaina.

Parameters
[in]attrPointer to compute resource attribute structure, compute_res_attr_t.
[in]b_enable0 - Do not request cacheable mode (resets option).
1 - Request cacheable mode (sets option).
Returns
0 upon success.
Nonzero upon failure.
HAP_COMPUTE_RES_NOT_SUPPORTED when not supported.

◆ HAP_compute_res_attr_set_hmx_param()

static int HAP_compute_res_attr_set_hmx_param ( compute_res_attr_t attr,
unsigned char  b_enable 
)
inlinestatic

On chipsets with HMX, sets/resets the HMX request parameter in the attribute structure for acquiring the HMX resource.

Call this function after HAP_compute_res_attr_init().

Supported starting with Lahaina.

Parameters
[in]attrPointer to compute the resource attribute structure, compute_res_attr_t.
[in]b_enable0 - do not request HMX resource (resets option).
1 - request HMX resource (sets option).
Returns
0 upon success.
Nonzero upon failure.

◆ HAP_compute_res_attr_set_serialize()

static int HAP_compute_res_attr_set_serialize ( compute_res_attr_t attr,
unsigned char  b_serialize 
)
inlinestatic

Sets or clears the serialization option in the request resource structure.

Serialization allows participating use cases to run with mutually exclusive access to the entire cDSP which helps, for example, in avoiding cache thrashing while trying to run simultaneously on different hardware threads. Participating use cases issue blocking acquires on the serialization resource when ready to run, and each runs in turn when it is granted that resource.

Acquiring the serialization resource only ensures mutual exclusion from other cooperating use cases that also block on acquisition of that resource, it does not guarantee exclusion from concurrent use cases that do not request the serialization resource.

Parameters
[in]attrPointer to the compute resource attribute structure, compute_res_attr_t.
[in]b_serialize1 (TRUE) to participate in serialization.
0 (FALSE) otherwise.
Returns
0 upon success
Nonzero upon failure.

◆ HAP_compute_res_attr_set_vtcm_param()

static int HAP_compute_res_attr_set_vtcm_param ( compute_res_attr_t attr,
unsigned int  vtcm_size,
unsigned char  b_single_page 
)
inlinestatic

Sets VTCM request parameters in the provided resource attribute structure.

The user calls this function to request the specified VTCM size in the acquire call. These VTCM request attributes are reset to 0 (no VTCM request) in the resource attribute structure by HAP_compute_res_attr_init().

Parameters
[in]attrPointer to compute resource attribute structure, compute_res_attr_t.
[in]vtcm_sizeSize of the VTCM request in bytes; 0 if VTCM allocation is not required.
[in]b_single_page1 - Requested VTCM size to be allocated in a single page.
0 - No page requirement (allocation can spread across multiple pages. VTCM manager always attempts the best fit).
Returns
0 upon success.
Non-zero upon failure.

◆ HAP_compute_res_attr_set_vtcm_param_v2()

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 
)
inlinestatic

Sets an extended set of VTCM request parameters in the attribute structure, specifically VTCM Size, the minimum required page size, and the minimum required VTCM size.

This function cannot be used with HAP_compute_res_attr_set_vtcm_param(). Call this function after HAP_compute_res_attr_init().

Supported starting with Lahaina.

Parameters
[in]attrPointer to compute the resource attribute structure, compute_res_attr_t.
[in]vtcm_sizeSize of the VTCM request in bytes. 0 if VTCM allocation is NOT required.
[in]min_page_sizeMinimum page size required in bytes. Valid pages include 4 KB, 16 KB, 64 KB, 256 KB, 1 MB, 4 MB, 16 MB. Setting 0 will select best possible fit (least page mappings)
[in]min_vtcm_sizeMinimum VTCM size in bytes, if the specified size (vtcm_size) is not available. 0 means the size is an absolute requirement.
Returns
0 for success.
Non-zero for failure.
HAP_COMPUTE_RES_NOT_SUPPORTED when not supported.