^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) .. SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) =====
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) spufs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) =====
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) Name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) ====
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) spufs - the SPU file system
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) Description
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) ===========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) The SPU file system is used on PowerPC machines that implement the Cell
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) Broadband Engine Architecture in order to access Synergistic Processor
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) Units (SPUs).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) The file system provides a name space similar to posix shared memory or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) message queues. Users that have write permissions on the file system
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) can use spu_create(2) to establish SPU contexts in the spufs root.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) Every SPU context is represented by a directory containing a predefined
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) set of files. These files can be used for manipulating the state of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) logical SPU. Users can change permissions on those files, but not actu-
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) ally add or remove files.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) Mount Options
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) =============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) uid=<uid>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) set the user owning the mount point, the default is 0 (root).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) gid=<gid>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) set the group owning the mount point, the default is 0 (root).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) Files
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) =====
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) The files in spufs mostly follow the standard behavior for regular sys-
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) tem calls like read(2) or write(2), but often support only a subset of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) the operations supported on regular file systems. This list details the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) supported operations and the deviations from the behaviour in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) respective man pages.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) All files that support the read(2) operation also support readv(2) and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) all files that support the write(2) operation also support writev(2).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) All files support the access(2) and stat(2) family of operations, but
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) only the st_mode, st_nlink, st_uid and st_gid fields of struct stat
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) contain reliable information.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) All files support the chmod(2)/fchmod(2) and chown(2)/fchown(2) opera-
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) tions, but will not be able to grant permissions that contradict the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) possible operations, e.g. read access on the wbox file.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) The current set of files is:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) /mem
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) the contents of the local storage memory of the SPU. This can be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) accessed like a regular shared memory file and contains both code and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) data in the address space of the SPU. The possible operations on an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) open mem file are:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) read(2), pread(2), write(2), pwrite(2), lseek(2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) These operate as documented, with the exception that seek(2),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) write(2) and pwrite(2) are not supported beyond the end of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) file. The file size is the size of the local storage of the SPU,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) which normally is 256 kilobytes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) mmap(2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) Mapping mem into the process address space gives access to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) SPU local storage within the process address space. Only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) MAP_SHARED mappings are allowed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) /mbox
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) The first SPU to CPU communication mailbox. This file is read-only and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) can be read in units of 32 bits. The file can only be used in non-
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) blocking mode and it even poll() will not block on it. The possible
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) operations on an open mbox file are:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) read(2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) If a count smaller than four is requested, read returns -1 and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) sets errno to EINVAL. If there is no data available in the mail
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) box, the return value is set to -1 and errno becomes EAGAIN.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) When data has been read successfully, four bytes are placed in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) the data buffer and the value four is returned.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) /ibox
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) The second SPU to CPU communication mailbox. This file is similar to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) the first mailbox file, but can be read in blocking I/O mode, and the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) poll family of system calls can be used to wait for it. The possible
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) operations on an open ibox file are:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) read(2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) If a count smaller than four is requested, read returns -1 and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) sets errno to EINVAL. If there is no data available in the mail
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) box and the file descriptor has been opened with O_NONBLOCK, the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) return value is set to -1 and errno becomes EAGAIN.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) If there is no data available in the mail box and the file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) descriptor has been opened without O_NONBLOCK, the call will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) block until the SPU writes to its interrupt mailbox channel.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) When data has been read successfully, four bytes are placed in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) the data buffer and the value four is returned.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) poll(2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) Poll on the ibox file returns (POLLIN | POLLRDNORM) whenever
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) data is available for reading.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) /wbox
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) The CPU to SPU communation mailbox. It is write-only and can be written
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) in units of 32 bits. If the mailbox is full, write() will block and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) poll can be used to wait for it becoming empty again. The possible
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) operations on an open wbox file are: write(2) If a count smaller than
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) four is requested, write returns -1 and sets errno to EINVAL. If there
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) is no space available in the mail box and the file descriptor has been
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) opened with O_NONBLOCK, the return value is set to -1 and errno becomes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) EAGAIN.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) If there is no space available in the mail box and the file descriptor
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) has been opened without O_NONBLOCK, the call will block until the SPU
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) reads from its PPE mailbox channel. When data has been read success-
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) fully, four bytes are placed in the data buffer and the value four is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) returned.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) poll(2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) Poll on the ibox file returns (POLLOUT | POLLWRNORM) whenever
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) space is available for writing.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) /mbox_stat, /ibox_stat, /wbox_stat
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) Read-only files that contain the length of the current queue, i.e. how
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) many words can be read from mbox or ibox or how many words can be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) written to wbox without blocking. The files can be read only in 4-byte
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) units and return a big-endian binary integer number. The possible
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) operations on an open ``*box_stat`` file are:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) read(2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) If a count smaller than four is requested, read returns -1 and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) sets errno to EINVAL. Otherwise, a four byte value is placed in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) the data buffer, containing the number of elements that can be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) read from (for mbox_stat and ibox_stat) or written to (for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) wbox_stat) the respective mail box without blocking or resulting
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) in EAGAIN.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) /npc, /decr, /decr_status, /spu_tag_mask, /event_mask, /srr0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) Internal registers of the SPU. The representation is an ASCII string
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) with the numeric value of the next instruction to be executed. These
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) can be used in read/write mode for debugging, but normal operation of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) programs should not rely on them because access to any of them except
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) npc requires an SPU context save and is therefore very inefficient.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) The contents of these files are:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) =================== ===================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) npc Next Program Counter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) decr SPU Decrementer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) decr_status Decrementer Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) spu_tag_mask MFC tag mask for SPU DMA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) event_mask Event mask for SPU interrupts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) srr0 Interrupt Return address register
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) =================== ===================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) The possible operations on an open npc, decr, decr_status,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) spu_tag_mask, event_mask or srr0 file are:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) read(2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) When the count supplied to the read call is shorter than the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) required length for the pointer value plus a newline character,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) subsequent reads from the same file descriptor will result in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) completing the string, regardless of changes to the register by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) a running SPU task. When a complete string has been read, all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) subsequent read operations will return zero bytes and a new file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) descriptor needs to be opened to read the value again.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) write(2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) A write operation on the file results in setting the register to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) the value given in the string. The string is parsed from the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) beginning to the first non-numeric character or the end of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) buffer. Subsequent writes to the same file descriptor overwrite
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) the previous setting.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) /fpcr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) This file gives access to the Floating Point Status and Control Regis-
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) ter as a four byte long file. The operations on the fpcr file are:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) read(2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) If a count smaller than four is requested, read returns -1 and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) sets errno to EINVAL. Otherwise, a four byte value is placed in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) the data buffer, containing the current value of the fpcr regis-
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) ter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) write(2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) If a count smaller than four is requested, write returns -1 and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) sets errno to EINVAL. Otherwise, a four byte value is copied
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) from the data buffer, updating the value of the fpcr register.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) /signal1, /signal2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) The two signal notification channels of an SPU. These are read-write
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) files that operate on a 32 bit word. Writing to one of these files
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) triggers an interrupt on the SPU. The value written to the signal
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) files can be read from the SPU through a channel read or from host user
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) space through the file. After the value has been read by the SPU, it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) is reset to zero. The possible operations on an open signal1 or sig-
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) nal2 file are:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) read(2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) If a count smaller than four is requested, read returns -1 and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) sets errno to EINVAL. Otherwise, a four byte value is placed in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) the data buffer, containing the current value of the specified
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) signal notification register.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) write(2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) If a count smaller than four is requested, write returns -1 and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) sets errno to EINVAL. Otherwise, a four byte value is copied
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) from the data buffer, updating the value of the specified signal
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) notification register. The signal notification register will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) either be replaced with the input data or will be updated to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) bitwise OR or the old value and the input data, depending on the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) contents of the signal1_type, or signal2_type respectively,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) file.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) /signal1_type, /signal2_type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) These two files change the behavior of the signal1 and signal2 notifi-
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) cation files. The contain a numerical ASCII string which is read as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) either "1" or "0". In mode 0 (overwrite), the hardware replaces the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) contents of the signal channel with the data that is written to it. in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) mode 1 (logical OR), the hardware accumulates the bits that are subse-
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) quently written to it. The possible operations on an open signal1_type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) or signal2_type file are:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) read(2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) When the count supplied to the read call is shorter than the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) required length for the digit plus a newline character, subse-
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) quent reads from the same file descriptor will result in com-
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) pleting the string. When a complete string has been read, all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) subsequent read operations will return zero bytes and a new file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) descriptor needs to be opened to read the value again.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) write(2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) A write operation on the file results in setting the register to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) the value given in the string. The string is parsed from the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) beginning to the first non-numeric character or the end of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) buffer. Subsequent writes to the same file descriptor overwrite
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) the previous setting.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) Examples
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) ========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) /etc/fstab entry
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) none /spu spufs gid=spu 0 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) Authors
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) =======
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) Arnd Bergmann <arndb@de.ibm.com>, Mark Nutter <mnutter@us.ibm.com>,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) See Also
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) ========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) capabilities(7), close(2), spu_create(2), spu_run(2), spufs(7)