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 .\" Mark Nutter <mnutter@us.ibm.com> and
21 .\" Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
22 .\" 2006-06-16, revised by Eduardo M. Fleury <efleury@br.ibm.com>
23 .\" 2007-07-10, quite a lot of polishing by mtk
24 .\" 2007-09-28, updates for newer kernels by Jeremy Kerr <jk@ozlabs.org>
26 .TH SPUFS 7 2007-12-20 Linux "Linux Programmer's Manual"
28 spufs \- SPU file system
30 The SPU file system is used on PowerPC machines that implement the
31 Cell Broadband Engine Architecture in order to access Synergistic
32 Processor Units (SPUs).
34 The file system provides a name space similar to POSIX shared
35 memory or message queues.
36 Users that have write permissions
37 on the file system can use
39 to establish SPU contexts under the
43 Every SPU context is represented by a directory containing
44 a predefined set of files.
46 used for manipulating the state of the logical SPU.
47 Users can change permissions on the files, but can't
52 Set the user owning the mount point; the default is 0 (root).
55 Set the group owning the mount point; the default is 0 (root).
58 Set the mode of the top-level directory in
60 as an octal mode string.
65 mostly follow the standard behavior for regular system calls like
69 but often support only a subset of the operations
70 supported on regular file systems.
71 This list details the supported
72 operations and the deviations from the standard behavior described
73 in the respective man pages.
75 All files that support the
77 operation also support
79 and all files that support the
81 operation also support
87 family of operations, but for the latter call,
88 the only fields of the returned
90 structure that contain reliable information are
98 .BR chmod (2)/ fchmod (2)
100 .BR chown (2)/ fchown (2)
101 operations, but will not be able to grant permissions that contradict
102 the possible operations (e.g., read access on the
106 The current set of files is:
109 Contains a comma-delimited string representing the capabilities of this
111 Possible capabilities are:
115 This context may be scheduled.
118 This context can be run in single-step mode, for debugging.
120 New capabilities flags may be added in the future.
124 the contents of the local storage memory of the SPU.
125 This can be accessed like a regular shared memory
126 file and contains both code and data in the address
128 The possible operations on an open
133 .BR read "(2), " pread "(2), " write "(2), " pwrite "(2), " lseek (2)
134 These operate as usual, with the exception that
139 are not supported beyond the end of the file.
141 is the size of the local storage of the SPU,
142 which is normally 256 kilobytes.
147 into the process address space provides access to the SPU local
148 storage within the process address space.
151 mappings are allowed.
155 Contains the saved general-purpose registers of the SPU context.
156 This file contains the 128-bit values of each register,
157 from register 0 to register 127, in order.
158 This allows the general-purpose registers to be
159 inspected for debugging.
161 Reading to or writing from this file requires that the context is
162 scheduled out, so use of this file is not recommended in normal
167 file is not present on contexts that have been created with the
168 .B SPU_CREATE_NOSCHED
172 The first SPU-to-CPU communication mailbox.
173 This file is read-only and can be read in units of 4 bytes.
174 The file can only be used in nonblocking mode \- even
176 cannot be used to block on this file.
177 The only possible operation on an open
185 is smaller than four,
191 If there is no data available in the mailbox (i.e., the SPU has not
192 sent a mailbox message), the return value is set to \-1 and
197 has been read successfully, four bytes are placed in
198 the data buffer and the value four is returned.
202 The second SPU-to-CPU communication mailbox.
203 This file is similar to the first mailbox file, but can be read
204 in blocking I/O mode, thus calling
208 file will block until the SPU has written data to its interrupt mailbox
209 channel (unless the file has been opened with
214 and similar system calls can be used to monitor for the presence
217 The possible operations on an open
225 is smaller than four,
231 If there is no data available in the mailbox and the file
232 descriptor has been opened with
234 the return value is set to \-1 and
239 If there is no data available in the mailbox and the file
240 descriptor has been opened without
243 block until the SPU writes to its interrupt mailbox channel.
244 When data has been read successfully, four bytes are placed in
245 the data buffer and the value four is returned.
251 .I "(POLLIN | POLLRDNORM)"
252 whenever data is available for reading.
256 The CPU-to-SPU communication mailbox.
257 It is write-only and can be written in units of four bytes.
258 If the mailbox is full,
262 can be used to block until the mailbox is available for writing again.
263 The possible operations on an open
271 is smaller than four,
277 If there is no space available in the mailbox and the file
278 descriptor has been opened with
281 value is set to \-1 and
286 If there is no space available in the mailbox and the file
287 descriptor has been opened without
289 the call will block until the SPU reads from its
290 PPE (PowerPC Processing Element)
292 When data has been written successfully,
293 the system call returns four as its function result.
299 .I "(POLLOUT | POLLWRNORM)"
300 whenever space is available for writing.
303 .IR /mbox_stat ", " /ibox_stat ", " /wbox_stat
304 These are read-only files that contain the length of the current
305 queue of each mailbox, i.e., how many words can be read from
307 or how many words can be written to
310 The files can be read only in four-byte units and return
311 a big-endian binary integer number.
312 The only possible operation on an open
320 is smaller than four,
326 Otherwise, a four-byte value is placed in the data buffer.
327 This value is the number of elements that can be read from (for
333 the respective mailbox without blocking or returning an
338 .IR /npc ", " /decr ", " /decr_status ", " /spu_tag_mask ", " \
339 /event_mask ", " /event_status ", " /srr0 ", " /lslr
340 Internal registers of the SPU.
341 These files contain an ASCII string
342 representing the hex value of the specified register.
343 Reads and writes on these
346 see below) require that the SPU context be scheduled out,
347 so frequent access to
348 these files is not recommended for normal program operation.
350 The contents of these files are:
354 Next Program Counter \- only valid when the SPU is in a stopped state.
363 MFC tag mask for SPU DMA
366 Event mask for SPU interrupts
369 Number of SPU events pending (read-only)
372 Interrupt Return address register
375 Local Store Limit Register
378 The possible operations on these files are:
382 Reads the current register value.
383 If the register value is larger than the buffer passed to the
385 system call, subsequent reads will continue reading from the same
386 buffer, until the end of the buffer is reached.
388 When a complete string has been read, all subsequent read operations
389 will return zero bytes and a new file descriptor needs to be opened
395 operation on the file sets the register to the
396 value given in the string.
397 The string is parsed from the beginning
398 until the first nonnumeric character or the end of the buffer.
399 Subsequent writes to the same file descriptor overwrite the
404 file, these files are not present on contexts that have been created with
406 .B SPU_CREATE_NOSCHED
411 This file provides access to the Floating Point Status and
412 Control Register (fcpr) as a binary, four-byte file.
413 The operations on the
421 is smaller than four,
427 Otherwise, a four-byte value is placed in the data buffer;
428 this is the current value of the
435 is smaller than four,
441 Otherwise, a four-byte value is copied from the data buffer,
442 updating the value of the
447 .IR /signal1 ", " /signal2
448 The files provide access to the two signal notification channels
450 These are read-write files that operate on four-byte words.
451 Writing to one of these files triggers an interrupt on the SPU.
452 The value written to the signal files can
453 be read from the SPU through a channel read or from
454 host user space through the file.
455 After the value has been read by the SPU, it is reset to zero.
456 The possible operations on an open
466 is smaller than four,
472 Otherwise, a four-byte value is placed in the data buffer;
473 this is the current value of the specified signal notification
479 is smaller than four,
485 Otherwise, a four-byte value is copied from the data buffer,
486 updating the value of the specified signal notification
488 The signal notification register will either be replaced with
489 the input data or will be updated to the bitwise OR operation
490 of the old value and the input data, depending on the contents
498 .IR /signal1_type ", " /signal2_type
499 These two files change the behavior of the
504 They contain a numeric ASCII string which is read
505 as either "1" or "0".
506 In mode 0 (overwrite), the hardware replaces the contents
507 of the signal channel with the data that is written to it.
508 In mode 1 (logical OR), the hardware accumulates the bits
509 that are subsequently written to it.
510 The possible operations on an open
518 When the count supplied to the
520 call is shorter than the required length for the digit (plus a newline
521 character), subsequent reads from the same file descriptor will
523 When a complete string has been read, all subsequent read operations
524 will return zero bytes and a new file descriptor needs to be opened
525 to read the value again.
530 operation on the file sets the register to the
531 value given in the string.
532 The string is parsed from the beginning
533 until the first nonnumeric character or the end of the buffer.
534 Subsequent writes to the same file descriptor overwrite the
538 .IR /mbox_info ", " /ibox_info ", " /wbox_info ", " /dma_into ", " /proxydma_info
539 Read-only files that contain the saved state of the SPU mailboxes and
541 This allows the SPU status to be inspected, mainly for debugging.
546 files each contain the four-byte mailbox message that has been written
548 If no message has been written to these mailboxes, then
549 contents of these files is undefined.
555 files contain the available message count.
559 file contains an array of four-byte mailbox messages, which have been
561 With current CBEA machines, the array is four items in
562 length, so up to 4 * 4 = 16 bytes can be read from this file.
563 If any mailbox queue entry is empty,
564 then the bytes read at the corresponding location are undefined.
568 file contains the contents of the SPU MFC DMA queue, represented as the
573 struct spu_dma_info {
574 uint64_t dma_info_type;
575 uint64_t dma_info_mask;
576 uint64_t dma_info_status;
577 uint64_t dma_info_stall_and_notify;
578 uint64_t dma_info_atomic_command_status;
579 struct mfc_cq_sr dma_info_command_data[16];
584 The last member of this data structure is the actual DMA queue,
585 containing 16 entries.
588 structure is defined as:
593 uint64_t mfc_cq_data0_RW;
594 uint64_t mfc_cq_data1_RW;
595 uint64_t mfc_cq_data2_RW;
596 uint64_t mfc_cq_data3_RW;
603 file contains similar information, but describes the proxy DMA queue
604 (i.e., DMAs initiated by entities outside the SPU) instead.
605 The file is in the following format:
609 struct spu_proxydma_info {
610 uint64_t proxydma_info_type;
611 uint64_t proxydma_info_mask;
612 uint64_t proxydma_info_status;
613 struct mfc_cq_sr proxydma_info_command_data[8];
618 Accessing these files requires that the SPU context is scheduled out -
619 frequent use can be inefficient.
620 These files should not be used for normal program operation.
622 These files are not present on contexts that have been created with the
623 .B SPU_CREATE_NOSCHED
627 This file provides access to the SPU Run Control and SPU status
628 registers, as an ASCII string.
629 The following operations are supported:
635 file will return an ASCII string with the hex
636 value of the SPU Status register.
641 file will set the context's SPU Run Control register.
645 Provides access to the Memory Flow Controller of the SPU.
646 Reading from the file returns the contents of the
647 SPU's MFC Tag Status register, and
648 writing to the file initiates a DMA from the MFC.
649 The following operations are supported:
653 Writes to this file need to be in the format of a MFC DMA command,
658 struct mfc_dma_command {
659 int32_t pad; /* reserved */
660 uint32_t lsa; /* local storage address */
661 uint64_t ea; /* effective address */
662 uint16_t size; /* transfer size */
663 uint16_t tag; /* command tag */
664 uint16_t class; /* class ID */
665 uint16_t cmd; /* command opcode */
670 Writes are required to be exactly
671 .I sizeof(struct mfc_dma_command)
673 The command will be sent to the SPU's MFC proxy queue, and the
674 tag stored in the kernel (see below).
677 Reads the contents of the tag status register.
678 If the file is opened in blocking mode (i.e., without
680 then the read will block until a
681 DMA tag (as performed by a previous write) is complete.
683 the MFC tag status register will be returned without waiting.
690 file will block until a new DMA can be
691 started (by checking for
693 or until a previously started DMA
699 Provides access to the MFC MultiSource Synchronization (MSS) facility.
702 this file, processes can access the MSS area of the SPU.
704 The following operations are supported:
709 into the process address space gives access to the SPU MSS area
710 within the process address space.
713 mappings are allowed.
717 Provides access to the whole problem-state mapping of the SPU.
718 Applications can use this area to interface to the SPU, rather than
719 writing to individual register files in
722 The following operations are supported:
728 gives a process a direct map of the SPU problem state area.
731 mappings are supported.
735 Read-only file containing the physical SPU number that the SPU context
737 When the context is not running, this file contains the
740 The physical SPU number is given by an ASCII hex string.
743 Allows applications to store (or retrieve) a single 64-bit ID into the
745 This ID is later used by profiling tools to uniquely identify
750 By writing an ASCII hex value into this file, applications can set the
751 object ID of the SPU context.
752 Any previous value of the object ID is overwritten.
755 Reading this file gives an ASCII hex string representing the object ID
756 for this SPU context.
760 .IR /etc/fstab " entry"
761 none /spu spufs gid=spu 0 0
763 .\" Arnd Bergmann <arndb@de.ibm.com>, Mark Nutter <mnutter@us.ibm.com>,
764 .\" Ulrich Weigand <Ulrich.Weigand@de.ibm.com>, Jeremy Kerr <jk@ozlabs.org>
769 .BR capabilities (7),
770 .I The Cell Broadband Engine Architecture (CBEA) specification