API Reference Manual  1.45.0
api/spec/shared_memory.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright (c) 2013-2018 Linaro Limited
3  * Copyright (c) 2019-2021 Nokia
4  */
5 
12 #ifndef ODP_API_SPEC_SHARED_MEMORY_H_
13 #define ODP_API_SPEC_SHARED_MEMORY_H_
14 #include <odp/visibility_begin.h>
15 #include <odp/api/init.h>
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
54 #define ODP_SHM_PROC 0x2
55 
63 #define ODP_SHM_SINGLE_VA 0x4
64 
71 #define ODP_SHM_EXPORT 0x08
72 
80 #define ODP_SHM_HP 0x10
81 
90 #define ODP_SHM_HW_ACCESS 0x20
91 
99 #define ODP_SHM_NO_HP 0x40
100 
104 typedef struct odp_shm_info_t {
106  const char *name;
107 
109  void *addr;
110 
112  uint64_t size;
113 
115  uint64_t page_size;
116 
118  uint32_t flags;
119 
127  uint32_t num_seg;
128 
130 
134 typedef struct odp_shm_segment_info_t {
136  uintptr_t addr;
137 
142  uint64_t iova;
143 
148  uint64_t pa;
149 
151  uint64_t len;
152 
154 
158 typedef struct odp_shm_capability_t {
163  uint32_t max_blocks;
164 
169  uint64_t max_size;
170 
175  uint64_t max_align;
176 
183  uint32_t flags;
184 
186 
198 
222 odp_shm_t odp_shm_reserve(const char *name, uint64_t size, uint64_t align, uint32_t flags);
223 
236 
245 odp_shm_t odp_shm_lookup(const char *name);
246 
267 odp_shm_t odp_shm_import(const char *remote_name,
268  odp_instance_t odp_inst,
269  const char *local_name);
270 
280 
293 
312 int odp_shm_segment_info(odp_shm_t shm, uint32_t index, uint32_t num,
313  odp_shm_segment_info_t info[]);
314 
318 void odp_shm_print_all(void);
319 
329 
341 uint64_t odp_shm_to_u64(odp_shm_t shm);
342 
347 #ifdef __cplusplus
348 }
349 #endif
350 
351 #include <odp/visibility_end.h>
352 #endif
ODP initialization.
uint64_t odp_instance_t
ODP instance ID.
void odp_shm_print_all(void)
Print all shared memory blocks.
odp_shm_t odp_shm_lookup(const char *name)
Lookup for a block of shared memory.
int odp_shm_free(odp_shm_t shm)
Free a contiguous block of shared memory.
int odp_shm_info(odp_shm_t shm, odp_shm_info_t *info)
Shared memory block info.
void odp_shm_print(odp_shm_t shm)
Print shared memory block info.
struct odp_shm_info_t odp_shm_info_t
Shared memory block info.
struct odp_shm_capability_t odp_shm_capability_t
Shared memory capabilities.
struct odp_shm_segment_info_t odp_shm_segment_info_t
SHM memory segment info.
int odp_shm_capability(odp_shm_capability_t *capa)
Query shared memory capabilities.
int odp_shm_segment_info(odp_shm_t shm, uint32_t index, uint32_t num, odp_shm_segment_info_t info[])
SHM block segmentation information.
void * odp_shm_addr(odp_shm_t shm)
Shared memory block address.
odp_shm_t odp_shm_reserve(const char *name, uint64_t size, uint64_t align, uint32_t flags)
Reserve a contiguous block of shared memory.
odp_shm_t odp_shm_import(const char *remote_name, odp_instance_t odp_inst, const char *local_name)
Import a block of shared memory, exported by another ODP instance.
uint64_t odp_shm_to_u64(odp_shm_t shm)
Get printable value for an odp_shm_t.
Shared memory capabilities.
uint32_t max_blocks
Maximum number of shared memory blocks.
uint32_t flags
Supported shared memory flags.
uint64_t max_size
Maximum memory block size in bytes.
uint64_t max_align
Maximum memory block alignment in bytes.
Shared memory block info.
uint32_t flags
ODP_SHM_* flags.
const char * name
Block name.
uint32_t num_seg
Number of memory segments.
uint64_t page_size
Memory page size.
void * addr
Block address.
uint64_t size
Block size in bytes.
SHM memory segment info.
uint64_t len
Segment length in bytes.
uint64_t pa
Segment start address in physical address space.
uintptr_t addr
Segment start address (virtual)
uint64_t iova
Segment start address in IO virtual address (IOVA) space.