2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved.
7 * Copyright (C) 2013 Imagination Technologies Ltd.
12 #include <linux/init.h>
13 #include <linux/list.h>
14 #include <linux/smp.h>
15 #include <linux/spinlock.h>
17 #define VPE_MODULE_NAME "vpe"
18 #define VPE_MODULE_MINOR 1
20 /* grab the likely amount of memory we will need. */
21 #ifdef CONFIG_MIPS_VPE_LOADER_TOM
22 #define P_SIZE (2 * 1024 * 1024)
24 /* add an overhead to the max kmalloc size for non-striped symbols/etc */
25 #define P_SIZE (256 * 1024)
29 #define VPE_PATH_MAX 256
31 static inline int aprp_cpu_index(void)
33 #ifdef CONFIG_MIPS_CMP
34 return setup_max_cpus
;
57 /* (device) minor associated with this vpe */
65 char cwd
[VPE_PATH_MAX
];
67 unsigned long __start
;
69 /* tc's associated with this vpe */
72 /* The list of vpe's */
73 struct list_head list
;
75 /* shared symbol address */
78 /* the list of who wants to know when something major happens */
79 struct list_head notify
;
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 */
93 struct vpe_notifications
{
94 void (*start
)(int vpe
);
95 void (*stop
)(int vpe
);
97 struct list_head list
;
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 */
107 extern unsigned long physical_memsize
;
108 extern struct vpe_control vpecontrol
;
109 extern const struct file_operations vpe_fops
;
111 int vpe_notify(int index
, struct vpe_notifications
*notify
);
113 void *vpe_get_shared(int index
);
114 char *vpe_getcwd(int index
);
116 struct vpe
*get_vpe(int minor
);
117 struct tc
*get_tc(int index
);
118 struct vpe
*alloc_vpe(int minor
);
119 struct tc
*alloc_tc(int index
);
120 void release_vpe(struct vpe
*v
);
122 void *alloc_progmem(unsigned long len
);
123 void release_progmem(void *ptr
);
125 int vpe_run(struct vpe
*v
);
126 void cleanup_tc(struct tc
*tc
);
128 int __init
vpe_module_init(void);
129 void __exit
vpe_module_exit(void);
130 #endif /* _ASM_VPE_H */