1 .\" Copyright (c) International Business Machines Corp., 2006
3 .\" This program is free software; you can redistribute it and/or
4 .\" modify it under the terms of the GNU General Public License as
5 .\" published by the Free Software Foundation; either version 2 of
6 .\" the License, or (at your option) any later version.
8 .\" This program is distributed in the hope that it will be useful,
9 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
10 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
11 .\" the GNU General Public License for more details.
13 .\" You should have received a copy of the GNU General Public License
14 .\" along with this program; if not, write to the Free Software
15 .\" Foundation, Inc., 59 Temple Place, Suite 330, Boston,
19 .\" 2005-09-28, created by Arnd Bergmann <arndb@de.ibm.com>
20 .\" 2006-06-16, revised by Eduardo M. Fleury <efleury@br.ibm.com>
21 .\" 2007-07-10, some polishing by mtk
22 .\" 2007-09-28, updates for newer kernels by Jeremy Kerr <jk@ozlabs.org>
24 .TH SPU_CREATE 2 2007-12-20 Linux "Linux Programmer's Manual"
26 spu_create \- create a new spu context
29 .B #include <sys/types.h>
30 .B #include <sys/spu.h>
32 .BI "int spu_create(const char *" pathname ", int " flags ", mode_t " mode ");"
33 .BI "int spu_create(const char *" pathname ", int " flags ", mode_t " mode ","
34 .BI " int " neighbor_fd ");"
39 system call is used on PowerPC machines that implement the
40 Cell Broadband Engine Architecture in order to access Synergistic
41 Processor Units (SPUs).
42 It creates a new logical context for an SPU in
44 and returns a file descriptor associated with it.
46 must refer to a nonexistent directory in the mount point of
51 is successful, a directory is created at
53 and it is populated with the files described in
56 When a context is created,
57 the returned file descriptor can only be passed to
63 family of system calls (e.g.,
66 other operations are not defined.
68 context is destroyed (along with all files created within the context's
70 directory) once the last reference to the context has gone;
71 this usually occurs when the file descriptor returned by
77 argument can be zero or any bitwise OR-ed
78 combination of the following constants:
80 .B SPU_CREATE_EVENTS_ENABLED
81 Rather than using signals for reporting DMA errors, use the
87 Create an SPU gang instead of a context.
88 (A gang is a group of SPU contexts that are
89 functionally related to each other and which share common scheduling
90 parameters \(em priority and policy.
91 In the future, gang scheduling may be implemented causing
92 the group to be switched in and out as a single unit.)
94 A new directory will be created at the location specified by the
97 This gang may be used to hold other SPU contexts, by providing
98 a pathname that is within the gang directory to further calls to
101 .B SPU_CREATE_NOSCHED
102 Create a context that is not affected by the SPU scheduler.
103 Once the context is run,
104 it will not be scheduled out until it is destroyed by
105 the creating process.
107 Because the context cannot be removed from the SPU, some functionality
109 .BR SPU_CREATE_NOSCHED
111 Only a subset of the files will be
112 available in this context directory in
115 .BR SPU_CREATE_NOSCHED
116 contexts cannot dump a core file when crashing.
119 .BR SPU_CREATE_NOSCHED
120 contexts requires the
124 .B SPU_CREATE_ISOLATE
125 Create an isolated SPU context.
126 Isolated contexts are protected from some
127 PPE (PowerPC Processing Element)
129 such as access to the SPU local store and the NPC register.
132 .B SPU_CREATE_ISOLATE
133 contexts also requires the
134 .B SPU_CREATE_NOSCHED
137 .B SPU_CREATE_AFFINITY_SPU
138 Create a context with affinity to another SPU context.
139 This affinity information is used within the SPU scheduling algorithm.
140 Using this flag requires that a file descriptor referring to
141 the other SPU context be passed in the
145 .B SPU_CREATE_AFFINITY_MEM
146 Create a context with affinity to system memory.
147 This affinity information
148 is used within the SPU scheduling algorithm.
152 argument (minus any bits set in the process's
154 specifies the permissions used for creating the new directory in
158 for a full list of the possible
164 returns a new file descriptor.
165 On error, \-1 is returned, and
167 is set to one of the error codes listed below.
171 The current user does not have write access to the
176 An SPU context already exists at the given path name.
180 is not a valid string pointer in the
181 calling process's address space.
185 is not a directory in the
187 mount point, or invalid flags have been provided.
190 Too many symbolic links were found while resolving
194 The process has reached its maximum open files limit.
201 The system has reached the global open files limit.
204 An isolated context was requested, but the hardware does not support
210 could not be resolved.
213 The kernel could not allocate all resources required.
216 There are not enough SPU resources available to create
217 a new context or the user-specific limit for the number
218 of SPU contexts has been reached.
221 The functionality is not provided by the current system, because
222 either the hardware does not provide SPUs or the spufs module is not
232 .I SPU_CREATE_NOSCHED
233 flag has been given, but the user does not have the
238 must point to a location beneath the mount point of
240 By convention, it gets mounted in
245 system call was added to Linux in kernel 2.6.16.
247 This call is Linux-specific and only implemented on the PowerPC
249 Programs using this system call are not portable.
251 Glibc does not provide a wrapper for this system call; call it using
255 is meant to be used from libraries that implement a more abstract
256 interface to SPUs, not to be used from regular applications.
258 .I http://www.bsc.es/projects/deepcomputing/linuxoncell/
259 for the recommended libraries.
263 for an example of the use of
268 .BR capabilities (7),