Alternative VE Offloading  3.0.2
VEO VESHM API (low-level)

VESHM API functions for VEO. More...

Functions

int veo_shared_mem_open (void *vemva, size_t size, int syncnum, long long mode_flag)
 Register a VESHM area. More...
 
int veo_shared_mem_close (void *vemva, size_t size, int syncnum, long long mode_flag)
 Unregister a VESHM area. More...
 
void * veo_shared_mem_attach (veo_proc_handle *h, pid_t pid, void *veshm_vemva, size_t size, int syncnum, long long mode_flag)
 Attach a VESHM area. More...
 
int veo_shared_mem_detach (veo_proc_handle *h, void *veshm_addr, long long mode_flag)
 Detach a VESHM area. More...
 

Detailed Description

VESHM API functions for VEO.

This API is a low-level API and is intended to be called by upper layer software. This API is not intended to be called by a user program. To use VEO VESHM API functions, include "ve_offload.h" header and "veo_veshm.h" header.

Function Documentation

int veo_shared_mem_open ( void *  vemva,
size_t  size,
int  syncnum,
long long  mode_flag 
)

Register a VESHM area.

Parameters
[in]vemvaVirtual address of VESHM area (HMEM addr)
[in]sizeSize in byte
[in]syncnumPair number of PCISYAR/PCISYMR
  • Physical register number: 0-3 (Supported 0 only)
[in]mode_flagMode 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
0On success
-1On 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.
  • ENOTSUP Library load or symbol retrieval failed.
  • EBUSY Starting VESHM creation on VE or wating for result of it failed.
int veo_shared_mem_close ( void *  vemva,
size_t  size,
int  syncnum,
long long  mode_flag 
)

Unregister a VESHM area.

Parameters
[in]vemvaVirtual address of VESHM area (HMEM addr)
[in]sizeSize in byte
[in]syncnumPair number of PCISYAR/PCISYMR
  • Physical register number: 0-3 (Supported 0 only)
[in]mode_flagMode flag which is the same value as the argument of veo_shared_mem_open().
Return values
0On success
-1On failure (set errno)
  • EINVAL Invalid value.
  • ECANCELED Operation canceled.
  • ENOTSUP Library load or symbol retrieval failed.
  • EBUSY Starting VESHM close on VE or wating for result of it failed.
void* veo_shared_mem_attach ( veo_proc_handle *  h,
pid_t  pid,
void *  veshm_vemva,
size_t  size,
int  syncnum,
long long  mode_flag 
)

Attach a VESHM area.

This function basically does the same as ve_shared_mem_attach(). The difference point is that if VE_REGISTER_VEMVA is specified for the mode flag, HMEM address will be returned as attached address.

Parameters
[in]hVEO process handle
[in]pidPid of an owner process that is gotten by veo_get_pid_from_hmem()
[in]veshm_vemvaVirtual address of VESHM area (HMEM addr)
[in]sizeSize in byte
[in]syncnumPair number of PCISYAR/PCISYMR
  • Physical register number: 0-3 (Supported 0 only)
[in]mode_flagMode flag which is ORed value of one of the following macros and the same value as the argument of veo_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 veo_dma_post() or veo_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 veo_hmemcpy() 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-addressOn success
0xffffffffffffffffOn 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.
  • ECANCELED Operation canceled.
  • EAGAIN Owner process is swapped-out.
  • ENOTSUP Library load or symbol retrieval failed.
  • EBUSY Starting VESHM attachment on VE or wating for result of it failed.
int veo_shared_mem_detach ( veo_proc_handle *  h,
void *  veshm_addr,
long long  mode_flag 
)

Detach a VESHM area.

This function basically does the same as ve_shared_mem_detach(). The difference point is that if VE_REGISTER_VEMVA is specified for the mode flag, HMEM address is must specified as attached address.

Parameters
[in]hVEO process handle
[in]veshm_addrVirtual address of an attached VESHM area (HMEM addr in case of VE_REGISTERM_VEMVA)
[in]mode_flagMode flag which is one of the following macros
  • VE_REGISTER_VEHVA: VESHM on a remote VE will be attached to VEHVA (using DMAATB).
  • VE_REGISTER_VEMVA: VESHM on the local VE will be attached to VEMVA (using ATB).
  • VE_MEM_LOCAL: An own memory will be attached to VEHVA (using DMAATB).
Return values
0On success
-1On failure (set errno)
  • EINVAL Invalid argument.
  • ECANCELED No such memory.
  • ENOTSUP Library load or symbol retrieval failed.
  • EBUSY Starting VESHM detachment on VE or wating for result of it failed.