My Project
Modules | Classes | Macros | Typedefs | Enumerations
User-side Base Memory APIs

Modules

 User-side Base Defered Memory Coherency APIs
 

Classes

struct  base_mem_import_user_buffer
 
struct  base_import_handle
 

Macros

#define BASE_MEM_FLAGS_NR_BITS   19
 Number of bits used as flags for base memory management. More...
 
#define BASE_MEM_FLAGS_OUTPUT_MASK   BASE_MEM_NEED_MMAP
 
#define BASE_MEM_FLAGS_INPUT_MASK   (((1 << BASE_MEM_FLAGS_NR_BITS) - 1) & ~BASE_MEM_FLAGS_OUTPUT_MASK)
 
#define BASE_MEM_FLAGS_MODIFIABLE
 
#define BASE_MEM_INVALID_HANDLE   ((base_mem_handle) { {BASEP_MEM_INVALID_HANDLE} })
 Invalid memory handle. More...
 
#define BASE_MEM_WRITE_ALLOC_PAGES_HANDLE   ((base_mem_handle) { {BASEP_MEM_WRITE_ALLOC_PAGES_HANDLE} })
 Special write-alloc memory handle. More...
 
#define BASEP_MEM_INVALID_HANDLE   (0ull << 12)
 
#define BASE_MEM_MMU_DUMP_HANDLE   (1ull << 12)
 
#define BASE_MEM_TRACE_BUFFER_HANDLE   (2ull << 12)
 
#define BASE_MEM_MAP_TRACKING_HANDLE   (3ull << 12)
 
#define BASEP_MEM_WRITE_ALLOC_PAGES_HANDLE   (4ull << 12)
 
#define BASE_MEM_COOKIE_BASE   (64ul << 12)
 
#define BASE_MEM_FIRST_FREE_ADDRESS
 
#define BASE_MEM_MASK_4GB   0xfffff000UL
 
#define KBASE_COOKIE_MASK   ~1UL /* bit 0 is reserved */
 

Typedefs

typedef u32 base_mem_alloc_flags
 Memory allocation, access/hint flags. More...
 
typedef enum base_mem_import_type base_mem_import_type
 
typedef enum base_backing_threshold_status base_backing_threshold_status
 Result codes of changing the size of the backing store allocated to a tmem region.
 
typedef struct base_import_handle base_import_handle
 

Enumerations

enum  {
  BASE_MEM_PROT_CPU_RD = (1U << 0), BASE_MEM_PROT_CPU_WR = (1U << 1), BASE_MEM_PROT_GPU_RD = (1U << 2), BASE_MEM_PROT_GPU_WR = (1U << 3),
  BASE_MEM_PROT_GPU_EX = (1U << 4), BASE_MEM_GROW_ON_GPF = (1U << 9), BASE_MEM_COHERENT_SYSTEM = (1U << 10), BASE_MEM_COHERENT_LOCAL = (1U << 11),
  BASE_MEM_CACHED_CPU = (1U << 12), BASE_MEM_SAME_VA = (1U << 13), BASE_MEM_NEED_MMAP = (1U << 14), BASE_MEM_COHERENT_SYSTEM_REQUIRED = (1U << 15),
  BASE_MEM_SECURE = (1U << 16), BASE_MEM_DONT_NEED = (1U << 17), BASE_MEM_IMPORT_SHARED = (1U << 18)
}
 Memory allocation, access/hint flags. More...
 
enum  base_mem_import_type { BASE_MEM_IMPORT_TYPE_INVALID = 0, BASE_MEM_IMPORT_TYPE_UMP = 1, BASE_MEM_IMPORT_TYPE_UMM = 2, BASE_MEM_IMPORT_TYPE_USER_BUFFER = 3 }
 
enum  base_backing_threshold_status { BASE_BACKING_THRESHOLD_OK = 0, BASE_BACKING_THRESHOLD_ERROR_NOT_GROWABLE = -1, BASE_BACKING_THRESHOLD_ERROR_OOM = -2, BASE_BACKING_THRESHOLD_ERROR_INVALID_ARGUMENTS = -4 }
 Result codes of changing the size of the backing store allocated to a tmem region. More...
 

Detailed Description

Macro Definition Documentation

◆ BASE_MEM_FIRST_FREE_ADDRESS

#define BASE_MEM_FIRST_FREE_ADDRESS
Value:
((BITS_PER_LONG << 12) + \
BASE_MEM_COOKIE_BASE)

◆ BASE_MEM_FLAGS_INPUT_MASK

#define BASE_MEM_FLAGS_INPUT_MASK   (((1 << BASE_MEM_FLAGS_NR_BITS) - 1) & ~BASE_MEM_FLAGS_OUTPUT_MASK)

A mask for all input bits, including IN/OUT bits.

◆ BASE_MEM_FLAGS_MODIFIABLE

#define BASE_MEM_FLAGS_MODIFIABLE
Value:
BASE_MEM_COHERENT_LOCAL)
Definition: mali_base_kernel.h:182
Definition: mali_base_kernel.h:165

A mask for all the flags which are modifiable via the base_mem_set_flags interface.

