VESHM is a feature to share VE memory between VE processes.
More...
|
int | ve_shared_mem_open (void *vemva, size_t size, int syncnum, long long mode_flag) |
| Register a VESHM area. More...
|
|
void * | ve_shared_mem_attach (pid_t pid, void *veshm_vemva, size_t size, int syncnum, long long mode_flag) |
| Attach a VESHM area. More...
|
|
int | ve_shared_mem_detach (void *veshm_addr, long long mode_flag) |
| Detach a VESHM area. More...
|
|
int | ve_shared_mem_close (void *vemva, size_t size, int syncnum, long long mode_flag) |
| Unregister a VESHM area. More...
|
|
int | ve_get_pgmode (long long mode_flag, int pid, void *address) |
| Get the page size of a specified process and a specified address. More...
|
|
VESHM is a feature to share VE memory between VE processes.
The APIs of VESHM are low-level and are intended to be called by upper layer software such as NEC MPI. They are not intended to be called by a user program. Please use NEC MPI to share data on VE memory between VE processes.
If you want to use VESHM APIs directly to implement upper layer software, include "veshm.h" header.
- Note
- User programs linked with NEC MPI should not use these APIs directly, because the MPI library use them internally.
int ve_shared_mem_open |
( |
void * |
vemva, |
|
|
size_t |
size, |
|
|
int |
syncnum, |
|
|
long long |
mode_flag |
|
) |
| |
Register a VESHM area.
- Parameters
-
[in] | vemva | Virtual address of VESHM area |
[in] | size | Size in byte |
[in] | syncnum | Pair number of PCISYR/PCISMR
- Physical register number: 0-3 (Supported 0 only)
|
[in] | mode_flag | Mode flag which is ORed value of the following macros
- VE_REGISTER_PCI: Set up a memory as VESHM and register the memory with PCIATB. The values of vemva and size need to be aligned on the PCIATB page size (the PCIATB page size of almost all of the models of VEs is 64 MB). A caller process specifies this flag to allow VE processes on remote VEs and the local VE to access the specified memory.
- VE_REGISTER_NONE: Set up a memory as VESHM and NOT register the memory with PCIATB. The values of vemva and size need to be aligned on the page size of VE memory(default:64MB). A caller process specifies this flag to allow VE processes on the local VE to access the specified memory.
- VE_PCISYNC: Enable synchronization. VE_REGISTER_PCI must be specified.
- VE_SHM_RO: Set "Read Only" permission.
|
- Return values
-
0 | On success |
-1 | On failure (set errno)
- EINVAL Invalid value. (E.g., it is negative value, or too big)
- EINVAL Invalid value. (Different paze size from PCIATB)
- ENOMEM Creating a VESHM failed.
- EACCESS Permission denied.
- ECANCELED Operation canceled.
|
void* ve_shared_mem_attach |
( |
pid_t |
pid, |
|
|
void * |
veshm_vemva, |
|
|
size_t |
size, |
|
|
int |
syncnum, |
|
|
long long |
mode_flag |
|
) |
| |
Attach a VESHM area.
- Parameters
-
[in] | pid | Pid of an owner process |
[in] | veshm_vemva | Virtual address of VESHM area |
[in] | size | Size in byte |
[in] | syncnum | Pair number of PCISYR/PCISMR
- Physical register number: 0-3 (Supported 0 only)
|
[in] | mode_flag | Mode flag which is ORed value of one of the following macros and the same value as the argument of ve_shared_mem_open()
- VE_REGISTER_VEHVA: VESHM on a remote VE will be attached to VEHVA (using DMAATB). A caller process specifies this flag to access the memory registered by a VE process running on a remote VE. The caller process can transfer data using ve_dma_post() or ve_dma_post_wait() with returned address.
- VE_REGISTER_VEMVA: VESHM on the local VE will be attached to VEMVA (using ATB). A caller process specifies this flag to access the memory registered by a VE process running on the local VE. The caller process can transfer data using memcpy() with returned address.
- VE_MEM_LOCAL: An own memory will be attached to VEHVA (using DMAATB).
|
- Note
- A VESHM area is recognized by a combination of (vemva, size, syncnum, mode_flag) which are arguments of this function.
- Return values
-
Attached-address | On success |
0xffffffffffffffff | On failure (set errno)
- EINVAL Invalid value.
- EFAULT Bad address.
- ESRCH No such process.
- ENOENT No such memory.
- ENOMEM Cannot attach VESHM.
- EACCESS Cannot attach VESHM.
- EACCESS Permission denied.
|
int ve_shared_mem_detach |
( |
void * |
veshm_addr, |
|
|
long long |
mode_flag |
|
) |
| |
Detach a VESHM area.
- Parameters
-
[in] | veshm_addr | Virtual address of an attached VESHM area |
[in] | mode_flag | Mode flag which is one of the following macros
- VE_REGISTER_VEHVA: VESHM on a remote VE will be detached from VEHVA (using DMAATB).
- VE_REGISTER_VEMVA: VESHM on the local VE will be detached from VEMVA (using ATB).
- VE_MEM_LOCAL: An own memory will be detached from VEHVA (using DMAATB).
|
- Return values
-
0 | On success |
-1 | On failure (set errno)
- EINVAL Invalid argument.
- ECANCELED No such memory.
|
int ve_shared_mem_close |
( |
void * |
vemva, |
|
|
size_t |
size, |
|
|
int |
syncnum, |
|
|
long long |
mode_flag |
|
) |
| |
Unregister a VESHM area.
- Parameters
-
[in] | vemva | Virtual address of VESHM area |
[in] | size | Size in byte |
[in] | syncnum | Pair number of PCISYR/PCISMR |
[in] | mode_flag | Mode flag which is the same value as the argument of ve_shared_mem_open(). |
- Return values
-
0 | On success |
-1 | On failure (set errno)
- EINVAL Invalid value.
- ECANCELED Operation canceled.
|
int ve_get_pgmode |
( |
long long |
mode_flag, |
|
|
int |
pid, |
|
|
void * |
address |
|
) |
| |
Get the page size of a specified process and a specified address.
- Parameters
-
[in] | mode_flag | Mode flag which is one of the following macros
- VE_ADDR_VEMVA: The page size of VE memory mapped to VEMVA using ATB.
- VE_ADDR_VEHVA: The page size of VE memory mapped to VEHVA using DMAATB.
- VE_ADDR_PCI: The page size of PCIATB. The value of "address" will be ignored.
|
[in] | pid | Target pid |
[in] | address | Target address |
- Return values
-
0x200000 | (2MB) |
0x4000000 | (64MB) |
-1 | On failure (set errno)
- EINVAL Invalid argument.
- EFAULT Bad address.
- ESRCH No such process.
- ENOTSUP Operation not supported.
- ECANCELED Operation canceled.
|