1. 17 12月, 2009 40 次提交
    • D
      MIPS: Move several variables from .bss to .init.data · 599a8945
      Dmitri Vorobiev 提交于
      Several static uninitialized variables are used in the scope of __init
      functions but are themselves not marked as __initdata.  This patch is to put
      those variables to where they belong and to reduce the memory footprint a
      little bit.
      
      Also, a couple of lines with spaces instead of tabs were fixed.
      Signed-off-by: NDmitri Vorobiev <dmitri.vorobiev@movial.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: http://patchwork.linux-mips.org/patch/698/Acked-by: NFlorian Fainelli <florian@openwrt.org>
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      599a8945
    • W
      MIPS: Tracing: Make function graph tracer work with -mmcount-ra-address · 7326c4e5
      Wu Zhangjin 提交于
      That thread "MIPS: Add option to pass return address location to
      _mcount" from "David Daney <ddaney@caviumnetworks.com>" have added a new
      option -mmcount-ra-address to gcc(4.5) for MIPS to transfer the location
      of the return address to _mcount.
      
      Benefit from this new feature, function graph tracer on MIPS will be
      easier and safer to hijack the return address of the kernel function,
      which will save some overhead and make the whole thing more reliable.
      
      In this patch, at first, try to enable the option -mmcount-ra-address in
      arch/mips/Makefile with cc-option, if gcc support it, it will be
      enabled, otherwise, no side effect.
      
      and then, we need to support this new option of gcc 4.5 and also support
      the old gcc versions.
      
      with _mcount in the old gcc versions, it's not easy to get the location
      of return address(tracing: add function graph tracer support for MIPS),
         so, we do it in a C function: ftrace_get_parent_addr(ftrace.c), but
         with -mmcount-ra-address, only several instructions need to get what
         we want, so, I put into asm(mcount.S). and also, as the $12(t0) is
         used by -mmcount-ra-address for transferring the localtion of return
         address to _mcount, we need to save it into the stack and restore it
         when enabled dynamic function tracer, 'Cause we have called
         "ftrace_call" before "ftrace_graph_caller", which may destroy
         $12(t0).
      
      (Thanks to David for providing that -mcount-ra-address and giving the
       idea of KBUILD_MCOUNT_RA_ADDRESS, both of them have made the whole
       thing more beautiful!)
      Signed-off-by: NWu Zhangjin <wuzhangjin@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Nicholas Mc Guire <der.herr@hofr.at>
      Cc: zhangfx@lemote.com
      Cc: Wu Zhangjin <wuzhangjin@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Patchwork: http://patchwork.linux-mips.org/patch/681/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      7326c4e5
    • W
      MIPS: Tracing: Reserve $12(t0) for mcount-ra-address of gcc 4.5 · fc49a3be
      Wu Zhangjin 提交于
      A new option -mmcount-ra-address for gcc 4.5 have been sent by David
      Daney <ddaney@caviumnetworks.com> in the thread "MIPS: Add option to
      pass return address location to _mcount", which help to record the
      location of the return address(ra) for the function graph tracer of MIPS
      to hijack the return address easier and safer. that option used the
      $12(t0) register by default, so, we reserve it for it, and use t1,t2,t3
      instead of t0,t1,t2.
      Signed-off-by: NWu Zhangjin <wuzhangjin@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Nicholas Mc Guire <der.herr@hofr.at>
      Cc: zhangfx@lemote.com
      Cc: Wu Zhangjin <wuzhangjin@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Patchwork: http://patchwork.linux-mips.org/patch/680/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      fc49a3be
    • W
      MIPS: Tracing: Make ftrace for MIPS work without -fno-omit-frame-pointer · 046199ca
      Wu Zhangjin 提交于
      When remove the -fno-omit-frame-pointer, gcc will not save the frame
      pointer for us, we need to save one ourselves.
      Signed-off-by: NWu Zhangjin <wuzhangjin@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Nicholas Mc Guire <der.herr@hofr.at>
      Cc: zhangfx@lemote.com
      Cc: Wu Zhangjin <wuzhangjin@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Patchwork: http://patchwork.linux-mips.org/patch/679/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      046199ca
    • W
      MIPS: Tracing: Add dynamic function graph tracer for MIPS · e17ff5fe
      Wu Zhangjin 提交于
      This patch make function graph tracer work with dynamic function tracer.
      
      To share the source code of dynamic function tracer(MCOUNT_SAVE_REGS),
      and avoid restoring the whole saved registers, we need to restore the ra
      register from the stack.
      
      (NOTE: This not work with 32bit! need to ensure why!)
      Signed-off-by: NWu Zhangjin <wuzhangjin@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Nicholas Mc Guire <der.herr@hofr.at>
      Cc: zhangfx@lemote.com
      Cc: Wu Zhangjin <wuzhangjin@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Patchwork: http://patchwork.linux-mips.org/patch/678/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      e17ff5fe
    • W
      MIPS: Tracing: Add function graph tracer support for MIPS · 29c5d346
      Wu Zhangjin 提交于
      The implementation of function graph tracer for MIPS is a little
      different from X86.
      
      in MIPS, gcc(with -pg) only transfer the caller's return address(at) and
      the _mcount's return address(ra) to us.
      
      For the kernel part without -mlong-calls:
      
      move at, ra
      jal _mcount
      
      For the module part with -mlong-calls:
      
      lui v1, hi16bit_of_mcount
      addiu v1, v1, low16bit_of_mcount
      move at, ra
      jal _mcount
      
      Without -mlong-calls,
      
      if the function is a leaf, it will not save the return address(ra):
      
      ffffffff80101298 <au1k_wait>:
      ffffffff80101298:       67bdfff0        daddiu  sp,sp,-16
      ffffffff8010129c:       ffbe0008        sd      s8,8(sp)
      ffffffff801012a0:       03a0f02d        move    s8,sp
      ffffffff801012a4:       03e0082d        move    at,ra
      ffffffff801012a8:       0c042930        jal     ffffffff8010a4c0 <_mcount>
      ffffffff801012ac:       00020021        nop
      
      so, we can hijack it directly in _mcount, but if the function is non-leaf, the
      return address is saved in the stack.
      
      ffffffff80133030 <copy_process>:
      ffffffff80133030:       67bdff50        daddiu  sp,sp,-176
      ffffffff80133034:       ffbe00a0        sd      s8,160(sp)
      ffffffff80133038:       03a0f02d        move    s8,sp
      ffffffff8013303c:       ffbf00a8        sd      ra,168(sp)
      ffffffff80133040:       ffb70098        sd      s7,152(sp)
      ffffffff80133044:       ffb60090        sd      s6,144(sp)
      ffffffff80133048:       ffb50088        sd      s5,136(sp)
      ffffffff8013304c:       ffb40080        sd      s4,128(sp)
      ffffffff80133050:       ffb30078        sd      s3,120(sp)
      ffffffff80133054:       ffb20070        sd      s2,112(sp)
      ffffffff80133058:       ffb10068        sd      s1,104(sp)
      ffffffff8013305c:       ffb00060        sd      s0,96(sp)
      ffffffff80133060:       03e0082d        move    at,ra
      ffffffff80133064:       0c042930        jal     ffffffff8010a4c0 <_mcount>
      ffffffff80133068:       00020021        nop
      
      but we can not get the exact stack address(which saved ra) directly in
      _mcount, we need to search the content of at register in the stack space
      or search the "s{d,w} ra, offset(sp)" instruction in the text. 'Cause we
      can not prove there is only a match in the stack space, so, we search
      the text instead.
      
      as we can see, if the first instruction above "move at, ra" is not a
      store instruction, there should be a leaf function, so we hijack the at
      register directly via putting &return_to_handler into it, otherwise, we
      search the "s{d,w} ra, offset(sp)" instruction to get the stack offset,
      and then the stack address. we use the above copy_process() as an
      example, we at last find "ffbf00a8", 0xa8 is the stack offset, we plus
      it with s8(fp), that is the stack address, we hijack the content via
      writing the &return_to_handler in.
      
      If with -mlong-calls, since there are two more instructions above "move
      at, ra", so, we can move the pointer to the position above "lui v1,
      hi16bit_of_mcount".
      Signed-off-by: NWu Zhangjin <wuzhangjin@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Nicholas Mc Guire <der.herr@hofr.at>
      Cc: zhangfx@lemote.com
      Cc: Wu Zhangjin <wuzhangjin@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Patchwork: http://patchwork.linux-mips.org/patch/677/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      29c5d346
    • W
      MIPS: Tracing: Add IRQENTRY_EXIT section for MIPS · 8f99a162
      Wu Zhangjin 提交于
      This patch add a new section for MIPS to record the block of the hardirq
      handling for function graph tracer(print_graph_irq) via adding the
      __irq_entry annotation to the the entrypoints of the hardirqs(the block
      with irq_enter()...irq_exit()).
      
      Thanks goes to Steven & Frederic Weisbecker for their feedbacks.
      Signed-off-by: NWu Zhangjin <wuzhangjin@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Nicholas Mc Guire <der.herr@hofr.at>
      Cc: zhangfx@lemote.com
      Cc: Wu Zhangjin <wuzhangjin@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Reviewed-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Patchwork: http://patchwork.linux-mips.org/patch/676/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      8f99a162
    • W
      MIPS: Tracing: Add dynamic function tracer support · 538f1952
      Wu Zhangjin 提交于
      With dynamic function tracer, by default, _mcount is defined as an
      "empty" function, it returns directly without any more action . When
      enabling it in user-space, it will jump to a real tracing
      function(ftrace_caller), and do the real job for us.
      
      Differ from the static function tracer, dynamic function tracer provides
      two functions ftrace_make_call()/ftrace_make_nop() to enable/disable the
      tracing of some indicated kernel functions(set_ftrace_filter).
      
      In the -v4 version, the implementation of this support is basically the same as
      X86 version does: _mcount is implemented as an empty function and ftrace_caller
      is implemented as a real tracing function respectively.
      
      But in this version, to support module tracing with the help of
      -mlong-calls in arch/mips/Makefile:
      
      MODFLAGS += -mlong-calls.
      
      The stuff becomes a little more complex. We need to cope with two
      different type of calling to _mcount.
      
      For the kernel part, the calling to _mcount(result of "objdump -hdr
      vmlinux"). is like this:
      
      	108:   03e0082d        move    at,ra
      	10c:   0c000000        jal     0 <fpcsr_pending>
                              10c: R_MIPS_26  _mcount
                              10c: R_MIPS_NONE        *ABS*
                              10c: R_MIPS_NONE        *ABS*
      	110:   00020021        nop
      
      For the module with -mlong-calls, it looks like this:
      
      	c:	3c030000 	lui	v1,0x0
      			c: R_MIPS_HI16	_mcount
      			c: R_MIPS_NONE	*ABS*
      			c: R_MIPS_NONE	*ABS*
      	10:	64630000 	daddiu	v1,v1,0
      			10: R_MIPS_LO16	_mcount
      			10: R_MIPS_NONE	*ABS*
      			10: R_MIPS_NONE	*ABS*
      	14:	03e0082d 	move	at,ra
      	18:	0060f809 	jalr	v1
      
      In the kernel version, there is only one "_mcount" string for every
      kernel function, so, we just need to match this one in mcount_regex of
      scripts/recordmcount.pl, but in the module version, we need to choose
      one of the two to match. Herein, I choose the first one with
      "R_MIPS_HI16 _mcount".
      
      and In the kernel verion, without module tracing support, we just need
      to replace "jal _mcount" by "jal ftrace_caller" to do real tracing, and
      filter the tracing of some kernel functions via replacing it by a nop
      instruction.
      
      but as we have described before, the instruction "jal ftrace_caller" only left
      32bit length for the address of ftrace_caller, it will fail when calling from
      the module space. so, herein, we must replace something else.
      
      the basic idea is loading the address of ftrace_caller to v1 via changing these
      two instructions:
      
      	lui	v1,0x0
      	addiu	v1,v1,0
      
      If we want to enable the tracing, we need to replace the above instructions to:
      
      	lui	v1, HI_16BIT_ftrace_caller
      	addiu	v1, v1, LOW_16BIT_ftrace_caller
      
      If we want to stop the tracing of the indicated kernel functions, we
      just need to replace the "jalr v1" to a nop instruction. but we need to
      replace two instructions and encode the above two instructions
      oursevles.
      
      Is there a simpler solution? Yes! Here it is, in this version, we put _mcount
      and ftrace_caller together, which means the address of _mcount and
      ftrace_caller is the same:
      
      _mcount:
      ftrace_caller:
      	j	ftrace_stub
      	 nop
      
      	...(do real tracing here)...
      
      ftrace_stub:
      	jr	ra
      	 move	ra, at
      
      By default, the kernel functions call _mcount, and then jump to ftrace_stub and
      return. and when we want to do real tracing, we just need to remove that "j
      ftrace_stub", and it will run through the two "nop" instructions and then do
      the real tracing job.
      
      what about filtering job? we just need to do this:
      
      	 lui v1, hi_16bit_of_mcount        <--> b 1f (0x10000004)
      	 addiu v1, v1, low_16bit_of_mcount
      	 move at, ra
      	 jalr v1
      	 nop
      	 				     1f: (rec->ip + 12)
      
      In linux-mips64, there will be some local symbols, whose name are
      prefixed by $L, which need to be filtered. thanks goes to Steven for
      writing the mips64-specific function_regex.
      
      In a conclusion, with RISC, things becomes easier with such a "stupid"
      trick, RISC is something like K.I.S.S, and also, there are lots of
      "simple" tricks in the whole ftrace support, thanks goes to Steven and
      the other folks for providing such a wonderful tracing framework!
      Signed-off-by: NWu Zhangjin <wuzhangjin@gmail.com>
      Cc: Nicholas Mc Guire <der.herr@hofr.at>
      Cc: zhangfx@lemote.com
      Cc: Wu Zhangjin <wuzhangjin@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Patchwork: http://patchwork.linux-mips.org/patch/675/Acked-by: NSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      538f1952
    • W
      MIPS: Tracing: Add an endian argument to scripts/recordmcount.pl · e6299d26
      Wu Zhangjin 提交于
      MIPS and some other architectures need this argument to handle
      big/little endian respectively.
      Signed-off-by: NWu Zhangjin <wuzj@lemote.com>
      Cc: Nicholas Mc Guire <der.herr@hofr.at>
      Cc: zhangfx@lemote.com
      Cc: Wu Zhangjin <wuzhangjin@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Patchwork: http://patchwork.linux-mips.org/patch/674/Acked-by: NSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      e6299d26
    • W
      MIPS: Tracing: Enable HAVE_FUNCTION_TRACE_MCOUNT_TEST for MIPS · 69a7d1b3
      Wu Zhangjin 提交于
      There is an exisiting common ftrace_test_stop_func() in
      kernel/trace/ftrace.c, which is used to check the global variable
      ftrace_trace_stop to determine whether stop the function tracing.
      
      This patch implepment the MIPS specific one to speedup the procedure.
      
      Thanks goes to Zhang Le for Cleaning it up.
      Signed-off-by: NWu Zhangjin <wuzhangjin@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Nicholas Mc Guire <der.herr@hofr.at>
      Cc: zhangfx@lemote.com
      Cc: Wu Zhangjin <wuzhangjin@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Patchwork: http://patchwork.linux-mips.org/patch/673/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      69a7d1b3
    • W
      MIPS: Tracing: Add static function tracer support for MIPS · d2bb0762
      Wu Zhangjin 提交于
      If -pg of gcc is enabled with CONFIG_FUNCTION_TRACER=y. a calling to
      _mcount will be inserted into each kernel function. so, there is a
      possibility to trace the kernel functions in _mcount.
      
      This patch add the MIPS specific _mcount support for static function
      tracing. by default, ftrace_trace_function is initialized as
      ftrace_stub(an empty function), so, the default _mcount will introduce
      very little overhead. after enabling ftrace in user-space, it will jump
      to a real tracing function and do static function tracing for us.
      
      and -ffunction-sections is incompatible with -pg, so, disable it when
      ftracer is enabled.
      Signed-off-by: NWu Zhangjin <wuzhangjin@gmail.com>
      Reviewed-by: NSteven Rostedt <rostedt@goodmis.org>
      Cc: Nicholas Mc Guire <der.herr@hofr.at>
      Cc: zhangfx@lemote.com
      Cc: Wu Zhangjin <wuzhangjin@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Patchwork: http://patchwork.linux-mips.org/patch/672/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      d2bb0762
    • T
      MIPS: Fixup last users of irq_chip->typename · 8922f79e
      Thomas Gleixner 提交于
      The typename member of struct irq_chip was kept for migration purposes
      and is obsolete since more than 2 years. Fix up the leftovers.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: linux-mips@linux-mips.org
      To: LKML <linux-kernel@vger.kernel.org>
      Cc: Ingo Molnar <mingo@elte.hu>
      Patchwork: http://patchwork.linux-mips.org/patch/661/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      8922f79e
    • W
      MIPS: Loongson 2F: Add CPU frequency scaling support · f8ede0f7
      Wu Zhangjin 提交于
      Loongson 2F supports CPU clock scaling. When put it into wait mode by
      setting the frequency as ZERO it will stay in this mode until an external
      interrupt wakes the CPU again.
      
      To enable clock scaling support, an external timer of a known stable rate
      is required.
      Signed-off-by: NWu Zhangjin <wuzhangjin@gmail.com>
      Cc: linux-mips@linux-mips.org
      Cc: cpufreq@vger.kernel.org,
      Cc: Dave Jones <davej@redhat.com>,
      Cc: Dominik Brodowski <linux@dominikbrodowski.net>,
      Cc: yanh@lemote.com
      Cc: huhb@lemote.com,
      Patchwork: http://patchwork.linux-mips.org/patch/660/
      Patchwork: http://patchwork.linux-mips.org/patch/751/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      f8ede0f7
    • W
      MIPS: Add basic CPUFreq options. · 9726b43a
      Wu Zhangjin 提交于
      This patch adds basic options for MIPS CPUFreq support.
      
      Since the cp0 timer's frequency is based on the processor clockrate it can
      not be used with CPUFReq; an additional external timer is required.
      Signed-off-by: NWu Zhangjin <wuzhangjin@gmail.com>
      Cc: linux-mips@linux-mips.org
      Cc: cpufreq@vger.kernel.org,
      Cc: Dave Jones <davej@redhat.com>,
      Cc: Dominik Brodowski <linux@dominikbrodowski.net>,
      Cc: yanh@lemote.com
      Cc: huhb@lemote.com,
      Patchwork: http://patchwork.linux-mips.org/patch/659/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      9726b43a
    • W
      MIPS: Lemote 2F: Add cs5536 MFGPT timer support · 916daba8
      Wu Zhangjin 提交于
      CPUFreq support for Loongson 2F requires an external timer.
      
      Because the frequency of the MIPS Timer is related to the CPU frequency
      which itself is variable another timer of constant frequency is required.
      
      Export the mfgpt0 counter disable / enable operations for the coming
      suspend support to suspend / resume the timer.
      Signed-off-by: NWu Zhangjin <wuzhangjin@gmail.com>
      Cc: linux-mips@linux-mips.org
      Cc: cpufreq@vger.kernel.org,
      Cc: Dave Jones <davej@redhat.com>,
      Cc: Dominik Brodowski <linux@dominikbrodowski.net>,
      Cc: yanh@lemote.com
      Cc: huhb@lemote.com,
      Patchwork: http://patchwork.linux-mips.org/patch/658/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      916daba8
    • W
      MIPS: Lemote 2F: Add Lynloong support · 6e552c9b
      Wu Zhangjin 提交于
      Add a new machtype and kernel options for the Lynloong.
      Signed-off-by: NWu Zhangjin <wuzhangjin@gmail.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: http://patchwork.linux-mips.org/patch/657/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      6e552c9b
    • W
      MIPS: Lemote 2F: Add NAS support · e13fb776
      Wu Zhangjin 提交于
      Kernel support for this machine is almost the same as Fuloong 2F; the only
      difference is that it uses the serial port provided by Loongson 2F processor
      as Yeeloong 2F does.
      Signed-off-by: NWu Zhangjin <wuzhangjin@gmail.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: http://patchwork.linux-mips.org/patch/656/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      e13fb776
    • D
      MIPS: PowerTV: Base files for Cisco PowerTV platform · a3a0f8c8
      David VomLehn 提交于
      Add the Cisco Powertv cable settop box to the MIPS tree. This platform is
      based on a MIPS 24Kc processor with various devices integrated on the same
      ASIC. There are multiple models of this box, with differing configuration
      but the same kernel runs across the product line.
      Signed-off-by: NDavid VomLehn <dvomlehn@cisco.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: http://patchwork.linux-mips.org/patch/132/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      a3a0f8c8
    • A
      MIPS: Sibyte: Use hweight8 instead of counting bits · 13e79b46
      Akinobu Mita 提交于
      Signed-off-by: NAkinobu Mita <akinobu.mita@gmail.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: http://patchwork.linux-mips.org/patch/637/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      13e79b46
    • W
      MIPS: Yeeloong 2F: Add board specific suspend support · a9e8641f
      Wu Zhangjin 提交于
      Lemote Loongson 2F family machines need an external interrupt to wake the
      system from the suspend mode.
      
      For YeeLoong 2F and Mengloong 2F setup the keyboard interrupt as the wakeup
      interrupt.
      
      The new Fuloong 2F and LingLoong 2F have a button to directly send an
      interrupt to the CPU so there is no need to setup an interrupt.
      Signed-off-by: NWu Zhangjin <wuzhangjin@gmail.com>
      Cc: linux-mips@linux-mips.org
      Cc: yanh@lemote.com
      Cc: huhb@lemote.com
      Cc: Wu Zhangjin <wuzhangjin@gmail.com>
      Cc: Len Brown <len.brown@intel.com>
      Cc: Rafael J. Wysocki <rjw@sisk.pl>
      Cc: linux-pm@lists.linux-foundation.org
      Patchwork: http://patchwork.linux-mips.org/patch/630/Acked-by: NPavel Machek <pavel@ucw.cz>
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      a9e8641f
    • W
      MIPS: Loongson 2F: Add suspend support framework · f181bf60
      Wu Zhangjin 提交于
      This patch add basic suspend support for loongson2f family machines,
      loongson2f have a specific feature: when we set it's frequency to ZERO,
      it will go into a wait mode, and then can be waked up by the external
      interrupt. so, if we setup suitable interrupts before putting it into
      wait mode, we will be able wake it up whenever we want via sending the
      relative interrupts to it.
      
      These interrupts are board-specific, Yeeloong2F use the keyboard
      interrupt and SCI interrupt, but LingLoong and Fuloong2F use the
      interrupts connected to the processors directly. and BTW: some old
      LingLoong and FuLoong2F have no such interrupts connected, so, there is
      no way to wake them up from suspend mode. and therefore, please do not
      enable the kernel support for them.
      
      The board-specific support will be added in the coming patches.
      Signed-off-by: NWu Zhangjin <wuzhangjin@gmail.com>
      Cc: linux-mips@linux-mips.org
      Cc: yanh@lemote.com
      Cc: huhb@lemote.com
      Cc: Wu Zhangjin <wuzhangjin@gmail.com>
      Cc: Len Brown <len.brown@intel.com>
      Cc: Rafael J. Wysocki <rjw@sisk.pl>
      Cc: linux-pm@lists.linux-foundation.org
      Patchwork: http://patchwork.linux-mips.org/patch/629/Acked-by: NPavel Machek <pavel@ucw.cz>
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      f181bf60
    • W
      MIPS: Add support for uncached accelerated mappings. · 22f1fdfd
      Wu Zhangjin 提交于
      Loongson2f support video acceleration.
      Signed-off-by: NWu Zhangjin <wuzhangjin@gmail.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: http://patchwork.linux-mips.org/patch/624/
      Patchwork: http://patchwork.linux-mips.org/patch/625/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      22f1fdfd
    • W
      MIPS: Loongson 2F: Cleanup the #if clauses · 55045ff5
      Wu Zhangjin 提交于
      This patch adds two new kernel options: CPU_SUPPORTS_CPUFREQ and
      CPU_SUPPORTS_ADDRWINCFG to describe the new features of Loongons 2F and
      replaces the several ugly #if clauses by them.
      
      These two options will be utilized by the future loongson revisions and
      related drivers such as the coming Loongson 2F CPUFreq driver.
      Signed-off-by: NWu Zhangjin <wuzhangjin@gmail.com>
      Cc: linux-mips@linux-mips.org
      Cc: Wu Zhangjin <wuzhangjin@gmail.com>
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      55045ff5
    • W
      MIPS: Lemote 2F: Add defconfig file · 6e34358e
      Wu Zhangjin 提交于
      Add default config file for Lemote Loongson 2F family machines.  The
      resulting kernel image can be shared between Fuloong 2F, Yeeloong 2F and
      other Lemote Loongson 2F family machines.
      
      If you are using an old PMON, and not using a 2f box, please add a new
      command line argument in the boot.cfg.
      
      For example, add this argument for 8.9inches notebook:
      
          machtype=lemote-yeeloong-2f-8.9inches
      
      or
      
          machtype=8.9
      
      More information from arch/mips/loongson/common/machtype.c.
      Signed-off-by: NWu Zhangjin <wuzhangjin@gmail.com>
      Cc: zhangfx@lemote.com
      Cc: yanh@lemote.com 
      Cc: huhb@lemote.com
      Cc: Nicholas Mc Guire <hofrat@hofr.at>
      Cc: Arnaud Patard <apatard@mandriva.com>
      Cc: loongson-dev@googlegroups.com
      Cc: linux-mips@linux-mips.org
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      6e34358e
    • W
      MIPS: Lemote 2F: Add reset support · 2ee98e0f
      Wu Zhangjin 提交于
      Fuloong 2F, Yeeloong 2F and Menglong 2F have different reset / shutdown
      logic.
      Signed-off-by: NWu Zhangjin <wuzhangjin@gmail.com>
      Cc: zhangfx@lemote.com
      Cc: yanh@lemote.com 
      Cc: huhb@lemote.com
      Cc: Nicholas Mc Guire <hofrat@hofr.at>
      Cc: Arnaud Patard <apatard@mandriva.com>
      Cc: loongson-dev@googlegroups.com
      Cc: linux-mips@linux-mips.org
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      2ee98e0f
    • W
      MIPS: Lemote 2F: Add IRQ support · 6616db78
      Wu Zhangjin 提交于
      The generic i8259_irq() will make kernel hang on booting, so Loongson 2F
      needs its own polling method.
      
      IP6 is shared by the bonito interrupt and perfcounter interrupts.
      Signed-off-by: NWu Zhangjin <wuzhangjin@gmail.com>
      Cc: zhangfx@lemote.com
      Cc: yanh@lemote.com 
      Cc: huhb@lemote.com
      Cc: Nicholas Mc Guire <hofrat@hofr.at>
      Cc: Arnaud Patard <apatard@mandriva.com>
      Cc: loongson-dev@googlegroups.com
      Cc: linux-mips@linux-mips.org
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      6616db78
    • W
      MIPS: Lemote 2F: Add PCI support · 1032bce3
      Wu Zhangjin 提交于
      PCI support for the Fuloong 2E and Lemote Loongson 2F family machines is
      mostly identical with the exception of CS5536 support.
      
      Rename ops-fuloong2e.c to ops-loongson2.c then add the CS5536 support to
      share most of the source code among Loongson machines.
      Signed-off-by: NWu Zhangjin <wuzhangjin@gmail.com>
      Cc: zhangfx@lemote.com
      Cc: yanh@lemote.com 
      Cc: huhb@lemote.com
      Cc: Nicholas Mc Guire <hofrat@hofr.at>
      Cc: Arnaud Patard <apatard@mandriva.com>
      Cc: loongson-dev@googlegroups.com
      Cc: linux-mips@linux-mips.org
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      1032bce3
    • W
      MIPS: Lemote 2F: Add basic CS5536 VSM support · 22c21003
      Wu Zhangjin 提交于
      Lemote Loongson 2F family machines use CS5536 as their south bridge and need
      these lowlevel interfaces to access the devices on CS5536.
      
      Virtualize the legacy devices on CS5536 as PCI devices.  This way users can
      access the CS5536 PCI config space directly as a normal multi-function
      PCI 2.2 device.
      Signed-off-by: NWu Zhangjin <wuzhangjin@gmail.com>
      Cc: zhangfx@lemote.com
      Cc: yanh@lemote.com 
      Cc: huhb@lemote.com
      Cc: Nicholas Mc Guire <hofrat@hofr.at>
      Cc: Arnaud Patard <apatard@mandriva.com>
      Cc: loongson-dev@googlegroups.com
      Cc: linux-mips@linux-mips.org
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      22c21003
    • W
      MIPS: Lemote 2f: Enable legacy RTC driver · 21a41faa
      Wu Zhangjin 提交于
      Currently rtclib is not available on Loongson family machines but the
      legacy RTC driver works well on them.  Deselect RTC_LIB to allow the legacy
      RTC driver to be selected.
      
      The rtclib patch series
      
         http://www.linux-mips.org/cgi-bin/mesg.cgi?a=linux-mips&i=a91e34bf2595157830d599cb66becd52247b1819.1257383766.git.wuzhangjin%40gmail.com
      
      or, in patchworks:
      
         http://patchwork.linux-mips.org/patch/570/
         http://patchwork.linux-mips.org/patch/571/
         http://patchwork.linux-mips.org/patch/572/
      
      is eventually going to switch Lemote platforms to rtclib.
      Signed-off-by: NWu Zhangjin <wuzhangjin@gmail.com>
      Cc: zhangfx@lemote.com
      Cc: yanh@lemote.com 
      Cc: huhb@lemote.com
      Cc: Nicholas Mc Guire <hofrat@hofr.at>
      Cc: Arnaud Patard <apatard@mandriva.com>
      Cc: loongson-dev@googlegroups.com
      Cc: linux-mips@linux-mips.org
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      21a41faa
    • W
      MIPS: Lemote 2F: Add a LEMOTE_MACH2F kernel option · 7d32c6dd
      Wu Zhangjin 提交于
      Add a new kernel option for Lemote Loongson 2F family machines.
      
      Lemote loongson2f family machines utilize the 2f revision of loongson
      processor and the AMD CS5536 south bridge.
      
      Family members include Fuloong 2F mini PC, Yeeloong 2F notebook, LingLoong
      all-in-one PC and others.
      Signed-off-by: NWu Zhangjin <wuzhangjin@gmail.com>
      Cc: zhangfx@lemote.com
      Cc: yanh@lemote.com
      Cc: huhb@lemote.com
      Cc: Nicholas Mc Guire <hofrat@hofr.at>
      Cc: Arnaud Patard <apatard@mandriva.com>
      Cc: loongson-dev@googlegroups.com
      Cc: linux-mips@linux-mips.org
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      7d32c6dd
    • W
      MIPS: Loongson: Add basic Loongson 2F support · 6f7a251a
      Wu Zhangjin 提交于
      Loongson 2F has built-in DDR2 and PCI-X controller. The PCI-X controller
      has a programming interface similiar to the the FPGA northbridge used on
      Loongson 2E.
      
      The main differences between Loongson 2E and Loongson 2F include:
      
      1. Loongson 2F has an extra address window configuration module, which
         is used to map CPU address space to DDR or PCI address space, or map
         the PCI-DMA address space to DDR or LIO address space.
      
      2. Loongson 2F supports 8 levels of software configurable CPu frequency
         which can be configured in the LOONGSON_CHIPCFG0 register.  The coming
         cpufreq and standby support are based on this feature.
      
      Loongson.h abstracts the modules and corresponding methods are abstracted.
      
      Add other Loongson-2F-specific source code including gcc 4.4 support, PCI
      memory space, PCI IO space, DMA address.
      Signed-off-by: NWu Zhangjin <wuzhangjin@gmail.com>
      Cc: linux-mips@linux-mips.org
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      6f7a251a
    • W
      MIPS: oprofile: Only do performance counter handling for counter interrupts · 937893cf
      Wu Zhangjin 提交于
      In Loongson2f IP6 is shared by bonito and perfcounters so we need to avoid
      do_IRQ for perfcounter when the interrupt is from bonito.
      Signed-off-by: NWu Zhangjin <wuzhangjin@gmail.com>
      Cc: linux-mips@linux-mips.org
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      937893cf
    • W
      MIPS: Loongson: Cleanup the serial port support · a3ed4951
      Wu Zhangjin 提交于
      To share the same kernel image amon different machines we have added the
      machtype command line support.
      
      In the old serial port implementation the UART base address is hardcoded as
      a macro in machine.h which breaks with machtype, so change that to discover
      the address dynamically.  Also move the initialization of the UART base
      address to uart_base.c to avoid remapping twice for early_printk.c and
      serial.c.
      Signed-off-by: NWu Zhangjin <wuzhangjin@gmail.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: http://patchwork.linux-mips.org/patch/581/
      Patchwork: http://patchwork.linux-mips.org/patch/682/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      a3ed4951
    • W
      MIPS: Loongson: Cleanup machtype support · 04cfb90a
      Wu Zhangjin 提交于
      To choose code for different machines by the value of machtype it needs to
      be initialized as early as possible.  So move initialization of
      mips_machtype to prom_init().
      Signed-off-by: NWu Zhangjin <wuzhangjin@gmail.com>
      Cc: linux-mips@linux-mips.org
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      04cfb90a
    • D
      MIPS: Collect FPU emulator statistics per-CPU. · b6ee75ed
      David Daney 提交于
      On SMP systems, the collection of statistics can cause cache line
      bouncing in the lines associated with the counters.  Also there are
      races incrementing the counters on multiple CPUs.
      
      To fix both problems, we collect the statistics in per-CPU variables,
      and add them up in the debugfs read operation.
      
      As a test I ran the LTP float_bessel test on a 12 CPU Octeon system.
      
      Without CONFIG_DEBUG_FS :             2602 seconds.
      With CONFIG_DEBUG_FS:                 2640 seconds.
      With non-cpu-local atomic statistics: 14569 seconds.
      Signed-off-by: NDavid Daney <ddaney@caviumnetworks.com>
      Cc: linux-mips@linux-mips.org
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      b6ee75ed
    • R
      MIPS: Remove addinitrd and CONFIG_PROBE_INITRD_HEADER · 32028f1f
      Ralf Baechle 提交于
      Addinitrd has been superseded by initramfs ages ago.
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      32028f1f
    • W
      MIPS: Fuloong 2E: Update defconfig file · 0e8cccc4
      Wu Zhangjin 提交于
      Enable hibernation support by default. Also enable sparsemem to avoid
      the hibernation failures with flatmem and save memory wasted by flatmem.
      Signed-off-by: NWu Zhangjin <wuzhangjin@gmail.com>
      Cc: Linux-MIPS <linux-mips@linux-mips.org>
      Cc: yanh@lemote.com
      Cc: huhb@lemote.com
      Cc: Zhang Le <r0bertz@gentoo.org>
      Cc: zhangfx@lemote.com
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      0e8cccc4
    • W
      MIPS: Bonito64: Make Loongson independent from Bonito64 code. · e2fee572
      Wu Zhangjin 提交于
      The built-in Loongson 2E/2F northbridge in is bonito64-compatible but not
      identical with it.  To avoid influencing the original bonito64 support and
      make the loongson support more maintainable, it's better to separate the
      Bonito64 code from the Loongson code.
      
      This also prepares the kernel for the coming Loongson 2f machines family
      support.
      Signed-off-by: NWu Zhangjin <wuzhangjin@gmail.com>
      Cc: Linux-MIPS <linux-mips@linux-mips.org>
      Cc: yanh@lemote.com
      Cc: huhb@lemote.com
      Cc: Zhang Le <r0bertz@gentoo.org>
      Cc: zhangfx@lemote.com,
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      e2fee572
    • W
      MIPS: Loongson: Add serial port support · e8be5283
      Wu Zhangjin 提交于
      This patch add serial port support for all of the existing loongson
      family machines. most of the board specific part are put in serial.c,
      and the base address of the serial ports are defined as macros in
      machine.h for sharing it between serial.c and early_printk.c
      Signed-off-by: NWu Zhangjin <wuzhangjin@gmail.com>
      Cc: Linux-MIPS <linux-mips@linux-mips.org>
      Cc: yanh@lemote.com
      Cc: huhb@lemote.com
      Cc: Zhang Le <r0bertz@gentoo.org>
      Cc: zhangfx@lemote.com
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      e8be5283
    • W
      MIPS: Loongson early_printk: Fix variable type of uart_base · db54ff24
      Wu Zhangjin 提交于
      The uart_base variable here is not a physical address, so, we replace it
      by unsigned char *.
      Signed-off-by: NWu Zhangjin <wuzhangjin@gmail.com>
      Cc: Linux-MIPS <linux-mips@linux-mips.org>
      Cc: yanh@lemote.com
      Cc: huhb@lemote.com
      Cc: Zhang Le <r0bertz@gentoo.org>
      Cc: zhangfx@lemote.com
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      db54ff24