18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ci==========
48c2ecf20Sopenharmony_cispu_create
58c2ecf20Sopenharmony_ci==========
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ciName
88c2ecf20Sopenharmony_ci====
98c2ecf20Sopenharmony_ci       spu_create - create a new spu context
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ciSynopsis
138c2ecf20Sopenharmony_ci========
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci       ::
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci         #include <sys/types.h>
188c2ecf20Sopenharmony_ci         #include <sys/spu.h>
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci         int spu_create(const char *pathname, int flags, mode_t mode);
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ciDescription
238c2ecf20Sopenharmony_ci===========
248c2ecf20Sopenharmony_ci       The  spu_create  system call is used on PowerPC machines that implement
258c2ecf20Sopenharmony_ci       the Cell Broadband Engine Architecture in order to  access  Synergistic
268c2ecf20Sopenharmony_ci       Processor  Units (SPUs). It creates a new logical context for an SPU in
278c2ecf20Sopenharmony_ci       pathname and returns a handle to associated  with  it.   pathname  must
288c2ecf20Sopenharmony_ci       point  to  a  non-existing directory in the mount point of the SPU file
298c2ecf20Sopenharmony_ci       system (spufs).  When spu_create is successful, a directory  gets  cre-
308c2ecf20Sopenharmony_ci       ated on pathname and it is populated with files.
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci       The  returned  file  handle can only be passed to spu_run(2) or closed,
338c2ecf20Sopenharmony_ci       other operations are not defined on it. When it is closed, all  associ-
348c2ecf20Sopenharmony_ci       ated  directory entries in spufs are removed. When the last file handle
358c2ecf20Sopenharmony_ci       pointing either inside  of  the  context  directory  or  to  this  file
368c2ecf20Sopenharmony_ci       descriptor is closed, the logical SPU context is destroyed.
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci       The  parameter flags can be zero or any bitwise or'd combination of the
398c2ecf20Sopenharmony_ci       following constants:
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci       SPU_RAWIO
428c2ecf20Sopenharmony_ci              Allow mapping of some of the hardware registers of the SPU  into
438c2ecf20Sopenharmony_ci              user space. This flag requires the CAP_SYS_RAWIO capability, see
448c2ecf20Sopenharmony_ci              capabilities(7).
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci       The mode parameter specifies the permissions used for creating the  new
478c2ecf20Sopenharmony_ci       directory  in  spufs.   mode is modified with the user's umask(2) value
488c2ecf20Sopenharmony_ci       and then used for both the directory and the files contained in it. The
498c2ecf20Sopenharmony_ci       file permissions mask out some more bits of mode because they typically
508c2ecf20Sopenharmony_ci       support only read or write access. See stat(2) for a full list  of  the
518c2ecf20Sopenharmony_ci       possible mode values.
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ciReturn Value
558c2ecf20Sopenharmony_ci============
568c2ecf20Sopenharmony_ci       spu_create  returns a new file descriptor. It may return -1 to indicate
578c2ecf20Sopenharmony_ci       an error condition and set errno to  one  of  the  error  codes  listed
588c2ecf20Sopenharmony_ci       below.
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ciErrors
628c2ecf20Sopenharmony_ci======
638c2ecf20Sopenharmony_ci       EACCES
648c2ecf20Sopenharmony_ci              The  current  user does not have write access on the spufs mount
658c2ecf20Sopenharmony_ci              point.
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci       EEXIST An SPU context already exists at the given path name.
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci       EFAULT pathname is not a valid string pointer in  the  current  address
708c2ecf20Sopenharmony_ci              space.
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci       EINVAL pathname is not a directory in the spufs mount point.
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci       ELOOP  Too many symlinks were found while resolving pathname.
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci       EMFILE The process has reached its maximum open file limit.
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci       ENAMETOOLONG
798c2ecf20Sopenharmony_ci              pathname was too long.
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci       ENFILE The system has reached the global open file limit.
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_ci       ENOENT Part of pathname could not be resolved.
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci       ENOMEM The kernel could not allocate all resources required.
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci       ENOSPC There  are  not  enough  SPU resources available to create a new
888c2ecf20Sopenharmony_ci              context or the user specific limit for the number  of  SPU  con-
898c2ecf20Sopenharmony_ci              texts has been reached.
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci       ENOSYS the functionality is not provided by the current system, because
928c2ecf20Sopenharmony_ci              either the hardware does not provide SPUs or the spufs module is
938c2ecf20Sopenharmony_ci              not loaded.
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci       ENOTDIR
968c2ecf20Sopenharmony_ci              A part of pathname is not a directory.
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_ciNotes
1018c2ecf20Sopenharmony_ci=====
1028c2ecf20Sopenharmony_ci       spu_create  is  meant  to  be used from libraries that implement a more
1038c2ecf20Sopenharmony_ci       abstract interface to SPUs, not to be used from  regular  applications.
1048c2ecf20Sopenharmony_ci       See  http://www.bsc.es/projects/deepcomputing/linuxoncell/ for the rec-
1058c2ecf20Sopenharmony_ci       ommended libraries.
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ciFiles
1098c2ecf20Sopenharmony_ci=====
1108c2ecf20Sopenharmony_ci       pathname must point to a location beneath the mount point of spufs.  By
1118c2ecf20Sopenharmony_ci       convention, it gets mounted in /spu.
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_ciConforming to
1158c2ecf20Sopenharmony_ci=============
1168c2ecf20Sopenharmony_ci       This call is Linux specific and only implemented by the ppc64 architec-
1178c2ecf20Sopenharmony_ci       ture. Programs using this system call are not portable.
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ciBugs
1218c2ecf20Sopenharmony_ci====
1228c2ecf20Sopenharmony_ci       The code does not yet fully implement all features lined out here.
1238c2ecf20Sopenharmony_ci
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_ciAuthor
1268c2ecf20Sopenharmony_ci======
1278c2ecf20Sopenharmony_ci       Arnd Bergmann <arndb@de.ibm.com>
1288c2ecf20Sopenharmony_ci
1298c2ecf20Sopenharmony_ciSee Also
1308c2ecf20Sopenharmony_ci========
1318c2ecf20Sopenharmony_ci       capabilities(7), close(2), spu_run(2), spufs(7)
132