1de6cc651SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
267207b96SArnd Bergmann /*
367207b96SArnd Bergmann * SPU file system
467207b96SArnd Bergmann *
567207b96SArnd Bergmann * (C) Copyright IBM Deutschland Entwicklung GmbH 2005
667207b96SArnd Bergmann *
767207b96SArnd Bergmann * Author: Arnd Bergmann <arndb@de.ibm.com>
867207b96SArnd Bergmann */
967207b96SArnd Bergmann #ifndef SPUFS_H
1067207b96SArnd Bergmann #define SPUFS_H
1167207b96SArnd Bergmann
1267207b96SArnd Bergmann #include <linux/kref.h>
13650f8b02SChristoph Hellwig #include <linux/mutex.h>
1467207b96SArnd Bergmann #include <linux/spinlock.h>
1567207b96SArnd Bergmann #include <linux/fs.h>
16ea1ae594SChristoph Hellwig #include <linux/cpumask.h>
17174cd4b1SIngo Molnar #include <linux/sched/signal.h>
1867207b96SArnd Bergmann
1967207b96SArnd Bergmann #include <asm/spu.h>
205473af04SMark Nutter #include <asm/spu_csa.h>
21b9e3bd77SDwayne Grant McConnell #include <asm/spu_info.h>
2267207b96SArnd Bergmann
2387ff6090SJeremy Kerr #define SPUFS_PS_MAP_SIZE 0x20000
2487ff6090SJeremy Kerr #define SPUFS_MFC_MAP_SIZE 0x1000
2587ff6090SJeremy Kerr #define SPUFS_CNTL_MAP_SIZE 0x1000
2687ff6090SJeremy Kerr #define SPUFS_SIGNAL_MAP_SIZE PAGE_SIZE
2787ff6090SJeremy Kerr #define SPUFS_MSS_MAP_SIZE 0x1000
2887ff6090SJeremy Kerr
2967207b96SArnd Bergmann /* The magic number for our file system */
3067207b96SArnd Bergmann enum {
3167207b96SArnd Bergmann SPUFS_MAGIC = 0x23c9b64e,
3267207b96SArnd Bergmann };
3367207b96SArnd Bergmann
348b3d6663SArnd Bergmann struct spu_context_ops;
356263203eSArnd Bergmann struct spu_gang;
366263203eSArnd Bergmann
3736aaccc1SBob Nelson /* ctx->sched_flags */
3836aaccc1SBob Nelson enum {
3936aaccc1SBob Nelson SPU_SCHED_NOTIFY_ACTIVE,
40b2c863bdSChristoph Hellwig SPU_SCHED_WAS_ACTIVE, /* was active upon spu_acquire_saved() */
41ce7c191bSJeremy Kerr SPU_SCHED_SPU_RUN, /* context is within spu_run */
4236aaccc1SBob Nelson };
4336aaccc1SBob Nelson
445158e9b5SChristoph Hellwig enum {
455158e9b5SChristoph Hellwig SWITCH_LOG_BUFSIZE = 4096,
465158e9b5SChristoph Hellwig };
475158e9b5SChristoph Hellwig
485158e9b5SChristoph Hellwig enum {
495158e9b5SChristoph Hellwig SWITCH_LOG_START,
505158e9b5SChristoph Hellwig SWITCH_LOG_STOP,
515158e9b5SChristoph Hellwig SWITCH_LOG_EXIT,
525158e9b5SChristoph Hellwig };
535158e9b5SChristoph Hellwig
545158e9b5SChristoph Hellwig struct switch_log {
555158e9b5SChristoph Hellwig wait_queue_head_t wait;
565158e9b5SChristoph Hellwig unsigned long head;
575158e9b5SChristoph Hellwig unsigned long tail;
585158e9b5SChristoph Hellwig struct switch_log_entry {
59cef37ac1SArnd Bergmann struct timespec64 tstamp;
605158e9b5SChristoph Hellwig s32 spu_id;
615158e9b5SChristoph Hellwig u32 type;
625158e9b5SChristoph Hellwig u32 val;
635158e9b5SChristoph Hellwig u64 timebase;
645158e9b5SChristoph Hellwig } log[];
655158e9b5SChristoph Hellwig };
665158e9b5SChristoph Hellwig
6767207b96SArnd Bergmann struct spu_context {
6867207b96SArnd Bergmann struct spu *spu; /* pointer to a physical SPU */
695473af04SMark Nutter struct spu_state csa; /* SPU context save area. */
7067207b96SArnd Bergmann spinlock_t mmio_lock; /* protects mmio access */
716df10a82SMark Nutter struct address_space *local_store; /* local store mapping. */
726df10a82SMark Nutter struct address_space *mfc; /* 'mfc' area mappings. */
736df10a82SMark Nutter struct address_space *cntl; /* 'control' area mappings. */
746df10a82SMark Nutter struct address_space *signal1; /* 'signal1' area mappings. */
756df10a82SMark Nutter struct address_space *signal2; /* 'signal2' area mappings. */
7617e0e270SBenjamin Herrenschmidt struct address_space *mss; /* 'mss' area mappings. */
7717e0e270SBenjamin Herrenschmidt struct address_space *psmap; /* 'psmap' area mappings. */
7847d3a5faSChristoph Hellwig struct mutex mapping_lock;
79*62ccae78SChristophe Leroy u64 object_id; /* user space pointer for GNU Debugger */
808b3d6663SArnd Bergmann
818b3d6663SArnd Bergmann enum { SPU_STATE_RUNNABLE, SPU_STATE_SAVED } state;
82650f8b02SChristoph Hellwig struct mutex state_mutex;
83e45d48a3SChristoph Hellwig struct mutex run_mutex;
848b3d6663SArnd Bergmann
858b3d6663SArnd Bergmann struct mm_struct *owner;
8667207b96SArnd Bergmann
8767207b96SArnd Bergmann struct kref kref;
888b3d6663SArnd Bergmann wait_queue_head_t ibox_wq;
898b3d6663SArnd Bergmann wait_queue_head_t wbox_wq;
905110459fSArnd Bergmann wait_queue_head_t stop_wq;
91a33a7d73SArnd Bergmann wait_queue_head_t mfc_wq;
9233bfd7a7SArnd Bergmann wait_queue_head_t run_wq;
93a33a7d73SArnd Bergmann u32 tagwait;
948b3d6663SArnd Bergmann struct spu_context_ops *ops;
952a911f0bSArnd Bergmann struct work_struct reap_work;
969add11daSArnd Bergmann unsigned long flags;
979add11daSArnd Bergmann unsigned long event_return;
986263203eSArnd Bergmann
996263203eSArnd Bergmann struct list_head gang_list;
1006263203eSArnd Bergmann struct spu_gang *gang;
1011474855dSBob Nelson struct kref *prof_priv_kref;
1021474855dSBob Nelson void ( * prof_priv_release) (struct kref *kref);
1038389998aSChristoph Hellwig
104476273adSChristoph Hellwig /* owner thread */
105476273adSChristoph Hellwig pid_t tid;
106476273adSChristoph Hellwig
1078389998aSChristoph Hellwig /* scheduler fields */
108079cdb61SChristoph Hellwig struct list_head rq;
10937901802SChristoph Hellwig unsigned int time_slice;
11026bec673SChristoph Hellwig unsigned long sched_flags;
111ea1ae594SChristoph Hellwig cpumask_t cpus_allowed;
1122eb1b120SChristoph Hellwig int policy;
1138389998aSChristoph Hellwig int prio;
1147a214200SLuke Browning int last_ran;
115e9f8a0b6SChristoph Hellwig
116e9f8a0b6SChristoph Hellwig /* statistics */
117e9f8a0b6SChristoph Hellwig struct {
118e9f8a0b6SChristoph Hellwig /* updates protected by ctx->state_mutex */
11927ec41d3SAndre Detsch enum spu_utilization_state util_state;
12027ec41d3SAndre Detsch unsigned long long tstamp; /* time of last state switch */
12127ec41d3SAndre Detsch unsigned long long times[SPU_UTIL_MAX];
122e9f8a0b6SChristoph Hellwig unsigned long long vol_ctx_switch;
123e9f8a0b6SChristoph Hellwig unsigned long long invol_ctx_switch;
124e9f8a0b6SChristoph Hellwig unsigned long long min_flt;
125e9f8a0b6SChristoph Hellwig unsigned long long maj_flt;
126e9f8a0b6SChristoph Hellwig unsigned long long hash_flt;
127e9f8a0b6SChristoph Hellwig unsigned long long slb_flt;
128e9f8a0b6SChristoph Hellwig unsigned long long slb_flt_base; /* # at last ctx switch */
129e9f8a0b6SChristoph Hellwig unsigned long long class2_intr;
130e9f8a0b6SChristoph Hellwig unsigned long long class2_intr_base; /* # at last ctx switch */
131e9f8a0b6SChristoph Hellwig unsigned long long libassist;
132e9f8a0b6SChristoph Hellwig } stats;
1338e68e2f2SArnd Bergmann
1345158e9b5SChristoph Hellwig /* context switch log */
1355158e9b5SChristoph Hellwig struct switch_log *switch_log;
1365158e9b5SChristoph Hellwig
1378e68e2f2SArnd Bergmann struct list_head aff_list;
1388e68e2f2SArnd Bergmann int aff_head;
139c5fc8d2aSArnd Bergmann int aff_offset;
1406263203eSArnd Bergmann };
1416263203eSArnd Bergmann
1426263203eSArnd Bergmann struct spu_gang {
1436263203eSArnd Bergmann struct list_head list;
1446263203eSArnd Bergmann struct mutex mutex;
1456263203eSArnd Bergmann struct kref kref;
1466263203eSArnd Bergmann int contexts;
1478e68e2f2SArnd Bergmann
1488e68e2f2SArnd Bergmann struct spu_context *aff_ref_ctx;
1498e68e2f2SArnd Bergmann struct list_head aff_list_head;
1508e68e2f2SArnd Bergmann struct mutex aff_mutex;
1518e68e2f2SArnd Bergmann int aff_flags;
152c5fc8d2aSArnd Bergmann struct spu *aff_ref_spu;
153c5fc8d2aSArnd Bergmann atomic_t aff_sched_count;
15467207b96SArnd Bergmann };
15567207b96SArnd Bergmann
1568e68e2f2SArnd Bergmann /* Flag bits for spu_gang aff_flags */
1578e68e2f2SArnd Bergmann #define AFF_OFFSETS_SET 1
1588e68e2f2SArnd Bergmann #define AFF_MERGED 2
1598e68e2f2SArnd Bergmann
160a33a7d73SArnd Bergmann struct mfc_dma_command {
161a33a7d73SArnd Bergmann int32_t pad; /* reserved */
162a33a7d73SArnd Bergmann uint32_t lsa; /* local storage address */
163a33a7d73SArnd Bergmann uint64_t ea; /* effective address */
164a33a7d73SArnd Bergmann uint16_t size; /* transfer size */
165a33a7d73SArnd Bergmann uint16_t tag; /* command tag */
166a33a7d73SArnd Bergmann uint16_t class; /* class ID */
167a33a7d73SArnd Bergmann uint16_t cmd; /* command opcode */
168a33a7d73SArnd Bergmann };
169a33a7d73SArnd Bergmann
170a33a7d73SArnd Bergmann
1718b3d6663SArnd Bergmann /* SPU context query/set operations. */
1728b3d6663SArnd Bergmann struct spu_context_ops {
1738b3d6663SArnd Bergmann int (*mbox_read) (struct spu_context * ctx, u32 * data);
1748b3d6663SArnd Bergmann u32(*mbox_stat_read) (struct spu_context * ctx);
1758153a5eaSAl Viro __poll_t (*mbox_stat_poll)(struct spu_context *ctx, __poll_t events);
1768b3d6663SArnd Bergmann int (*ibox_read) (struct spu_context * ctx, u32 * data);
1778b3d6663SArnd Bergmann int (*wbox_write) (struct spu_context * ctx, u32 data);
1788b3d6663SArnd Bergmann u32(*signal1_read) (struct spu_context * ctx);
1798b3d6663SArnd Bergmann void (*signal1_write) (struct spu_context * ctx, u32 data);
1808b3d6663SArnd Bergmann u32(*signal2_read) (struct spu_context * ctx);
1818b3d6663SArnd Bergmann void (*signal2_write) (struct spu_context * ctx, u32 data);
1828b3d6663SArnd Bergmann void (*signal1_type_set) (struct spu_context * ctx, u64 val);
1838b3d6663SArnd Bergmann u64(*signal1_type_get) (struct spu_context * ctx);
1848b3d6663SArnd Bergmann void (*signal2_type_set) (struct spu_context * ctx, u64 val);
1858b3d6663SArnd Bergmann u64(*signal2_type_get) (struct spu_context * ctx);
1868b3d6663SArnd Bergmann u32(*npc_read) (struct spu_context * ctx);
1878b3d6663SArnd Bergmann void (*npc_write) (struct spu_context * ctx, u32 data);
1888b3d6663SArnd Bergmann u32(*status_read) (struct spu_context * ctx);
1898b3d6663SArnd Bergmann char*(*get_ls) (struct spu_context * ctx);
190cc210b3eSLuke Browning void (*privcntl_write) (struct spu_context *ctx, u64 data);
1913960c260SJeremy Kerr u32 (*runcntl_read) (struct spu_context * ctx);
1925110459fSArnd Bergmann void (*runcntl_write) (struct spu_context * ctx, u32 data);
193c25620d7SMasato Noguchi void (*runcntl_stop) (struct spu_context * ctx);
194ee2d7340SArnd Bergmann void (*master_start) (struct spu_context * ctx);
195ee2d7340SArnd Bergmann void (*master_stop) (struct spu_context * ctx);
196a33a7d73SArnd Bergmann int (*set_mfc_query)(struct spu_context * ctx, u32 mask, u32 mode);
197a33a7d73SArnd Bergmann u32 (*read_mfc_tagstatus)(struct spu_context * ctx);
198a33a7d73SArnd Bergmann u32 (*get_mfc_free_elements)(struct spu_context *ctx);
199a33a7d73SArnd Bergmann int (*send_mfc_command)(struct spu_context * ctx,
200a33a7d73SArnd Bergmann struct mfc_dma_command * cmd);
201b9e3bd77SDwayne Grant McConnell void (*dma_info_read) (struct spu_context * ctx,
202b9e3bd77SDwayne Grant McConnell struct spu_dma_info * info);
203b9e3bd77SDwayne Grant McConnell void (*proxydma_info_read) (struct spu_context * ctx,
204b9e3bd77SDwayne Grant McConnell struct spu_proxydma_info * info);
20557dace23SArnd Bergmann void (*restart_dma)(struct spu_context *ctx);
2068b3d6663SArnd Bergmann };
2078b3d6663SArnd Bergmann
2088b3d6663SArnd Bergmann extern struct spu_context_ops spu_hw_ops;
2098b3d6663SArnd Bergmann extern struct spu_context_ops spu_backing_ops;
2108b3d6663SArnd Bergmann
21167207b96SArnd Bergmann struct spufs_inode_info {
21267207b96SArnd Bergmann struct spu_context *i_ctx;
2136263203eSArnd Bergmann struct spu_gang *i_gang;
21467207b96SArnd Bergmann struct inode vfs_inode;
21543c2bbd9SChristoph Hellwig int i_openers;
21667207b96SArnd Bergmann };
21767207b96SArnd Bergmann #define SPUFS_I(inode) \
21867207b96SArnd Bergmann container_of(inode, struct spufs_inode_info, vfs_inode)
21967207b96SArnd Bergmann
22023d893f5SJeremy Kerr struct spufs_tree_descr {
22123d893f5SJeremy Kerr const char *name;
22223d893f5SJeremy Kerr const struct file_operations *ops;
223c6684b26SAl Viro umode_t mode;
22423d893f5SJeremy Kerr size_t size;
22523d893f5SJeremy Kerr };
22623d893f5SJeremy Kerr
22774254647SJeremy Kerr extern const struct spufs_tree_descr spufs_dir_contents[];
22874254647SJeremy Kerr extern const struct spufs_tree_descr spufs_dir_nosched_contents[];
22974254647SJeremy Kerr extern const struct spufs_tree_descr spufs_dir_debug_contents[];
23067207b96SArnd Bergmann
23167207b96SArnd Bergmann /* system call implementation */
23298f06978SJeremy Kerr extern struct spufs_calls spufs_calls;
233cdc3d562SAl Viro struct coredump_params;
23450af32a9SJeremy Kerr long spufs_run_spu(struct spu_context *ctx, u32 *npc, u32 *status);
2351ba10681SAl Viro long spufs_create(const struct path *nd, struct dentry *dentry, unsigned int flags,
236c6684b26SAl Viro umode_t mode, struct file *filp);
23748cad41fSMichael Ellerman /* ELF coredump callbacks for writing SPU ELF notes */
23848cad41fSMichael Ellerman extern int spufs_coredump_extra_notes_size(void);
239cdc3d562SAl Viro extern int spufs_coredump_extra_notes_write(struct coredump_params *cprm);
24048cad41fSMichael Ellerman
2419c2e08c5SArjan van de Ven extern const struct file_operations spufs_context_fops;
24267207b96SArnd Bergmann
2436263203eSArnd Bergmann /* gang management */
2446263203eSArnd Bergmann struct spu_gang *alloc_spu_gang(void);
2456263203eSArnd Bergmann struct spu_gang *get_spu_gang(struct spu_gang *gang);
2466263203eSArnd Bergmann int put_spu_gang(struct spu_gang *gang);
2476263203eSArnd Bergmann void spu_gang_remove_ctx(struct spu_gang *gang, struct spu_context *ctx);
2486263203eSArnd Bergmann void spu_gang_add_ctx(struct spu_gang *gang, struct spu_context *ctx);
2496263203eSArnd Bergmann
25057dace23SArnd Bergmann /* fault handling */
25157dace23SArnd Bergmann int spufs_handle_class1(struct spu_context *ctx);
252d6ad39bcSJeremy Kerr int spufs_handle_class0(struct spu_context *ctx);
25357dace23SArnd Bergmann
254c5fc8d2aSArnd Bergmann /* affinity */
255c5fc8d2aSArnd Bergmann struct spu *affinity_check(struct spu_context *ctx);
256c5fc8d2aSArnd Bergmann
25767207b96SArnd Bergmann /* context management */
25865de66f0SChristoph Hellwig extern atomic_t nr_spu_contexts;
spu_acquire(struct spu_context * ctx)259c9101bdbSChristoph Hellwig static inline int __must_check spu_acquire(struct spu_context *ctx)
2606a0641e5SChristoph Hellwig {
261c9101bdbSChristoph Hellwig return mutex_lock_interruptible(&ctx->state_mutex);
2626a0641e5SChristoph Hellwig }
2636a0641e5SChristoph Hellwig
spu_release(struct spu_context * ctx)2646a0641e5SChristoph Hellwig static inline void spu_release(struct spu_context *ctx)
2656a0641e5SChristoph Hellwig {
2666a0641e5SChristoph Hellwig mutex_unlock(&ctx->state_mutex);
2676a0641e5SChristoph Hellwig }
2686a0641e5SChristoph Hellwig
2696263203eSArnd Bergmann struct spu_context * alloc_spu_context(struct spu_gang *gang);
27067207b96SArnd Bergmann void destroy_spu_context(struct kref *kref);
27167207b96SArnd Bergmann struct spu_context * get_spu_context(struct spu_context *ctx);
27267207b96SArnd Bergmann int put_spu_context(struct spu_context *ctx);
2735110459fSArnd Bergmann void spu_unmap_mappings(struct spu_context *ctx);
27467207b96SArnd Bergmann
2758b3d6663SArnd Bergmann void spu_forget(struct spu_context *ctx);
276c9101bdbSChristoph Hellwig int __must_check spu_acquire_saved(struct spu_context *ctx);
27727b1ea09SChristoph Hellwig void spu_release_saved(struct spu_context *ctx);
27850b520d4SChristoph Hellwig
279e65c2f6fSLuke Browning int spu_stopped(struct spu_context *ctx, u32 * stat);
280e65c2f6fSLuke Browning void spu_del_from_rq(struct spu_context *ctx);
28126bec673SChristoph Hellwig int spu_activate(struct spu_context *ctx, unsigned long flags);
2828b3d6663SArnd Bergmann void spu_deactivate(struct spu_context *ctx);
2838b3d6663SArnd Bergmann void spu_yield(struct spu_context *ctx);
2845158e9b5SChristoph Hellwig void spu_switch_log_notify(struct spu *spu, struct spu_context *ctx,
2855158e9b5SChristoph Hellwig u32 type, u32 val);
286fe443ef2SChristoph Hellwig void spu_set_timeslice(struct spu_context *ctx);
2872cf2b3b4SChristoph Hellwig void spu_update_sched_info(struct spu_context *ctx);
2882cf2b3b4SChristoph Hellwig void __spu_update_sched_info(struct spu_context *ctx);
2898b3d6663SArnd Bergmann int __init spu_sched_init(void);
290d1450317SSebastian Siewior void spu_sched_exit(void);
2918b3d6663SArnd Bergmann
292c6730ed4SJeremy Kerr extern char *isolated_loader;
293c6730ed4SJeremy Kerr
294ce8ab854SArnd Bergmann /*
295ce8ab854SArnd Bergmann * spufs_wait
296ce8ab854SArnd Bergmann * Same as wait_event_interruptible(), except that here
297ce8ab854SArnd Bergmann * we need to call spu_release(ctx) before sleeping, and
298ce8ab854SArnd Bergmann * then spu_acquire(ctx) when awoken.
299eebead5bSChristoph Hellwig *
30073ac36eaSColy Li * Returns with state_mutex re-acquired when successful or
301eebead5bSChristoph Hellwig * with -ERESTARTSYS and the state_mutex dropped when interrupted.
302ce8ab854SArnd Bergmann */
303ce8ab854SArnd Bergmann
304ce8ab854SArnd Bergmann #define spufs_wait(wq, condition) \
305ce8ab854SArnd Bergmann ({ \
306ce8ab854SArnd Bergmann int __ret = 0; \
307ce8ab854SArnd Bergmann DEFINE_WAIT(__wait); \
308ce8ab854SArnd Bergmann for (;;) { \
309ce8ab854SArnd Bergmann prepare_to_wait(&(wq), &__wait, TASK_INTERRUPTIBLE); \
310ce8ab854SArnd Bergmann if (condition) \
311ce8ab854SArnd Bergmann break; \
312eebead5bSChristoph Hellwig spu_release(ctx); \
313d3764397SJeremy Kerr if (signal_pending(current)) { \
314d3764397SJeremy Kerr __ret = -ERESTARTSYS; \
315d3764397SJeremy Kerr break; \
316d3764397SJeremy Kerr } \
317ce8ab854SArnd Bergmann schedule(); \
318c9101bdbSChristoph Hellwig __ret = spu_acquire(ctx); \
319c9101bdbSChristoph Hellwig if (__ret) \
320c9101bdbSChristoph Hellwig break; \
321ce8ab854SArnd Bergmann } \
322ce8ab854SArnd Bergmann finish_wait(&(wq), &__wait); \
323ce8ab854SArnd Bergmann __ret; \
324ce8ab854SArnd Bergmann })
325ce8ab854SArnd Bergmann
3268b3d6663SArnd Bergmann size_t spu_wbox_write(struct spu_context *ctx, u32 data);
3278b3d6663SArnd Bergmann size_t spu_ibox_read(struct spu_context *ctx, u32 *data);
3288b3d6663SArnd Bergmann
3298b3d6663SArnd Bergmann /* irq callback funcs. */
3308b3d6663SArnd Bergmann void spufs_ibox_callback(struct spu *spu);
3318b3d6663SArnd Bergmann void spufs_wbox_callback(struct spu *spu);
332f3d69e05SLuke Browning void spufs_stop_callback(struct spu *spu, int irq);
333a33a7d73SArnd Bergmann void spufs_mfc_callback(struct spu *spu);
3349add11daSArnd Bergmann void spufs_dma_callback(struct spu *spu, int type);
3358b3d6663SArnd Bergmann
336bf1ab978SDwayne Grant McConnell struct spufs_coredump_reader {
337bf1ab978SDwayne Grant McConnell char *name;
3385456ffdeSChristoph Hellwig ssize_t (*dump)(struct spu_context *ctx, struct coredump_params *cprm);
33974de08bcSMichael Ellerman u64 (*get)(struct spu_context *ctx);
340bf1ab978SDwayne Grant McConnell size_t size;
341bf1ab978SDwayne Grant McConnell };
34274254647SJeremy Kerr extern const struct spufs_coredump_reader spufs_coredump_read[];
343bf1ab978SDwayne Grant McConnell
3447cd58e43SJeremy Kerr extern int spu_init_csa(struct spu_state *csa);
3457cd58e43SJeremy Kerr extern void spu_fini_csa(struct spu_state *csa);
3467cd58e43SJeremy Kerr extern int spu_save(struct spu_state *prev, struct spu *spu);
3477cd58e43SJeremy Kerr extern int spu_restore(struct spu_state *new, struct spu *spu);
3487cd58e43SJeremy Kerr extern int spu_switch(struct spu_state *prev, struct spu_state *new,
3497cd58e43SJeremy Kerr struct spu *spu);
3507cd58e43SJeremy Kerr extern int spu_alloc_lscsa(struct spu_state *csa);
3517cd58e43SJeremy Kerr extern void spu_free_lscsa(struct spu_state *csa);
35227ec41d3SAndre Detsch
3537cd58e43SJeremy Kerr extern void spuctx_switch_state(struct spu_context *ctx,
3547cd58e43SJeremy Kerr enum spu_utilization_state new_state);
355fe2f896dSChristoph Hellwig
35667207b96SArnd Bergmann #endif
357