167207b96SArnd Bergmann /* 267207b96SArnd Bergmann * SPU file system 367207b96SArnd Bergmann * 467207b96SArnd Bergmann * (C) Copyright IBM Deutschland Entwicklung GmbH 2005 567207b96SArnd Bergmann * 667207b96SArnd Bergmann * Author: Arnd Bergmann <arndb@de.ibm.com> 767207b96SArnd Bergmann * 867207b96SArnd Bergmann * This program is free software; you can redistribute it and/or modify 967207b96SArnd Bergmann * it under the terms of the GNU General Public License as published by 1067207b96SArnd Bergmann * the Free Software Foundation; either version 2, or (at your option) 1167207b96SArnd Bergmann * any later version. 1267207b96SArnd Bergmann * 1367207b96SArnd Bergmann * This program is distributed in the hope that it will be useful, 1467207b96SArnd Bergmann * but WITHOUT ANY WARRANTY; without even the implied warranty of 1567207b96SArnd Bergmann * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1667207b96SArnd Bergmann * GNU General Public License for more details. 1767207b96SArnd Bergmann * 1867207b96SArnd Bergmann * You should have received a copy of the GNU General Public License 1967207b96SArnd Bergmann * along with this program; if not, write to the Free Software 2067207b96SArnd Bergmann * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 2167207b96SArnd Bergmann */ 2267207b96SArnd Bergmann #ifndef SPUFS_H 2367207b96SArnd Bergmann #define SPUFS_H 2467207b96SArnd Bergmann 2567207b96SArnd Bergmann #include <linux/kref.h> 26650f8b02SChristoph Hellwig #include <linux/mutex.h> 2767207b96SArnd Bergmann #include <linux/spinlock.h> 2867207b96SArnd Bergmann #include <linux/fs.h> 29ea1ae594SChristoph Hellwig #include <linux/cpumask.h> 3067207b96SArnd Bergmann 3167207b96SArnd Bergmann #include <asm/spu.h> 325473af04SMark Nutter #include <asm/spu_csa.h> 33b9e3bd77SDwayne Grant McConnell #include <asm/spu_info.h> 3467207b96SArnd Bergmann 3567207b96SArnd Bergmann /* The magic number for our file system */ 3667207b96SArnd Bergmann enum { 3767207b96SArnd Bergmann SPUFS_MAGIC = 0x23c9b64e, 3867207b96SArnd Bergmann }; 3967207b96SArnd Bergmann 408b3d6663SArnd Bergmann struct spu_context_ops; 416263203eSArnd Bergmann struct spu_gang; 426263203eSArnd Bergmann 4336aaccc1SBob Nelson /* ctx->sched_flags */ 4436aaccc1SBob Nelson enum { 4536aaccc1SBob Nelson SPU_SCHED_NOTIFY_ACTIVE, 46b2c863bdSChristoph Hellwig SPU_SCHED_WAS_ACTIVE, /* was active upon spu_acquire_saved() */ 47ce7c191bSJeremy Kerr SPU_SCHED_SPU_RUN, /* context is within spu_run */ 4836aaccc1SBob Nelson }; 4936aaccc1SBob Nelson 505158e9b5SChristoph Hellwig enum { 515158e9b5SChristoph Hellwig SWITCH_LOG_BUFSIZE = 4096, 525158e9b5SChristoph Hellwig }; 535158e9b5SChristoph Hellwig 545158e9b5SChristoph Hellwig enum { 555158e9b5SChristoph Hellwig SWITCH_LOG_START, 565158e9b5SChristoph Hellwig SWITCH_LOG_STOP, 575158e9b5SChristoph Hellwig SWITCH_LOG_EXIT, 585158e9b5SChristoph Hellwig }; 595158e9b5SChristoph Hellwig 605158e9b5SChristoph Hellwig struct switch_log { 615158e9b5SChristoph Hellwig spinlock_t lock; 625158e9b5SChristoph Hellwig wait_queue_head_t wait; 635158e9b5SChristoph Hellwig unsigned long head; 645158e9b5SChristoph Hellwig unsigned long tail; 655158e9b5SChristoph Hellwig struct switch_log_entry { 665158e9b5SChristoph Hellwig struct timespec tstamp; 675158e9b5SChristoph Hellwig s32 spu_id; 685158e9b5SChristoph Hellwig u32 type; 695158e9b5SChristoph Hellwig u32 val; 705158e9b5SChristoph Hellwig u64 timebase; 715158e9b5SChristoph Hellwig } log[]; 725158e9b5SChristoph Hellwig }; 735158e9b5SChristoph Hellwig 7467207b96SArnd Bergmann struct spu_context { 7567207b96SArnd Bergmann struct spu *spu; /* pointer to a physical SPU */ 765473af04SMark Nutter struct spu_state csa; /* SPU context save area. */ 7767207b96SArnd Bergmann spinlock_t mmio_lock; /* protects mmio access */ 786df10a82SMark Nutter struct address_space *local_store; /* local store mapping. */ 796df10a82SMark Nutter struct address_space *mfc; /* 'mfc' area mappings. */ 806df10a82SMark Nutter struct address_space *cntl; /* 'control' area mappings. */ 816df10a82SMark Nutter struct address_space *signal1; /* 'signal1' area mappings. */ 826df10a82SMark Nutter struct address_space *signal2; /* 'signal2' area mappings. */ 8317e0e270SBenjamin Herrenschmidt struct address_space *mss; /* 'mss' area mappings. */ 8417e0e270SBenjamin Herrenschmidt struct address_space *psmap; /* 'psmap' area mappings. */ 8547d3a5faSChristoph Hellwig struct mutex mapping_lock; 8686767277SArnd Bergmann u64 object_id; /* user space pointer for oprofile */ 878b3d6663SArnd Bergmann 888b3d6663SArnd Bergmann enum { SPU_STATE_RUNNABLE, SPU_STATE_SAVED } state; 89650f8b02SChristoph Hellwig struct mutex state_mutex; 90e45d48a3SChristoph Hellwig struct mutex run_mutex; 918b3d6663SArnd Bergmann 928b3d6663SArnd Bergmann struct mm_struct *owner; 9367207b96SArnd Bergmann 9467207b96SArnd Bergmann struct kref kref; 958b3d6663SArnd Bergmann wait_queue_head_t ibox_wq; 968b3d6663SArnd Bergmann wait_queue_head_t wbox_wq; 975110459fSArnd Bergmann wait_queue_head_t stop_wq; 98a33a7d73SArnd Bergmann wait_queue_head_t mfc_wq; 9933bfd7a7SArnd Bergmann wait_queue_head_t run_wq; 1008b3d6663SArnd Bergmann struct fasync_struct *ibox_fasync; 1018b3d6663SArnd Bergmann struct fasync_struct *wbox_fasync; 102a33a7d73SArnd Bergmann struct fasync_struct *mfc_fasync; 103a33a7d73SArnd Bergmann u32 tagwait; 1048b3d6663SArnd Bergmann struct spu_context_ops *ops; 1052a911f0bSArnd Bergmann struct work_struct reap_work; 1069add11daSArnd Bergmann unsigned long flags; 1079add11daSArnd Bergmann unsigned long event_return; 1086263203eSArnd Bergmann 1096263203eSArnd Bergmann struct list_head gang_list; 1106263203eSArnd Bergmann struct spu_gang *gang; 1111474855dSBob Nelson struct kref *prof_priv_kref; 1121474855dSBob Nelson void ( * prof_priv_release) (struct kref *kref); 1138389998aSChristoph Hellwig 114476273adSChristoph Hellwig /* owner thread */ 115476273adSChristoph Hellwig pid_t tid; 116476273adSChristoph Hellwig 1178389998aSChristoph Hellwig /* scheduler fields */ 118079cdb61SChristoph Hellwig struct list_head rq; 11937901802SChristoph Hellwig unsigned int time_slice; 12026bec673SChristoph Hellwig unsigned long sched_flags; 121ea1ae594SChristoph Hellwig cpumask_t cpus_allowed; 1222eb1b120SChristoph Hellwig int policy; 1238389998aSChristoph Hellwig int prio; 124e9f8a0b6SChristoph Hellwig 125e9f8a0b6SChristoph Hellwig /* statistics */ 126e9f8a0b6SChristoph Hellwig struct { 127e9f8a0b6SChristoph Hellwig /* updates protected by ctx->state_mutex */ 12827ec41d3SAndre Detsch enum spu_utilization_state util_state; 12927ec41d3SAndre Detsch unsigned long long tstamp; /* time of last state switch */ 13027ec41d3SAndre Detsch unsigned long long times[SPU_UTIL_MAX]; 131e9f8a0b6SChristoph Hellwig unsigned long long vol_ctx_switch; 132e9f8a0b6SChristoph Hellwig unsigned long long invol_ctx_switch; 133e9f8a0b6SChristoph Hellwig unsigned long long min_flt; 134e9f8a0b6SChristoph Hellwig unsigned long long maj_flt; 135e9f8a0b6SChristoph Hellwig unsigned long long hash_flt; 136e9f8a0b6SChristoph Hellwig unsigned long long slb_flt; 137e9f8a0b6SChristoph Hellwig unsigned long long slb_flt_base; /* # at last ctx switch */ 138e9f8a0b6SChristoph Hellwig unsigned long long class2_intr; 139e9f8a0b6SChristoph Hellwig unsigned long long class2_intr_base; /* # at last ctx switch */ 140e9f8a0b6SChristoph Hellwig unsigned long long libassist; 141e9f8a0b6SChristoph Hellwig } stats; 1428e68e2f2SArnd Bergmann 1435158e9b5SChristoph Hellwig /* context switch log */ 1445158e9b5SChristoph Hellwig struct switch_log *switch_log; 1455158e9b5SChristoph Hellwig 1468e68e2f2SArnd Bergmann struct list_head aff_list; 1478e68e2f2SArnd Bergmann int aff_head; 148c5fc8d2aSArnd Bergmann int aff_offset; 1496263203eSArnd Bergmann }; 1506263203eSArnd Bergmann 1516263203eSArnd Bergmann struct spu_gang { 1526263203eSArnd Bergmann struct list_head list; 1536263203eSArnd Bergmann struct mutex mutex; 1546263203eSArnd Bergmann struct kref kref; 1556263203eSArnd Bergmann int contexts; 1568e68e2f2SArnd Bergmann 1578e68e2f2SArnd Bergmann struct spu_context *aff_ref_ctx; 1588e68e2f2SArnd Bergmann struct list_head aff_list_head; 1598e68e2f2SArnd Bergmann struct mutex aff_mutex; 1608e68e2f2SArnd Bergmann int aff_flags; 161c5fc8d2aSArnd Bergmann struct spu *aff_ref_spu; 162c5fc8d2aSArnd Bergmann atomic_t aff_sched_count; 16367207b96SArnd Bergmann }; 16467207b96SArnd Bergmann 1658e68e2f2SArnd Bergmann /* Flag bits for spu_gang aff_flags */ 1668e68e2f2SArnd Bergmann #define AFF_OFFSETS_SET 1 1678e68e2f2SArnd Bergmann #define AFF_MERGED 2 1688e68e2f2SArnd Bergmann 169a33a7d73SArnd Bergmann struct mfc_dma_command { 170a33a7d73SArnd Bergmann int32_t pad; /* reserved */ 171a33a7d73SArnd Bergmann uint32_t lsa; /* local storage address */ 172a33a7d73SArnd Bergmann uint64_t ea; /* effective address */ 173a33a7d73SArnd Bergmann uint16_t size; /* transfer size */ 174a33a7d73SArnd Bergmann uint16_t tag; /* command tag */ 175a33a7d73SArnd Bergmann uint16_t class; /* class ID */ 176a33a7d73SArnd Bergmann uint16_t cmd; /* command opcode */ 177a33a7d73SArnd Bergmann }; 178a33a7d73SArnd Bergmann 179a33a7d73SArnd Bergmann 1808b3d6663SArnd Bergmann /* SPU context query/set operations. */ 1818b3d6663SArnd Bergmann struct spu_context_ops { 1828b3d6663SArnd Bergmann int (*mbox_read) (struct spu_context * ctx, u32 * data); 1838b3d6663SArnd Bergmann u32(*mbox_stat_read) (struct spu_context * ctx); 1843a843d7cSArnd Bergmann unsigned int (*mbox_stat_poll)(struct spu_context *ctx, 1853a843d7cSArnd Bergmann unsigned int events); 1868b3d6663SArnd Bergmann int (*ibox_read) (struct spu_context * ctx, u32 * data); 1878b3d6663SArnd Bergmann int (*wbox_write) (struct spu_context * ctx, u32 data); 1888b3d6663SArnd Bergmann u32(*signal1_read) (struct spu_context * ctx); 1898b3d6663SArnd Bergmann void (*signal1_write) (struct spu_context * ctx, u32 data); 1908b3d6663SArnd Bergmann u32(*signal2_read) (struct spu_context * ctx); 1918b3d6663SArnd Bergmann void (*signal2_write) (struct spu_context * ctx, u32 data); 1928b3d6663SArnd Bergmann void (*signal1_type_set) (struct spu_context * ctx, u64 val); 1938b3d6663SArnd Bergmann u64(*signal1_type_get) (struct spu_context * ctx); 1948b3d6663SArnd Bergmann void (*signal2_type_set) (struct spu_context * ctx, u64 val); 1958b3d6663SArnd Bergmann u64(*signal2_type_get) (struct spu_context * ctx); 1968b3d6663SArnd Bergmann u32(*npc_read) (struct spu_context * ctx); 1978b3d6663SArnd Bergmann void (*npc_write) (struct spu_context * ctx, u32 data); 1988b3d6663SArnd Bergmann u32(*status_read) (struct spu_context * ctx); 1998b3d6663SArnd Bergmann char*(*get_ls) (struct spu_context * ctx); 200cc210b3eSLuke Browning void (*privcntl_write) (struct spu_context *ctx, u64 data); 2013960c260SJeremy Kerr u32 (*runcntl_read) (struct spu_context * ctx); 2025110459fSArnd Bergmann void (*runcntl_write) (struct spu_context * ctx, u32 data); 203c25620d7SMasato Noguchi void (*runcntl_stop) (struct spu_context * ctx); 204ee2d7340SArnd Bergmann void (*master_start) (struct spu_context * ctx); 205ee2d7340SArnd Bergmann void (*master_stop) (struct spu_context * ctx); 206a33a7d73SArnd Bergmann int (*set_mfc_query)(struct spu_context * ctx, u32 mask, u32 mode); 207a33a7d73SArnd Bergmann u32 (*read_mfc_tagstatus)(struct spu_context * ctx); 208a33a7d73SArnd Bergmann u32 (*get_mfc_free_elements)(struct spu_context *ctx); 209a33a7d73SArnd Bergmann int (*send_mfc_command)(struct spu_context * ctx, 210a33a7d73SArnd Bergmann struct mfc_dma_command * cmd); 211b9e3bd77SDwayne Grant McConnell void (*dma_info_read) (struct spu_context * ctx, 212b9e3bd77SDwayne Grant McConnell struct spu_dma_info * info); 213b9e3bd77SDwayne Grant McConnell void (*proxydma_info_read) (struct spu_context * ctx, 214b9e3bd77SDwayne Grant McConnell struct spu_proxydma_info * info); 21557dace23SArnd Bergmann void (*restart_dma)(struct spu_context *ctx); 2168b3d6663SArnd Bergmann }; 2178b3d6663SArnd Bergmann 2188b3d6663SArnd Bergmann extern struct spu_context_ops spu_hw_ops; 2198b3d6663SArnd Bergmann extern struct spu_context_ops spu_backing_ops; 2208b3d6663SArnd Bergmann 22167207b96SArnd Bergmann struct spufs_inode_info { 22267207b96SArnd Bergmann struct spu_context *i_ctx; 2236263203eSArnd Bergmann struct spu_gang *i_gang; 22467207b96SArnd Bergmann struct inode vfs_inode; 22543c2bbd9SChristoph Hellwig int i_openers; 22667207b96SArnd Bergmann }; 22767207b96SArnd Bergmann #define SPUFS_I(inode) \ 22867207b96SArnd Bergmann container_of(inode, struct spufs_inode_info, vfs_inode) 22967207b96SArnd Bergmann 23067207b96SArnd Bergmann extern struct tree_descr spufs_dir_contents[]; 2315737edd1SMark Nutter extern struct tree_descr spufs_dir_nosched_contents[]; 23267207b96SArnd Bergmann 23367207b96SArnd Bergmann /* system call implementation */ 23498f06978SJeremy Kerr extern struct spufs_calls spufs_calls; 23550af32a9SJeremy Kerr long spufs_run_spu(struct spu_context *ctx, u32 *npc, u32 *status); 2368e68e2f2SArnd Bergmann long spufs_create(struct nameidata *nd, unsigned int flags, 2378e68e2f2SArnd Bergmann mode_t mode, struct file *filp); 23848cad41fSMichael Ellerman /* ELF coredump callbacks for writing SPU ELF notes */ 23948cad41fSMichael Ellerman extern int spufs_coredump_extra_notes_size(void); 2407af1443aSMichael Ellerman extern int spufs_coredump_extra_notes_write(struct file *file, loff_t *foffset); 24148cad41fSMichael Ellerman 2429c2e08c5SArjan van de Ven extern const struct file_operations spufs_context_fops; 24367207b96SArnd Bergmann 2446263203eSArnd Bergmann /* gang management */ 2456263203eSArnd Bergmann struct spu_gang *alloc_spu_gang(void); 2466263203eSArnd Bergmann struct spu_gang *get_spu_gang(struct spu_gang *gang); 2476263203eSArnd Bergmann int put_spu_gang(struct spu_gang *gang); 2486263203eSArnd Bergmann void spu_gang_remove_ctx(struct spu_gang *gang, struct spu_context *ctx); 2496263203eSArnd Bergmann void spu_gang_add_ctx(struct spu_gang *gang, struct spu_context *ctx); 2506263203eSArnd Bergmann 25157dace23SArnd Bergmann /* fault handling */ 25257dace23SArnd Bergmann int spufs_handle_class1(struct spu_context *ctx); 253d6ad39bcSJeremy Kerr int spufs_handle_class0(struct spu_context *ctx); 25457dace23SArnd Bergmann 255c5fc8d2aSArnd Bergmann /* affinity */ 256c5fc8d2aSArnd Bergmann struct spu *affinity_check(struct spu_context *ctx); 257c5fc8d2aSArnd Bergmann 25867207b96SArnd Bergmann /* context management */ 25965de66f0SChristoph Hellwig extern atomic_t nr_spu_contexts; 260c9101bdbSChristoph Hellwig static inline int __must_check spu_acquire(struct spu_context *ctx) 2616a0641e5SChristoph Hellwig { 262c9101bdbSChristoph Hellwig return mutex_lock_interruptible(&ctx->state_mutex); 2636a0641e5SChristoph Hellwig } 2646a0641e5SChristoph Hellwig 2656a0641e5SChristoph Hellwig static inline void spu_release(struct spu_context *ctx) 2666a0641e5SChristoph Hellwig { 2676a0641e5SChristoph Hellwig mutex_unlock(&ctx->state_mutex); 2686a0641e5SChristoph Hellwig } 2696a0641e5SChristoph Hellwig 2706263203eSArnd Bergmann struct spu_context * alloc_spu_context(struct spu_gang *gang); 27167207b96SArnd Bergmann void destroy_spu_context(struct kref *kref); 27267207b96SArnd Bergmann struct spu_context * get_spu_context(struct spu_context *ctx); 27367207b96SArnd Bergmann int put_spu_context(struct spu_context *ctx); 2745110459fSArnd Bergmann void spu_unmap_mappings(struct spu_context *ctx); 27567207b96SArnd Bergmann 2768b3d6663SArnd Bergmann void spu_forget(struct spu_context *ctx); 277c9101bdbSChristoph Hellwig int __must_check spu_acquire_saved(struct spu_context *ctx); 27827b1ea09SChristoph Hellwig void spu_release_saved(struct spu_context *ctx); 27950b520d4SChristoph Hellwig 280e65c2f6fSLuke Browning int spu_stopped(struct spu_context *ctx, u32 * stat); 281e65c2f6fSLuke Browning void spu_del_from_rq(struct spu_context *ctx); 28226bec673SChristoph Hellwig int spu_activate(struct spu_context *ctx, unsigned long flags); 2838b3d6663SArnd Bergmann void spu_deactivate(struct spu_context *ctx); 2848b3d6663SArnd Bergmann void spu_yield(struct spu_context *ctx); 28536aaccc1SBob Nelson void spu_switch_notify(struct spu *spu, struct spu_context *ctx); 2865158e9b5SChristoph Hellwig void spu_switch_log_notify(struct spu *spu, struct spu_context *ctx, 2875158e9b5SChristoph Hellwig u32 type, u32 val); 288fe443ef2SChristoph Hellwig void spu_set_timeslice(struct spu_context *ctx); 2892cf2b3b4SChristoph Hellwig void spu_update_sched_info(struct spu_context *ctx); 2902cf2b3b4SChristoph Hellwig void __spu_update_sched_info(struct spu_context *ctx); 2918b3d6663SArnd Bergmann int __init spu_sched_init(void); 292d1450317SSebastian Siewior void spu_sched_exit(void); 2938b3d6663SArnd Bergmann 294c6730ed4SJeremy Kerr extern char *isolated_loader; 295c6730ed4SJeremy Kerr 296ce8ab854SArnd Bergmann /* 297ce8ab854SArnd Bergmann * spufs_wait 298ce8ab854SArnd Bergmann * Same as wait_event_interruptible(), except that here 299ce8ab854SArnd Bergmann * we need to call spu_release(ctx) before sleeping, and 300ce8ab854SArnd Bergmann * then spu_acquire(ctx) when awoken. 301eebead5bSChristoph Hellwig * 302eebead5bSChristoph Hellwig * Returns with state_mutex re-acquired when successfull or 303eebead5bSChristoph Hellwig * with -ERESTARTSYS and the state_mutex dropped when interrupted. 304ce8ab854SArnd Bergmann */ 305ce8ab854SArnd Bergmann 306ce8ab854SArnd Bergmann #define spufs_wait(wq, condition) \ 307ce8ab854SArnd Bergmann ({ \ 308ce8ab854SArnd Bergmann int __ret = 0; \ 309ce8ab854SArnd Bergmann DEFINE_WAIT(__wait); \ 310ce8ab854SArnd Bergmann for (;;) { \ 311ce8ab854SArnd Bergmann prepare_to_wait(&(wq), &__wait, TASK_INTERRUPTIBLE); \ 312ce8ab854SArnd Bergmann if (condition) \ 313ce8ab854SArnd Bergmann break; \ 314eebead5bSChristoph Hellwig spu_release(ctx); \ 315d3764397SJeremy Kerr if (signal_pending(current)) { \ 316d3764397SJeremy Kerr __ret = -ERESTARTSYS; \ 317d3764397SJeremy Kerr break; \ 318d3764397SJeremy Kerr } \ 319ce8ab854SArnd Bergmann schedule(); \ 320c9101bdbSChristoph Hellwig __ret = spu_acquire(ctx); \ 321c9101bdbSChristoph Hellwig if (__ret) \ 322c9101bdbSChristoph Hellwig break; \ 323ce8ab854SArnd Bergmann } \ 324ce8ab854SArnd Bergmann finish_wait(&(wq), &__wait); \ 325ce8ab854SArnd Bergmann __ret; \ 326ce8ab854SArnd Bergmann }) 327ce8ab854SArnd Bergmann 3288b3d6663SArnd Bergmann size_t spu_wbox_write(struct spu_context *ctx, u32 data); 3298b3d6663SArnd Bergmann size_t spu_ibox_read(struct spu_context *ctx, u32 *data); 3308b3d6663SArnd Bergmann 3318b3d6663SArnd Bergmann /* irq callback funcs. */ 3328b3d6663SArnd Bergmann void spufs_ibox_callback(struct spu *spu); 3338b3d6663SArnd Bergmann void spufs_wbox_callback(struct spu *spu); 3345110459fSArnd Bergmann void spufs_stop_callback(struct spu *spu); 335a33a7d73SArnd Bergmann void spufs_mfc_callback(struct spu *spu); 3369add11daSArnd Bergmann void spufs_dma_callback(struct spu *spu, int type); 3378b3d6663SArnd Bergmann 338bf1ab978SDwayne Grant McConnell extern struct spu_coredump_calls spufs_coredump_calls; 339bf1ab978SDwayne Grant McConnell struct spufs_coredump_reader { 340bf1ab978SDwayne Grant McConnell char *name; 341bf1ab978SDwayne Grant McConnell ssize_t (*read)(struct spu_context *ctx, 342bf1ab978SDwayne Grant McConnell char __user *buffer, size_t size, loff_t *pos); 34374de08bcSMichael Ellerman u64 (*get)(struct spu_context *ctx); 344bf1ab978SDwayne Grant McConnell size_t size; 345bf1ab978SDwayne Grant McConnell }; 346bf1ab978SDwayne Grant McConnell extern struct spufs_coredump_reader spufs_coredump_read[]; 347bf1ab978SDwayne Grant McConnell extern int spufs_coredump_num_notes; 348bf1ab978SDwayne Grant McConnell 3497cd58e43SJeremy Kerr extern int spu_init_csa(struct spu_state *csa); 3507cd58e43SJeremy Kerr extern void spu_fini_csa(struct spu_state *csa); 3517cd58e43SJeremy Kerr extern int spu_save(struct spu_state *prev, struct spu *spu); 3527cd58e43SJeremy Kerr extern int spu_restore(struct spu_state *new, struct spu *spu); 3537cd58e43SJeremy Kerr extern int spu_switch(struct spu_state *prev, struct spu_state *new, 3547cd58e43SJeremy Kerr struct spu *spu); 3557cd58e43SJeremy Kerr extern int spu_alloc_lscsa(struct spu_state *csa); 3567cd58e43SJeremy Kerr extern void spu_free_lscsa(struct spu_state *csa); 35727ec41d3SAndre Detsch 3587cd58e43SJeremy Kerr extern void spuctx_switch_state(struct spu_context *ctx, 3597cd58e43SJeremy Kerr enum spu_utilization_state new_state); 360fe2f896dSChristoph Hellwig 361038200cfSChristoph Hellwig #define spu_context_trace(name, ctx, spu) \ 362038200cfSChristoph Hellwig trace_mark(name, "%p %p", ctx, spu); 363038200cfSChristoph Hellwig #define spu_context_nospu_trace(name, ctx) \ 364038200cfSChristoph Hellwig trace_mark(name, "%p", ctx); 365038200cfSChristoph Hellwig 36667207b96SArnd Bergmann #endif 367