3acbec356d
[ Upstream commit 91dc288f4edf0d768e46c2c6d33e0ab703403459 ] When neither LANTIQ nor MIPS_MALTA is set, 'physical_memsize' is not declared. This causes the build to fail with: mips-linux-ld: arch/mips/kernel/vpe-mt.o: in function `vpe_run': arch/mips/kernel/vpe-mt.c:(.text.vpe_run+0x280): undefined reference to `physical_memsize' LANTIQ is not using 'physical_memsize' and MIPS_MALTA's use of it is self-contained in mti-malta/malta-dtshim.c. Use of physical_memsize in vpe-mt.c appears to be unused, so eliminate this loader mode completely and require VPE programs to be compiled with DFLT_STACK_SIZE and DFLT_HEAP_SIZE defined. Fixes:9050d50e22
("MIPS: lantiq: Set physical_memsize") Fixes:1a2a6d7e88
("MIPS: APRP: Split VPE loader into separate files.") Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Reported-by: kernel test robot <lkp@intel.com> Link: https://lore.kernel.org/all/202302030625.2g3E98sY-lkp@intel.com/ Cc: Dengcheng Zhu <dzhu@wavecomp.com> Cc: John Crispin <john@phrozen.org> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Cc: Philippe Mathieu-Daudé <philmd@linaro.org> Cc: "Steven J. Hill" <Steven.Hill@imgtec.com> Cc: Qais Yousef <Qais.Yousef@imgtec.com> Cc: Yang Yingliang <yangyingliang@huawei.com> Cc: Hauke Mehrtens <hauke@hauke-m.de> Cc: James Hogan <jhogan@kernel.org> Cc: linux-mips@vger.kernel.org Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
130 lines
2.7 KiB
C
130 lines
2.7 KiB
C
/*
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
* License. See the file "COPYING" in the main directory of this archive
|
|
* for more details.
|
|
*
|
|
* Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved.
|
|
* Copyright (C) 2013 Imagination Technologies Ltd.
|
|
*/
|
|
#ifndef _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;
|
|
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 {
|
|
void (*start)(int vpe);
|
|
void (*stop)(int vpe);
|
|
|
|
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 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);
|
|
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);
|
|
|
|
void *alloc_progmem(unsigned long len);
|
|
void release_progmem(void *ptr);
|
|
|
|
int vpe_run(struct vpe *v);
|
|
void cleanup_tc(struct tc *tc);
|
|
|
|
int __init vpe_module_init(void);
|
|
void __exit vpe_module_exit(void);
|
|
#endif /* _ASM_VPE_H */
|