xref: /openbmc/linux/arch/powerpc/platforms/cell/spufs/spufs.h (revision b694e3c604e999343258c49e574abd7be012e726)
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;
7962ccae78SChristophe 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;
154*324f2808SAl Viro 
155*324f2808SAl Viro 	int alive;
15667207b96SArnd Bergmann };
15767207b96SArnd Bergmann 
1588e68e2f2SArnd Bergmann /* Flag bits for spu_gang aff_flags */
1598e68e2f2SArnd Bergmann #define AFF_OFFSETS_SET		1
1608e68e2f2SArnd Bergmann #define AFF_MERGED		2
1618e68e2f2SArnd Bergmann 
162a33a7d73SArnd Bergmann struct mfc_dma_command {
163a33a7d73SArnd Bergmann 	int32_t pad;	/* reserved */
164a33a7d73SArnd Bergmann 	uint32_t lsa;	/* local storage address */
165a33a7d73SArnd Bergmann 	uint64_t ea;	/* effective address */
166a33a7d73SArnd Bergmann 	uint16_t size;	/* transfer size */
167a33a7d73SArnd Bergmann 	uint16_t tag;	/* command tag */
168a33a7d73SArnd Bergmann 	uint16_t class;	/* class ID */
169a33a7d73SArnd Bergmann 	uint16_t cmd;	/* command opcode */
170a33a7d73SArnd Bergmann };
171a33a7d73SArnd Bergmann 
172a33a7d73SArnd Bergmann 
1738b3d6663SArnd Bergmann /* SPU context query/set operations. */
1748b3d6663SArnd Bergmann struct spu_context_ops {
1758b3d6663SArnd Bergmann 	int (*mbox_read) (struct spu_context * ctx, u32 * data);
1768b3d6663SArnd Bergmann 	 u32(*mbox_stat_read) (struct spu_context * ctx);
1778153a5eaSAl Viro 	__poll_t (*mbox_stat_poll)(struct spu_context *ctx, __poll_t events);
1788b3d6663SArnd Bergmann 	int (*ibox_read) (struct spu_context * ctx, u32 * data);
1798b3d6663SArnd Bergmann 	int (*wbox_write) (struct spu_context * ctx, u32 data);
1808b3d6663SArnd Bergmann 	 u32(*signal1_read) (struct spu_context * ctx);
1818b3d6663SArnd Bergmann 	void (*signal1_write) (struct spu_context * ctx, u32 data);
1828b3d6663SArnd Bergmann 	 u32(*signal2_read) (struct spu_context * ctx);
1838b3d6663SArnd Bergmann 	void (*signal2_write) (struct spu_context * ctx, u32 data);
1848b3d6663SArnd Bergmann 	void (*signal1_type_set) (struct spu_context * ctx, u64 val);
1858b3d6663SArnd Bergmann 	 u64(*signal1_type_get) (struct spu_context * ctx);
1868b3d6663SArnd Bergmann 	void (*signal2_type_set) (struct spu_context * ctx, u64 val);
1878b3d6663SArnd Bergmann 	 u64(*signal2_type_get) (struct spu_context * ctx);
1888b3d6663SArnd Bergmann 	 u32(*npc_read) (struct spu_context * ctx);
1898b3d6663SArnd Bergmann 	void (*npc_write) (struct spu_context * ctx, u32 data);
1908b3d6663SArnd Bergmann 	 u32(*status_read) (struct spu_context * ctx);
1918b3d6663SArnd Bergmann 	char*(*get_ls) (struct spu_context * ctx);
192cc210b3eSLuke Browning 	void (*privcntl_write) (struct spu_context *ctx, u64 data);
1933960c260SJeremy Kerr 	 u32 (*runcntl_read) (struct spu_context * ctx);
1945110459fSArnd Bergmann 	void (*runcntl_write) (struct spu_context * ctx, u32 data);
195c25620d7SMasato Noguchi 	void (*runcntl_stop) (struct spu_context * ctx);
196ee2d7340SArnd Bergmann 	void (*master_start) (struct spu_context * ctx);
197ee2d7340SArnd Bergmann 	void (*master_stop) (struct spu_context * ctx);
198a33a7d73SArnd Bergmann 	int (*set_mfc_query)(struct spu_context * ctx, u32 mask, u32 mode);
199a33a7d73SArnd Bergmann 	u32 (*read_mfc_tagstatus)(struct spu_context * ctx);
200a33a7d73SArnd Bergmann 	u32 (*get_mfc_free_elements)(struct spu_context *ctx);
201a33a7d73SArnd Bergmann 	int (*send_mfc_command)(struct spu_context * ctx,
202a33a7d73SArnd Bergmann 				struct mfc_dma_command * cmd);
203b9e3bd77SDwayne Grant McConnell 	void (*dma_info_read) (struct spu_context * ctx,
204b9e3bd77SDwayne Grant McConnell 			       struct spu_dma_info * info);
205b9e3bd77SDwayne Grant McConnell 	void (*proxydma_info_read) (struct spu_context * ctx,
206b9e3bd77SDwayne Grant McConnell 				    struct spu_proxydma_info * info);
20757dace23SArnd Bergmann 	void (*restart_dma)(struct spu_context *ctx);
2088b3d6663SArnd Bergmann };
2098b3d6663SArnd Bergmann 
2108b3d6663SArnd Bergmann extern struct spu_context_ops spu_hw_ops;
2118b3d6663SArnd Bergmann extern struct spu_context_ops spu_backing_ops;
2128b3d6663SArnd Bergmann 
21367207b96SArnd Bergmann struct spufs_inode_info {
21467207b96SArnd Bergmann 	struct spu_context *i_ctx;
2156263203eSArnd Bergmann 	struct spu_gang *i_gang;
21667207b96SArnd Bergmann 	struct inode vfs_inode;
21743c2bbd9SChristoph Hellwig 	int i_openers;
21867207b96SArnd Bergmann };
21967207b96SArnd Bergmann #define SPUFS_I(inode) \
22067207b96SArnd Bergmann 	container_of(inode, struct spufs_inode_info, vfs_inode)
22167207b96SArnd Bergmann 
22223d893f5SJeremy Kerr struct spufs_tree_descr {
22323d893f5SJeremy Kerr 	const char *name;
22423d893f5SJeremy Kerr 	const struct file_operations *ops;
225c6684b26SAl Viro 	umode_t mode;
22623d893f5SJeremy Kerr 	size_t size;
22723d893f5SJeremy Kerr };
22823d893f5SJeremy Kerr 
22974254647SJeremy Kerr extern const struct spufs_tree_descr spufs_dir_contents[];
23074254647SJeremy Kerr extern const struct spufs_tree_descr spufs_dir_nosched_contents[];
23174254647SJeremy Kerr extern const struct spufs_tree_descr spufs_dir_debug_contents[];
23267207b96SArnd Bergmann 
23367207b96SArnd Bergmann /* system call implementation */
23498f06978SJeremy Kerr extern struct spufs_calls spufs_calls;
235cdc3d562SAl Viro struct coredump_params;
23650af32a9SJeremy Kerr long spufs_run_spu(struct spu_context *ctx, u32 *npc, u32 *status);
23720f45ad5SAl Viro long spufs_create(const struct path *nd, struct dentry *dentry, unsigned int flags,
238c6684b26SAl Viro 			umode_t mode, struct file *filp);
23948cad41fSMichael Ellerman /* ELF coredump callbacks for writing SPU ELF notes */
24048cad41fSMichael Ellerman extern int spufs_coredump_extra_notes_size(void);
241cdc3d562SAl Viro extern int spufs_coredump_extra_notes_write(struct coredump_params *cprm);
24248cad41fSMichael Ellerman 
2439c2e08c5SArjan van de Ven extern const struct file_operations spufs_context_fops;
24467207b96SArnd Bergmann 
2456263203eSArnd Bergmann /* gang management */
2466263203eSArnd Bergmann struct spu_gang *alloc_spu_gang(void);
2476263203eSArnd Bergmann struct spu_gang *get_spu_gang(struct spu_gang *gang);
2486263203eSArnd Bergmann int put_spu_gang(struct spu_gang *gang);
2496263203eSArnd Bergmann void spu_gang_remove_ctx(struct spu_gang *gang, struct spu_context *ctx);
2506263203eSArnd Bergmann void spu_gang_add_ctx(struct spu_gang *gang, struct spu_context *ctx);
2516263203eSArnd Bergmann 
25257dace23SArnd Bergmann /* fault handling */
25357dace23SArnd Bergmann int spufs_handle_class1(struct spu_context *ctx);
254d6ad39bcSJeremy Kerr int spufs_handle_class0(struct spu_context *ctx);
25557dace23SArnd Bergmann 
256c5fc8d2aSArnd Bergmann /* affinity */
257c5fc8d2aSArnd Bergmann struct spu *affinity_check(struct spu_context *ctx);
258c5fc8d2aSArnd Bergmann 
25967207b96SArnd Bergmann /* context management */
26065de66f0SChristoph Hellwig extern atomic_t nr_spu_contexts;
spu_acquire(struct spu_context * ctx)261c9101bdbSChristoph Hellwig static inline int __must_check spu_acquire(struct spu_context *ctx)
2626a0641e5SChristoph Hellwig {
263c9101bdbSChristoph Hellwig 	return mutex_lock_interruptible(&ctx->state_mutex);
2646a0641e5SChristoph Hellwig }
2656a0641e5SChristoph Hellwig 
spu_release(struct spu_context * ctx)2666a0641e5SChristoph Hellwig static inline void spu_release(struct spu_context *ctx)
2676a0641e5SChristoph Hellwig {
2686a0641e5SChristoph Hellwig 	mutex_unlock(&ctx->state_mutex);
2696a0641e5SChristoph Hellwig }
2706a0641e5SChristoph Hellwig 
2716263203eSArnd Bergmann struct spu_context * alloc_spu_context(struct spu_gang *gang);
27267207b96SArnd Bergmann void destroy_spu_context(struct kref *kref);
27367207b96SArnd Bergmann struct spu_context * get_spu_context(struct spu_context *ctx);
27467207b96SArnd Bergmann int put_spu_context(struct spu_context *ctx);
2755110459fSArnd Bergmann void spu_unmap_mappings(struct spu_context *ctx);
27667207b96SArnd Bergmann 
2778b3d6663SArnd Bergmann void spu_forget(struct spu_context *ctx);
278c9101bdbSChristoph Hellwig int __must_check spu_acquire_saved(struct spu_context *ctx);
27927b1ea09SChristoph Hellwig void spu_release_saved(struct spu_context *ctx);
28050b520d4SChristoph Hellwig 
281e65c2f6fSLuke Browning int spu_stopped(struct spu_context *ctx, u32 * stat);
282e65c2f6fSLuke Browning void spu_del_from_rq(struct spu_context *ctx);
28326bec673SChristoph Hellwig int spu_activate(struct spu_context *ctx, unsigned long flags);
2848b3d6663SArnd Bergmann void spu_deactivate(struct spu_context *ctx);
2858b3d6663SArnd Bergmann void spu_yield(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  *
30273ac36eaSColy Li  * 	Returns with state_mutex re-acquired when successful 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);
334f3d69e05SLuke Browning void spufs_stop_callback(struct spu *spu, int irq);
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 struct spufs_coredump_reader {
339bf1ab978SDwayne Grant McConnell 	char *name;
3405456ffdeSChristoph Hellwig 	ssize_t (*dump)(struct spu_context *ctx, struct coredump_params *cprm);
34174de08bcSMichael Ellerman 	u64 (*get)(struct spu_context *ctx);
342bf1ab978SDwayne Grant McConnell 	size_t size;
343bf1ab978SDwayne Grant McConnell };
34474254647SJeremy Kerr extern const struct spufs_coredump_reader spufs_coredump_read[];
345bf1ab978SDwayne Grant McConnell 
3467cd58e43SJeremy Kerr extern int spu_init_csa(struct spu_state *csa);
3477cd58e43SJeremy Kerr extern void spu_fini_csa(struct spu_state *csa);
3487cd58e43SJeremy Kerr extern int spu_save(struct spu_state *prev, struct spu *spu);
3497cd58e43SJeremy Kerr extern int spu_restore(struct spu_state *new, struct spu *spu);
3507cd58e43SJeremy Kerr extern int spu_switch(struct spu_state *prev, struct spu_state *new,
3517cd58e43SJeremy Kerr 		      struct spu *spu);
3527cd58e43SJeremy Kerr extern int spu_alloc_lscsa(struct spu_state *csa);
3537cd58e43SJeremy Kerr extern void spu_free_lscsa(struct spu_state *csa);
35427ec41d3SAndre Detsch 
3557cd58e43SJeremy Kerr extern void spuctx_switch_state(struct spu_context *ctx,
3567cd58e43SJeremy Kerr 		enum spu_utilization_state new_state);
357fe2f896dSChristoph Hellwig 
35867207b96SArnd Bergmann #endif
359