10#ifndef __SOF_LIB_VREGION_H__
11#define __SOF_LIB_VREGION_H__
45#if CONFIG_SOF_VREGIONS
181#include <zephyr/syscalls/vregion.h>
186 unsigned int use_count;
193static inline struct vregion *
vregion_create_map(uintptr_t *vreg_start,
size_t *vreg_size)
198static inline struct vregion *
vregion_get(
struct vregion *vr)
202static inline struct vregion *
vregion_put(
struct vregion *vr)
206static inline void *
vregion_alloc(
struct vregion *vr,
size_t size)
223static inline void vregion_free(
struct vregion *vr,
void *ptr) {}
225static inline void vregion_mem_info(
struct vregion *vr,
size_t *size, uintptr_t *start)
230static inline bool vregion_verify(
struct vregion *vr) {
return false;}
void vregion_info(struct vregion *vr)
Log virtual region memory usage.
void vregion_mem_info(struct vregion *vr, size_t *size, uintptr_t *start)
Retrieve virtual region memory base address and size.
void vregion_free(struct vregion *vr, void *ptr)
Free memory allocated from the specified virtual region.
vregion_mem_type
Memory allocation modes within a virtual memory region.
Definition vregion.h:36
struct vregion * vregion_create(size_t memsize)
Create a new virtual region instance.
void * vregion_alloc_align(struct vregion *vr, size_t size, size_t alignment)
Allocate aligned memory from the specified virtual region.
struct vregion * vregion_get(struct vregion *vr)
Increment virtual region's user count.
struct vregion * vregion_create_map(uintptr_t *vreg_start, size_t *vreg_size)
Create and map a new virtual region instance accessible by user-space domains.
void vregion_set_interim(struct vregion *vr)
Switch virtual region allocations to interim mode.
static void * vregion_alloc_coherent(struct vregion *vr, size_t size)
Allocate naturally aligned coherent (uncached) memory from the specified virtual region.
Definition vregion.h:143
void * vregion_alloc_coherent_align(struct vregion *vr, size_t size, size_t alignment)
Allocate aligned coherent (uncached) memory from the specified virtual region.
struct vregion * vregion_put(struct vregion *vr)
Decrement virtual region's user count or destroy it.
bool vregion_verify(struct vregion *vr)
Validate that a virtual region handle is genuine and isolated from user space.
static void * vregion_alloc(struct vregion *vr, size_t size)
Allocate memory from the specified virtual region.
Definition vregion.h:132
@ VREGION_MEM_TYPE_INVALID
Invalid memory type indicating initialization error or exhaustion.
Definition vregion.h:42
@ VREGION_MEM_TYPE_INTERIM
Interim allocation that can be freed dynamically (e.g.
Definition vregion.h:38
@ VREGION_MEM_TYPE_LIFETIME
Lifetime allocation that persists until region destruction (e.g.
Definition vregion.h:40