Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
file.c File Reference
#include <linux/fs.h>
#include <linux/ioctl.h>
#include <linux/export.h>
#include <linux/pagemap.h>
#include <linux/poll.h>
#include <linux/ptrace.h>
#include <linux/seq_file.h>
#include <linux/slab.h>
#include <asm/io.h>
#include <asm/time.h>
#include <asm/spu.h>
#include <asm/spu_info.h>
#include <asm/uaccess.h>
#include "spufs.h"
#include "sputrace.h"

Go to the source code of this file.

Data Structures

struct  spufs_attr
 

Macros

#define SPUFS_MMAP_4K   (PAGE_SIZE == 0x1000)
 
#define DEFINE_SPUFS_SIMPLE_ATTRIBUTE(__fops, __get, __set, __fmt)
 
#define spufs_cntl_mmap   NULL
 
#define spufs_signal2_mmap   NULL
 
#define SPU_ATTR_NOACQUIRE   0
 
#define SPU_ATTR_ACQUIRE   1
 
#define SPU_ATTR_ACQUIRE_SAVED   2
 
#define DEFINE_SPUFS_ATTRIBUTE(__name, __get, __set, __fmt, __acquire)
 
#define spufs_mss_mmap   NULL
 
#define spufs_mfc_mmap   NULL
 

Functions

size_t spu_ibox_read (struct spu_context *ctx, u32 *data)
 
void spufs_ibox_callback (struct spu *spu)
 
size_t spu_wbox_write (struct spu_context *ctx, u32 data)
 
void spufs_wbox_callback (struct spu *spu)
 
 DEFINE_SPUFS_ATTRIBUTE (spufs_signal1_type, spufs_signal1_type_get, spufs_signal1_type_set,"%llu\n", SPU_ATTR_ACQUIRE)
 
 DEFINE_SPUFS_ATTRIBUTE (spufs_signal2_type, spufs_signal2_type_get, spufs_signal2_type_set,"%llu\n", SPU_ATTR_ACQUIRE)
 
void spufs_mfc_callback (struct spu *spu)
 
 DEFINE_SPUFS_ATTRIBUTE (spufs_npc_ops, spufs_npc_get, spufs_npc_set,"0x%llx\n", SPU_ATTR_ACQUIRE)
 
 DEFINE_SPUFS_ATTRIBUTE (spufs_decr_ops, spufs_decr_get, spufs_decr_set,"0x%llx\n", SPU_ATTR_ACQUIRE_SAVED)
 
 DEFINE_SPUFS_ATTRIBUTE (spufs_decr_status_ops, spufs_decr_status_get, spufs_decr_status_set,"0x%llx\n", SPU_ATTR_ACQUIRE_SAVED)
 
 DEFINE_SPUFS_ATTRIBUTE (spufs_event_mask_ops, spufs_event_mask_get, spufs_event_mask_set,"0x%llx\n", SPU_ATTR_ACQUIRE_SAVED)
 
 DEFINE_SPUFS_ATTRIBUTE (spufs_event_status_ops, spufs_event_status_get, NULL,"0x%llx\n", SPU_ATTR_ACQUIRE_SAVED)
 
 DEFINE_SPUFS_ATTRIBUTE (spufs_srr0_ops, spufs_srr0_get, spufs_srr0_set,"0x%llx\n", SPU_ATTR_ACQUIRE_SAVED)
 
 DEFINE_SPUFS_ATTRIBUTE (spufs_id_ops, spufs_id_get, NULL,"0x%llx\n", SPU_ATTR_ACQUIRE)
 
 DEFINE_SPUFS_ATTRIBUTE (spufs_object_id_ops, spufs_object_id_get, spufs_object_id_set,"0x%llx\n", SPU_ATTR_NOACQUIRE)
 
 DEFINE_SPUFS_ATTRIBUTE (spufs_lslr_ops, spufs_lslr_get, NULL,"0x%llx\n", SPU_ATTR_ACQUIRE_SAVED)
 
void spu_switch_log_notify (struct spu *spu, struct spu_context *ctx, u32 type, u32 val)
 

Variables

struct spufs_tree_descr spufs_dir_contents []
 
struct spufs_tree_descr spufs_dir_nosched_contents []
 
struct spufs_tree_descr spufs_dir_debug_contents []
 
struct spufs_coredump_reader spufs_coredump_read []
 

Macro Definition Documentation

