1 .\" Copyright (c) International Business Machines Corp., 2006
3 .\" %%%LICENSE_START(GPLv2+_SW_3_PARA)
4 .\" This program is free software; you can redistribute it and/or
5 .\" modify it under the terms of the GNU General Public License as
6 .\" published by the Free Software Foundation; either version 2 of
7 .\" the License, or (at your option) any later version.
9 .\" This program is distributed in the hope that it will be useful,
10 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
11 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
12 .\" the GNU General Public License for more details.
14 .\" You should have received a copy of the GNU General Public
15 .\" License along with this manual; if not, see
16 .\" <http://www.gnu.org/licenses/>.
20 .\" 2005-09-28, created by Arnd Bergmann <arndb@de.ibm.com>,
21 .\" Mark Nutter <mnutter@us.ibm.com> and
22 .\" Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
23 .\" 2006-06-16, revised by Eduardo M. Fleury <efleury@br.ibm.com>
24 .\" 2007-07-10, quite a lot of polishing by mtk
25 .\" 2007-09-28, updates for newer kernels by Jeremy Kerr <jk@ozlabs.org>
27 .TH SPUFS 7 2021-03-22 Linux "Linux Programmer's Manual"
29 spufs \- SPU filesystem
31 The SPU filesystem is used on PowerPC machines that implement the
32 Cell Broadband Engine Architecture in order to access Synergistic
33 Processor Units (SPUs).
35 The filesystem provides a name space similar to POSIX shared
36 memory or message queues.
37 Users that have write permissions
38 on the filesystem can use
40 to establish SPU contexts under the
44 Every SPU context is represented by a directory containing
45 a predefined set of files.
47 used for manipulating the state of the logical SPU.
48 Users can change permissions on the files, but can't
53 Set the user owning the mount point; the default is 0 (root).
56 Set the group owning the mount point; the default is 0 (root).
59 Set the mode of the top-level directory in
61 as an octal mode string.
66 mostly follow the standard behavior for regular system calls like
70 but often support only a subset of the operations
71 supported on regular filesystems.
72 This list details the supported
73 operations and the deviations from the standard behavior described
74 in the respective man pages.
76 All files that support the
78 operation also support
80 and all files that support the
82 operation also support
88 family of operations, but for the latter call,
89 the only fields of the returned
91 structure that contain reliable information are
99 .BR chmod (2)/ fchmod (2)
101 .BR chown (2)/ fchown (2)
102 operations, but will not be able to grant permissions that contradict
103 the possible operations (e.g., read access on the
107 The current set of files is:
110 Contains a comma-delimited string representing the capabilities of this
112 Possible capabilities are:
116 This context may be scheduled.
119 This context can be run in single-step mode, for debugging.
121 New capabilities flags may be added in the future.
125 the contents of the local storage memory of the SPU.
126 This can be accessed like a regular shared memory
127 file and contains both code and data in the address
129 The possible operations on an open
134 .BR read "(2), " pread "(2), " write "(2), " pwrite "(2), " lseek (2)
135 These operate as usual, with the exception that
140 are not supported beyond the end of the file.
142 is the size of the local storage of the SPU,
143 which is normally 256 kilobytes.
148 into the process address space provides access to the SPU local
149 storage within the process address space.
152 mappings are allowed.
156 Contains the saved general-purpose registers of the SPU context.
157 This file contains the 128-bit values of each register,
158 from register 0 to register 127, in order.
159 This allows the general-purpose registers to be
160 inspected for debugging.
162 Reading to or writing from this file requires that the context is
163 scheduled out, so use of this file is not recommended in normal
168 file is not present on contexts that have been created with the
169 .B SPU_CREATE_NOSCHED
173 The first SPU-to-CPU communication mailbox.
174 This file is read-only and can be read in units of 4 bytes.
175 The file can be used only in nonblocking mode \- even
177 cannot be used to block on this file.
178 The only possible operation on an open
186 is smaller than four,
192 If there is no data available in the mailbox (i.e., the SPU has not
193 sent a mailbox message), the return value is set to \-1 and
198 has been read successfully, four bytes are placed in
199 the data buffer and the value four is returned.
203 The second SPU-to-CPU communication mailbox.
204 This file is similar to the first mailbox file, but can be read
205 in blocking I/O mode, thus calling
209 file will block until the SPU has written data to its interrupt mailbox
210 channel (unless the file has been opened with
215 and similar system calls can be used to monitor for the presence
218 The possible operations on an open
226 is smaller than four,
232 If there is no data available in the mailbox and the file
233 descriptor has been opened with
235 the return value is set to \-1 and
240 If there is no data available in the mailbox and the file
241 descriptor has been opened without
244 block until the SPU writes to its interrupt mailbox channel.
245 When data has been read successfully, four bytes are placed in
246 the data buffer and the value four is returned.
252 .I "(POLLIN | POLLRDNORM)"
253 whenever data is available for reading.
257 The CPU-to-SPU communication mailbox.
258 It is write-only and can be written in units of four bytes.
259 If the mailbox is full,
263 can be used to block until the mailbox is available for writing again.
264 The possible operations on an open
272 is smaller than four,
278 If there is no space available in the mailbox and the file
279 descriptor has been opened with
282 value is set to \-1 and
287 If there is no space available in the mailbox and the file
288 descriptor has been opened without
290 the call will block until the SPU reads from its
291 PPE (PowerPC Processing Element)
293 When data has been written successfully,
294 the system call returns four as its function result.
300 .I "(POLLOUT | POLLWRNORM)"
301 whenever space is available for writing.
304 .IR /mbox_stat ", " /ibox_stat ", " /wbox_stat
305 These are read-only files that contain the length of the current
306 queue of each mailbox\(emthat is, how many words can be read from
308 or how many words can be written to
311 The files can be read only in four-byte units and return
312 a big-endian binary integer number.
313 The only possible operation on an open
321 is smaller than four,
327 Otherwise, a four-byte value is placed in the data buffer.
328 This value is the number of elements that can be read from (for
334 the respective mailbox without blocking or returning an
339 .IR /npc ", " /decr ", " /decr_status ", " /spu_tag_mask ", " \
340 /event_mask ", " /event_status ", " /srr0 ", " /lslr
341 Internal registers of the SPU.
342 These files contain an ASCII string
343 representing the hex value of the specified register.
344 Reads and writes on these
347 see below) require that the SPU context be scheduled out,
348 so frequent access to
349 these files is not recommended for normal program operation.
351 The contents of these files are:
355 Next Program Counter \- valid only when the SPU is in a stopped state.
364 MFC tag mask for SPU DMA
367 Event mask for SPU interrupts
370 Number of SPU events pending (read-only)
373 Interrupt Return address register
376 Local Store Limit Register
379 The possible operations on these files are:
383 Reads the current register value.
384 If the register value is larger than the buffer passed to the
386 system call, subsequent reads will continue reading from the same
387 buffer, until the end of the buffer is reached.
389 When a complete string has been read, all subsequent read operations
390 will return zero bytes and a new file descriptor needs to be opened
396 operation on the file sets the register to the
397 value given in the string.
398 The string is parsed from the beginning
399 until the first nonnumeric character or the end of the buffer.
400 Subsequent writes to the same file descriptor overwrite the
405 file, these files are not present on contexts that have been created with
407 .B SPU_CREATE_NOSCHED
412 This file provides access to the Floating Point Status and
413 Control Register (fcpr) as a binary, four-byte file.
414 The operations on the
422 is smaller than four,
428 Otherwise, a four-byte value is placed in the data buffer;
429 this is the current value of the
436 is smaller than four,
442 Otherwise, a four-byte value is copied from the data buffer,
443 updating the value of the
448 .IR /signal1 ", " /signal2
449 The files provide access to the two signal notification channels
451 These are read-write files that operate on four-byte words.
452 Writing to one of these files triggers an interrupt on the SPU.
453 The value written to the signal files can
454 be read from the SPU through a channel read or from
455 host user space through the file.
456 After the value has been read by the SPU, it is reset to zero.
457 The possible operations on an open
467 is smaller than four,
473 Otherwise, a four-byte value is placed in the data buffer;
474 this is the current value of the specified signal notification
480 is smaller than four,
486 Otherwise, a four-byte value is copied from the data buffer,
487 updating the value of the specified signal notification
489 The signal notification register will either be replaced with
490 the input data or will be updated to the bitwise OR operation
491 of the old value and the input data, depending on the contents
499 .IR /signal1_type ", " /signal2_type
500 These two files change the behavior of the
505 They contain a numeric ASCII string which is read
506 as either "1" or "0".
507 In mode 0 (overwrite), the hardware replaces the contents
508 of the signal channel with the data that is written to it.
509 In mode 1 (logical OR), the hardware accumulates the bits
510 that are subsequently written to it.
511 The possible operations on an open
519 When the count supplied to the
521 call is shorter than the required length for the digit (plus a newline
522 character), subsequent reads from the same file descriptor will
524 When a complete string has been read, all subsequent read operations
525 will return zero bytes and a new file descriptor needs to be opened
526 to read the value again.
531 operation on the file sets the register to the
532 value given in the string.
533 The string is parsed from the beginning
534 until the first nonnumeric character or the end of the buffer.
535 Subsequent writes to the same file descriptor overwrite the
539 .IR /mbox_info ", " /ibox_info ", " /wbox_info ", " /dma_into ", " /proxydma_info
540 Read-only files that contain the saved state of the SPU mailboxes and
542 This allows the SPU status to be inspected, mainly for debugging.
547 files each contain the four-byte mailbox message that has been written
549 If no message has been written to these mailboxes, then
550 contents of these files is undefined.
556 files contain the available message count.
560 file contains an array of four-byte mailbox messages, which have been
562 With current CBEA machines, the array is four items in
563 length, so up to 4 * 4 = 16 bytes can be read from this file.
564 If any mailbox queue entry is empty,
565 then the bytes read at the corresponding location are undefined.
569 file contains the contents of the SPU MFC DMA queue, represented as the
574 struct spu_dma_info {
575 uint64_t dma_info_type;
576 uint64_t dma_info_mask;
577 uint64_t dma_info_status;
578 uint64_t dma_info_stall_and_notify;
579 uint64_t dma_info_atomic_command_status;
580 struct mfc_cq_sr dma_info_command_data[16];
585 The last member of this data structure is the actual DMA queue,
586 containing 16 entries.
589 structure is defined as:
594 uint64_t mfc_cq_data0_RW;
595 uint64_t mfc_cq_data1_RW;
596 uint64_t mfc_cq_data2_RW;
597 uint64_t mfc_cq_data3_RW;
604 file contains similar information, but describes the proxy DMA queue
605 (i.e., DMAs initiated by entities outside the SPU) instead.
606 The file is in the following format:
610 struct spu_proxydma_info {
611 uint64_t proxydma_info_type;
612 uint64_t proxydma_info_mask;
613 uint64_t proxydma_info_status;
614 struct mfc_cq_sr proxydma_info_command_data[8];
619 Accessing these files requires that the SPU context is scheduled out -
620 frequent use can be inefficient.
621 These files should not be used for normal program operation.
623 These files are not present on contexts that have been created with the
624 .B SPU_CREATE_NOSCHED
628 This file provides access to the SPU Run Control and SPU status
629 registers, as an ASCII string.
630 The following operations are supported:
636 file will return an ASCII string with the hex
637 value of the SPU Status register.
642 file will set the context's SPU Run Control register.
646 Provides access to the Memory Flow Controller of the SPU.
647 Reading from the file returns the contents of the
648 SPU's MFC Tag Status register, and
649 writing to the file initiates a DMA from the MFC.
650 The following operations are supported:
654 Writes to this file need to be in the format of a MFC DMA command,
659 struct mfc_dma_command {
660 int32_t pad; /* reserved */
661 uint32_t lsa; /* local storage address */
662 uint64_t ea; /* effective address */
663 uint16_t size; /* transfer size */
664 uint16_t tag; /* command tag */
665 uint16_t class; /* class ID */
666 uint16_t cmd; /* command opcode */
671 Writes are required to be exactly
672 .I sizeof(struct mfc_dma_command)
674 The command will be sent to the SPU's MFC proxy queue, and the
675 tag stored in the kernel (see below).
678 Reads the contents of the tag status register.
679 If the file is opened in blocking mode (i.e., without
681 then the read will block until a
682 DMA tag (as performed by a previous write) is complete.
684 the MFC tag status register will be returned without waiting.
691 file will block until a new DMA can be
692 started (by checking for
694 or until a previously started DMA
700 Provides access to the MFC MultiSource Synchronization (MSS) facility.
703 this file, processes can access the MSS area of the SPU.
705 The following operations are supported:
710 into the process address space gives access to the SPU MSS area
711 within the process address space.
714 mappings are allowed.
718 Provides access to the whole problem-state mapping of the SPU.
719 Applications can use this area to interface to the SPU, rather than
720 writing to individual register files in
723 The following operations are supported:
729 gives a process a direct map of the SPU problem state area.
732 mappings are supported.
736 Read-only file containing the physical SPU number that the SPU context
738 When the context is not running, this file contains the
741 The physical SPU number is given by an ASCII hex string.
744 Allows applications to store (or retrieve) a single 64-bit ID into the
746 This ID is later used by profiling tools to uniquely identify
751 By writing an ASCII hex value into this file, applications can set the
752 object ID of the SPU context.
753 Any previous value of the object ID is overwritten.
756 Reading this file gives an ASCII hex string representing the object ID
757 for this SPU context.
761 .IR /etc/fstab " entry"
762 none /spu spufs gid=spu 0 0
764 .\" Arnd Bergmann <arndb@de.ibm.com>, Mark Nutter <mnutter@us.ibm.com>,
765 .\" Ulrich Weigand <Ulrich.Weigand@de.ibm.com>, Jeremy Kerr <jk@ozlabs.org>
772 .I The Cell Broadband Engine Architecture (CBEA) specification