Blame man7/spufs.7

Packit 7cfc04
.\" Copyright (c) International Business Machines Corp., 2006
Packit 7cfc04
.\"
Packit 7cfc04
.\" %%%LICENSE_START(GPLv2+_SW_3_PARA)
Packit 7cfc04
.\" This program is free software; you can redistribute it and/or
Packit 7cfc04
.\" modify it under the terms of the GNU General Public License as
Packit 7cfc04
.\" published by the Free Software Foundation; either version 2 of
Packit 7cfc04
.\" the License, or (at your option) any later version.
Packit 7cfc04
.\"
Packit 7cfc04
.\" This program is distributed in the hope that it will be useful,
Packit 7cfc04
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 7cfc04
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
Packit 7cfc04
.\" the GNU General Public License for more details.
Packit 7cfc04
.\"
Packit 7cfc04
.\" You should have received a copy of the GNU General Public
Packit 7cfc04
.\" License along with this manual; if not, see
Packit 7cfc04
.\" <http://www.gnu.org/licenses/>.
Packit 7cfc04
.\" %%%LICENSE_END
Packit 7cfc04
.\"
Packit 7cfc04
.\" HISTORY:
Packit 7cfc04
.\" 2005-09-28, created by Arnd Bergmann <arndb@de.ibm.com>,
Packit 7cfc04
.\"   Mark Nutter <mnutter@us.ibm.com> and
Packit 7cfc04
.\"   Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
Packit 7cfc04
.\" 2006-06-16, revised by Eduardo M. Fleury <efleury@br.ibm.com>
Packit 7cfc04
.\" 2007-07-10, quite a lot of polishing by mtk
Packit 7cfc04
.\" 2007-09-28, updates for newer kernels by Jeremy Kerr <jk@ozlabs.org>
Packit 7cfc04
.\"
Packit 7cfc04
.TH SPUFS 7 2017-09-15 Linux "Linux Programmer's Manual"
Packit 7cfc04
.SH NAME
Packit 7cfc04
spufs \- SPU filesystem
Packit 7cfc04
.SH DESCRIPTION
Packit 7cfc04
The SPU filesystem is used on PowerPC machines that implement the
Packit 7cfc04
Cell Broadband Engine Architecture in order to access Synergistic
Packit 7cfc04
Processor Units (SPUs).
Packit 7cfc04
.PP
Packit 7cfc04
The filesystem provides a name space similar to POSIX shared
Packit 7cfc04
memory or message queues.
Packit 7cfc04
Users that have write permissions
Packit 7cfc04
on the filesystem can use
Packit 7cfc04
.BR spu_create (2)
Packit 7cfc04
to establish SPU contexts under the
Packit 7cfc04
.B spufs
Packit 7cfc04
root directory.
Packit 7cfc04
.PP
Packit 7cfc04
Every SPU context is represented by a directory containing
Packit 7cfc04
a predefined set of files.
Packit 7cfc04
These files can be
Packit 7cfc04
used for manipulating the state of the logical SPU.
Packit 7cfc04
Users can change permissions on the files, but can't
Packit 7cfc04
add or remove files.
Packit 7cfc04
.SS Mount options
Packit 7cfc04
.TP
Packit 7cfc04
.B uid=<uid>
Packit 7cfc04
Set the user owning the mount point; the default is 0 (root).
Packit 7cfc04
.TP
Packit 7cfc04
.B gid=<gid>
Packit 7cfc04
Set the group owning the mount point; the default is 0 (root).
Packit 7cfc04
.TP
Packit 7cfc04
.B mode=<mode>
Packit 7cfc04
Set the mode of the top-level directory in
Packit 7cfc04
.BR spufs ,
Packit 7cfc04
as an octal mode string.
Packit 7cfc04
The default is 0775.
Packit 7cfc04
.SS Files
Packit 7cfc04
The files in
Packit 7cfc04
.B spufs
Packit 7cfc04
mostly follow the standard behavior for regular system calls like
Packit 7cfc04
.BR read (2)
Packit 7cfc04
or
Packit 7cfc04
.BR write (2),
Packit 7cfc04
but often support only a subset of the operations
Packit 7cfc04
supported on regular filesystems.
Packit 7cfc04
This list details the supported
Packit 7cfc04
operations and the deviations from the standard behavior described
Packit 7cfc04
in the respective man pages.
Packit 7cfc04
.PP
Packit 7cfc04
All files that support the
Packit 7cfc04
.BR read (2)
Packit 7cfc04
operation also support
Packit 7cfc04
.BR readv (2)
Packit 7cfc04
and all files that support the
Packit 7cfc04
.BR write (2)
Packit 7cfc04
operation also support
Packit 7cfc04
.BR writev (2).
Packit 7cfc04
All files support the
Packit 7cfc04
.BR access (2)
Packit 7cfc04
and
Packit 7cfc04
.BR stat (2)
Packit 7cfc04
family of operations, but for the latter call,
Packit 7cfc04
the only fields of the returned
Packit 7cfc04
.I stat
Packit 7cfc04
structure that contain reliable information are
Packit 7cfc04
.IR st_mode ,
Packit 7cfc04
.IR st_nlink ,
Packit 7cfc04
.IR st_uid ,
Packit 7cfc04
and
Packit 7cfc04
.IR st_gid .
Packit 7cfc04
.PP
Packit 7cfc04
All files support the
Packit 7cfc04
.BR chmod (2)/ fchmod (2)
Packit 7cfc04
and
Packit 7cfc04
.BR chown (2)/ fchown (2)
Packit 7cfc04
operations, but will not be able to grant permissions that contradict
Packit 7cfc04
the possible operations (e.g., read access on the
Packit 7cfc04
.I wbox
Packit 7cfc04
file).
Packit 7cfc04
.PP
Packit 7cfc04
The current set of files is:
Packit 7cfc04
.TP
Packit 7cfc04
.I /capabilities
Packit 7cfc04
Contains a comma-delimited string representing the capabilities of this
Packit 7cfc04
SPU context.
Packit 7cfc04
Possible capabilities are:
Packit 7cfc04
.RS
Packit 7cfc04
.TP
Packit 7cfc04
.B sched
Packit 7cfc04
This context may be scheduled.
Packit 7cfc04
.TP
Packit 7cfc04
.B step
Packit 7cfc04
This context can be run in single-step mode, for debugging.
Packit 7cfc04
.PP
Packit 7cfc04
New capabilities flags may be added in the future.
Packit 7cfc04
.RE
Packit 7cfc04
.TP
Packit 7cfc04
.I /mem
Packit 7cfc04
the contents of the local storage memory of the SPU.
Packit 7cfc04
This can be accessed like a regular shared memory
Packit 7cfc04
file and contains both code and data in the address
Packit 7cfc04
space of the SPU.
Packit 7cfc04
The possible operations on an open
Packit 7cfc04
.I mem
Packit 7cfc04
file are:
Packit 7cfc04
.RS
Packit 7cfc04
.TP
Packit 7cfc04
.BR read "(2), " pread "(2), " write "(2), " pwrite "(2), " lseek (2)
Packit 7cfc04
These operate as usual, with the exception that
Packit 7cfc04
.BR lseek (2),
Packit 7cfc04
.BR write (2),
Packit 7cfc04
and
Packit 7cfc04
.BR pwrite (2)
Packit 7cfc04
are not supported beyond the end of the file.
Packit 7cfc04
The file size
Packit 7cfc04
is the size of the local storage of the SPU,
Packit 7cfc04
which is normally 256 kilobytes.
Packit 7cfc04
.TP
Packit 7cfc04
.BR mmap (2)
Packit 7cfc04
Mapping
Packit 7cfc04
.I mem
Packit 7cfc04
into the process address space provides access to the SPU local
Packit 7cfc04
storage within the process address space.
Packit 7cfc04
Only
Packit 7cfc04
.B MAP_SHARED
Packit 7cfc04
mappings are allowed.
Packit 7cfc04
.RE
Packit 7cfc04
.TP
Packit 7cfc04
.I /regs
Packit 7cfc04
Contains the saved general-purpose registers of the SPU context.
Packit 7cfc04
This file contains the 128-bit values of each register,
Packit 7cfc04
from register 0 to register 127, in order.
Packit 7cfc04
This allows the general-purpose registers to be
Packit 7cfc04
inspected for debugging.
Packit 7cfc04
.IP
Packit 7cfc04
Reading to or writing from this file requires that the context is
Packit 7cfc04
scheduled out, so use of this file is not recommended in normal
Packit 7cfc04
program operation.
Packit 7cfc04
.IP
Packit 7cfc04
The
Packit 7cfc04
.I regs
Packit 7cfc04
file is not present on contexts that have been created with the
Packit 7cfc04
.B SPU_CREATE_NOSCHED
Packit 7cfc04
flag.
Packit 7cfc04
.TP
Packit 7cfc04
.I /mbox
Packit 7cfc04
The first SPU-to-CPU communication mailbox.
Packit 7cfc04
This file is read-only and can be read in units of 4 bytes.
Packit 7cfc04
The file can be used only in nonblocking mode \- even
Packit 7cfc04
.BR poll (2)
Packit 7cfc04
cannot be used to block on this file.
Packit 7cfc04
The only possible operation on an open
Packit 7cfc04
.I mbox
Packit 7cfc04
file is:
Packit 7cfc04
.RS
Packit 7cfc04
.TP
Packit 7cfc04
.BR read (2)
Packit 7cfc04
If
Packit 7cfc04
.I count
Packit 7cfc04
is smaller than four,
Packit 7cfc04
.BR read (2)
Packit 7cfc04
returns \-1 and sets
Packit 7cfc04
.I errno
Packit 7cfc04
to
Packit 7cfc04
.BR EINVAL .
Packit 7cfc04
If there is no data available in the mailbox (i.e., the SPU has not
Packit 7cfc04
sent a mailbox message), the return value is set to \-1 and
Packit 7cfc04
.I errno
Packit 7cfc04
is set to
Packit 7cfc04
.BR EAGAIN .
Packit 7cfc04
When data
Packit 7cfc04
has been read successfully, four bytes are placed in
Packit 7cfc04
the data buffer and the value four is returned.
Packit 7cfc04
.RE
Packit 7cfc04
.TP
Packit 7cfc04
.I /ibox
Packit 7cfc04
The second SPU-to-CPU communication mailbox.
Packit 7cfc04
This file is similar to the first mailbox file, but can be read
Packit 7cfc04
in blocking I/O mode, thus calling
Packit 7cfc04
.BR read (2)
Packit 7cfc04
on an open
Packit 7cfc04
.I ibox
Packit 7cfc04
file will block until the SPU has written data to its interrupt mailbox
Packit 7cfc04
channel (unless the file has been opened with
Packit 7cfc04
.BR O_NONBLOCK ,
Packit 7cfc04
see below).
Packit 7cfc04
Also,
Packit 7cfc04
.BR poll (2)
Packit 7cfc04
and similar system calls can be used to monitor for the presence
Packit 7cfc04
of mailbox data.
Packit 7cfc04
.IP
Packit 7cfc04
The possible operations on an open
Packit 7cfc04
.I ibox
Packit 7cfc04
file are:
Packit 7cfc04
.RS
Packit 7cfc04
.TP
Packit 7cfc04
.BR read (2)
Packit 7cfc04
If
Packit 7cfc04
.I count
Packit 7cfc04
is smaller than four,
Packit 7cfc04
.BR read (2)
Packit 7cfc04
returns \-1 and sets
Packit 7cfc04
.I errno
Packit 7cfc04
to
Packit 7cfc04
.BR EINVAL .
Packit 7cfc04
If there is no data available in the mailbox and the file
Packit 7cfc04
descriptor has been opened with
Packit 7cfc04
.BR O_NONBLOCK ,
Packit 7cfc04
the return value is set to \-1 and
Packit 7cfc04
.I errno
Packit 7cfc04
is set to
Packit 7cfc04
.BR EAGAIN .
Packit 7cfc04
.IP
Packit 7cfc04
If there is no data available in the mailbox and the file
Packit 7cfc04
descriptor has been opened without
Packit 7cfc04
.BR O_NONBLOCK ,
Packit 7cfc04
the call will
Packit 7cfc04
block until the SPU writes to its interrupt mailbox channel.
Packit 7cfc04
When data has been read successfully, four bytes are placed in
Packit 7cfc04
the data buffer and the value four is returned.
Packit 7cfc04
.TP
Packit 7cfc04
.BR poll (2)
Packit 7cfc04
Poll on the
Packit 7cfc04
.I ibox
Packit 7cfc04
file returns
Packit 7cfc04
.I "(POLLIN | POLLRDNORM)"
Packit 7cfc04
whenever data is available for reading.
Packit 7cfc04
.RE
Packit 7cfc04
.TP
Packit 7cfc04
.I /wbox
Packit 7cfc04
The CPU-to-SPU communication mailbox.
Packit 7cfc04
It is write-only and can be written in units of four bytes.
Packit 7cfc04
If the mailbox is full,
Packit 7cfc04
.BR write (2)
Packit 7cfc04
will block, and
Packit 7cfc04
.BR poll (2)
Packit 7cfc04
can be used to block until the mailbox is available for writing again.
Packit 7cfc04
The possible operations on an open
Packit 7cfc04
.I wbox
Packit 7cfc04
file are:
Packit 7cfc04
.RS
Packit 7cfc04
.TP
Packit 7cfc04
.BR write (2)
Packit 7cfc04
If
Packit 7cfc04
.I count
Packit 7cfc04
is smaller than four,
Packit 7cfc04
.BR write (2)
Packit 7cfc04
returns \-1 and sets
Packit 7cfc04
.I errno
Packit 7cfc04
to
Packit 7cfc04
.BR EINVAL .
Packit 7cfc04
If there is no space available in the mailbox and the file
Packit 7cfc04
descriptor has been opened with
Packit 7cfc04
.BR O_NONBLOCK ,
Packit 7cfc04
the return
Packit 7cfc04
value is set to \-1 and
Packit 7cfc04
.I errno
Packit 7cfc04
is set to
Packit 7cfc04
.BR EAGAIN .
Packit 7cfc04
.IP
Packit 7cfc04
If there is no space available in the mailbox and the file
Packit 7cfc04
descriptor has been opened without
Packit 7cfc04
.BR O_NONBLOCK ,
Packit 7cfc04
the call will block until the SPU reads from its
Packit 7cfc04
PPE (PowerPC Processing Element)
Packit 7cfc04
mailbox channel.
Packit 7cfc04
When data has been written successfully,
Packit 7cfc04
the system call returns four as its function result.
Packit 7cfc04
.TP
Packit 7cfc04
.BR poll (2)
Packit 7cfc04
A poll on the
Packit 7cfc04
.I wbox
Packit 7cfc04
file returns
Packit 7cfc04
.I "(POLLOUT | POLLWRNORM)"
Packit 7cfc04
whenever space is available for writing.
Packit 7cfc04
.RE
Packit 7cfc04
.TP
Packit 7cfc04
.IR /mbox_stat ", " /ibox_stat ", " /wbox_stat
Packit 7cfc04
These are read-only files that contain the length of the current
Packit 7cfc04
queue of each mailbox\(emthat is, how many words can be read from
Packit 7cfc04
.IR mbox " or " ibox
Packit 7cfc04
or how many words can be written to
Packit 7cfc04
.I wbox
Packit 7cfc04
without blocking.
Packit 7cfc04
The files can be read only in four-byte units and return
Packit 7cfc04
a big-endian binary integer number.
Packit 7cfc04
The only possible operation on an open
Packit 7cfc04
.I *box_stat
Packit 7cfc04
file is:
Packit 7cfc04
.RS
Packit 7cfc04
.TP
Packit 7cfc04
.BR read (2)
Packit 7cfc04
If
Packit 7cfc04
.I count
Packit 7cfc04
is smaller than four,
Packit 7cfc04
.BR read (2)
Packit 7cfc04
returns \-1 and sets
Packit 7cfc04
.I errno
Packit 7cfc04
to
Packit 7cfc04
.BR EINVAL .
Packit 7cfc04
Otherwise, a four-byte value is placed in the data buffer.
Packit 7cfc04
This value is the number of elements that can be read from (for
Packit 7cfc04
.IR mbox_stat
Packit 7cfc04
and
Packit 7cfc04
.IR ibox_stat )
Packit 7cfc04
or written to (for
Packit 7cfc04
.IR wbox_stat )
Packit 7cfc04
the respective mailbox without blocking or returning an
Packit 7cfc04
.BR EAGAIN
Packit 7cfc04
error.
Packit 7cfc04
.RE
Packit 7cfc04
.TP
Packit 7cfc04
.IR /npc ", " /decr ", " /decr_status ", " /spu_tag_mask ", " \
Packit 7cfc04
/event_mask ", " /event_status ", " /srr0 ", " /lslr
Packit 7cfc04
Internal registers of the SPU.
Packit 7cfc04
These files contain an ASCII string
Packit 7cfc04
representing the hex value of the specified register.
Packit 7cfc04
Reads and writes on these
Packit 7cfc04
files (except for
Packit 7cfc04
.IR npc ,
Packit 7cfc04
see below) require that the SPU context be scheduled out,
Packit 7cfc04
so frequent access to
Packit 7cfc04
these files is not recommended for normal program operation.
Packit 7cfc04
.IP
Packit 7cfc04
The contents of these files are:
Packit 7cfc04
.RS
Packit 7cfc04
.TP 16
Packit 7cfc04
.I npc
Packit 7cfc04
Next Program Counter \- valid only when the SPU is in a stopped state.
Packit 7cfc04
.TP
Packit 7cfc04
.I decr
Packit 7cfc04
SPU Decrementer
Packit 7cfc04
.TP
Packit 7cfc04
.I decr_status
Packit 7cfc04
Decrementer Status
Packit 7cfc04
.TP
Packit 7cfc04
.I spu_tag_mask
Packit 7cfc04
MFC tag mask for SPU DMA
Packit 7cfc04
.TP
Packit 7cfc04
.I event_mask
Packit 7cfc04
Event mask for SPU interrupts
Packit 7cfc04
.TP
Packit 7cfc04
.I event_status
Packit 7cfc04
Number of SPU events pending (read-only)
Packit 7cfc04
.TP
Packit 7cfc04
.I srr0
Packit 7cfc04
Interrupt Return address register
Packit 7cfc04
.TP
Packit 7cfc04
.I lslr
Packit 7cfc04
Local Store Limit Register
Packit 7cfc04
.RE
Packit 7cfc04
.IP
Packit 7cfc04
The possible operations on these files are:
Packit 7cfc04
.RS
Packit 7cfc04
.TP
Packit 7cfc04
.BR read (2)
Packit 7cfc04
Reads the current register value.
Packit 7cfc04
If the register value is larger than the buffer passed to the
Packit 7cfc04
.BR read (2)
Packit 7cfc04
system call, subsequent reads will continue reading from the same
Packit 7cfc04
buffer, until the end of the buffer is reached.
Packit 7cfc04
.IP
Packit 7cfc04
When a complete string has been read, all subsequent read operations
Packit 7cfc04
will return zero bytes and a new file descriptor needs to be opened
Packit 7cfc04
to read a new value.
Packit 7cfc04
.TP
Packit 7cfc04
.BR write (2)
Packit 7cfc04
A
Packit 7cfc04
.BR write (2)
Packit 7cfc04
operation on the file sets the register to the
Packit 7cfc04
value given in the string.
Packit 7cfc04
The string is parsed from the beginning
Packit 7cfc04
until the first nonnumeric character or the end of the buffer.
Packit 7cfc04
Subsequent writes to the same file descriptor overwrite the
Packit 7cfc04
previous setting.
Packit 7cfc04
.IP
Packit 7cfc04
Except for the
Packit 7cfc04
.I npc
Packit 7cfc04
file, these files are not present on contexts that have been created with
Packit 7cfc04
the
Packit 7cfc04
.B SPU_CREATE_NOSCHED
Packit 7cfc04
flag.
Packit 7cfc04
.RE
Packit 7cfc04
.TP
Packit 7cfc04
.IR /fpcr
Packit 7cfc04
This file provides access to the Floating Point Status and
Packit 7cfc04
Control Register (fcpr) as a binary, four-byte file.
Packit 7cfc04
The operations on the
Packit 7cfc04
.I fpcr
Packit 7cfc04
file are:
Packit 7cfc04
.RS
Packit 7cfc04
.TP
Packit 7cfc04
.BR read (2)
Packit 7cfc04
If
Packit 7cfc04
.I count
Packit 7cfc04
is smaller than four,
Packit 7cfc04
.BR read (2)
Packit 7cfc04
returns \-1 and sets
Packit 7cfc04
.I errno
Packit 7cfc04
to
Packit 7cfc04
.BR EINVAL .
Packit 7cfc04
Otherwise, a four-byte value is placed in the data buffer;
Packit 7cfc04
this is the current value of the
Packit 7cfc04
.I fpcr
Packit 7cfc04
register.
Packit 7cfc04
.TP
Packit 7cfc04
.BR write (2)
Packit 7cfc04
If
Packit 7cfc04
.I count
Packit 7cfc04
is smaller than four,
Packit 7cfc04
.BR write (2)
Packit 7cfc04
returns \-1 and sets
Packit 7cfc04
.I errno
Packit 7cfc04
to
Packit 7cfc04
.BR EINVAL .
Packit 7cfc04
Otherwise, a four-byte value is copied from the data buffer,
Packit 7cfc04
updating the value of the
Packit 7cfc04
.I fpcr
Packit 7cfc04
register.
Packit 7cfc04
.RE
Packit 7cfc04
.TP
Packit 7cfc04
.IR /signal1 ", " /signal2
Packit 7cfc04
The files provide access to the two signal notification channels
Packit 7cfc04
of an SPU.
Packit 7cfc04
These are read-write files that operate on four-byte words.
Packit 7cfc04
Writing to one of these files triggers an interrupt on the SPU.
Packit 7cfc04
The value written to the signal files can
Packit 7cfc04
be read from the SPU through a channel read or from
Packit 7cfc04
host user space through the file.
Packit 7cfc04
After the value has been read by the SPU, it is reset to zero.
Packit 7cfc04
The possible operations on an open
Packit 7cfc04
.I signal1
Packit 7cfc04
or
Packit 7cfc04
.I signal2
Packit 7cfc04
file are:
Packit 7cfc04
.RS
Packit 7cfc04
.TP
Packit 7cfc04
.BR read (2)
Packit 7cfc04
If
Packit 7cfc04
.I count
Packit 7cfc04
is smaller than four,
Packit 7cfc04
.BR read (2)
Packit 7cfc04
returns \-1 and sets
Packit 7cfc04
.I errno
Packit 7cfc04
to
Packit 7cfc04
.BR EINVAL .
Packit 7cfc04
Otherwise, a four-byte value is placed in the data buffer;
Packit 7cfc04
this is the current value of the specified signal notification
Packit 7cfc04
register.
Packit 7cfc04
.TP
Packit 7cfc04
.BR write (2)
Packit 7cfc04
If
Packit 7cfc04
.I count
Packit 7cfc04
is smaller than four,
Packit 7cfc04
.BR write (2)
Packit 7cfc04
returns \-1 and sets
Packit 7cfc04
.I errno
Packit 7cfc04
to
Packit 7cfc04
.BR EINVAL .
Packit 7cfc04
Otherwise, a four-byte value is copied from the data buffer,
Packit 7cfc04
updating the value of the specified signal notification
Packit 7cfc04
register.
Packit 7cfc04
The signal notification register will either be replaced with
Packit 7cfc04
the input data or will be updated to the bitwise OR operation
Packit 7cfc04
of the old value and the input data, depending on the contents
Packit 7cfc04
of the
Packit 7cfc04
.IR signal1_type
Packit 7cfc04
or
Packit 7cfc04
.IR signal2_type
Packit 7cfc04
files respectively.
Packit 7cfc04
.RE
Packit 7cfc04
.TP
Packit 7cfc04
.IR /signal1_type ", " /signal2_type
Packit 7cfc04
These two files change the behavior of the
Packit 7cfc04
.IR signal1
Packit 7cfc04
and
Packit 7cfc04
.IR signal2
Packit 7cfc04
notification files.
Packit 7cfc04
They contain a numeric ASCII string which is read
Packit 7cfc04
as either "1" or "0".
Packit 7cfc04
In mode 0 (overwrite), the hardware replaces the contents
Packit 7cfc04
of the signal channel with the data that is written to it.
Packit 7cfc04
In mode 1 (logical OR), the hardware accumulates the bits
Packit 7cfc04
that are subsequently written to it.
Packit 7cfc04
The possible operations on an open
Packit 7cfc04
.I signal1_type
Packit 7cfc04
or
Packit 7cfc04
.I signal2_type
Packit 7cfc04
file are:
Packit 7cfc04
.RS
Packit 7cfc04
.TP
Packit 7cfc04
.BR read (2)
Packit 7cfc04
When the count supplied to the
Packit 7cfc04
.BR read (2)
Packit 7cfc04
call is shorter than the required length for the digit (plus a newline
Packit 7cfc04
character), subsequent reads from the same file descriptor will
Packit 7cfc04
complete the string.
Packit 7cfc04
When a complete string has been read, all subsequent read operations
Packit 7cfc04
will return zero bytes and a new file descriptor needs to be opened
Packit 7cfc04
to read the value again.
Packit 7cfc04
.TP
Packit 7cfc04
.BR write (2)
Packit 7cfc04
A
Packit 7cfc04
.BR write (2)
Packit 7cfc04
operation on the file sets the register to the
Packit 7cfc04
value given in the string.
Packit 7cfc04
The string is parsed from the beginning
Packit 7cfc04
until the first nonnumeric character or the end of the buffer.
Packit 7cfc04
Subsequent writes to the same file descriptor overwrite the
Packit 7cfc04
previous setting.
Packit 7cfc04
.RE
Packit 7cfc04
.TP
Packit 7cfc04
.IR /mbox_info ", " /ibox_info ", " /wbox_info ", " /dma_into ", " /proxydma_info
Packit 7cfc04
Read-only files that contain the saved state of the SPU mailboxes and
Packit 7cfc04
DMA queues.
Packit 7cfc04
This allows the SPU status to be inspected, mainly for debugging.
Packit 7cfc04
The
Packit 7cfc04
.I mbox_info
Packit 7cfc04
and
Packit 7cfc04
.I ibox_info
Packit 7cfc04
files each contain the four-byte mailbox message that has been written
Packit 7cfc04
by the SPU.
Packit 7cfc04
If no message has been written to these mailboxes, then
Packit 7cfc04
contents of these files is undefined.
Packit 7cfc04
The
Packit 7cfc04
.IR mbox_stat ,
Packit 7cfc04
.I ibox_stat
Packit 7cfc04
and
Packit 7cfc04
.I wbox_stat
Packit 7cfc04
files contain the available message count.
Packit 7cfc04
.IP
Packit 7cfc04
The
Packit 7cfc04
.I wbox_info
Packit 7cfc04
file contains an array of four-byte mailbox messages, which have been
Packit 7cfc04
sent to the SPU.
Packit 7cfc04
With current CBEA machines, the array is four items in
Packit 7cfc04
length, so up to 4 * 4 = 16 bytes can be read from this file.
Packit 7cfc04
If any mailbox queue entry is empty,
Packit 7cfc04
then the bytes read at the corresponding location are undefined.
Packit 7cfc04
.IP
Packit 7cfc04
The
Packit 7cfc04
.I dma_info
Packit 7cfc04
file contains the contents of the SPU MFC DMA queue, represented as the
Packit 7cfc04
following structure:
Packit 7cfc04
.IP
Packit 7cfc04
.in +4n
Packit 7cfc04
.EX
Packit 7cfc04
struct spu_dma_info {
Packit 7cfc04
    uint64_t         dma_info_type;
Packit 7cfc04
    uint64_t         dma_info_mask;
Packit 7cfc04
    uint64_t         dma_info_status;
Packit 7cfc04
    uint64_t         dma_info_stall_and_notify;
Packit 7cfc04
    uint64_t         dma_info_atomic_command_status;
Packit 7cfc04
    struct mfc_cq_sr dma_info_command_data[16];
Packit 7cfc04
};
Packit 7cfc04
.EE
Packit 7cfc04
.in
Packit 7cfc04
.IP
Packit 7cfc04
The last member of this data structure is the actual DMA queue,
Packit 7cfc04
containing 16 entries.
Packit 7cfc04
The
Packit 7cfc04
.I mfc_cq_sr
Packit 7cfc04
structure is defined as:
Packit 7cfc04
.IP
Packit 7cfc04
.in +4n
Packit 7cfc04
.EX
Packit 7cfc04
struct mfc_cq_sr {
Packit 7cfc04
    uint64_t mfc_cq_data0_RW;
Packit 7cfc04
    uint64_t mfc_cq_data1_RW;
Packit 7cfc04
    uint64_t mfc_cq_data2_RW;
Packit 7cfc04
    uint64_t mfc_cq_data3_RW;
Packit 7cfc04
};
Packit 7cfc04
.EE
Packit 7cfc04
.in
Packit 7cfc04
.IP
Packit 7cfc04
The
Packit 7cfc04
.I proxydma_info
Packit 7cfc04
file contains similar information, but describes the proxy DMA queue
Packit 7cfc04
(i.e., DMAs initiated by entities outside the SPU) instead.
Packit 7cfc04
The file is in the following format:
Packit 7cfc04
.IP
Packit 7cfc04
.in +4n
Packit 7cfc04
.EX
Packit 7cfc04
struct spu_proxydma_info {
Packit 7cfc04
    uint64_t         proxydma_info_type;
Packit 7cfc04
    uint64_t         proxydma_info_mask;
Packit 7cfc04
    uint64_t         proxydma_info_status;
Packit 7cfc04
    struct mfc_cq_sr proxydma_info_command_data[8];
Packit 7cfc04
};
Packit 7cfc04
.EE
Packit 7cfc04
.in
Packit 7cfc04
.IP
Packit 7cfc04
Accessing these files requires that the SPU context is scheduled out -
Packit 7cfc04
frequent use can be inefficient.
Packit 7cfc04
These files should not be used for normal program operation.
Packit 7cfc04
.IP
Packit 7cfc04
These files are not present on contexts that have been created with the
Packit 7cfc04
.B SPU_CREATE_NOSCHED
Packit 7cfc04
flag.
Packit 7cfc04
.TP
Packit 7cfc04
.IR /cntl
Packit 7cfc04
This file provides access to the SPU Run Control and SPU status
Packit 7cfc04
registers, as an ASCII string.
Packit 7cfc04
The following operations are supported:
Packit 7cfc04
.RS
Packit 7cfc04
.TP
Packit 7cfc04
.BR read (2)
Packit 7cfc04
Reads from the
Packit 7cfc04
.I cntl
Packit 7cfc04
file will return an ASCII string with the hex
Packit 7cfc04
value of the SPU Status register.
Packit 7cfc04
.TP
Packit 7cfc04
.BR write (2)
Packit 7cfc04
Writes to the
Packit 7cfc04
.I cntl
Packit 7cfc04
file will set the context's SPU Run Control register.
Packit 7cfc04
.RE
Packit 7cfc04
.TP
Packit 7cfc04
.I /mfc
Packit 7cfc04
Provides access to the Memory Flow Controller of the SPU.
Packit 7cfc04
Reading from the file returns the contents of the
Packit 7cfc04
SPU's MFC Tag Status register, and
Packit 7cfc04
writing to the file initiates a DMA from the MFC.
Packit 7cfc04
The following operations are supported:
Packit 7cfc04
.RS
Packit 7cfc04
.TP
Packit 7cfc04
.BR write (2)
Packit 7cfc04
Writes to this file need to be in the format of a MFC DMA command,
Packit 7cfc04
defined as follows:
Packit 7cfc04
.IP
Packit 7cfc04
.in +4n
Packit 7cfc04
.EX
Packit 7cfc04
struct mfc_dma_command {
Packit 7cfc04
    int32_t  pad;    /* reserved */
Packit 7cfc04
    uint32_t lsa;    /* local storage address */
Packit 7cfc04
    uint64_t ea;     /* effective address */
Packit 7cfc04
    uint16_t size;   /* transfer size */
Packit 7cfc04
    uint16_t tag;    /* command tag */
Packit 7cfc04
    uint16_t class;  /* class ID */
Packit 7cfc04
    uint16_t cmd;    /* command opcode */
Packit 7cfc04
};
Packit 7cfc04
.EE
Packit 7cfc04
.in
Packit 7cfc04
.IP
Packit 7cfc04
Writes are required to be exactly
Packit 7cfc04
.I sizeof(struct mfc_dma_command)
Packit 7cfc04
bytes in size.
Packit 7cfc04
The command will be sent to the SPU's MFC proxy queue, and the
Packit 7cfc04
tag stored in the kernel (see below).
Packit 7cfc04
.TP
Packit 7cfc04
.BR read (2)
Packit 7cfc04
Reads the contents of the tag status register.
Packit 7cfc04
If the file is opened in blocking mode (i.e., without
Packit 7cfc04
.BR O_NONBLOCK ),
Packit 7cfc04
then the read will block until a
Packit 7cfc04
DMA tag (as performed by a previous write) is complete.
Packit 7cfc04
In nonblocking mode,
Packit 7cfc04
the MFC tag status register will be returned without waiting.
Packit 7cfc04
.TP
Packit 7cfc04
.BR poll (2)
Packit 7cfc04
Calling
Packit 7cfc04
.BR poll (2)
Packit 7cfc04
on the
Packit 7cfc04
.I mfc
Packit 7cfc04
file will block until a new DMA can be
Packit 7cfc04
started (by checking for
Packit 7cfc04
.BR POLLOUT )
Packit 7cfc04
or until a previously started DMA
Packit 7cfc04
(by checking for
Packit 7cfc04
.BR POLLIN )
Packit 7cfc04
has been completed.
Packit 7cfc04
.IP
Packit 7cfc04
.I /mss
Packit 7cfc04
Provides access to the MFC MultiSource Synchronization (MSS) facility.
Packit 7cfc04
By
Packit 7cfc04
.BR mmap (2)-ing
Packit 7cfc04
this file, processes can access the MSS area of the SPU.
Packit 7cfc04
.IP
Packit 7cfc04
The following operations are supported:
Packit 7cfc04
.TP
Packit 7cfc04
.BR mmap (2)
Packit 7cfc04
Mapping
Packit 7cfc04
.B mss
Packit 7cfc04
into the process address space gives access to the SPU MSS area
Packit 7cfc04
within the process address space.
Packit 7cfc04
Only
Packit 7cfc04
.B MAP_SHARED
Packit 7cfc04
mappings are allowed.
Packit 7cfc04
.RE
Packit 7cfc04
.TP
Packit 7cfc04
.I /psmap
Packit 7cfc04
Provides access to the whole problem-state mapping of the SPU.
Packit 7cfc04
Applications can use this area to interface to the SPU, rather than
Packit 7cfc04
writing to individual register files in
Packit 7cfc04
.BR spufs .
Packit 7cfc04
.IP
Packit 7cfc04
The following operations are supported:
Packit 7cfc04
.RS
Packit 7cfc04
.TP
Packit 7cfc04
.BR mmap (2)
Packit 7cfc04
Mapping
Packit 7cfc04
.B psmap
Packit 7cfc04
gives a process a direct map of the SPU problem state area.
Packit 7cfc04
Only
Packit 7cfc04
.B MAP_SHARED
Packit 7cfc04
mappings are supported.
Packit 7cfc04
.RE
Packit 7cfc04
.TP
Packit 7cfc04
.I /phys-id
Packit 7cfc04
Read-only file containing the physical SPU number that the SPU context
Packit 7cfc04
is running on.
Packit 7cfc04
When the context is not running, this file contains the
Packit 7cfc04
string "\-1".
Packit 7cfc04
.IP
Packit 7cfc04
The physical SPU number is given by an ASCII hex string.
Packit 7cfc04
.TP
Packit 7cfc04
.I /object-id
Packit 7cfc04
Allows applications to store (or retrieve) a single 64-bit ID into the
Packit 7cfc04
context.
Packit 7cfc04
This ID is later used by profiling tools to uniquely identify
Packit 7cfc04
the context.
Packit 7cfc04
.RS
Packit 7cfc04
.TP
Packit 7cfc04
.BR write (2)
Packit 7cfc04
By writing an ASCII hex value into this file, applications can set the
Packit 7cfc04
object ID of the SPU context.
Packit 7cfc04
Any previous value of the object ID is overwritten.
Packit 7cfc04
.TP
Packit 7cfc04
.BR read (2)
Packit 7cfc04
Reading this file gives an ASCII hex string representing the object ID
Packit 7cfc04
for this SPU context.
Packit 7cfc04
.RE
Packit 7cfc04
.SH EXAMPLE
Packit 7cfc04
.TP
Packit 7cfc04
.IR /etc/fstab "  entry"
Packit 7cfc04
none  	/spu  	spufs  	gid=spu  	0	0
Packit 7cfc04
.\" .SH AUTHORS
Packit 7cfc04
.\" Arnd Bergmann <arndb@de.ibm.com>, Mark Nutter <mnutter@us.ibm.com>,
Packit 7cfc04
.\" Ulrich Weigand <Ulrich.Weigand@de.ibm.com>, Jeremy Kerr <jk@ozlabs.org>
Packit 7cfc04
.SH SEE ALSO
Packit 7cfc04
.BR close (2),
Packit 7cfc04
.BR spu_create (2),
Packit 7cfc04
.BR spu_run (2),
Packit 7cfc04
.BR capabilities (7)
Packit 7cfc04
.PP
Packit 7cfc04
.I The Cell Broadband Engine Architecture (CBEA) specification
Packit 7cfc04
.SH COLOPHON
Packit 7cfc04
This page is part of release 4.15 of the Linux
Packit 7cfc04
.I man-pages
Packit 7cfc04
project.
Packit 7cfc04
A description of the project,
Packit 7cfc04
information about reporting bugs,
Packit 7cfc04
and the latest version of this page,
Packit 7cfc04
can be found at
Packit 7cfc04
\%https://www.kernel.org/doc/man\-pages/.