#define DEFINE_SPUFS_ATTRIBUTE (   __name,
  __get,
  __set,
  __fmt,
  __acquire 
)
Value:
static int __##__get(void *data, u64 *val) \
{ \
int ret = 0; \
ret = spu_acquire(ctx); \
if (ret) \
return ret; \
*val = __get(ctx); \
spu_release(ctx); \
} else if (__acquire == SPU_ATTR_ACQUIRE_SAVED) { \
ret = spu_acquire_saved(ctx); \
if (ret) \
return ret; \
*val = __get(ctx); \
spu_release_saved(ctx); \
} else \
*val = __get(ctx); \
\
return 0; \
} \
DEFINE_SPUFS_SIMPLE_ATTRIBUTE(__name, __##__get, __set, __fmt);

Definition at line 1325 of file file.c.

#define DEFINE_SPUFS_SIMPLE_ATTRIBUTE (   __fops,
  __get,
  __set,
  __fmt 
)
Value:
static int __fops ## _open(struct inode *inode, struct file *file) \
{ \
__simple_attr_check_format(__fmt, 0ull); \
return spufs_attr_open(inode, file, __get, __set, __fmt); \
} \
static const struct file_operations __fops = { \
.open = __fops ## _open, \
.release = spufs_attr_release, \
.read = spufs_attr_read, \
.write = spufs_attr_write, \
.llseek = generic_file_llseek, \
};

Definition at line 145 of file file.c.

#define SPU_ATTR_ACQUIRE   1

Definition at line 1322 of file file.c.

#define SPU_ATTR_ACQUIRE_SAVED   2

Definition at line 1323 of file file.c.

#define SPU_ATTR_NOACQUIRE   0

Definition at line 1321 of file file.c.

#define spufs_cntl_mmap   NULL

Definition at line 453 of file file.c.

#define spufs_mfc_mmap   NULL

Definition at line 1541 of file file.c.

#define SPUFS_MMAP_4K   (PAGE_SIZE == 0x1000)

Definition at line 43 of file file.c.

#define spufs_mss_mmap   NULL

Definition at line 1419 of file file.c.

#define spufs_signal2_mmap   NULL

Definition at line 1296 of file file.c.

Function Documentation

DEFINE_SPUFS_ATTRIBUTE ( spufs_signal1_type  ,
spufs_signal1_type_get  ,
spufs_signal1_type_set  ,
"%llu\n"  ,
SPU_ATTR_ACQUIRE   
)
DEFINE_SPUFS_ATTRIBUTE ( spufs_signal2_type  ,
spufs_signal2_type_get  ,
spufs_signal2_type_set  ,
"%llu\n"  ,
SPU_ATTR_ACQUIRE   
)
DEFINE_SPUFS_ATTRIBUTE ( spufs_npc_ops  ,
spufs_npc_get  ,
spufs_npc_set  ,
"0x%llx\n"  ,
SPU_ATTR_ACQUIRE   
)
DEFINE_SPUFS_ATTRIBUTE ( spufs_decr_ops  ,
spufs_decr_get  ,
spufs_decr_set  ,
"0x%llx\n"  ,
SPU_ATTR_ACQUIRE_SAVED   
)
DEFINE_SPUFS_ATTRIBUTE ( spufs_decr_status_ops  ,
spufs_decr_status_get  ,
spufs_decr_status_set  ,
"0x%llx\n"  ,
SPU_ATTR_ACQUIRE_SAVED   
)
DEFINE_SPUFS_ATTRIBUTE ( spufs_event_mask_ops  ,
spufs_event_mask_get  ,
spufs_event_mask_set  ,
"0x%llx\n"  ,
SPU_ATTR_ACQUIRE_SAVED   
)
DEFINE_SPUFS_ATTRIBUTE ( spufs_event_status_ops  ,
spufs_event_status_get  ,
NULL  ,
"0x%llx\n"  ,
SPU_ATTR_ACQUIRE_SAVED   
)

Definition at line 1991 of file file.c.

DEFINE_SPUFS_ATTRIBUTE ( spufs_srr0_ops  ,
spufs_srr0_get  ,
spufs_srr0_set  ,
"0x%llx\n"  ,
SPU_ATTR_ACQUIRE_SAVED   
)

Definition at line 2014 of file file.c.

DEFINE_SPUFS_ATTRIBUTE ( spufs_id_ops  ,
spufs_id_get  ,
NULL  ,
"0x%llx\n"  ,
SPU_ATTR_ACQUIRE   
)

Definition at line 2028 of file file.c.

DEFINE_SPUFS_ATTRIBUTE ( spufs_object_id_ops  ,
spufs_object_id_get  ,
spufs_object_id_set  ,
"0x%llx\n"  ,
SPU_ATTR_NOACQUIRE   
)
DEFINE_SPUFS_ATTRIBUTE ( spufs_lslr_ops  ,
spufs_lslr_get  ,
NULL  ,
"0x%llx\n"  ,
SPU_ATTR_ACQUIRE_SAVED   
)
size_t spu_ibox_read ( struct spu_context ctx,
u32 data 
)

