aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/include/asm/vpe.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/include/asm/vpe.h')
-rw-r--r--arch/mips/include/asm/vpe.h133
1 files changed, 113 insertions, 20 deletions
diff --git a/arch/mips/include/asm/vpe.h b/arch/mips/include/asm/vpe.h
index c6e1b961537d..7849f3978fea 100644
--- a/arch/mips/include/asm/vpe.h
+++ b/arch/mips/include/asm/vpe.h
@@ -1,24 +1,95 @@
1/* 1/*
2 * Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved. 2 * This file is subject to the terms and conditions of the GNU General Public
3 * 3 * License. See the file "COPYING" in the main directory of this archive
4 * This program is free software; you can distribute it and/or modify it 4 * for more details.
5 * under the terms of the GNU General Public License (Version 2) as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11 * for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
16 * 5 *
6 * Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved.
7 * Copyright (C) 2013 Imagination Technologies Ltd.
17 */ 8 */
18
19#ifndef _ASM_VPE_H 9#ifndef _ASM_VPE_H
20#define _ASM_VPE_H 10#define _ASM_VPE_H
21 11
12#include <linux/init.h>
13#include <linux/list.h>
14#include <linux/smp.h>
15#include <linux/spinlock.h>
16
17#define VPE_MODULE_NAME "vpe"
18#define VPE_MODULE_MINOR 1
19
20/* grab the likely amount of memory we will need. */
21#ifdef CONFIG_MIPS_VPE_LOADER_TOM
22#define P_SIZE (2 * 1024 * 1024)
23#else
24/* add an overhead to the max kmalloc size for non-striped symbols/etc */
25#define P_SIZE (256 * 1024)
26#endif
27
28#define MAX_VPES 16
29#define VPE_PATH_MAX 256
30
31static inline int aprp_cpu_index(void)
32{
33#ifdef CONFIG_MIPS_CMP
34 return setup_max_cpus;
35#else
36 extern int tclimit;
37 return tclimit;
38#endif
39}
40
41enum vpe_state {
42 VPE_STATE_UNUSED = 0,
43 VPE_STATE_INUSE,
44 VPE_STATE_RUNNING
45};
46
47enum tc_state {
48 TC_STATE_UNUSED = 0,
49 TC_STATE_INUSE,
50 TC_STATE_RUNNING,
51 TC_STATE_DYNAMIC
52};
53
54struct vpe {
55 enum vpe_state state;
56
57 /* (device) minor associated with this vpe */
58 int minor;
59
60 /* elfloader stuff */
61 void *load_addr;
62 unsigned long len;
63 char *pbuffer;
64 unsigned long plen;
65 char cwd[VPE_PATH_MAX];
66
67 unsigned long __start;
68
69 /* tc's associated with this vpe */
70 struct list_head tc;
71
72 /* The list of vpe's */
73 struct list_head list;
74
75 /* shared symbol address */
76 void *shared_ptr;
77
78 /* the list of who wants to know when something major happens */
79 struct list_head notify;
80
81 unsigned int ntcs;
82};
83
84struct tc {
85 enum tc_state state;
86 int index;
87
88 struct vpe *pvpe; /* parent VPE */
89 struct list_head tc; /* The list of TC's with this VPE */
90 struct list_head list; /* The global list of tc's */
91};
92
22struct vpe_notifications { 93struct vpe_notifications {
23 void (*start)(int vpe); 94 void (*start)(int vpe);
24 void (*stop)(int vpe); 95 void (*stop)(int vpe);
@@ -26,12 +97,34 @@ struct vpe_notifications {
26 struct list_head list; 97 struct list_head list;
27}; 98};
28 99
100struct vpe_control {
101 spinlock_t vpe_list_lock;
102 struct list_head vpe_list; /* Virtual processing elements */
103 spinlock_t tc_list_lock;
104 struct list_head tc_list; /* Thread contexts */
105};
106
107extern unsigned long physical_memsize;
108extern struct vpe_control vpecontrol;
109extern const struct file_operations vpe_fops;
110
111int vpe_notify(int index, struct vpe_notifications *notify);
112
113void *vpe_get_shared(int index);
114char *vpe_getcwd(int index);
115
116struct vpe *get_vpe(int minor);
117struct tc *get_tc(int index);
118struct vpe *alloc_vpe(int minor);
119struct tc *alloc_tc(int index);
120void release_vpe(struct vpe *v);
29 121
30extern int vpe_notify(int index, struct vpe_notifications *notify); 122void *alloc_progmem(unsigned long len);
123void release_progmem(void *ptr);
31 124
32extern void *vpe_get_shared(int index); 125int __weak vpe_run(struct vpe *v);
33extern int vpe_getuid(int index); 126void cleanup_tc(struct tc *tc);
34extern int vpe_getgid(int index);
35extern char *vpe_getcwd(int index);
36 127
128int __init vpe_module_init(void);
129void __exit vpe_module_exit(void);
37#endif /* _ASM_VPE_H */ 130#endif /* _ASM_VPE_H */