1 .. SPDX-License-Identifier: GPL-2.0
10 spu_run - execute an spu context
20 int spu_run(int fd, unsigned int *npc, unsigned int *event);
24 The spu_run system call is used on PowerPC machines that implement the
25 Cell Broadband Engine Architecture in order to access Synergistic Pro-
26 cessor Units (SPUs). It uses the fd that was returned from spu_cre-
27 ate(2) to address a specific SPU context. When the context gets sched-
28 uled to a physical SPU, it starts execution at the instruction pointer
31 Execution of SPU code happens synchronously, meaning that spu_run does
32 not return while the SPU is still running. If there is a need to exe-
33 cute SPU code in parallel with other code on either the main CPU or
34 other SPUs, you need to create a new thread of execution first, e.g.
35 using the pthread_create(3) call.
37 When spu_run returns, the current value of the SPU instruction pointer
38 is written back to npc, so you can call spu_run again without updating
41 event can be a NULL pointer or point to an extended status code that
42 gets filled when spu_run returns. It can be one of the following con-
45 SPE_EVENT_DMA_ALIGNMENT
48 SPE_EVENT_SPE_DATA_SEGMENT
49 A DMA segmentation error
51 SPE_EVENT_SPE_DATA_STORAGE
54 If NULL is passed as the event argument, these errors will result in a
55 signal delivered to the calling process.
59 spu_run returns the value of the spu_status register or -1 to indicate
60 an error and set errno to one of the error codes listed below. The
61 spu_status register value contains a bit mask of status codes and
62 optionally a 14 bit code returned from the stop-and-signal instruction
63 on the SPU. The bit masks for the status codes are:
66 SPU was stopped by stop-and-signal.
69 SPU was stopped by halt.
72 SPU is waiting for a channel.
75 SPU is in single-step mode.
78 SPU has tried to execute an invalid instruction.
81 SPU has tried to access an invalid channel.
84 The bits masked with this value contain the code returned from
87 There are always one or more of the lower eight bits set or an error
88 code is returned from spu_run.
93 fd is in non-blocking mode and spu_run would block.
95 EBADF fd is not a valid file descriptor.
97 EFAULT npc is not a valid pointer or status is neither NULL nor a valid
100 EINTR A signal occurred while spu_run was in progress. The npc value
101 has been updated to the new program counter value if necessary.
103 EINVAL fd is not a file descriptor returned from spu_create(2).
105 ENOMEM Insufficient memory was available to handle a page fault result-
106 ing from an MFC direct memory access.
108 ENOSYS the functionality is not provided by the current system, because
109 either the hardware does not provide SPUs or the spufs module is
115 spu_run is meant to be used from libraries that implement a more
116 abstract interface to SPUs, not to be used from regular applications.
117 See http://www.bsc.es/projects/deepcomputing/linuxoncell/ for the rec-
123 This call is Linux specific and only implemented by the ppc64 architec-
124 ture. Programs using this system call are not portable.
129 The code does not yet fully implement all features lined out here.
134 Arnd Bergmann <arndb@de.ibm.com>
138 capabilities(7), close(2), spu_create(2), spufs(7)