2005-11-15 20:53:48 +00:00
|
|
|
/*
|
|
|
|
* SPU file system
|
|
|
|
*
|
|
|
|
* (C) Copyright IBM Deutschland Entwicklung GmbH 2005
|
|
|
|
*
|
|
|
|
* Author: Arnd Bergmann <arndb@de.ibm.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*/
|
|
|
|
#ifndef SPUFS_H
|
|
|
|
#define SPUFS_H
|
|
|
|
|
|
|
|
#include <linux/kref.h>
|
2007-02-13 20:36:50 +00:00
|
|
|
#include <linux/mutex.h>
|
2005-11-15 20:53:48 +00:00
|
|
|
#include <linux/spinlock.h>
|
|
|
|
#include <linux/fs.h>
|
2007-06-29 00:57:56 +00:00
|
|
|
#include <linux/cpumask.h>
|
2005-11-15 20:53:48 +00:00
|
|
|
|
|
|
|
#include <asm/spu.h>
|
2005-11-15 20:53:49 +00:00
|
|
|
#include <asm/spu_csa.h>
|
2006-11-20 17:44:58 +00:00
|
|
|
#include <asm/spu_info.h>
|
2005-11-15 20:53:48 +00:00
|
|
|
|
|
|
|
/* The magic number for our file system */
|
|
|
|
enum {
|
|
|
|
SPUFS_MAGIC = 0x23c9b64e,
|
|
|
|
};
|
|
|
|
|
2005-11-15 20:53:52 +00:00
|
|
|
struct spu_context_ops;
|
2006-10-04 15:26:15 +00:00
|
|
|
struct spu_gang;
|
|
|
|
|
2007-07-20 19:39:52 +00:00
|
|
|
/* ctx->sched_flags */
|
|
|
|
enum {
|
|
|
|
SPU_SCHED_NOTIFY_ACTIVE,
|
2007-07-24 01:43:53 +00:00
|
|
|
SPU_SCHED_WAS_ACTIVE, /* was active upon spu_acquire_saved() */
|
2008-03-04 09:17:02 +00:00
|
|
|
SPU_SCHED_SPU_RUN, /* context is within spu_run */
|
2007-07-20 19:39:52 +00:00
|
|
|
};
|
|
|
|
|
2005-11-15 20:53:48 +00:00
|
|
|
struct spu_context {
|
|
|
|
struct spu *spu; /* pointer to a physical SPU */
|
2005-11-15 20:53:49 +00:00
|
|
|
struct spu_state csa; /* SPU context save area. */
|
2005-11-15 20:53:48 +00:00
|
|
|
spinlock_t mmio_lock; /* protects mmio access */
|
2006-03-22 23:00:12 +00:00
|
|
|
struct address_space *local_store; /* local store mapping. */
|
|
|
|
struct address_space *mfc; /* 'mfc' area mappings. */
|
2007-04-23 19:08:07 +00:00
|
|
|
struct address_space *cntl; /* 'control' area mappings. */
|
|
|
|
struct address_space *signal1; /* 'signal1' area mappings. */
|
|
|
|
struct address_space *signal2; /* 'signal2' area mappings. */
|
|
|
|
struct address_space *mss; /* 'mss' area mappings. */
|
|
|
|
struct address_space *psmap; /* 'psmap' area mappings. */
|
2007-06-04 13:26:51 +00:00
|
|
|
struct mutex mapping_lock;
|
2006-10-04 15:26:21 +00:00
|
|
|
u64 object_id; /* user space pointer for oprofile */
|
2005-11-15 20:53:52 +00:00
|
|
|
|
|
|
|
enum { SPU_STATE_RUNNABLE, SPU_STATE_SAVED } state;
|
2007-02-13 20:36:50 +00:00
|
|
|
struct mutex state_mutex;
|
2007-04-23 19:08:17 +00:00
|
|
|
struct mutex run_mutex;
|
2005-11-15 20:53:52 +00:00
|
|
|
|
|
|
|
struct mm_struct *owner;
|
2005-11-15 20:53:48 +00:00
|
|
|
|
|
|
|
struct kref kref;
|
2005-11-15 20:53:52 +00:00
|
|
|
wait_queue_head_t ibox_wq;
|
|
|
|
wait_queue_head_t wbox_wq;
|
2005-12-06 03:52:25 +00:00
|
|
|
wait_queue_head_t stop_wq;
|
2006-03-22 23:00:11 +00:00
|
|
|
wait_queue_head_t mfc_wq;
|
2007-12-20 07:39:59 +00:00
|
|
|
wait_queue_head_t run_wq;
|
2005-11-15 20:53:52 +00:00
|
|
|
struct fasync_struct *ibox_fasync;
|
|
|
|
struct fasync_struct *wbox_fasync;
|
2006-03-22 23:00:11 +00:00
|
|
|
struct fasync_struct *mfc_fasync;
|
|
|
|
u32 tagwait;
|
2005-11-15 20:53:52 +00:00
|
|
|
struct spu_context_ops *ops;
|
2005-12-06 03:52:26 +00:00
|
|
|
struct work_struct reap_work;
|
2006-10-04 15:26:14 +00:00
|
|
|
unsigned long flags;
|
|
|
|
unsigned long event_return;
|
2006-10-04 15:26:15 +00:00
|
|
|
|
|
|
|
struct list_head gang_list;
|
|
|
|
struct spu_gang *gang;
|
2007-07-20 19:39:53 +00:00
|
|
|
struct kref *prof_priv_kref;
|
|
|
|
void ( * prof_priv_release) (struct kref *kref);
|
2007-02-13 20:54:22 +00:00
|
|
|
|
2007-06-29 00:58:01 +00:00
|
|
|
/* owner thread */
|
|
|
|
pid_t tid;
|
|
|
|
|
2007-02-13 20:54:22 +00:00
|
|
|
/* scheduler fields */
|
2007-06-29 00:58:00 +00:00
|
|
|
struct list_head rq;
|
2007-06-29 00:57:51 +00:00
|
|
|
unsigned int time_slice;
|
2007-02-13 20:54:24 +00:00
|
|
|
unsigned long sched_flags;
|
2007-06-29 00:57:56 +00:00
|
|
|
cpumask_t cpus_allowed;
|
2007-02-13 20:54:29 +00:00
|
|
|
int policy;
|
2007-02-13 20:54:22 +00:00
|
|
|
int prio;
|
2007-06-29 00:58:03 +00:00
|
|
|
|
|
|
|
/* statistics */
|
|
|
|
struct {
|
|
|
|
/* updates protected by ctx->state_mutex */
|
2007-07-20 19:39:33 +00:00
|
|
|
enum spu_utilization_state util_state;
|
|
|
|
unsigned long long tstamp; /* time of last state switch */
|
|
|
|
unsigned long long times[SPU_UTIL_MAX];
|
2007-06-29 00:58:03 +00:00
|
|
|
unsigned long long vol_ctx_switch;
|
|
|
|
unsigned long long invol_ctx_switch;
|
|
|
|
unsigned long long min_flt;
|
|
|
|
unsigned long long maj_flt;
|
|
|
|
unsigned long long hash_flt;
|
|
|
|
unsigned long long slb_flt;
|
|
|
|
unsigned long long slb_flt_base; /* # at last ctx switch */
|
|
|
|
unsigned long long class2_intr;
|
|
|
|
unsigned long long class2_intr_base; /* # at last ctx switch */
|
|
|
|
unsigned long long libassist;
|
|
|
|
} stats;
|
2007-07-20 19:39:47 +00:00
|
|
|
|
|
|
|
struct list_head aff_list;
|
|
|
|
int aff_head;
|
2007-07-20 19:39:48 +00:00
|
|
|
int aff_offset;
|
2006-10-04 15:26:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct spu_gang {
|
|
|
|
struct list_head list;
|
|
|
|
struct mutex mutex;
|
|
|
|
struct kref kref;
|
|
|
|
int contexts;
|
2007-07-20 19:39:47 +00:00
|
|
|
|
|
|
|
struct spu_context *aff_ref_ctx;
|
|
|
|
struct list_head aff_list_head;
|
|
|
|
struct mutex aff_mutex;
|
|
|
|
int aff_flags;
|
2007-07-20 19:39:48 +00:00
|
|
|
struct spu *aff_ref_spu;
|
|
|
|
atomic_t aff_sched_count;
|
2005-11-15 20:53:52 +00:00
|
|
|
};
|
|
|
|
|
2007-07-20 19:39:47 +00:00
|
|
|
/* Flag bits for spu_gang aff_flags */
|
|
|
|
#define AFF_OFFSETS_SET 1
|
|
|
|
#define AFF_MERGED 2
|
|
|
|
|
2006-03-22 23:00:11 +00:00
|
|
|
struct mfc_dma_command {
|
|
|
|
int32_t pad; /* reserved */
|
|
|
|
uint32_t lsa; /* local storage address */
|
|
|
|
uint64_t ea; /* effective address */
|
|
|
|
uint16_t size; /* transfer size */
|
|
|
|
uint16_t tag; /* command tag */
|
|
|
|
uint16_t class; /* class ID */
|
|
|
|
uint16_t cmd; /* command opcode */
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2005-11-15 20:53:52 +00:00
|
|
|
/* SPU context query/set operations. */
|
|
|
|
struct spu_context_ops {
|
|
|
|
int (*mbox_read) (struct spu_context * ctx, u32 * data);
|
|
|
|
u32(*mbox_stat_read) (struct spu_context * ctx);
|
2005-12-06 03:52:27 +00:00
|
|
|
unsigned int (*mbox_stat_poll)(struct spu_context *ctx,
|
|
|
|
unsigned int events);
|
2005-11-15 20:53:52 +00:00
|
|
|
int (*ibox_read) (struct spu_context * ctx, u32 * data);
|
|
|
|
int (*wbox_write) (struct spu_context * ctx, u32 data);
|
|
|
|
u32(*signal1_read) (struct spu_context * ctx);
|
|
|
|
void (*signal1_write) (struct spu_context * ctx, u32 data);
|
|
|
|
u32(*signal2_read) (struct spu_context * ctx);
|
|
|
|
void (*signal2_write) (struct spu_context * ctx, u32 data);
|
|
|
|
void (*signal1_type_set) (struct spu_context * ctx, u64 val);
|
|
|
|
u64(*signal1_type_get) (struct spu_context * ctx);
|
|
|
|
void (*signal2_type_set) (struct spu_context * ctx, u64 val);
|
|
|
|
u64(*signal2_type_get) (struct spu_context * ctx);
|
|
|
|
u32(*npc_read) (struct spu_context * ctx);
|
|
|
|
void (*npc_write) (struct spu_context * ctx, u32 data);
|
|
|
|
u32(*status_read) (struct spu_context * ctx);
|
|
|
|
char*(*get_ls) (struct spu_context * ctx);
|
2007-12-20 07:39:59 +00:00
|
|
|
void (*privcntl_write) (struct spu_context *ctx, u64 data);
|
2006-11-20 17:45:09 +00:00
|
|
|
u32 (*runcntl_read) (struct spu_context * ctx);
|
2005-12-06 03:52:25 +00:00
|
|
|
void (*runcntl_write) (struct spu_context * ctx, u32 data);
|
2007-12-05 02:49:31 +00:00
|
|
|
void (*runcntl_stop) (struct spu_context * ctx);
|
2006-11-20 17:45:08 +00:00
|
|
|
void (*master_start) (struct spu_context * ctx);
|
|
|
|
void (*master_stop) (struct spu_context * ctx);
|
2006-03-22 23:00:11 +00:00
|
|
|
int (*set_mfc_query)(struct spu_context * ctx, u32 mask, u32 mode);
|
|
|
|
u32 (*read_mfc_tagstatus)(struct spu_context * ctx);
|
|
|
|
u32 (*get_mfc_free_elements)(struct spu_context *ctx);
|
2006-11-20 17:44:58 +00:00
|
|
|
int (*send_mfc_command)(struct spu_context * ctx,
|
|
|
|
struct mfc_dma_command * cmd);
|
|
|
|
void (*dma_info_read) (struct spu_context * ctx,
|
|
|
|
struct spu_dma_info * info);
|
|
|
|
void (*proxydma_info_read) (struct spu_context * ctx,
|
|
|
|
struct spu_proxydma_info * info);
|
2007-04-23 19:08:15 +00:00
|
|
|
void (*restart_dma)(struct spu_context *ctx);
|
2005-11-15 20:53:48 +00:00
|
|
|
};
|
|
|
|
|
2005-11-15 20:53:52 +00:00
|
|
|
extern struct spu_context_ops spu_hw_ops;
|
|
|
|
extern struct spu_context_ops spu_backing_ops;
|
|
|
|
|
2005-11-15 20:53:48 +00:00
|
|
|
struct spufs_inode_info {
|
|
|
|
struct spu_context *i_ctx;
|
2006-10-04 15:26:15 +00:00
|
|
|
struct spu_gang *i_gang;
|
2005-11-15 20:53:48 +00:00
|
|
|
struct inode vfs_inode;
|
2007-04-23 19:08:07 +00:00
|
|
|
int i_openers;
|
2005-11-15 20:53:48 +00:00
|
|
|
};
|
|
|
|
#define SPUFS_I(inode) \
|
|
|
|
container_of(inode, struct spufs_inode_info, vfs_inode)
|
|
|
|
|
|
|
|
extern struct tree_descr spufs_dir_contents[];
|
2006-10-24 16:31:16 +00:00
|
|
|
extern struct tree_descr spufs_dir_nosched_contents[];
|
2005-11-15 20:53:48 +00:00
|
|
|
|
|
|
|
/* system call implementation */
|
[POWERPC] cell: Unify spufs syscall path
At present, a built-in spufs will not use the spufs_calls callbacks, but
directly call sys_spu_create. This saves us an indirect branch, but
means we have duplicated functions - one for CONFIG_SPU_FS=y and one for
=m.
This change unifies the spufs syscall path, and provides access to the
spufs_calls structure through a get/put pair. At present, the only user
of the spufs_calls structure is spu_syscalls.c, but this will facilitate
adding the coredump calls later.
Everyone likes numbers, right? Here's a before/after comparison with
CONFIG_SPU_FS=y, doing spu_create(); close(); 64k times.
Before:
[jk@cell ~]$ time ./spu_create
performing 65536 spu_create calls
real 0m24.075s
user 0m0.146s
sys 0m23.925s
After:
[jk@cell ~]$ time ./spu_create
performing 65536 spu_create calls
real 0m24.777s
user 0m0.141s
sys 0m24.631s
So, we're adding around 11us per syscall, at the benefit of having
only one syscall path.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-09-19 04:38:12 +00:00
|
|
|
extern struct spufs_calls spufs_calls;
|
2007-07-20 19:39:42 +00:00
|
|
|
long spufs_run_spu(struct spu_context *ctx, u32 *npc, u32 *status);
|
2007-07-20 19:39:47 +00:00
|
|
|
long spufs_create(struct nameidata *nd, unsigned int flags,
|
|
|
|
mode_t mode, struct file *filp);
|
2007-09-19 04:38:12 +00:00
|
|
|
/* ELF coredump callbacks for writing SPU ELF notes */
|
|
|
|
extern int spufs_coredump_extra_notes_size(void);
|
2007-09-19 04:38:12 +00:00
|
|
|
extern int spufs_coredump_extra_notes_write(struct file *file, loff_t *foffset);
|
2007-09-19 04:38:12 +00:00
|
|
|
|
2007-02-12 08:55:37 +00:00
|
|
|
extern const struct file_operations spufs_context_fops;
|
2005-11-15 20:53:48 +00:00
|
|
|
|
2006-10-04 15:26:15 +00:00
|
|
|
/* gang management */
|
|
|
|
struct spu_gang *alloc_spu_gang(void);
|
|
|
|
struct spu_gang *get_spu_gang(struct spu_gang *gang);
|
|
|
|
int put_spu_gang(struct spu_gang *gang);
|
|
|
|
void spu_gang_remove_ctx(struct spu_gang *gang, struct spu_context *ctx);
|
|
|
|
void spu_gang_add_ctx(struct spu_gang *gang, struct spu_context *ctx);
|
|
|
|
|
2007-04-23 19:08:15 +00:00
|
|
|
/* fault handling */
|
|
|
|
int spufs_handle_class1(struct spu_context *ctx);
|
2007-12-20 07:39:59 +00:00
|
|
|
int spufs_handle_class0(struct spu_context *ctx);
|
2007-04-23 19:08:15 +00:00
|
|
|
|
2007-07-20 19:39:48 +00:00
|
|
|
/* affinity */
|
|
|
|
struct spu *affinity_check(struct spu_context *ctx);
|
|
|
|
|
2005-11-15 20:53:48 +00:00
|
|
|
/* context management */
|
2007-06-29 00:58:02 +00:00
|
|
|
extern atomic_t nr_spu_contexts;
|
2007-12-20 07:39:59 +00:00
|
|
|
static inline int __must_check spu_acquire(struct spu_context *ctx)
|
2007-02-13 20:54:21 +00:00
|
|
|
{
|
2007-12-20 07:39:59 +00:00
|
|
|
return mutex_lock_interruptible(&ctx->state_mutex);
|
2007-02-13 20:54:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void spu_release(struct spu_context *ctx)
|
|
|
|
{
|
|
|
|
mutex_unlock(&ctx->state_mutex);
|
|
|
|
}
|
|
|
|
|
2006-10-04 15:26:15 +00:00
|
|
|
struct spu_context * alloc_spu_context(struct spu_gang *gang);
|
2005-11-15 20:53:48 +00:00
|
|
|
void destroy_spu_context(struct kref *kref);
|
|
|
|
struct spu_context * get_spu_context(struct spu_context *ctx);
|
|
|
|
int put_spu_context(struct spu_context *ctx);
|
2005-12-06 03:52:25 +00:00
|
|
|
void spu_unmap_mappings(struct spu_context *ctx);
|
2005-11-15 20:53:48 +00:00
|
|
|
|
2005-11-15 20:53:52 +00:00
|
|
|
void spu_forget(struct spu_context *ctx);
|
2007-12-20 07:39:59 +00:00
|
|
|
int __must_check spu_acquire_saved(struct spu_context *ctx);
|
2007-07-20 19:39:34 +00:00
|
|
|
void spu_release_saved(struct spu_context *ctx);
|
2007-03-09 23:05:36 +00:00
|
|
|
|
2007-12-20 07:39:59 +00:00
|
|
|
int spu_stopped(struct spu_context *ctx, u32 * stat);
|
|
|
|
void spu_del_from_rq(struct spu_context *ctx);
|
2007-02-13 20:54:24 +00:00
|
|
|
int spu_activate(struct spu_context *ctx, unsigned long flags);
|
2005-11-15 20:53:52 +00:00
|
|
|
void spu_deactivate(struct spu_context *ctx);
|
|
|
|
void spu_yield(struct spu_context *ctx);
|
2007-07-20 19:39:52 +00:00
|
|
|
void spu_switch_notify(struct spu *spu, struct spu_context *ctx);
|
2007-06-29 00:57:52 +00:00
|
|
|
void spu_set_timeslice(struct spu_context *ctx);
|
2007-06-29 00:57:55 +00:00
|
|
|
void spu_update_sched_info(struct spu_context *ctx);
|
|
|
|
void __spu_update_sched_info(struct spu_context *ctx);
|
2005-11-15 20:53:52 +00:00
|
|
|
int __init spu_sched_init(void);
|
2007-07-20 19:39:29 +00:00
|
|
|
void spu_sched_exit(void);
|
2005-11-15 20:53:52 +00:00
|
|
|
|
2006-11-20 17:45:10 +00:00
|
|
|
extern char *isolated_loader;
|
|
|
|
|
2006-01-04 19:31:29 +00:00
|
|
|
/*
|
|
|
|
* spufs_wait
|
2007-06-29 00:58:00 +00:00
|
|
|
* Same as wait_event_interruptible(), except that here
|
2006-01-04 19:31:29 +00:00
|
|
|
* we need to call spu_release(ctx) before sleeping, and
|
|
|
|
* then spu_acquire(ctx) when awoken.
|
2008-02-08 04:50:41 +00:00
|
|
|
*
|
|
|
|
* Returns with state_mutex re-acquired when successfull or
|
|
|
|
* with -ERESTARTSYS and the state_mutex dropped when interrupted.
|
2006-01-04 19:31:29 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#define spufs_wait(wq, condition) \
|
|
|
|
({ \
|
|
|
|
int __ret = 0; \
|
|
|
|
DEFINE_WAIT(__wait); \
|
|
|
|
for (;;) { \
|
|
|
|
prepare_to_wait(&(wq), &__wait, TASK_INTERRUPTIBLE); \
|
|
|
|
if (condition) \
|
|
|
|
break; \
|
2008-02-08 04:50:41 +00:00
|
|
|
spu_release(ctx); \
|
2007-04-23 19:08:24 +00:00
|
|
|
if (signal_pending(current)) { \
|
|
|
|
__ret = -ERESTARTSYS; \
|
|
|
|
break; \
|
2006-01-04 19:31:29 +00:00
|
|
|
} \
|
2007-04-23 19:08:24 +00:00
|
|
|
schedule(); \
|
2007-12-20 07:39:59 +00:00
|
|
|
__ret = spu_acquire(ctx); \
|
|
|
|
if (__ret) \
|
|
|
|
break; \
|
2006-01-04 19:31:29 +00:00
|
|
|
} \
|
|
|
|
finish_wait(&(wq), &__wait); \
|
|
|
|
__ret; \
|
|
|
|
})
|
|
|
|
|
2005-11-15 20:53:52 +00:00
|
|
|
size_t spu_wbox_write(struct spu_context *ctx, u32 data);
|
|
|
|
size_t spu_ibox_read(struct spu_context *ctx, u32 *data);
|
|
|
|
|
|
|
|
/* irq callback funcs. */
|
|
|
|
void spufs_ibox_callback(struct spu *spu);
|
|
|
|
void spufs_wbox_callback(struct spu *spu);
|
2005-12-06 03:52:25 +00:00
|
|
|
void spufs_stop_callback(struct spu *spu);
|
2006-03-22 23:00:11 +00:00
|
|
|
void spufs_mfc_callback(struct spu *spu);
|
2006-10-04 15:26:14 +00:00
|
|
|
void spufs_dma_callback(struct spu *spu, int type);
|
2005-11-15 20:53:52 +00:00
|
|
|
|
[POWERPC] coredump: Add SPU elf notes to coredump.
This patch adds SPU elf notes to the coredump. It creates a separate note
for each of /regs, /fpcr, /lslr, /decr, /decr_status, /mem, /signal1,
/signal1_type, /signal2, /signal2_type, /event_mask, /event_status,
/mbox_info, /ibox_info, /wbox_info, /dma_info, /proxydma_info, /object-id.
A new macro, ARCH_HAVE_EXTRA_NOTES, was created for architectures to
specify they have extra elf core notes.
A new macro, ELF_CORE_EXTRA_NOTES_SIZE, was created so the size of the
additional notes could be calculated and added to the notes phdr entry.
A new macro, ELF_CORE_WRITE_EXTRA_NOTES, was created so the new notes
would be written after the existing notes.
The SPU coredump code resides in spufs. Stub functions are provided in the
kernel which are hooked into the spufs code which does the actual work via
register_arch_coredump_calls().
A new set of __spufs_<file>_read/get() functions was provided to allow the
coredump code to read from the spufs files without having to lock the
SPU context for each file read from.
Cc: <linux-arch@vger.kernel.org>
Signed-off-by: Dwayne Grant McConnell <decimal@us.ibm.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
2006-11-22 23:46:37 +00:00
|
|
|
extern struct spu_coredump_calls spufs_coredump_calls;
|
|
|
|
struct spufs_coredump_reader {
|
|
|
|
char *name;
|
|
|
|
ssize_t (*read)(struct spu_context *ctx,
|
|
|
|
char __user *buffer, size_t size, loff_t *pos);
|
2007-09-19 04:38:12 +00:00
|
|
|
u64 (*get)(struct spu_context *ctx);
|
[POWERPC] coredump: Add SPU elf notes to coredump.
This patch adds SPU elf notes to the coredump. It creates a separate note
for each of /regs, /fpcr, /lslr, /decr, /decr_status, /mem, /signal1,
/signal1_type, /signal2, /signal2_type, /event_mask, /event_status,
/mbox_info, /ibox_info, /wbox_info, /dma_info, /proxydma_info, /object-id.
A new macro, ARCH_HAVE_EXTRA_NOTES, was created for architectures to
specify they have extra elf core notes.
A new macro, ELF_CORE_EXTRA_NOTES_SIZE, was created so the size of the
additional notes could be calculated and added to the notes phdr entry.
A new macro, ELF_CORE_WRITE_EXTRA_NOTES, was created so the new notes
would be written after the existing notes.
The SPU coredump code resides in spufs. Stub functions are provided in the
kernel which are hooked into the spufs code which does the actual work via
register_arch_coredump_calls().
A new set of __spufs_<file>_read/get() functions was provided to allow the
coredump code to read from the spufs files without having to lock the
SPU context for each file read from.
Cc: <linux-arch@vger.kernel.org>
Signed-off-by: Dwayne Grant McConnell <decimal@us.ibm.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
2006-11-22 23:46:37 +00:00
|
|
|
size_t size;
|
|
|
|
};
|
|
|
|
extern struct spufs_coredump_reader spufs_coredump_read[];
|
|
|
|
extern int spufs_coredump_num_notes;
|
|
|
|
|
2007-12-20 07:39:59 +00:00
|
|
|
extern int spu_init_csa(struct spu_state *csa);
|
|
|
|
extern void spu_fini_csa(struct spu_state *csa);
|
|
|
|
extern int spu_save(struct spu_state *prev, struct spu *spu);
|
|
|
|
extern int spu_restore(struct spu_state *new, struct spu *spu);
|
|
|
|
extern int spu_switch(struct spu_state *prev, struct spu_state *new,
|
|
|
|
struct spu *spu);
|
|
|
|
extern int spu_alloc_lscsa(struct spu_state *csa);
|
|
|
|
extern void spu_free_lscsa(struct spu_state *csa);
|
|
|
|
|
|
|
|
extern void spuctx_switch_state(struct spu_context *ctx,
|
|
|
|
enum spu_utilization_state new_state);
|
2007-06-29 00:58:07 +00:00
|
|
|
|
2008-01-11 04:03:26 +00:00
|
|
|
#define spu_context_trace(name, ctx, spu) \
|
|
|
|
trace_mark(name, "%p %p", ctx, spu);
|
|
|
|
#define spu_context_nospu_trace(name, ctx) \
|
|
|
|
trace_mark(name, "%p", ctx);
|
|
|
|
|
2005-11-15 20:53:48 +00:00
|
|
|
#endif
|