Commit 07cc0c9e authored by Ralf Baechle's avatar Ralf Baechle

[MIPS] MT: Enable coexistence of AP/SP with VSMP and SMTC.

Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent c3a005f4
...@@ -1377,17 +1377,6 @@ config MIPS_MT_SMTC ...@@ -1377,17 +1377,6 @@ config MIPS_MT_SMTC
This is a kernel model which is known a SMTC or lately has been This is a kernel model which is known a SMTC or lately has been
marketesed into SMVP. marketesed into SMVP.
config MIPS_VPE_LOADER
bool "VPE loader support."
depends on SYS_SUPPORTS_MULTITHREADING
select CPU_MIPSR2_IRQ_VI
select CPU_MIPSR2_IRQ_EI
select CPU_MIPSR2_SRS
select MIPS_MT
help
Includes a loader for loading an elf relocatable object
onto another VPE and running it.
endchoice endchoice
config MIPS_MT config MIPS_MT
...@@ -1398,8 +1387,19 @@ config SYS_SUPPORTS_MULTITHREADING ...@@ -1398,8 +1387,19 @@ config SYS_SUPPORTS_MULTITHREADING
config MIPS_MT_FPAFF config MIPS_MT_FPAFF
bool "Dynamic FPU affinity for FP-intensive threads" bool "Dynamic FPU affinity for FP-intensive threads"
depends on MIPS_MT
default y default y
depends on MIPS_MT_SMP || MIPS_MT_SMTC
config MIPS_VPE_LOADER
bool "VPE loader support."
depends on SYS_SUPPORTS_MULTITHREADING
select CPU_MIPSR2_IRQ_VI
select CPU_MIPSR2_IRQ_EI
select CPU_MIPSR2_SRS
select MIPS_MT
help
Includes a loader for loading an elf relocatable object
onto another VPE and running it.
config MIPS_MT_SMTC_INSTANT_REPLAY config MIPS_MT_SMTC_INSTANT_REPLAY
bool "Low-latency Dispatch of Deferred SMTC IPIs" bool "Low-latency Dispatch of Deferred SMTC IPIs"
......
...@@ -89,7 +89,7 @@ static int sp_stopping = 0; ...@@ -89,7 +89,7 @@ static int sp_stopping = 0;
#define MTSP_O_EXCL 0x0800 #define MTSP_O_EXCL 0x0800
#define MTSP_O_BINARY 0x8000 #define MTSP_O_BINARY 0x8000
#define SP_VPE 1 extern int tclimit;
struct apsp_table { struct apsp_table {
int sp; int sp;
...@@ -225,8 +225,8 @@ void sp_work_handle_request(void) ...@@ -225,8 +225,8 @@ void sp_work_handle_request(void)
/* Run the syscall at the priviledge of the user who loaded the /* Run the syscall at the priviledge of the user who loaded the
SP program */ SP program */
if (vpe_getuid(SP_VPE)) if (vpe_getuid(tclimit))
sp_setfsuidgid( vpe_getuid(SP_VPE), vpe_getgid(SP_VPE)); sp_setfsuidgid(vpe_getuid(tclimit), vpe_getgid(tclimit));
switch (sc.cmd) { switch (sc.cmd) {
/* needs the flags argument translating from SDE kit to /* needs the flags argument translating from SDE kit to
...@@ -245,7 +245,7 @@ void sp_work_handle_request(void) ...@@ -245,7 +245,7 @@ void sp_work_handle_request(void)
case MTSP_SYSCALL_EXIT: case MTSP_SYSCALL_EXIT:
list_for_each_entry(n, &kspd_notifylist, list) list_for_each_entry(n, &kspd_notifylist, list)
n->kspd_sp_exit(SP_VPE); n->kspd_sp_exit(tclimit);
sp_stopping = 1; sp_stopping = 1;
printk(KERN_DEBUG "KSPD got exit syscall from SP exitcode %d\n", printk(KERN_DEBUG "KSPD got exit syscall from SP exitcode %d\n",
...@@ -255,7 +255,7 @@ void sp_work_handle_request(void) ...@@ -255,7 +255,7 @@ void sp_work_handle_request(void)
case MTSP_SYSCALL_OPEN: case MTSP_SYSCALL_OPEN:
generic.arg1 = translate_open_flags(generic.arg1); generic.arg1 = translate_open_flags(generic.arg1);
vcwd = vpe_getcwd(SP_VPE); vcwd = vpe_getcwd(tclimit);
/* change to the cwd of the process that loaded the SP program */ /* change to the cwd of the process that loaded the SP program */
old_fs = get_fs(); old_fs = get_fs();
...@@ -283,7 +283,7 @@ void sp_work_handle_request(void) ...@@ -283,7 +283,7 @@ void sp_work_handle_request(void)
break; break;
} /* switch */ } /* switch */
if (vpe_getuid(SP_VPE)) if (vpe_getuid(tclimit))
sp_setfsuidgid( 0, 0); sp_setfsuidgid( 0, 0);
old_fs = get_fs(); old_fs = get_fs();
...@@ -364,10 +364,9 @@ static void startwork(int vpe) ...@@ -364,10 +364,9 @@ static void startwork(int vpe)
} }
INIT_WORK(&work, sp_work); INIT_WORK(&work, sp_work);
queue_work(workqueue, &work); }
} else
queue_work(workqueue, &work);
queue_work(workqueue, &work);
} }
static void stopwork(int vpe) static void stopwork(int vpe)
...@@ -389,7 +388,7 @@ static int kspd_module_init(void) ...@@ -389,7 +388,7 @@ static int kspd_module_init(void)
notify.start = startwork; notify.start = startwork;
notify.stop = stopwork; notify.stop = stopwork;
vpe_notify(SP_VPE, &notify); vpe_notify(tclimit, &notify);
return 0; return 0;
} }
......
...@@ -21,6 +21,28 @@ ...@@ -21,6 +21,28 @@
#include <asm/r4kcache.h> #include <asm/r4kcache.h>
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
int vpelimit;
static int __init maxvpes(char *str)
{
get_option(&str, &vpelimit);
return 1;
}
__setup("maxvpes=", maxvpes);
int tclimit;
static int __init maxtcs(char *str)
{
get_option(&str, &tclimit);
return 1;
}
__setup("maxtcs=", maxtcs);
/* /*
* Dump new MIPS MT state for the core. Does not leave TCs halted. * Dump new MIPS MT state for the core. Does not leave TCs halted.
* Takes an argument which taken to be a pre-call MVPControl value. * Takes an argument which taken to be a pre-call MVPControl value.
......
...@@ -40,12 +40,11 @@ ...@@ -40,12 +40,11 @@
#include <asm/atomic.h> #include <asm/atomic.h>
#include <asm/cpu.h> #include <asm/cpu.h>
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/mips_mt.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/vpe.h> #include <asm/vpe.h>
#include <asm/rtlx.h> #include <asm/rtlx.h>
#define RTLX_TARG_VPE 1
static struct rtlx_info *rtlx; static struct rtlx_info *rtlx;
static int major; static int major;
static char module_name[] = "rtlx"; static char module_name[] = "rtlx";
...@@ -165,10 +164,10 @@ int rtlx_open(int index, int can_sleep) ...@@ -165,10 +164,10 @@ int rtlx_open(int index, int can_sleep)
} }
if (rtlx == NULL) { if (rtlx == NULL) {
if( (p = vpe_get_shared(RTLX_TARG_VPE)) == NULL) { if( (p = vpe_get_shared(tclimit)) == NULL) {
if (can_sleep) { if (can_sleep) {
__wait_event_interruptible(channel_wqs[index].lx_queue, __wait_event_interruptible(channel_wqs[index].lx_queue,
(p = vpe_get_shared(RTLX_TARG_VPE)), (p = vpe_get_shared(tclimit)),
ret); ret);
if (ret) if (ret)
goto out_fail; goto out_fail;
...@@ -477,6 +476,19 @@ static int rtlx_module_init(void) ...@@ -477,6 +476,19 @@ static int rtlx_module_init(void)
struct device *dev; struct device *dev;
int i, err; int i, err;
if (!cpu_has_mipsmt) {
printk("VPE loader: not a MIPS MT capable processor\n");
return -ENODEV;
}
if (tclimit == 0) {
printk(KERN_WARNING "No TCs reserved for AP/SP, not "
"initializing RTLX.\nPass maxtcs=<n> argument as kernel "
"argument\n");
return -ENODEV;
}
major = register_chrdev(0, module_name, &rtlx_fops); major = register_chrdev(0, module_name, &rtlx_fops);
if (major < 0) { if (major < 0) {
printk(register_chrdev_failed); printk(register_chrdev_failed);
...@@ -501,7 +513,7 @@ static int rtlx_module_init(void) ...@@ -501,7 +513,7 @@ static int rtlx_module_init(void)
/* set up notifiers */ /* set up notifiers */
notify.start = starting; notify.start = starting;
notify.stop = stopping; notify.stop = stopping;
vpe_notify(RTLX_TARG_VPE, &notify); vpe_notify(tclimit, &notify);
if (cpu_has_vint) if (cpu_has_vint)
set_vi_handler(MIPS_CPU_RTLX_IRQ, rtlx_dispatch); set_vi_handler(MIPS_CPU_RTLX_IRQ, rtlx_dispatch);
......
...@@ -86,25 +86,11 @@ unsigned int smtc_status = 0; ...@@ -86,25 +86,11 @@ unsigned int smtc_status = 0;
/* Boot command line configuration overrides */ /* Boot command line configuration overrides */
static int vpelimit = 0;
static int tclimit = 0;
static int ipibuffers = 0; static int ipibuffers = 0;
static int nostlb = 0; static int nostlb = 0;
static int asidmask = 0; static int asidmask = 0;
unsigned long smtc_asid_mask = 0xff; unsigned long smtc_asid_mask = 0xff;
static int __init maxvpes(char *str)
{
get_option(&str, &vpelimit);
return 1;
}
static int __init maxtcs(char *str)
{
get_option(&str, &tclimit);
return 1;
}
static int __init ipibufs(char *str) static int __init ipibufs(char *str)
{ {
get_option(&str, &ipibuffers); get_option(&str, &ipibuffers);
...@@ -137,8 +123,6 @@ static int __init asidmask_set(char *str) ...@@ -137,8 +123,6 @@ static int __init asidmask_set(char *str)
return 1; return 1;
} }
__setup("maxvpes=", maxvpes);
__setup("maxtcs=", maxtcs);
__setup("ipibufs=", ipibufs); __setup("ipibufs=", ipibufs);
__setup("nostlb", stlb_disable); __setup("nostlb", stlb_disable);
__setup("asidmask=", asidmask_set); __setup("asidmask=", asidmask_set);
......
This diff is collapsed.
...@@ -8,6 +8,12 @@ ...@@ -8,6 +8,12 @@
#include <linux/cpumask.h> #include <linux/cpumask.h>
/*
* How many VPEs and TCs is Linux allowed to use? 0 means no limit.
*/
extern int tclimit;
extern int vpelimit;
extern cpumask_t mt_fpu_cpumask; extern cpumask_t mt_fpu_cpumask;
extern unsigned long mt_fpemul_threshold; extern unsigned long mt_fpemul_threshold;
......
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