162306a36Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0 262306a36Sopenharmony_ci 362306a36Sopenharmony_ci========== 462306a36Sopenharmony_cispu_create 562306a36Sopenharmony_ci========== 662306a36Sopenharmony_ci 762306a36Sopenharmony_ciName 862306a36Sopenharmony_ci==== 962306a36Sopenharmony_ci spu_create - create a new spu context 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ciSynopsis 1362306a36Sopenharmony_ci======== 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ci :: 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_ci #include <sys/types.h> 1862306a36Sopenharmony_ci #include <sys/spu.h> 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ci int spu_create(const char *pathname, int flags, mode_t mode); 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_ciDescription 2362306a36Sopenharmony_ci=========== 2462306a36Sopenharmony_ci The spu_create system call is used on PowerPC machines that implement 2562306a36Sopenharmony_ci the Cell Broadband Engine Architecture in order to access Synergistic 2662306a36Sopenharmony_ci Processor Units (SPUs). It creates a new logical context for an SPU in 2762306a36Sopenharmony_ci pathname and returns a handle to associated with it. pathname must 2862306a36Sopenharmony_ci point to a non-existing directory in the mount point of the SPU file 2962306a36Sopenharmony_ci system (spufs). When spu_create is successful, a directory gets cre- 3062306a36Sopenharmony_ci ated on pathname and it is populated with files. 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ci The returned file handle can only be passed to spu_run(2) or closed, 3362306a36Sopenharmony_ci other operations are not defined on it. When it is closed, all associ- 3462306a36Sopenharmony_ci ated directory entries in spufs are removed. When the last file handle 3562306a36Sopenharmony_ci pointing either inside of the context directory or to this file 3662306a36Sopenharmony_ci descriptor is closed, the logical SPU context is destroyed. 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_ci The parameter flags can be zero or any bitwise or'd combination of the 3962306a36Sopenharmony_ci following constants: 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_ci SPU_RAWIO 4262306a36Sopenharmony_ci Allow mapping of some of the hardware registers of the SPU into 4362306a36Sopenharmony_ci user space. This flag requires the CAP_SYS_RAWIO capability, see 4462306a36Sopenharmony_ci capabilities(7). 4562306a36Sopenharmony_ci 4662306a36Sopenharmony_ci The mode parameter specifies the permissions used for creating the new 4762306a36Sopenharmony_ci directory in spufs. mode is modified with the user's umask(2) value 4862306a36Sopenharmony_ci and then used for both the directory and the files contained in it. The 4962306a36Sopenharmony_ci file permissions mask out some more bits of mode because they typically 5062306a36Sopenharmony_ci support only read or write access. See stat(2) for a full list of the 5162306a36Sopenharmony_ci possible mode values. 5262306a36Sopenharmony_ci 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ciReturn Value 5562306a36Sopenharmony_ci============ 5662306a36Sopenharmony_ci spu_create returns a new file descriptor. It may return -1 to indicate 5762306a36Sopenharmony_ci an error condition and set errno to one of the error codes listed 5862306a36Sopenharmony_ci below. 5962306a36Sopenharmony_ci 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ciErrors 6262306a36Sopenharmony_ci====== 6362306a36Sopenharmony_ci EACCES 6462306a36Sopenharmony_ci The current user does not have write access on the spufs mount 6562306a36Sopenharmony_ci point. 6662306a36Sopenharmony_ci 6762306a36Sopenharmony_ci EEXIST An SPU context already exists at the given path name. 6862306a36Sopenharmony_ci 6962306a36Sopenharmony_ci EFAULT pathname is not a valid string pointer in the current address 7062306a36Sopenharmony_ci space. 7162306a36Sopenharmony_ci 7262306a36Sopenharmony_ci EINVAL pathname is not a directory in the spufs mount point. 7362306a36Sopenharmony_ci 7462306a36Sopenharmony_ci ELOOP Too many symlinks were found while resolving pathname. 7562306a36Sopenharmony_ci 7662306a36Sopenharmony_ci EMFILE The process has reached its maximum open file limit. 7762306a36Sopenharmony_ci 7862306a36Sopenharmony_ci ENAMETOOLONG 7962306a36Sopenharmony_ci pathname was too long. 8062306a36Sopenharmony_ci 8162306a36Sopenharmony_ci ENFILE The system has reached the global open file limit. 8262306a36Sopenharmony_ci 8362306a36Sopenharmony_ci ENOENT Part of pathname could not be resolved. 8462306a36Sopenharmony_ci 8562306a36Sopenharmony_ci ENOMEM The kernel could not allocate all resources required. 8662306a36Sopenharmony_ci 8762306a36Sopenharmony_ci ENOSPC There are not enough SPU resources available to create a new 8862306a36Sopenharmony_ci context or the user specific limit for the number of SPU con- 8962306a36Sopenharmony_ci texts has been reached. 9062306a36Sopenharmony_ci 9162306a36Sopenharmony_ci ENOSYS the functionality is not provided by the current system, because 9262306a36Sopenharmony_ci either the hardware does not provide SPUs or the spufs module is 9362306a36Sopenharmony_ci not loaded. 9462306a36Sopenharmony_ci 9562306a36Sopenharmony_ci ENOTDIR 9662306a36Sopenharmony_ci A part of pathname is not a directory. 9762306a36Sopenharmony_ci 9862306a36Sopenharmony_ci 9962306a36Sopenharmony_ci 10062306a36Sopenharmony_ciNotes 10162306a36Sopenharmony_ci===== 10262306a36Sopenharmony_ci spu_create is meant to be used from libraries that implement a more 10362306a36Sopenharmony_ci abstract interface to SPUs, not to be used from regular applications. 10462306a36Sopenharmony_ci See http://www.bsc.es/projects/deepcomputing/linuxoncell/ for the rec- 10562306a36Sopenharmony_ci ommended libraries. 10662306a36Sopenharmony_ci 10762306a36Sopenharmony_ci 10862306a36Sopenharmony_ciFiles 10962306a36Sopenharmony_ci===== 11062306a36Sopenharmony_ci pathname must point to a location beneath the mount point of spufs. By 11162306a36Sopenharmony_ci convention, it gets mounted in /spu. 11262306a36Sopenharmony_ci 11362306a36Sopenharmony_ci 11462306a36Sopenharmony_ciConforming to 11562306a36Sopenharmony_ci============= 11662306a36Sopenharmony_ci This call is Linux specific and only implemented by the ppc64 architec- 11762306a36Sopenharmony_ci ture. Programs using this system call are not portable. 11862306a36Sopenharmony_ci 11962306a36Sopenharmony_ci 12062306a36Sopenharmony_ciBugs 12162306a36Sopenharmony_ci==== 12262306a36Sopenharmony_ci The code does not yet fully implement all features lined out here. 12362306a36Sopenharmony_ci 12462306a36Sopenharmony_ci 12562306a36Sopenharmony_ciAuthor 12662306a36Sopenharmony_ci====== 12762306a36Sopenharmony_ci Arnd Bergmann <arndb@de.ibm.com> 12862306a36Sopenharmony_ci 12962306a36Sopenharmony_ciSee Also 13062306a36Sopenharmony_ci======== 13162306a36Sopenharmony_ci capabilities(7), close(2), spu_run(2), spufs(7) 132