SPU_RUNSection: Linux Programmer's Manual (2)
Index Return to Main Contents
NAMEspu_run - execute an spu context
The spu_run system call is used on PowerPC machines that implement the Cell Broadband Engine Architecture in order to access Synergistic Processor Units (SPUs). It uses the fd that was returned from spu_create(2) to address a specific SPU context. When the context gets scheduled to a physical SPU, it starts execution at the instruction pointer passed in npc.
Execution of SPU code happens synchronously, meaning that spu_run does not return while the SPU is still running. If there is a need to execute SPU code in parallel with other code on either the main CPU or other SPUs, you need to create a new thread of execution first, e.g. using the pthread_create(3) call.
When spu_run returns, the current value of the SPU instruction pointer is written back to npc, so you can call spu_run again without updating the pointers.
event can be a NULL pointer or point to an extended status code that gets filled when spu_run returns. It can be one of the following constants:
- A DMA alignment error
- A DMA segmentation error
- A DMA storage error
RETURN VALUEspu_run returns the value of the spu_status register or -1 to indicate an error and set errno to one of the error codes listed below. The spu_status register value contains a bit mask of status codes and optionally a 14 bit code returned from the stop-and-signal instruction on the SPU. The bit masks for the status codes are:
- SPU was stopped by stop-and-signal.
- SPU was stopped by halt.
- SPU is waiting for a channel.
- SPU is in single-step mode.
- SPU has tried to execute an invalid instruction.
- SPU has tried to access an invalid channel.
- The bits masked with this value contain the code returned from stop-and-signal.
- EAGAIN or EWOULDBLOCK
- fd is in non-blocking mode and spu_run would block.
- fd is not a valid file descriptor.
- npc is not a valid pointer or status is neither NULL nor a valid pointer.
- A signal occured while spu_run was in progress. The npc value has been updated to the new program counter value if necessary.
- fd is not a file descriptor returned from spu_create(2).
- Insufficient memory was available to handle a page fault resulting from an MFC direct memory access.
- the functionality is not provided by the current system, because either the hardware does not provide SPUs or the spufs module is not loaded.
NOTESspu_run is meant to be used from libraries that implement a more abstract interface to SPUs, not to be used from regular applications. See http://www.bsc.es/projects/deepcomputing/linuxoncell/ for the recommended libraries.
CONFORMING TOThis call is Linux specific and only implemented by the ppc64 architecture. Programs using this system call are not portable.
BUGSThe code does not yet fully implement all features lined out here.
AUTHORArnd Bergmann <firstname.lastname@example.org>
SEE ALSOcapabilities(7), close(2), spu_create(2), spufs(7)
This document was created by man2html, using the manual pages.
Time: 05:33:05 GMT, December 24, 2015