MIPS: Loongson: Add CPU_LOONGSON2F_WORKAROUNDS
authorWu Zhangjin <wuzhangjin@gmail.com>
Sat, 10 Apr 2010 12:04:42 +0000 (20:04 +0800)
committerRalf Baechle <ralf@linux-mips.org>
Fri, 30 Apr 2010 19:52:56 +0000 (20:52 +0100)
As documented in the  Loongson 2F User Manual [2, 3], the old Loongson2F
series (2F01 / 2F02) have the NOP & JUMP issues which requires workarounds
in the kernel and binutils.  This issue has been rectified in Loongson 2F
series 2F03 so no workarounds needed.

Now that the workarounds [1] adding the the -mfix-loongson2f-nop and
-mfix-loongson2f-jump options have been comitted to the binutils the CVS
repository), we can add the workarounds in the kernel.

The workarounds have no significant side effect on the system but may
decrease performance so we control them through a a new
CPU_LOONGSON2F_WORKAROUNDS config option allowing the users to only enable
it as necessary.

[1] "Fixups of Loongson2F" patch for binutils(actually for gas)
    http://sourceware.org/ml/binutils/2009-11/msg00387.html
[2] Chapter 15 of "Loongson2F User Manual"(Chinese Version)
    http://www.loongson.cn/uploadfile/file/200808211
[3] English Version of the above chapter 15
    http://groups.google.com.hk/group/loongson-dev/msg/e0d2e220958f10a6?dmode=source

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: linux-mips <linux-mips@linux-mips.org>
Patchwork: http://patchwork.linux-mips.org/patch/1105/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/Kconfig

index 38fd1b9..7e6fd1c 100644 (file)
@@ -1307,6 +1307,33 @@ config CPU_CAVIUM_OCTEON
 
 endchoice
 
+if CPU_LOONGSON2F
+config CPU_NOP_WORKAROUNDS
+       bool
+
+config CPU_JUMP_WORKAROUNDS
+       bool
+
+config CPU_LOONGSON2F_WORKAROUNDS
+       bool "Loongson 2F Workarounds"
+       default y
+       select CPU_NOP_WORKAROUNDS
+       select CPU_JUMP_WORKAROUNDS
+       help
+         Loongson 2F01 / 2F02 processors have the NOP & JUMP issues which
+         require workarounds.  Without workarounds the system may hang
+         unexpectedly.  For more information please refer to the gas
+         -mfix-loongson2f-nop and -mfix-loongson2f-jump options.
+
+         Loongson 2F03 and later have fixed these issues and no workarounds
+         are needed.  The workarounds have no significant side effect on them
+         but may decrease the performance of the system so this option should
+         be disabled unless the kernel is intended to be run on 2F01 or 2F02
+         systems.
+
+         If unsure, please say Y.
+endif # CPU_LOONGSON2F
+
 config SYS_SUPPORTS_ZBOOT
        bool
        select HAVE_KERNEL_GZIP