MIPS: enable APRP (APSP) and add features - v3
v3 cover MIPS: enable APRP (APSP) and add features - v3
The APRP model makes it possible that one or more CPUs run the Linux kernel whereas a dedicated CPU runs special real-time or signal processing program.
This patchset adds the following to the current APRP support:
1. Several bug fixes;
2. Running floating point heavy jobs on the RP side;
3. Waking up RP side read by interrupt;
4. CPS multicore APRP support.
A mp3 player program was ported to run in the APRP (APSP exactly) model. Considerable performance benefits were observed on the player program. CodeSourcery tools instead of the old SDE tools were used to build the example.
Changes:
v3 - v2:
o Split CMP/MT flavors into different files -cmp/-mt.
o Put Malta needed changes into a separate patch.
o Code style adjustments in rtlx/vpe files.
o Remove kspd.h which might have been left out in Ralf's kspd removal. v2 - v1:
o Rebase the patches to the latest kernel, and fix a bunch of warnings and errors reported by the current scripts/checkpatch.pl.
o Add MIPS_MALTA dependency to Kconfig since modifications of Malta files are needed. But it should be easy to port changes to other platforms.
Deng-Cheng Zhu (5):
MIPS: APRP (APSP): fix/enrich functionality
MIPS: APRP (APSP): split vpe-loader and rtlx into cmp/mt flavors
MIPS: APRP (APSP): remove kspd.h
MIPS: let amon_cpu_start() report results
MIPS: APRP (APSP): malta board support
arch/mips/Kconfig | 9 + arch/mips/include/asm/amon.h | 2 +- arch/mips/include/asm/kspd.h | 32 - .../include/asm/mach-malta/cpu-feature-overrides.h | 3 + arch/mips/include/asm/rtlx.h | 45 +- arch/mips/include/asm/vpe.h | 118 +++- arch/mips/kernel/Makefile | 9 +- arch/mips/kernel/rtlx-cmp.c | 125 +++ arch/mips/kernel/rtlx-mt.c | 160 ++++ arch/mips/kernel/rtlx.c | 205 +---- arch/mips/kernel/vpe-cmp.c | 202 +++++ arch/mips/kernel/vpe-mt.c | 534 +++++++++++++ arch/mips/kernel/vpe.c | 815 +++----------------- arch/mips/mti-malta/malta-amon.c | 8 +- arch/mips/mti-malta/malta-int.c | 22 +- 15 files changed, 1351 insertions(+), 938 deletions(-) delete mode 100644 arch/mips/include/asm/kspd.h create mode 100644 arch/mips/kernel/rtlx-cmp.c create mode 100644 arch/mips/kernel/rtlx-mt.c create mode 100644 arch/mips/kernel/vpe-cmp.c create mode 100644 arch/mips/kernel/vpe-mt.c
PATCH v3 1/5 MIPS: APRP (APSP): fix/enrich functionality
This patch makes 34K and CPS like multicore 1004K APRP (also known as APSP) work. Also, it allows the RP side to run floating point heavy jobs and uses interrupt to wake up RP side read. These functionalities need proper RP code to work correctly.
To run programs in APRP (APSP) mode on CPS, for example, a 3 core 1004K CPU, one can run SMVP Linux on the first 2 cores and leave a VPE of the 3rd core to run RTOS or signal processing program. The kernel command line option "maxcpus=" needs to be appointed.
To run FP intensive RP/SP side program on a Kf CPU, currently we simply disable the FPU on the AP side. And RP will init it and use it exclusively.
--- arch/mips/Kconfig | 9 ++ arch/mips/include/asm/rtlx.h | 5 + arch/mips/kernel/rtlx.c | 190 +++++++++++++++++++++----- arch/mips/kernel/vpe.c | 302 ++++++++++++++++++++++++++++++------------ 4 files changed, 381 insertions(+), 125 deletions(-)
arch/mips/Kconfig +9 -0
@@ -2036,6 +2036,15 @@ config MIPS_VPE_LOADER_TOM you to ensure the amount you put in the option and the space your program requires is less or equal to the amount physically present. +config MIPS_SP_FP_INTENSIVE + bool "SP is used for running FP-intensive jobs" + depends on MIPS_VPE_LOADER + ---help--- + If you intend to use the SP to run FP-intensive jobs, you probably + want to say yes here. Your FPU will then be exclusively used by the + SP, and the Linux on the AP side will not see the FPU. Make sure you + know what it does when choosing this option. + # this should possibly be in drivers/char, but it is rather cpu related. Hmmm config MIPS_VPE_APSP_API bool "Enable support for AP/SP API (RTLX)"
arch/mips/include/asm/rtlx.h +5 -0
@@ -28,6 +28,8 @@ extern ssize_t rtlx_write(int index, const void __user *buffer, size_t count);extern unsigned int rtlx_read_poll (int index,int can_sleep);extern unsigned int rtlx_write_poll (int index); +extern void (*aprp_hook)(void ); +enum rtlx_state {RTLX_STATE_UNUSED =0 ,RTLX_STATE_INITIALISED ,
@@ -58,6 +60,9 @@ struct rtlx_channel {struct rtlx_info {unsigned long id;enum rtlx_state state; +#ifdef CONFIG_MIPS_CMP +int ap_int_pending; +#endif struct rtlx_channel channel[RTLX_CHANNELS ]; };
arch/mips/kernel/rtlx.c +153 -37
309 lines not on this page · raw message
arch/mips/kernel/vpe.c +214 -88
603 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v3 2/5 MIPS: APRP (APSP): split vpe-loader and rtlx into cmp/mt flavors
In reply to Deng-Cheng ZhuRemove CONFIG_MIPS_CMP #ifdef's by using -cmp/-mt files. Coding style adjustments are made as well.
--- arch/mips/include/asm/rtlx.h | 40 ++- arch/mips/include/asm/vpe.h | 118 ++++++- arch/mips/kernel/Makefile | 9 +- arch/mips/kernel/rtlx-cmp.c | 125 ++++++ arch/mips/kernel/rtlx-mt.c | 160 ++++++++ arch/mips/kernel/rtlx.c | 285 ++------------- arch/mips/kernel/vpe-cmp.c | 185 +++++++++ arch/mips/kernel/vpe-mt.c | 534 ++++++++++++++++++++++++++ arch/mips/kernel/vpe.c | 873 +++--------------------------------------- 9 files changed, 1238 insertions(+), 1091 deletions(-) create mode 100644 arch/mips/kernel/rtlx-cmp.c create mode 100644 arch/mips/kernel/rtlx-mt.c create mode 100644 arch/mips/kernel/vpe-cmp.c create mode 100644 arch/mips/kernel/vpe-mt.c
arch/mips/include/asm/rtlx.h +29 -11
@@ -1,5 +1,5 @@/* -* Copyright (C) 2004, 2005 MIPS Technologies, Inc. All rights reserved. +* Copyright (C) 2004, 2005, 2012 MIPS Technologies, Inc. All rights reserved. * */
@@ -8,6 +8,8 @@#include <irq.h> +#define RTLX_MODULE_NAME "rtlx" +#define LX_NODE_BASE 10#define MIPS_CPU_RTLX_IRQ 0
@@ -15,19 +17,31 @@#define RTLX_VERSION 2#define RTLX_xID 0x12345600#define RTLX_ID (RTLX_xID | RTLX_VERSION) +#define RTLX_BUFFER_SIZE 2048#define RTLX_CHANNELS 8#define RTLX_CHANNEL_STDIO 0#define RTLX_CHANNEL_DBG 1#define RTLX_CHANNEL_SYSIO 2 -extern int rtlx_open (int index,int can_sleep); -extern int rtlx_release (int index); -extern ssize_t rtlx_read (int index,void __user *buff,size_t count); -extern ssize_t rtlx_write (int index,const void __user *buffer,size_t count); -extern unsigned int rtlx_read_poll (int index,int can_sleep); -extern unsigned int rtlx_write_poll (int index); +void rtlx_starting (int vpe); +void rtlx_stopping (int vpe); + +int rtlx_open (int index,int can_sleep); +int rtlx_release (int index); +ssize_t rtlx_read (int index,void __user *buff,size_t count); +ssize_t rtlx_write (int index,const void __user *buffer,size_t count); +unsigned int rtlx_read_poll (int index,int can_sleep); +unsigned int rtlx_write_poll (int index); + +int __init rtlx_module_init (void ); +void __exit rtlx_module_exit(void); +void _interrupt_sp (void ); + +extern struct vpe_notifications rtlx_notify; +extern const struct file_operations rtlx_fops; +static inline void null_aprp_hook (void ) { }extern void (*aprp_hook)(void );enum rtlx_state {
@@ -37,7 +51,12 @@ enum rtlx_state { RTLX_STATE_OPENED }; -#define RTLX_BUFFER_SIZE 2048 +extern struct chan_waitqueues { +wait_queue_head_t rt_queue; +wait_queue_head_t lx_queue; +atomic_t in_open; +struct mutex mutex; +} channel_wqs[RTLX_CHANNELS ];/* each channel supports read and write. linux (vpe0) reads lx_buffer and writes rt_buffer
@@ -57,7 +76,7 @@ struct rtlx_channel {char *lx_buffer; }; -struct rtlx_info { +extern struct rtlx_info { unsigned long id; enum rtlx_state state; #ifdef CONFIG_MIPS_CMP
@@ -65,6 +84,5 @@ struct rtlx_info {#endif struct rtlx_channel channel[RTLX_CHANNELS]; -}; - +} *rtlx;#endif /* __ASM_RTLX_H_ */
arch/mips/include/asm/vpe.h +112 -6
135 lines not on this page · raw message
arch/mips/kernel/Makefile +7 -2
@@ -52,8 +52,13 @@ obj-$(CONFIG_MIPS_MT_SMP) += smp-mt.o obj-$(CONFIG_MIPS_CMP) += smp-cmp.o obj-$(CONFIG_CPU_MIPSR2) += spram.o -obj-$(CONFIG_MIPS_VPE_LOADER) += vpe.o -obj-$(CONFIG_MIPS_VPE_APSP_API) += rtlx.o +ifdef CONFIG_MIPS_CMP +obj-$(CONFIG_MIPS_VPE_LOADER) += vpe.o vpe-cmp.o +obj-$(CONFIG_MIPS_VPE_APSP_API) += rtlx.o rtlx-cmp.o +else +obj-$(CONFIG_MIPS_VPE_LOADER) += vpe.o vpe-mt.o +obj-$(CONFIG_MIPS_VPE_APSP_API) += rtlx.o rtlx-mt.o +endif obj-$(CONFIG_I8259) += i8259.o obj-$(CONFIG_IRQ_CPU) += irq_cpu.o
arch/mips/kernel/rtlx-cmp.c new file +125 -0
125 lines not on this page · raw message
arch/mips/kernel/rtlx-mt.c new file +160 -0
160 lines not on this page · raw message
arch/mips/kernel/rtlx.c +23 -262
373 lines not on this page · raw message
arch/mips/kernel/vpe-cmp.c new file +185 -0
185 lines not on this page · raw message
arch/mips/kernel/vpe-mt.c new file +534 -0
534 lines not on this page · raw message
arch/mips/kernel/vpe.c +63 -810
1,069 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v3 3/5 MIPS: APRP (APSP): remove kspd.h
In reply to Deng-Cheng ZhuNow that KSPD is gone, kspd.h has no reason to be there.
--- arch/mips/include/asm/kspd.h | 32 -------------------------------- 1 files changed, 0 insertions(+), 32 deletions(-) delete mode 100644 arch/mips/include/asm/kspd.h
arch/mips/include/asm/kspd.h deleted +0 -32
@@ -1,32 +0,0 @@ -/* -* Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved. -* -* This program is free software; you can distribute it and/or modify it -* under the terms of the GNU General Public License (Version 2) as -* published by the Free Software Foundation. -* -* This program is distributed in the hope it will be useful, but WITHOUT -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. -* -*/ - -#ifndef _ASM_KSPD_H -#define _ASM_KSPD_H - -struct kspd_notifications { -void (*kspd_sp_exit)(int sp_id); - -struct list_head list; -}; - -static inline void kspd_notify (struct kspd_notifications *notify) -{ -} - -#endif
Signature · 1 line
1.7.1
PATCH v3 5/5 MIPS: APRP (APSP): malta board support
In reply to Deng-Cheng ZhuAPRP is supposed to be platform independent, however, this patch is needed for Malta for various reasons, see code and code comments.
--- .../include/asm/mach-malta/cpu-feature-overrides.h | 3 ++ arch/mips/kernel/vpe-cmp.c | 17 +++++++++++++++ arch/mips/mti-malta/malta-int.c | 22 +++++++++++++++++++- 3 files changed, 41 insertions(+), 1 deletions(-)
arch/mips/include/asm/mach-malta/cpu-feature-overrides.h +3 -0
@@ -17,6 +17,9 @@#define cpu_has_tlb 1#define cpu_has_4kex 1#define cpu_has_4k_cache 1 +#ifdef CONFIG_MIPS_SP_FP_INTENSIVE +#define cpu_has_fpu 0 +#endif /* #define cpu_has_fpu ? */ /* #define cpu_has_32fpr ? */ #define cpu_has_counter 1
arch/mips/kernel/vpe-cmp.c +17 -0
@@ -25,7 +25,24 @@static int major; +#ifdef CONFIG_MIPS_MALTA +#include <asm/amon.h> + +int vpe_run (struct vpe *v) +{ +struct vpe_notifications *n; + +if (amon_cpu_start (aprp_cpu_index (), v->__start,0 ,0 ,0 ) <0 ) +return -1 ; + +list_for_each_entry (n, &v->notify, list) + n->start (VPE_MODULE_MINOR ); + +return 0 ; +} +#else #error CMP vpe_run() not implemented! +#endif void cleanup_tc (struct tc *tc) {
arch/mips/mti-malta/malta-int.c +21 -1
@@ -1,6 +1,6 @@/* * Carsten Langgaard, [email protected] -* Copyright (C) 2000, 2001, 2004 MIPS Technologies, Inc. +* Copyright (C) 2000, 2001, 2004, 2012 MIPS Technologies, Inc. * Copyright (C) 2001 Ralf Baechle * * This program is free software; you can distribute it and/or modify it
@@ -45,6 +45,9 @@#include <asm/gic.h> #include <asm/gcmpregs.h> #include <asm/setup.h> +#ifdef CONFIG_MIPS_VPE_APSP_API +#include <asm/rtlx.h> +#endif int gcmp_present =-1 ;int gic_present;
@@ -128,6 +131,15 @@ static void malta_hw0_irqdispatch(void) }do_IRQ (MALTA_INT_BASE + irq); + +#if defined(CONFIG_MIPS_VPE_APSP_API ) && !defined(CONFIG_MIPS_CMP ) +/* +* When sw0 gets set, a spurious hw interrupt is signaled as well. +* The sw0 will not be handled until the hw interrupt is cleared. +* We use the hook to handle sw0 and the hw interrupt gets cleared. +*/ +aprp_hook (); +#endif }static void malta_ipi_irqdispatch (void )
@@ -312,6 +324,10 @@ static void ipi_call_dispatch(void)static irqreturn_t ipi_resched_interrupt (int irq,void *dev_id) { +#if defined(CONFIG_MIPS_VPE_APSP_API ) && defined(CONFIG_MIPS_CMP ) +aprp_hook (); +#endif +scheduler_ipi ();return IRQ_HANDLED ;
@@ -622,6 +638,10 @@ void __init arch_init_irq(void)arch_init_ipiirq (cpu_ipi_call_irq, &irq_call);#endif } + +#ifdef CONFIG_MIPS_VPE_APSP_API + aprp_hook = null_aprp_hook; +#endif }void malta_be_init (void )
Signature · 1 line
1.7.1
PATCH v3 4/5 MIPS: let amon_cpu_start() report results
In reply to Deng-Cheng ZhuChange the return type of amon_cpu_start() from void to int.
--- arch/mips/include/asm/amon.h | 2 +- arch/mips/mti-malta/malta-amon.c | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-)
arch/mips/include/asm/amon.h +1 -1
@@ -3,5 +3,5 @@*/ int amon_cpu_avail (int ); -void amon_cpu_start (int ,unsigned long ,unsigned long , +int amon_cpu_start (int ,unsigned long ,unsigned long ,unsigned long ,unsigned long );
arch/mips/mti-malta/malta-amon.c +5 -3
@@ -48,7 +48,7 @@ int amon_cpu_avail(int cpu)return 1 ; } -void amon_cpu_start (int cpu, +int amon_cpu_start (int cpu,unsigned long pc,unsigned long sp,unsigned long gp,unsigned long a0) {
@@ -56,10 +56,10 @@ void amon_cpu_start(int cpu, (struct cpulaunch *)CKSEG0ADDR (CPULAUNCH );if (!amon_cpu_avail (cpu)) -return ; +return -1 ;if (cpu ==smp_processor_id ()) {pr_debug ("launch: I am cpu%d!\n" , cpu); -return ; +return -1 ; } launch += cpu;
@@ -78,4 +78,6 @@ void amon_cpu_start(int cpu, ;smp_rmb ();/* Target will be updating flags soon */ pr_debug ("launch: cpu%d gone!\n" , cpu); + +return 0 ; }
Signature · 1 line
1.7.1