CDSP L2 cache locking manager API. More...
Go to the source code of this file.
Functions | |
void * | HAP_cache_lock (unsigned int size, unsigned long long *paddr_ptr) |
int | HAP_cache_unlock (void *vaddr_ptr) |
int | HAP_cache_lock_addr (void *vaddr_ptr, unsigned int size) |
int | HAP_cache_unlock_addr (void *vaddr_ptr) |
int | HAP_query_avail_cachelock (void) |
int | HAP_query_total_cachelock (void) |
CDSP L2 cache locking manager API.
void* HAP_cache_lock | ( | unsigned int | size, |
unsigned long long * | paddr_ptr | ||
) |
Allocates a memory buffer, locks it in L2 cache, and returns the locked virtual address.
[in] | size | Memory size (in bytes) to lock. |
[out] | paddr_ptr | Pointer to unsigned long long variable to get the locked 64-bit physical address upon success. NULL if the allocation and cache lock failed. |
void*
Virtual address of the locked memory region. int HAP_cache_lock_addr | ( | void * | vaddr_ptr, |
unsigned int | size | ||
) |
Locks the cache for a given virtual address and memory size (in bytes).
Align the address and size to 32 bytes. The size should not be more than 64 KB, and at any point of time, only one such request is honored (this restriction has been removed from SM8250 onwards).
Use this function to lock an existing memory block, for example, to lock a code segment or data buffer. Note that whenever possible, it is preferable to let the driver allocate the memory to be locked in L2 via the HAP_cache_lock API, as it can often avoid the fragmentation likely to occur when the user provides the memory ranges to be locked.
[in] | vaddr_ptr | Virtual address of the memory block to lock; should be 32-byte aligned. |
[in] | size | Memory size (in bytes) to lock; should be 32-byte aligned. The maximum size limit is 64 KB. From SM8250, this size limit is the same as HAP_cache_lock(). |
int HAP_cache_unlock | ( | void * | vaddr_ptr | ) |
Unlocks cache and deallocates memory for a virtual address returned by the corresponding HAP_cache_lock() call.
[in] | vaddr_ptr | Virtual address of the memory block to unlock. |
int HAP_cache_unlock_addr | ( | void * | vaddr_ptr | ) |
Unlocks the cache for a given virtual address.
Use this function together with HAP_cache_lock_addr().
[in] | vaddr_ptr | Virtual address of the memory block to unlock. |
int HAP_query_avail_cachelock | ( | void | ) |
Queries the API to get the size of largest contiguous memory block available for cache locking.
int HAP_query_total_cachelock | ( | void | ) |
Queries the API to get the total locked cache size.