MIPS: Updates to SMTC and SMVP support for threaded cores.
PATCH 3/5 MIPS: Updates to SMTC and SMVP support for threaded cores.
From: "Steven J. Hill" <[email protected]>
Changes for sharing interrupts between VPEs. Add support for APRP and loading a VPE with an ELF image.
Change-Id I56ffc0536c2c3814320521fb26aa65fa73b3b414
Signed-off-by Steven J. Hill <[email protected]>
--- arch/mips/Kconfig | 34 +- arch/mips/include/asm/mips_mt.h | 1 + arch/mips/include/asm/topology.h | 3 + arch/mips/include/asm/vpe.h | 30 +- arch/mips/kernel/rtlx.c | 21 +- arch/mips/kernel/smp-mt.c | 39 +- arch/mips/kernel/syscall.c | 5 +- arch/mips/kernel/vpe.c | 844 ++++++++++++++++++++++++++++++++++---- 8 files changed, 857 insertions(+), 120 deletions(-)
arch/mips/Kconfig +18 -16
@@ -1862,14 +1862,14 @@ config MIPS_MT_SMP select SYS_SUPPORTS_SMP select SMP_UP help - This is a kernel model which is known a VSMP but lately has been - marketesed into SMVP. - Virtual SMP uses the processor's VPEs to implement virtual - processors. In currently available configuration of the 34K processor - this allows for a dual processor. Both processors will share the same - primary caches; each will obtain the half of the TLB for it's own - exclusive use. For a layman this model can be described as similar to - what Intel calls Hyperthreading. + Virtual SMP uses the processor's VPEs to implement virtual + processors. In currently available configurations of the 34K + processor this allows for a dual processor. Both processors will + share the same primary caches and each will obtain the half of + the TLB for its own exclusive use. For a layman this model can + be described as similar to what Intel calls Hyperthreading. At + some point MIPS marketing decided to renamed to SMVP but the + renaming hasn't caught on as of yet. For further information see http://www.linux-mips.org/wiki/34K#VSMP
@@ -1886,14 +1886,16 @@ config MIPS_MT_SMTC select SYS_SUPPORTS_SMP select SMP_UP help - This is a kernel model which is known a SMTC or lately has been - marketesed into SMVP. - is presenting the available TC's of the core as processors to Linux. - On currently available 34K processors this means a Linux system will - see up to 5 processors. The implementation of the SMTC kernel differs - significantly from VSMP and cannot efficiently coexist in the same - kernel binary so the choice between VSMP and SMTC is a compile time - decision. + SMTC is presenting the available TCs of the core as processors to + Linux. On currently available 34K processors this means a Linux + system will see up to 5 processors. The implementation of the SMTC + kernel differs significantly from VSMP. It was found that SMTC cannot + efficiently coexist in the same kernel binary with other modes of + multiprocessor support, so enabling SMTC is a compile time decision. + The choice between VSMP and SMTC is a bit delicate as it is affected + by clockspeed, memory speed, the specific workload and other factors. + As such the choice should not be made on an evaluation board such as + the Malta but preferably on final target hardware. For further information see http://www.linux-mips.org/wiki/34K#SMTC
arch/mips/include/asm/mips_mt.h +1 -0
@@ -19,6 +19,7 @@ extern unsigned long mt_fpemul_threshold;extern void mips_mt_regdump (unsigned long previous_mvpcontrol_value);extern void mips_mt_set_cpuoptions (void ); +extern void cmp_send_ipi_single (int cpu,unsigned int action);struct class ;extern struct class *mt_class;
arch/mips/include/asm/topology.h +3 -0
@@ -12,6 +12,9 @@#ifdef CONFIG_SMP #define smt_capable () (smp_num_siblings > 1) +/* FIXME: cpu_sibling_map is not a per_cpu variable */ +/*#define topology_thread_cpumask(cpu) (&per_cpu(cpu_sibling_map, cpu)) */ +#define topology_thread_cpumask (cpu) (&cpu_sibling_map[cpu])#endif #endif /* __ASM_TOPOLOGY_H */
arch/mips/include/asm/vpe.h +29 -1
@@ -26,12 +26,40 @@ struct vpe_notifications { struct list_head list; }; - +extern unsigned long physical_memsize;extern int vpe_notify (int index,struct vpe_notifications *notify); +extern void save_gp_address (unsigned int secbase,unsigned int rel); + +/* +* libc style I/O support hooks +*/ extern void *vpe_get_shared (int index);extern int vpe_getuid (int index);extern int vpe_getgid (int index);extern char *vpe_getcwd (int index); +/* +* Kernel/Kernel message passing support hooks +*/ + +extern void *vpe_get_shared_area (int index,int type); + +/* "Well-Known" Area Types */ + +#define VPE_SHARED_NULL 0 +#define VPE_SHARED_RESERVED -1 + +struct vpe_shared_area { +int type; +void *addr; +}; + +/* +* IRQ assignment and initialization hook for RP services. +*/ + +int arch_get_xcpu_irq (void ); + +int vpe_send_interrupt (int v,int i);#endif /* _ASM_VPE_H */
arch/mips/kernel/rtlx.c +7 -14
@@ -57,12 +57,6 @@ static int sp_stopping;extern void *vpe_get_shared (int index); -static void rtlx_dispatch (void ) -{ -do_IRQ (MIPS_CPU_IRQ_BASE +MIPS_CPU_RTLX_IRQ ); -} - -/* Interrupt handler may be called before rtlx_init has otherwise had a chance to run. */
@@ -483,7 +477,7 @@ static char register_chrdev_failed[] __initdata =static int __init rtlx_module_init (void ) {struct device *dev; -int i, err; +int i, err, irq;if (!cpu_has_mipsmt) {printk ("VPE loader: not a MIPS MT capable processor\n" );
@@ -523,18 +517,17 @@ static int __init rtlx_module_init(void) notify.start = starting; notify.stop = stopping;vpe_notify (tclimit, ¬ify); - -if (cpu_has_vint) -set_vi_handler (MIPS_CPU_RTLX_IRQ , rtlx_dispatch); -else { + irq =arch_get_xcpu_irq (); +if (irq <0 ) {pr_err ("APRP RTLX init on non-vectored-interrupt processor\n" ); err = -ENODEV ; goto out_chrdev; } - rtlx_irq.dev_id = rtlx; -setup_irq (rtlx_irq_num, &rtlx_irq); - + err =request_irq (irq, &rtlx_interrupt,IRQF_SHARED , + module_name, (void *)dev); +if (err) + goto out_chrdev;return 0 ; out_chrdev:
arch/mips/kernel/smp-mt.c +36 -3
@@ -34,7 +34,9 @@#include <asm/mipsregs.h> #include <asm/mipsmtregs.h> #include <asm/mips_mt.h> +#include <asm/gic.h> +extern int gic_present;static void __init smvp_copy_vpe_config (void ) { write_vpe_c0_status(
@@ -111,12 +113,35 @@ static void __init smvp_tc_init(unsigned int tc, unsigned int mvpconf0)write_tc_c0_tchalt (TCHALT_H ); } +static void mp_send_ipi_single (int cpu,unsigned int action) +{ +unsigned long flags; + +local_irq_save (flags); + +switch (action) { +case SMP_CALL_FUNCTION : +gic_send_ipi (plat_ipi_call_int_xlate (cpu)); +break ; + +case SMP_RESCHEDULE_YOURSELF : +gic_send_ipi (plat_ipi_resched_int_xlate (cpu)); +break ; + } + +local_irq_restore (flags); +} +static void vsmp_send_ipi_single (int cpu,unsigned int action) {int i;unsigned long flags;int vpflags; +if (gic_present) { +mp_send_ipi_single (cpu, action); +return ; + }local_irq_save (flags); vpflags =dvpe ();/* can't access the other CPU's registers whilst MVPE enabled */
@@ -150,9 +175,8 @@ static void vsmp_send_ipi_mask(const struct cpumask *mask, unsigned int action)static void __cpuinit vsmp_init_secondary (void ) { -extern int gic_present; - -/* This is Malta specific: IPI,performance and timer interrupts */ +pr_debug ("SMPMT: CPU%d: vsmp_init_secondary\n" ,smp_processor_id ()); +/* This is Malta specific: IPI,performance and timer inetrrupts */ if (gic_present)change_c0_status (ST0_IM ,STATUSF_IP3 |STATUSF_IP4 |STATUSF_IP6 |STATUSF_IP7 );
@@ -163,6 +187,8 @@ static void __cpuinit vsmp_init_secondary(void)static void __cpuinit vsmp_smp_finish (void ) { +pr_debug ("SMPMT: CPU%d: vsmp_smp_finish\n" ,smp_processor_id ()); +/* CDFIXME: remove this? */ write_c0_compare (read_c0_count () + (8 * mips_hpt_frequency/HZ ));
@@ -177,6 +203,7 @@ static void __cpuinit vsmp_smp_finish(void)static void vsmp_cpus_done (void ) { +pr_debug ("SMPMT: CPU%d: vsmp_cpus_done\n" ,smp_processor_id ()); }/*
@@ -190,6 +217,8 @@ static void vsmp_cpus_done(void)static void __cpuinit vsmp_boot_secondary (int cpu,struct task_struct *idle) {struct thread_info *gp =task_thread_info (idle); +pr_debug ("SMPMT: CPU%d: vsmp_boot_secondary cpu %d\n" , +smp_processor_id (), cpu);dvpe ();set_c0_mvpcontrol (MVPCONTROL_VPC );
@@ -231,6 +260,7 @@ static void __init vsmp_smp_setup(void)unsigned int mvpconf0, ntc, tc, ncpu =0 ;unsigned int nvpe; +pr_debug ("SMPMT: CPU%d: vsmp_smp_setup\n" ,smp_processor_id ());#ifdef CONFIG_MIPS_MT_FPAFF /* If we have an FPU, enroll ourselves in the FPU-full mask */ if (cpu_has_fpu)
@@ -260,6 +290,7 @@ static void __init vsmp_smp_setup(void)smvp_tc_init (tc, mvpconf0); ncpu =smvp_vpe_init (tc, mvpconf0, ncpu); } + cpu_present_map = cpu_possible_map;/* Release config state */ clear_c0_mvpcontrol (MVPCONTROL_VPC );
@@ -271,6 +302,8 @@ static void __init vsmp_smp_setup(void)static void __init vsmp_prepare_cpus (unsigned int max_cpus) { +pr_debug ("SMPMT: CPU%d: vsmp_prepare_cpus %d\n" , +smp_processor_id (), max_cpus);mips_mt_set_cpuoptions (); }
arch/mips/kernel/syscall.c +3 -2
@@ -124,7 +124,7 @@ _sys_clone(nabi_no_regargs struct pt_regs regs) child_tidptr = (int __user *) regs.regs[8 ];#endif return do_fork (clone_flags, newsp, ®s,0 , - parent_tidptr, child_tidptr); + parent_tidptr, child_tidptr); }/*
@@ -264,11 +264,12 @@ save_static_function(sys_sysmips); static int __used noinline _sys_sysmips(nabi_no_regargs struct pt_regs regs) { -long cmd, arg1, arg2; +long cmd, arg1, arg2, arg3; cmd = regs.regs[4 ]; arg1 = regs.regs[5 ]; arg2 = regs.regs[6 ]; + arg3 = regs.regs[7 ];switch (cmd) {case MIPS_ATOMIC_SET :
arch/mips/kernel/vpe.c +760 -84
1,102 lines not on this page · raw message
Signature · 1 line
1.7.9.6