◆ BASE_MEM_FLAGS_NR_BITS

#define BASE_MEM_FLAGS_NR_BITS   19

Number of bits used as flags for base memory management.

Must be kept in sync with the base_mem_alloc_flags flags

◆ BASE_MEM_FLAGS_OUTPUT_MASK

#define BASE_MEM_FLAGS_OUTPUT_MASK   BASE_MEM_NEED_MMAP

A mask for all output bits, excluding IN/OUT bits.

◆ BASE_MEM_INVALID_HANDLE

#define BASE_MEM_INVALID_HANDLE   ((base_mem_handle) { {BASEP_MEM_INVALID_HANDLE} })

Invalid memory handle.

Return value from functions returning base_mem_handle on error.

Warning
base_mem_handle_new_invalid must be used instead of this macro in C++ code or other situations where compound literals cannot be used.

◆ BASE_MEM_WRITE_ALLOC_PAGES_HANDLE

#define BASE_MEM_WRITE_ALLOC_PAGES_HANDLE   ((base_mem_handle) { {BASEP_MEM_WRITE_ALLOC_PAGES_HANDLE} })

Special write-alloc memory handle.

A special handle is used to represent a region where a special page is mapped with a write-alloc cache setup, typically used when the write result of the GPU isn't needed, but the GPU must write anyway.

Warning
base_mem_handle_new_write_alloc must be used instead of this macro in C++ code or other situations where compound literals cannot be used.

Typedef Documentation

◆ base_import_handle

Handle to represent imported memory object. Simple opague handle to imported memory, can't be used with anything but base_external_resource_init to bind to an atom.

◆ base_mem_alloc_flags

typedef u32 base_mem_alloc_flags

Memory allocation, access/hint flags.

A combination of MEM_PROT/MEM_HINT flags must be passed to each allocator in order to determine the best cache policy. Some combinations are of course invalid (eg MEM_PROT_CPU_WR | MEM_HINT_CPU_RD), which defines a write-only region on the CPU side, which is heavily read by the CPU... Other flags are only meaningful to a particular allocator. More flags can be added to this list, as long as they don't clash (see BASE_MEM_FLAGS_NR_BITS for the number of the first free bit).

◆ base_mem_import_type

enum base_mem_import_type - Memory types supported by base_mem_import

: Invalid type : UMP import. Handle type is ump_secure_id. : UMM import. Handle type is a file descriptor (int) : User buffer import. Handle is a base_mem_import_user_buffer

Each type defines what the supported handle type is.

If any new type is added here ARM must be contacted to allocate a numeric value for it. Do not just add a new type without synchronizing with ARM as future releases from ARM might include other new types which could clash with your custom types.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Memory allocation, access/hint flags.

See base_mem_alloc_flags.

Enumerator
BASE_MEM_PROT_CPU_RD 

Read access CPU side

BASE_MEM_PROT_CPU_WR 

Write access CPU side

BASE_MEM_PROT_GPU_RD 

Read access GPU side

BASE_MEM_PROT_GPU_WR 

Write access GPU side

BASE_MEM_PROT_GPU_EX 

Execute allowed on the GPU side

BASE_MEM_GROW_ON_GPF 

Grow backing store on GPU Page Fault

BASE_MEM_COHERENT_SYSTEM 

Page coherence Outer shareable, if available

BASE_MEM_COHERENT_LOCAL 

Page coherence Inner shareable

BASE_MEM_CACHED_CPU 

Should be cached on the CPU

BASE_MEM_SAME_VA 

Must have same VA on both the GPU and the CPU

BASE_MEM_NEED_MMAP 

Must call mmap to acquire a GPU address for the alloc

BASE_MEM_COHERENT_SYSTEM_REQUIRED 

Page coherence Outer shareable, required.

BASE_MEM_SECURE 

Secure memory

BASE_MEM_DONT_NEED 

Not needed physical memory

BASE_MEM_IMPORT_SHARED 

Must use shared CPU/GPU zone (SAME_VA zone) but doesn't require the addresses to be the same

◆ base_backing_threshold_status

Result codes of changing the size of the backing store allocated to a tmem region.

Enumerator
BASE_BACKING_THRESHOLD_OK 

Resize successful

BASE_BACKING_THRESHOLD_ERROR_NOT_GROWABLE 

Not a growable tmem object

BASE_BACKING_THRESHOLD_ERROR_OOM 

Increase failed due to an out-of-memory condition

BASE_BACKING_THRESHOLD_ERROR_INVALID_ARGUMENTS 

Invalid arguments (not tmem, illegal size request, etc.)

◆ base_mem_import_type

enum base_mem_import_type - Memory types supported by base_mem_import

: Invalid type : UMP import. Handle type is ump_secure_id. : UMM import. Handle type is a file descriptor (int) : User buffer import. Handle is a base_mem_import_user_buffer

Each type defines what the supported handle type is.

If any new type is added here ARM must be contacted to allocate a numeric value for it. Do not just add a new type without synchronizing with ARM as future releases from ARM might include other new types which could clash with your custom types.