Definition at line 740 of file file.c.

void spu_switch_log_notify ( struct spu *  spu,
struct spu_context ctx,
u32  type,
u32  val 
)

Log a context switch event to a switch log reader.

Must be called with ctx->state_mutex held.

Definition at line 2607 of file file.c.

size_t spu_wbox_write ( struct spu_context ctx,
u32  data 
)

Definition at line 889 of file file.c.

void spufs_ibox_callback ( struct spu *  spu)

Definition at line 753 of file file.c.

void spufs_mfc_callback ( struct spu *  spu)

Definition at line 1578 of file file.c.

void spufs_wbox_callback ( struct spu *  spu)

Definition at line 905 of file file.c.

Variable Documentation

struct spufs_coredump_reader spufs_coredump_read[]
Initial value:
= {
{ "regs", __spufs_regs_read, NULL, sizeof(struct spu_reg128[128])},
{ "fpcr", __spufs_fpcr_read, NULL, sizeof(struct spu_reg128) },
{ "lslr", NULL, spufs_lslr_get, 19 },
{ "decr", NULL, spufs_decr_get, 19 },
{ "decr_status", NULL, spufs_decr_status_get, 19 },
{ "mem", __spufs_mem_read, NULL, LS_SIZE, },
{ "signal1", __spufs_signal1_read, NULL, sizeof(u32) },
{ "signal1_type", NULL, spufs_signal1_type_get, 19 },
{ "signal2", __spufs_signal2_read, NULL, sizeof(u32) },
{ "signal2_type", NULL, spufs_signal2_type_get, 19 },
{ "event_mask", NULL, spufs_event_mask_get, 19 },
{ "event_status", NULL, spufs_event_status_get, 19 },
{ "mbox_info", __spufs_mbox_info_read, NULL, sizeof(u32) },
{ "ibox_info", __spufs_ibox_info_read, NULL, sizeof(u32) },
{ "wbox_info", __spufs_wbox_info_read, NULL, 4 * sizeof(u32)},
{ "dma_info", __spufs_dma_info_read, NULL, sizeof(struct spu_dma_info)},
{ "proxydma_info", __spufs_proxydma_info_read,
NULL, sizeof(struct spu_proxydma_info)},
{ "object-id", NULL, spufs_object_id_get, 19 },
{ "npc", NULL, spufs_npc_get, 19 },
{ NULL },
}

Definition at line 2753 of file file.c.

struct spufs_tree_descr spufs_dir_contents[]

Definition at line 2682 of file file.c.

struct spufs_tree_descr spufs_dir_debug_contents[]
Initial value:
= {
{ ".ctx", &spufs_ctx_fops, 0444, },
{},
}

Definition at line 2748 of file file.c.

struct spufs_tree_descr spufs_dir_nosched_contents[]
Initial value:
= {
{ "capabilities", &spufs_caps_fops, 0444, },
{ "mem", &spufs_mem_fops, 0666, LS_SIZE, },
{ "mbox", &spufs_mbox_fops, 0444, },
{ "ibox", &spufs_ibox_fops, 0444, },
{ "wbox", &spufs_wbox_fops, 0222, },
{ "mbox_stat", &spufs_mbox_stat_fops, 0444, sizeof(u32), },
{ "ibox_stat", &spufs_ibox_stat_fops, 0444, sizeof(u32), },
{ "wbox_stat", &spufs_wbox_stat_fops, 0444, sizeof(u32), },
{ "signal1", &spufs_signal1_nosched_fops, 0222, },
{ "signal2", &spufs_signal2_nosched_fops, 0222, },
{ "signal1_type", &spufs_signal1_type, 0666, },
{ "signal2_type", &spufs_signal2_type, 0666, },
{ "mss", &spufs_mss_fops, 0666, },
{ "mfc", &spufs_mfc_fops, 0666, },
{ "cntl", &spufs_cntl_fops, 0666, },
{ "npc", &spufs_npc_ops, 0666, },
{ "psmap", &spufs_psmap_fops, 0666, SPUFS_PS_MAP_SIZE, },
{ "phys-id", &spufs_id_ops, 0666, },
{ "object-id", &spufs_object_id_ops, 0666, },
{ "tid", &spufs_tid_fops, 0444, },
{ "stat", &spufs_stat_fops, 0444, },
{},
}

Definition at line 2723 of file file.c.