Commit 1a2a6d7e authored by Deng-Cheng Zhu's avatar Deng-Cheng Zhu Committed by Ralf Baechle

MIPS: APRP: Split VPE loader into separate files.

Split the VPE functionality in preparation for adding support
for CMP platforms. Common functions remain in the original file
and a new file contains code specific to platforms that do not
have a CMP present.
Signed-off-by: default avatarDeng-Cheng Zhu <dengcheng.zhu@imgtec.com>
Signed-off-by: default avatarSteven J. Hill <Steven.Hill@imgtec.com>
Reviewed-by: default avatarQais Yousef <Qais.Yousef@imgtec.com>
Signed-off-by: default avatarJohn Crispin <blogic@openwrt.org>
Patchwork: http://patchwork.linux-mips.org/patch/6094/
parent c080faa5
...@@ -1907,6 +1907,11 @@ config MIPS_VPE_LOADER ...@@ -1907,6 +1907,11 @@ config MIPS_VPE_LOADER
Includes a loader for loading an elf relocatable object Includes a loader for loading an elf relocatable object
onto another VPE and running it. onto another VPE and running it.
config MIPS_VPE_LOADER_MT
bool
default "y"
depends on MIPS_VPE_LOADER && !MIPS_CMP
config MIPS_MT_SMTC_IM_BACKSTOP config MIPS_MT_SMTC_IM_BACKSTOP
bool "Use per-TC register bits as backstop for inhibited IM bits" bool "Use per-TC register bits as backstop for inhibited IM bits"
depends on MIPS_MT_SMTC depends on MIPS_MT_SMTC
......
/* /*
* Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved. * Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved.
* Copyright (C) 2013 Imagination Technologies Ltd.
* *
* This program is free software; you can distribute it and/or modify it * This program is free software; you can distribute it and/or modify it
* under the terms of the GNU General Public License (Version 2) as * under the terms of the GNU General Public License (Version 2) as
...@@ -19,6 +20,88 @@ ...@@ -19,6 +20,88 @@
#ifndef _ASM_VPE_H #ifndef _ASM_VPE_H
#define _ASM_VPE_H #define _ASM_VPE_H
#include <linux/init.h>
#include <linux/list.h>
#include <linux/smp.h>
#include <linux/spinlock.h>
#define VPE_MODULE_NAME "vpe"
#define VPE_MODULE_MINOR 1
/* grab the likely amount of memory we will need. */
#ifdef CONFIG_MIPS_VPE_LOADER_TOM
#define P_SIZE (2 * 1024 * 1024)
#else
/* add an overhead to the max kmalloc size for non-striped symbols/etc */
#define P_SIZE (256 * 1024)
#endif
#define MAX_VPES 16
#define VPE_PATH_MAX 256
static inline int aprp_cpu_index(void)
{
#ifdef CONFIG_MIPS_CMP
return setup_max_cpus;
#else
extern int tclimit;
return tclimit;
#endif
}
enum vpe_state {
VPE_STATE_UNUSED = 0,
VPE_STATE_INUSE,
VPE_STATE_RUNNING
};
enum tc_state {
TC_STATE_UNUSED = 0,
TC_STATE_INUSE,
TC_STATE_RUNNING,
TC_STATE_DYNAMIC
};
struct vpe {
enum vpe_state state;
/* (device) minor associated with this vpe */
int minor;
/* elfloader stuff */
void *load_addr;
unsigned long len;
char *pbuffer;
unsigned long plen;
unsigned int uid, gid;
char cwd[VPE_PATH_MAX];
unsigned long __start;
/* tc's associated with this vpe */
struct list_head tc;
/* The list of vpe's */
struct list_head list;
/* shared symbol address */
void *shared_ptr;
/* the list of who wants to know when something major happens */
struct list_head notify;
unsigned int ntcs;
};
struct tc {
enum tc_state state;
int index;
struct vpe *pvpe; /* parent VPE */
struct list_head tc; /* The list of TC's with this VPE */
struct list_head list; /* The global list of tc's */
};
struct vpe_notifications { struct vpe_notifications {
void (*start)(int vpe); void (*start)(int vpe);
void (*stop)(int vpe); void (*stop)(int vpe);
...@@ -26,12 +109,36 @@ struct vpe_notifications { ...@@ -26,12 +109,36 @@ struct vpe_notifications {
struct list_head list; struct list_head list;
}; };
struct vpe_control {
spinlock_t vpe_list_lock;
struct list_head vpe_list; /* Virtual processing elements */
spinlock_t tc_list_lock;
struct list_head tc_list; /* Thread contexts */
};
extern unsigned long physical_memsize;
extern struct vpe_control vpecontrol;
extern const struct file_operations vpe_fops;
int vpe_notify(int index, struct vpe_notifications *notify);
void *vpe_get_shared(int index);
int vpe_getuid(int index);
int vpe_getgid(int index);
char *vpe_getcwd(int index);
struct vpe *get_vpe(int minor);
struct tc *get_tc(int index);
struct vpe *alloc_vpe(int minor);
struct tc *alloc_tc(int index);
void release_vpe(struct vpe *v);
extern int vpe_notify(int index, struct vpe_notifications *notify); void *alloc_progmem(unsigned long len);
void release_progmem(void *ptr);
extern void *vpe_get_shared(int index); int __weak vpe_run(struct vpe *v);
extern int vpe_getuid(int index); void cleanup_tc(struct tc *tc);
extern int vpe_getgid(int index);
extern char *vpe_getcwd(int index);
int __init vpe_module_init(void);
void __exit vpe_module_exit(void);
#endif /* _ASM_VPE_H */ #endif /* _ASM_VPE_H */
...@@ -56,6 +56,7 @@ obj-$(CONFIG_MIPS_CMP) += smp-cmp.o ...@@ -56,6 +56,7 @@ obj-$(CONFIG_MIPS_CMP) += smp-cmp.o
obj-$(CONFIG_CPU_MIPSR2) += spram.o obj-$(CONFIG_CPU_MIPSR2) += spram.o
obj-$(CONFIG_MIPS_VPE_LOADER) += vpe.o obj-$(CONFIG_MIPS_VPE_LOADER) += vpe.o
obj-$(CONFIG_MIPS_VPE_LOADER_MT) += vpe-mt.o
obj-$(CONFIG_MIPS_VPE_APSP_API) += rtlx.o obj-$(CONFIG_MIPS_VPE_APSP_API) += rtlx.o
obj-$(CONFIG_I8259) += i8259.o obj-$(CONFIG_I8259) += i8259.o
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment