Copyright © tutorialspoint.com
The file system provides a name space similar to posix shared memory or message queues. Users that have write permissions on the file system can use spu_create(2) to establish SPU contexts in the spufs root.
Every SPU context is represented by a directory containing a predefined set of files. These files can be used for manipulating the state of the logical SPU. Users can change permissions on those files, but not actually add or remove files.
Tag | Description |
---|---|
uid=<uid> | |
set the user owning the mount point, the default is 0 (root). | |
gid=<gid> | |
set the group owning the mount point, the default is 0 (root).
|
All files that support the read(2) operation also support readv(2) and all files that support the write(2) operation also support writev(2). All files support the access(2) and stat(2) family of operations, but only the st_mode, st_nlink, st_uid and st_gid fields of struct stat contain reliable information.
All files support the chmod(2)/ fchmod(2) and chown(2)/ fchown(2) operations, but will not be able to grant permissions that contradict the possible operations, e.g. read access on the wbox file.
The current set of files is:
Tag | Description |
---|---|
read(2), pread(2), write(2), pwrite(2), lseek(2) | |
These operate as documented, with the exception that seek(2), write(2) and pwrite(2) are not supported beyond the end of the file. The file size is the size of the local storage of the SPU, which normally is 256 kilobytes. | |
mmap(2) | |
Mapping
mem into the process address space gives access to the SPU local
storage within the process address space. Only MAP_SHARED
mappings are allowed.
|
Tag | Description |
---|---|
read(2) | |
If a count smaller than four is requested,
read returns -1 and sets errno to EINVAL.
If there is no data available in the mail box, the return
value is set to -1 and errno becomes EAGAIN. When data
has been read successfully, four bytes are placed in
the data buffer and the value four is returned.
|
Tag | Description |
---|---|
read(2) | |
If a count smaller than four is requested,
read returns -1 and sets errno to EINVAL.
If there is no data available in the mail box and the file
descriptor has been opened with O_NONBLOCK, the return
value is set to -1 and errno becomes EAGAIN.
If there is no data available in the mail box and the file descriptor has been opened without O_NONBLOCK, the call will block until the SPU writes to its interrupt mailbox channel. When data has been read successfully, four bytes are placed in the data buffer and the value four is returned. | |
poll(2) | |
Poll on the
ibox file returns (POLLIN | POLLRDNORM) whenever data is available
for reading.
|
If there is no space available in the mail box and the file descriptor has been opened without O_NONBLOCK, the call will block until the SPU reads from its PPE mailbox channel. When data has been read successfully, four bytes are placed in the data buffer and the value four is returned.
Tag | Description |
---|---|
poll(2) | |
Poll on the
ibox file returns (POLLOUT | POLLWRNORM) whenever space is available
for writing.
|
Tag | Description |
---|---|
read(2) | |
If a count smaller than four is requested,
read returns -1 and sets errno to EINVAL.
Otherwise, a four byte value is placed in the data buffer,
containing the number of elements that can be read from (for
mbox_stat and
ibox_stat) or written to (for
wbox_stat) the respective mail box without blocking or resulting in
EAGAIN.
|
The contents of these files are:
Tag | Description |
---|---|
npc | Next Program Counter |
decr | SPU Decrementer |
decr_status | Decrementer Status |
spu_tag_mask | MFC tag mask for SPU DMA |
event_mask | Event mask for SPU interrupts |
srr0 | Interrupt Return address register |
The possible operations on an open npc, decr, decr_status, spu_tag_mask, event_mask or srr0 file are:
Tag | Description |
---|---|
read(2) | |
When the count supplied to the read call is shorter than the required length for the pointer value plus a newline character, subsequent reads from the same file descriptor will result in completing the string, regardless of changes to the register by a running SPU task. When a complete string has been read, all subsequent read operations will return zero bytes and a new file descriptor needs to be opened to read the value again. | |
write(2) | |
A
write operation on the file results in setting the register to the
value given in the string. The string is parsed from the beginning
to the first non-numeric character or the end of the buffer.
Subsequent writes to the same file descriptor overwrite the
previous setting.
|
Tag | Description |
---|---|
read(2) | |
If a count smaller than four is requested, read returns -1 and sets errno to EINVAL. Otherwise, a four byte value is placed in the data buffer, containing the current value of the fpcr register. | |
write(2) | |
If a count smaller than four is requested,
write returns -1 and sets errno to EINVAL.
Otherwise, a four byte value is copied from the data buffer,
updating the value of the fpcr register.
|
Tag | Description |
---|---|
read(2) | |
If a count smaller than four is requested, read returns -1 and sets errno to EINVAL. Otherwise, a four byte value is placed in the data buffer, containing the current value of the specified signal notification register. | |
write(2) | |
If a count smaller than four is requested,
write returns -1 and sets errno to EINVAL.
Otherwise, a four byte value is copied from the data buffer,
updating the value of the specified signal notification
register.
The signal notification register will either be replaced with
the input data or will be updated to the bitwise OR
or the old value and the input data, depending on the contents
of the signal1_type, or signal2_type respectively, file.
|
Tag | Description |
---|---|
read(2) | |
When the count supplied to the read call is shorter than the required length for the digit plus a newline character, subsequent reads from the same file descriptor will result in completing the string. When a complete string has been read, all subsequent read operations will return zero bytes and a new file descriptor needs to be opened to read the value again. | |
write(2) | |
A
write operation on the file results in setting the register to the
value given in the string. The string is parsed from the beginning
to the first non-numeric character or the end of the buffer.
Subsequent writes to the same file descriptor overwrite the
previous setting.
|
Tag | Description |
---|---|
/etc/fstab entry | |
none /spu spufs gid=spu 0 0
|
Copyright © tutorialspoint.com