Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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

parent c3a005f4
Loading
Loading
Loading
Loading
+12 −12
Original line number Diff line number Diff line
@@ -1377,17 +1377,6 @@ config MIPS_MT_SMTC
	  This is a kernel model which is known a SMTC or lately has been
	  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

config MIPS_MT
@@ -1398,8 +1387,19 @@ config SYS_SUPPORTS_MULTITHREADING

config MIPS_MT_FPAFF
	bool "Dynamic FPU affinity for FP-intensive threads"
	depends on MIPS_MT
	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
	bool "Low-latency Dispatch of Deferred SMTC IPIs"
+9 −10
Original line number Diff line number Diff line
@@ -89,7 +89,7 @@ static int sp_stopping = 0;
#define MTSP_O_EXCL		0x0800
#define MTSP_O_BINARY		0x8000

#define SP_VPE 1
extern int tclimit;

struct apsp_table  {
	int sp;
@@ -225,8 +225,8 @@ void sp_work_handle_request(void)
	/* Run the syscall at the priviledge of the user who loaded the
	   SP program */

	if (vpe_getuid(SP_VPE))
		sp_setfsuidgid( vpe_getuid(SP_VPE), vpe_getgid(SP_VPE));
	if (vpe_getuid(tclimit))
		sp_setfsuidgid(vpe_getuid(tclimit), vpe_getgid(tclimit));

	switch (sc.cmd) {
	/* needs the flags argument translating from SDE kit to
@@ -245,7 +245,7 @@ void sp_work_handle_request(void)

 	case MTSP_SYSCALL_EXIT:
		list_for_each_entry(n, &kspd_notifylist, list)
 			n->kspd_sp_exit(SP_VPE);
			n->kspd_sp_exit(tclimit);
		sp_stopping = 1;

		printk(KERN_DEBUG "KSPD got exit syscall from SP exitcode %d\n",
@@ -255,7 +255,7 @@ void sp_work_handle_request(void)
 	case MTSP_SYSCALL_OPEN:
 		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 */
		old_fs = get_fs();
@@ -283,7 +283,7 @@ void sp_work_handle_request(void)
		break;
 	} /* switch */

	if (vpe_getuid(SP_VPE))
	if (vpe_getuid(tclimit))
		sp_setfsuidgid( 0, 0);

	old_fs = get_fs();
@@ -364,10 +364,9 @@ static void startwork(int vpe)
		}

		INIT_WORK(&work, sp_work);
		queue_work(workqueue, &work);
	} else
		queue_work(workqueue, &work);
	}

	queue_work(workqueue, &work);
}

static void stopwork(int vpe)
@@ -389,7 +388,7 @@ static int kspd_module_init(void)

	notify.start = startwork;
	notify.stop = stopwork;
	vpe_notify(SP_VPE, &notify);
	vpe_notify(tclimit, &notify);

	return 0;
}
+22 −0
Original line number Diff line number Diff line
@@ -21,6 +21,28 @@
#include <asm/r4kcache.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.
 * Takes an argument which taken to be a pre-call MVPControl value.
+17 −5
Original line number Diff line number Diff line
@@ -40,12 +40,11 @@
#include <asm/atomic.h>
#include <asm/cpu.h>
#include <asm/processor.h>
#include <asm/mips_mt.h>
#include <asm/system.h>
#include <asm/vpe.h>
#include <asm/rtlx.h>

#define RTLX_TARG_VPE 1

static struct rtlx_info *rtlx;
static int major;
static char module_name[] = "rtlx";
@@ -165,10 +164,10 @@ int rtlx_open(int index, int can_sleep)
	}

	if (rtlx == NULL) {
		if( (p = vpe_get_shared(RTLX_TARG_VPE)) == NULL) {
		if( (p = vpe_get_shared(tclimit)) == NULL) {
			if (can_sleep) {
				__wait_event_interruptible(channel_wqs[index].lx_queue,
				                           (p = vpe_get_shared(RTLX_TARG_VPE)),
				                           (p = vpe_get_shared(tclimit)),
				                           ret);
				if (ret)
					goto out_fail;
@@ -477,6 +476,19 @@ static int rtlx_module_init(void)
	struct device *dev;
	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);
	if (major < 0) {
		printk(register_chrdev_failed);
@@ -501,7 +513,7 @@ static int rtlx_module_init(void)
	/* set up notifiers */
	notify.start = starting;
	notify.stop = stopping;
	vpe_notify(RTLX_TARG_VPE, &notify);
	vpe_notify(tclimit, &notify);

	if (cpu_has_vint)
		set_vi_handler(MIPS_CPU_RTLX_IRQ, rtlx_dispatch);
+0 −16
Original line number Diff line number Diff line
@@ -86,25 +86,11 @@ unsigned int smtc_status = 0;

/* Boot command line configuration overrides */

static int vpelimit = 0;
static int tclimit = 0;
static int ipibuffers = 0;
static int nostlb = 0;
static int asidmask = 0;
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)
{
	get_option(&str, &ipibuffers);
@@ -137,8 +123,6 @@ static int __init asidmask_set(char *str)
	return 1;
}

__setup("maxvpes=", maxvpes);
__setup("maxtcs=", maxtcs);
__setup("ipibufs=", ipibufs);
__setup("nostlb", stlb_disable);
__setup("asidmask=", asidmask_set);
Loading