* [PATCH] mips/loongson: unify compiler flags and load location for Loongson 2E and 2F
@ 2011-08-21 1:05 Andreas Barth
2011-08-22 0:19 ` Matt Turner
2011-08-25 8:00 ` Andreas Barth
0 siblings, 2 replies; 9+ messages in thread
From: Andreas Barth @ 2011-08-21 1:05 UTC (permalink / raw)
To: linux-mips, debian-mips
This patch is the first one in a series to unify the kernels for the different
loongson machines. More patches will follow after more testing.
Signed-off-by: Andreas Barth <aba@not.so.argh.org>
---
arch/mips/Kconfig | 4 ++--
arch/mips/loongson/Platform | 9 +++------
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index b122adc..5d3e753 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1481,7 +1481,7 @@ config CPU_XLR
Netlogic Microsystems XLR/XLS processors.
endchoice
-if CPU_LOONGSON2F
+if CPU_LOONGSON2
config CPU_NOP_WORKAROUNDS
bool
@@ -1506,7 +1506,7 @@ config CPU_LOONGSON2F_WORKAROUNDS
systems.
If unsure, please say Y.
-endif # CPU_LOONGSON2F
+endif # CPU_LOONGSON2
config SYS_SUPPORTS_ZBOOT
bool
diff --git a/arch/mips/loongson/Platform b/arch/mips/loongson/Platform
index 29692e5..d6471a5 100644
--- a/arch/mips/loongson/Platform
+++ b/arch/mips/loongson/Platform
@@ -4,10 +4,8 @@
# Only gcc >= 4.4 have Loongson specific support
cflags-$(CONFIG_CPU_LOONGSON2) += -Wa,--trap
-cflags-$(CONFIG_CPU_LOONGSON2E) += \
- $(call cc-option,-march=loongson2e,-march=r4600)
-cflags-$(CONFIG_CPU_LOONGSON2F) += \
- $(call cc-option,-march=loongson2f,-march=r4600)
+cflags-$(CONFIG_CPU_LOONGSON2) += \
+ $(call cc-option,-march=r4600)
# Enable the workarounds for Loongson2f
ifdef CONFIG_CPU_LOONGSON2F_WORKAROUNDS
ifeq ($(call as-option,-Wa$(comma)-mfix-loongson2f-nop,),)
@@ -28,5 +26,4 @@ endif
platform-$(CONFIG_MACH_LOONGSON) += loongson/
cflags-$(CONFIG_MACH_LOONGSON) += -I$(srctree)/arch/mips/include/asm/mach-loongson -mno-branch-likely
-load-$(CONFIG_LEMOTE_FULOONG2E) += 0xffffffff80100000
-load-$(CONFIG_LEMOTE_MACH2F) += 0xffffffff80200000
+load-$(CONFIG_MACH_LOONGSON) += 0xffffffff80200000
--
1.5.6.5
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] mips/loongson: unify compiler flags and load location for Loongson 2E and 2F
2011-08-21 1:05 [PATCH] mips/loongson: unify compiler flags and load location for Loongson 2E and 2F Andreas Barth
@ 2011-08-22 0:19 ` Matt Turner
2011-08-22 8:06 ` Andreas Barth
2011-08-25 8:00 ` Andreas Barth
1 sibling, 1 reply; 9+ messages in thread
From: Matt Turner @ 2011-08-22 0:19 UTC (permalink / raw)
To: Andreas Barth, linux-mips, debian-mips
On Sat, Aug 20, 2011 at 9:05 PM, Andreas Barth <aba@not.so.argh.org> wrote:
> This patch is the first one in a series to unify the kernels for the different
> loongson machines. More patches will follow after more testing.
>
> Signed-off-by: Andreas Barth <aba@not.so.argh.org>
> ---
> arch/mips/Kconfig | 4 ++--
> arch/mips/loongson/Platform | 9 +++------
> 2 files changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index b122adc..5d3e753 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -1481,7 +1481,7 @@ config CPU_XLR
> Netlogic Microsystems XLR/XLS processors.
> endchoice
>
> -if CPU_LOONGSON2F
> +if CPU_LOONGSON2
> config CPU_NOP_WORKAROUNDS
> bool
>
> @@ -1506,7 +1506,7 @@ config CPU_LOONGSON2F_WORKAROUNDS
> systems.
>
> If unsure, please say Y.
> -endif # CPU_LOONGSON2F
> +endif # CPU_LOONGSON2
>
> config SYS_SUPPORTS_ZBOOT
> bool
OK, I understand this hunk. This just allows you to enable the 2F
workarounds even if you're building for Loongson 2E, which simplifies
life for distributions. Works for me.
> diff --git a/arch/mips/loongson/Platform b/arch/mips/loongson/Platform
> index 29692e5..d6471a5 100644
> --- a/arch/mips/loongson/Platform
> +++ b/arch/mips/loongson/Platform
> @@ -4,10 +4,8 @@
>
> # Only gcc >= 4.4 have Loongson specific support
> cflags-$(CONFIG_CPU_LOONGSON2) += -Wa,--trap
> -cflags-$(CONFIG_CPU_LOONGSON2E) += \
> - $(call cc-option,-march=loongson2e,-march=r4600)
> -cflags-$(CONFIG_CPU_LOONGSON2F) += \
> - $(call cc-option,-march=loongson2f,-march=r4600)
> +cflags-$(CONFIG_CPU_LOONGSON2) += \
> + $(call cc-option,-march=r4600)
> # Enable the workarounds for Loongson2f
> ifdef CONFIG_CPU_LOONGSON2F_WORKAROUNDS
> ifeq ($(call as-option,-Wa$(comma)-mfix-loongson2f-nop,),)
... but I don't understand this one.
So, in the name of simplification, let's just remove the ability to
compile with -march=loongson2{e,f}? What?
Is there some case where a -march=loongson2e kernel won't work on a 2F
system? If not, why not just build for Loongson2E for
ease-of-distribution purposes? And if so, just add a generic
CONFIG_CPU_LOONGSON2 case without removing the 2F case.
The commit message should explain this stuff.
Matt
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] mips/loongson: unify compiler flags and load location for Loongson 2E and 2F
2011-08-22 0:19 ` Matt Turner
@ 2011-08-22 8:06 ` Andreas Barth
2011-08-22 20:15 ` Matt Turner
0 siblings, 1 reply; 9+ messages in thread
From: Andreas Barth @ 2011-08-22 8:06 UTC (permalink / raw)
To: Matt Turner; +Cc: linux-mips, debian-mips
* Matt Turner (mattst88@gmail.com) [110822 02:20]:
> On Sat, Aug 20, 2011 at 9:05 PM, Andreas Barth <aba@not.so.argh.org> wrote:
> > diff --git a/arch/mips/loongson/Platform b/arch/mips/loongson/Platform
> > index 29692e5..d6471a5 100644
> > --- a/arch/mips/loongson/Platform
> > +++ b/arch/mips/loongson/Platform
> > @@ -4,10 +4,8 @@
> >
> > # Only gcc >= 4.4 have Loongson specific support
> > cflags-$(CONFIG_CPU_LOONGSON2) += -Wa,--trap
> > -cflags-$(CONFIG_CPU_LOONGSON2E) += \
> > - $(call cc-option,-march=loongson2e,-march=r4600)
> > -cflags-$(CONFIG_CPU_LOONGSON2F) += \
> > - $(call cc-option,-march=loongson2f,-march=r4600)
> > +cflags-$(CONFIG_CPU_LOONGSON2) += \
> > + $(call cc-option,-march=r4600)
> > # Enable the workarounds for Loongson2f
> > ifdef CONFIG_CPU_LOONGSON2F_WORKAROUNDS
> > ifeq ($(call as-option,-Wa$(comma)-mfix-loongson2f-nop,),)
>
> ... but I don't understand this one.
>
> So, in the name of simplification, let's just remove the ability to
> compile with -march=loongson2{e,f}? What?
I want to build a kernel that works on both 2e and 2f. Such a kernel
must not be built with 2e or 2f specific code (which are incompatible
to each other).
> Is there some case where a -march=loongson2e kernel won't work on a 2F
> system?
Yes. There are 2E opcodes removed in the 2F. See e.g.
http://media.romanrm.ru/loongson/info/Loongson%202F%20Datasheet.pdf
Implementing all the features described in the MIPSIII, Loongson 2E
has some of custom instructions occupied the MIPS-reserved
instruction slot. So in the 2F, these custom-tailored instruction
opcodes need to remove to the user instruction slot (COP2 or
Special2).
(I could of course check if a kernel has such opcodes included. But
I'm unhappy to use compiler instructions which might end in invalid
code.
> The commit message should explain this stuff.
Ok.
Andi
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] mips/loongson: unify compiler flags and load location for Loongson 2E and 2F
2011-08-22 8:06 ` Andreas Barth
@ 2011-08-22 20:15 ` Matt Turner
0 siblings, 0 replies; 9+ messages in thread
From: Matt Turner @ 2011-08-22 20:15 UTC (permalink / raw)
To: Andreas Barth, linux-mips, debian-mips
On Mon, Aug 22, 2011 at 4:06 AM, Andreas Barth <aba@not.so.argh.org> wrote:
> * Matt Turner (mattst88@gmail.com) [110822 02:20]:
>> On Sat, Aug 20, 2011 at 9:05 PM, Andreas Barth <aba@not.so.argh.org> wrote:
>> > diff --git a/arch/mips/loongson/Platform b/arch/mips/loongson/Platform
>> > index 29692e5..d6471a5 100644
>> > --- a/arch/mips/loongson/Platform
>> > +++ b/arch/mips/loongson/Platform
>> > @@ -4,10 +4,8 @@
>> >
>> > # Only gcc >= 4.4 have Loongson specific support
>> > cflags-$(CONFIG_CPU_LOONGSON2) += -Wa,--trap
>> > -cflags-$(CONFIG_CPU_LOONGSON2E) += \
>> > - $(call cc-option,-march=loongson2e,-march=r4600)
>> > -cflags-$(CONFIG_CPU_LOONGSON2F) += \
>> > - $(call cc-option,-march=loongson2f,-march=r4600)
>> > +cflags-$(CONFIG_CPU_LOONGSON2) += \
>> > + $(call cc-option,-march=r4600)
>> > # Enable the workarounds for Loongson2f
>> > ifdef CONFIG_CPU_LOONGSON2F_WORKAROUNDS
>> > ifeq ($(call as-option,-Wa$(comma)-mfix-loongson2f-nop,),)
>>
>> ... but I don't understand this one.
>>
>> So, in the name of simplification, let's just remove the ability to
>> compile with -march=loongson2{e,f}? What?
>
> I want to build a kernel that works on both 2e and 2f. Such a kernel
> must not be built with 2e or 2f specific code (which are incompatible
> to each other).
I understand the desire, but this is removing the ability to build the
kernel with -march=loongson2e or -march=loongson2f.
A Kconfig option should be added to allow building the kernel with
-march=r4600 for generic Loongson2 compatibility if you want to build
one kernel for 2e and 2f.
Matt
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH] mips/loongson: unify compiler flags and load location for Loongson 2E and 2F
2011-08-21 1:05 [PATCH] mips/loongson: unify compiler flags and load location for Loongson 2E and 2F Andreas Barth
2011-08-22 0:19 ` Matt Turner
@ 2011-08-25 8:00 ` Andreas Barth
2011-08-25 23:44 ` Matt Turner
2011-08-26 3:21 ` wu zhangjin
1 sibling, 2 replies; 9+ messages in thread
From: Andreas Barth @ 2011-08-25 8:00 UTC (permalink / raw)
To: linux-mips, debian-mips
This patch starts to merge the Loongson 2E and 2F code together with the
goal to produce a binary kernel image that can run on both machines. As
code compiled for 2E cannot run on 2F and vice versa, the usage of cpu
dependend code is optionally now (and old behaviour is default).
The load address is unified as well, and the 2F workarounds can be enabled
while compiling on a 2E machine (disabled there by default).
Signed-off-by: Andreas Barth <aba@not.so.argh.org>
---
arch/mips/Kconfig | 22 +++++++++++++++++++---
arch/mips/loongson/Platform | 15 +++++++++++----
2 files changed, 30 insertions(+), 7 deletions(-)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index b122adc..b7b65fb 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1481,7 +1481,7 @@ config CPU_XLR
Netlogic Microsystems XLR/XLS processors.
endchoice
-if CPU_LOONGSON2F
+if CPU_LOONGSON2
config CPU_NOP_WORKAROUNDS
bool
@@ -1490,7 +1490,7 @@ config CPU_JUMP_WORKAROUNDS
config CPU_LOONGSON2F_WORKAROUNDS
bool "Loongson 2F Workarounds"
- default y
+ default y if !CPU_LOONGSON2E
select CPU_NOP_WORKAROUNDS
select CPU_JUMP_WORKAROUNDS
help
@@ -1506,7 +1506,23 @@ config CPU_LOONGSON2F_WORKAROUNDS
systems.
If unsure, please say Y.
-endif # CPU_LOONGSON2F
+
+config CPU_LOONGSON2E_CODE
+ bool "Loongson 2E-only code"
+ default y
+ depends on SYS_HAS_CPU_LOONGSON2E
+ help
+ Compile with Loongson 2E specific compiler options. This prevents
+ the kernel to run on other cpus.
+
+config CPU_LOONGSON2F_CODE
+ bool "Loongson 2F-only code"
+ default y
+ depends on SYS_HAS_CPU_LOONGSON2F
+ help
+ Compile with Loongson 2F specific compiler options. This prevents
+ the kernel to run on other cpus.
+endif # CPU_LOONGSON2
config SYS_SUPPORTS_ZBOOT
bool
diff --git a/arch/mips/loongson/Platform b/arch/mips/loongson/Platform
index 29692e5..df52393 100644
--- a/arch/mips/loongson/Platform
+++ b/arch/mips/loongson/Platform
@@ -4,10 +4,18 @@
# Only gcc >= 4.4 have Loongson specific support
cflags-$(CONFIG_CPU_LOONGSON2) += -Wa,--trap
-cflags-$(CONFIG_CPU_LOONGSON2E) += \
+ifdef CONFIG_CPU_LOONGSON2E_CODE
+ cflags-$(CONFIG_CPU_LOONGSON2) += \
$(call cc-option,-march=loongson2e,-march=r4600)
-cflags-$(CONFIG_CPU_LOONGSON2F) += \
+else
+ ifdef CONFIG_CPU_LOONGSON2F_CODE
+ cflags-$(CONFIG_CPU_LOONGSON2) += \
$(call cc-option,-march=loongson2f,-march=r4600)
+ else
+ cflags-$(CONFIG_CPU_LOONGSON2) += \
+ $(call cc-option,-march=r4600)
+ endif
+endif
# Enable the workarounds for Loongson2f
ifdef CONFIG_CPU_LOONGSON2F_WORKAROUNDS
ifeq ($(call as-option,-Wa$(comma)-mfix-loongson2f-nop,),)
@@ -28,5 +36,4 @@ endif
platform-$(CONFIG_MACH_LOONGSON) += loongson/
cflags-$(CONFIG_MACH_LOONGSON) += -I$(srctree)/arch/mips/include/asm/mach-loongson -mno-branch-likely
-load-$(CONFIG_LEMOTE_FULOONG2E) += 0xffffffff80100000
-load-$(CONFIG_LEMOTE_MACH2F) += 0xffffffff80200000
+load-$(CONFIG_MACH_LOONGSON) += 0xffffffff80200000
--
1.5.6.5
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] mips/loongson: unify compiler flags and load location for Loongson 2E and 2F
2011-08-25 8:00 ` Andreas Barth
@ 2011-08-25 23:44 ` Matt Turner
2011-08-26 7:45 ` Andreas Barth
2011-08-26 3:21 ` wu zhangjin
1 sibling, 1 reply; 9+ messages in thread
From: Matt Turner @ 2011-08-25 23:44 UTC (permalink / raw)
To: Andreas Barth, linux-mips, debian-mips
[-- Attachment #1: Type: text/plain, Size: 699 bytes --]
On Thu, Aug 25, 2011 at 4:00 AM, Andreas Barth <aba@not.so.argh.org> wrote:
> This patch starts to merge the Loongson 2E and 2F code together with the
> goal to produce a binary kernel image that can run on both machines. As
> code compiled for 2E cannot run on 2F and vice versa, the usage of cpu
> dependend code is optionally now (and old behaviour is default).
>
> The load address is unified as well, and the 2F workarounds can be enabled
> while compiling on a 2E machine (disabled there by default).
>
> Signed-off-by: Andreas Barth <aba@not.so.argh.org>
I think we can simplify this a bit. How about something like what I've
attached? (I didn't touch the load location stuff)
Thanks,
Matt
[-- Attachment #2: 0001-mips-loongson-unify-compiler-flags.patch --]
[-- Type: text/x-patch, Size: 2475 bytes --]
From 58728ae98a00d032cc367cafb79400f024a36bae Mon Sep 17 00:00:00 2001
From: Matt Turner <mattst88@gmail.com>
Date: Thu, 25 Aug 2011 19:39:43 -0400
Subject: [PATCH] mips/loongson: unify compiler flags
This patch starts to merge the Loongson 2E and 2F code together with the
goal to produce a binary kernel image that can run on both machines. As
code compiled for 2E cannot run on 2F and vice versa, the usage of CPU
dependent code is optional now (and old behaviour is default).
Signed-off-by: Matt Turner <mattst88@gmail.com>
---
arch/mips/Kconfig | 12 ++++++++++--
arch/mips/loongson/Platform | 14 ++++++++++++--
2 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 177cdaf..6ff6813 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1166,6 +1166,14 @@ choice
prompt "CPU type"
default CPU_R4X00
+config CPU_LOONGSON2_GENERIC
+ bool "Loongson 2 (generic)"
+ depends on SYS_HAS_CPU_LOONGSON2E || SYS_HAS_LOONGSON2F
+ select CPU_LOONGSON2
+ help
+ The Loongson 2 processor implements the MIPS III instruction set
+ with many extensions.
+
config CPU_LOONGSON2E
bool "Loongson 2E"
depends on SYS_HAS_CPU_LOONGSON2E
@@ -1475,7 +1483,7 @@ config CPU_XLR
Netlogic Microsystems XLR/XLS processors.
endchoice
-if CPU_LOONGSON2F
+if CPU_LOONGSON2
config CPU_NOP_WORKAROUNDS
bool
@@ -1500,7 +1508,7 @@ config CPU_LOONGSON2F_WORKAROUNDS
systems.
If unsure, please say Y.
-endif # CPU_LOONGSON2F
+endif # CPU_LOONGSON2
config SYS_SUPPORTS_ZBOOT
bool
diff --git a/arch/mips/loongson/Platform b/arch/mips/loongson/Platform
index 29692e5..4a14e39 100644
--- a/arch/mips/loongson/Platform
+++ b/arch/mips/loongson/Platform
@@ -4,10 +4,20 @@
# Only gcc >= 4.4 have Loongson specific support
cflags-$(CONFIG_CPU_LOONGSON2) += -Wa,--trap
-cflags-$(CONFIG_CPU_LOONGSON2E) += \
+ifdef CONFIG_CPU_LOONGSON2E
+ cflags-$(CONFIG_CPU_LOONGSON2E) += \
$(call cc-option,-march=loongson2e,-march=r4600)
-cflags-$(CONFIG_CPU_LOONGSON2F) += \
+else
+ ifdef CONFIG_CPU_LOONGSON2F
+ cflags-$(CONFIG_CPU_LOONGSON2F) += \
$(call cc-option,-march=loongson2f,-march=r4600)
+ else
+ ifdef CONFIG_CPU_LOONGSON
+ cflags-$(CONFIG_CPU_LOONGSON2) += \
+ $(call cc-option,-march=r4600)
+ endif
+ endif
+endif
# Enable the workarounds for Loongson2f
ifdef CONFIG_CPU_LOONGSON2F_WORKAROUNDS
ifeq ($(call as-option,-Wa$(comma)-mfix-loongson2f-nop,),)
--
1.7.3.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] mips/loongson: unify compiler flags and load location for Loongson 2E and 2F
2011-08-25 8:00 ` Andreas Barth
2011-08-25 23:44 ` Matt Turner
@ 2011-08-26 3:21 ` wu zhangjin
2011-08-26 7:36 ` Andreas Barth
1 sibling, 1 reply; 9+ messages in thread
From: wu zhangjin @ 2011-08-26 3:21 UTC (permalink / raw)
To: Andreas Barth, linux-mips, debian-mips
Hi, Andreas
Thanks very much for your effort on merging the support for 2E and 2F.
but only this patch is not enough, we may also need to take care of
the following parts:
1. About processors
$ grep LOONGSON2E -ur arch/mips/
arch/mips/kernel/cpu-probe.c: case PRID_REV_LOONGSON2E:
arch/mips/include/asm/mach-loongson/mem.h:#ifdef CONFIG_CPU_LOONGSON2E
arch/mips/include/asm/mach-loongson/mem.h:#ifdef CONFIG_CPU_LOONGSON2E
arch/mips/include/asm/cpu.h:#define PRID_REV_LOONGSON2E 0x0002
arch/mips/Kconfig:config CPU_LOONGSON2E
arch/mips/Kconfig: depends on SYS_HAS_CPU_LOONGSON2E
arch/mips/Kconfig:config SYS_HAS_CPU_LOONGSON2E
arch/mips/loongson/Platform:cflags-$(CONFIG_CPU_LOONGSON2E) += \
arch/mips/loongson/Kconfig: select SYS_HAS_CPU_LOONGSON2E
arch/mips/loongson/common/bonito-irq.c:#ifdef CONFIG_CPU_LOONGSON2E
arch/mips/loongson/common/env.c: case PRID_REV_LOONGSON2E:
$ grep LOONGSON2F -ur arch/mips/
arch/mips/kernel/cpu-probe.c: case PRID_REV_LOONGSON2F:
arch/mips/include/asm/mach-loongson/dma-coherence.h:#if
defined(CONFIG_CPU_LOONGSON2F) && defined(CONFIG_64BIT)
arch/mips/include/asm/stackframe.h:#endif /* CONFIG_CPU_LOONGSON2F */
arch/mips/include/asm/cpu.h:#define PRID_REV_LOONGSON2F 0x0003
arch/mips/Kconfig:config CPU_LOONGSON2F
arch/mips/Kconfig: depends on SYS_HAS_CPU_LOONGSON2F
arch/mips/Kconfig:if CPU_LOONGSON2F
arch/mips/Kconfig:config CPU_LOONGSON2F_WORKAROUNDS
arch/mips/Kconfig:endif # CPU_LOONGSON2F
arch/mips/Kconfig:config SYS_HAS_CPU_LOONGSON2F
arch/mips/loongson/Platform:cflags-$(CONFIG_CPU_LOONGSON2F) += \
arch/mips/loongson/Platform:ifdef CONFIG_CPU_LOONGSON2F_WORKAROUNDS
arch/mips/loongson/Kconfig: select SYS_HAS_CPU_LOONGSON2F
arch/mips/loongson/common/env.c: case PRID_REV_LOONGSON2F:
arch/mips/loongson/common/platform.c: if ((c->processor_id &
PRID_REV_MASK) >= PRID_REV_LOONGSON2F)
2. About machines
$ grep LEMOTE_FULOONG2E -ur arch/mips/
arch/mips/include/asm/mach-loongson/machine.h:#ifdef CONFIG_LEMOTE_FULOONG2E
arch/mips/pci/Makefile:obj-$(CONFIG_LEMOTE_FULOONG2E) +=
fixup-fuloong2e.o ops-loongson2.o
arch/mips/loongson/Platform:load-$(CONFIG_LEMOTE_FULOONG2E) +=
0xffffffff80100000
arch/mips/loongson/Kconfig:config LEMOTE_FULOONG2E
arch/mips/loongson/Makefile:obj-$(CONFIG_LEMOTE_FULOONG2E) += fuloong-2e/
$ grep LEMOTE_MACH2F -ur arch/mips/
arch/mips/include/asm/mach-loongson/machine.h:/* use fuloong2f as the
default machine of LEMOTE_MACH2F */
arch/mips/include/asm/mach-loongson/machine.h:#ifdef CONFIG_LEMOTE_MACH2F
arch/mips/configs/lemote2f_defconfig:CONFIG_LEMOTE_MACH2F=y
arch/mips/pci/Makefile:obj-$(CONFIG_LEMOTE_MACH2F) += fixup-lemote2f.o
ops-loongson2.o
arch/mips/loongson/Platform:load-$(CONFIG_LEMOTE_MACH2F) += 0xffffffff80200000
arch/mips/loongson/Kconfig:config LEMOTE_MACH2F
arch/mips/loongson/Makefile:obj-$(CONFIG_LEMOTE_MACH2F) += lemote-2f/
Best Regards,
Wu Zhangjin
On 8/25/11, Andreas Barth <aba@not.so.argh.org> wrote:
> This patch starts to merge the Loongson 2E and 2F code together with the
> goal to produce a binary kernel image that can run on both machines. As
> code compiled for 2E cannot run on 2F and vice versa, the usage of cpu
> dependend code is optionally now (and old behaviour is default).
>
> The load address is unified as well, and the 2F workarounds can be enabled
> while compiling on a 2E machine (disabled there by default).
>
> Signed-off-by: Andreas Barth <aba@not.so.argh.org>
> ---
> arch/mips/Kconfig | 22 +++++++++++++++++++---
> arch/mips/loongson/Platform | 15 +++++++++++----
> 2 files changed, 30 insertions(+), 7 deletions(-)
>
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index b122adc..b7b65fb 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -1481,7 +1481,7 @@ config CPU_XLR
> Netlogic Microsystems XLR/XLS processors.
> endchoice
>
> -if CPU_LOONGSON2F
> +if CPU_LOONGSON2
> config CPU_NOP_WORKAROUNDS
> bool
>
> @@ -1490,7 +1490,7 @@ config CPU_JUMP_WORKAROUNDS
>
> config CPU_LOONGSON2F_WORKAROUNDS
> bool "Loongson 2F Workarounds"
> - default y
> + default y if !CPU_LOONGSON2E
> select CPU_NOP_WORKAROUNDS
> select CPU_JUMP_WORKAROUNDS
> help
> @@ -1506,7 +1506,23 @@ config CPU_LOONGSON2F_WORKAROUNDS
> systems.
>
> If unsure, please say Y.
> -endif # CPU_LOONGSON2F
> +
> +config CPU_LOONGSON2E_CODE
> + bool "Loongson 2E-only code"
> + default y
> + depends on SYS_HAS_CPU_LOONGSON2E
> + help
> + Compile with Loongson 2E specific compiler options. This prevents
> + the kernel to run on other cpus.
> +
> +config CPU_LOONGSON2F_CODE
> + bool "Loongson 2F-only code"
> + default y
> + depends on SYS_HAS_CPU_LOONGSON2F
> + help
> + Compile with Loongson 2F specific compiler options. This prevents
> + the kernel to run on other cpus.
> +endif # CPU_LOONGSON2
>
> config SYS_SUPPORTS_ZBOOT
> bool
> diff --git a/arch/mips/loongson/Platform b/arch/mips/loongson/Platform
> index 29692e5..df52393 100644
> --- a/arch/mips/loongson/Platform
> +++ b/arch/mips/loongson/Platform
> @@ -4,10 +4,18 @@
>
> # Only gcc >= 4.4 have Loongson specific support
> cflags-$(CONFIG_CPU_LOONGSON2) += -Wa,--trap
> -cflags-$(CONFIG_CPU_LOONGSON2E) += \
> +ifdef CONFIG_CPU_LOONGSON2E_CODE
> + cflags-$(CONFIG_CPU_LOONGSON2) += \
> $(call cc-option,-march=loongson2e,-march=r4600)
> -cflags-$(CONFIG_CPU_LOONGSON2F) += \
> +else
> + ifdef CONFIG_CPU_LOONGSON2F_CODE
> + cflags-$(CONFIG_CPU_LOONGSON2) += \
> $(call cc-option,-march=loongson2f,-march=r4600)
> + else
> + cflags-$(CONFIG_CPU_LOONGSON2) += \
> + $(call cc-option,-march=r4600)
> + endif
> +endif
> # Enable the workarounds for Loongson2f
> ifdef CONFIG_CPU_LOONGSON2F_WORKAROUNDS
> ifeq ($(call as-option,-Wa$(comma)-mfix-loongson2f-nop,),)
> @@ -28,5 +36,4 @@ endif
>
> platform-$(CONFIG_MACH_LOONGSON) += loongson/
> cflags-$(CONFIG_MACH_LOONGSON) +=
> -I$(srctree)/arch/mips/include/asm/mach-loongson -mno-branch-likely
> -load-$(CONFIG_LEMOTE_FULOONG2E) += 0xffffffff80100000
> -load-$(CONFIG_LEMOTE_MACH2F) += 0xffffffff80200000
> +load-$(CONFIG_MACH_LOONGSON) += 0xffffffff80200000
> --
> 1.5.6.5
>
>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] mips/loongson: unify compiler flags and load location for Loongson 2E and 2F
2011-08-26 3:21 ` wu zhangjin
@ 2011-08-26 7:36 ` Andreas Barth
0 siblings, 0 replies; 9+ messages in thread
From: Andreas Barth @ 2011-08-26 7:36 UTC (permalink / raw)
To: wu zhangjin; +Cc: linux-mips, debian-mips
Hi Wu,
* wu zhangjin (wuzhangjin@gmail.com) [110826 05:21]:
> but only this patch is not enough, we may also need to take care of
> the following parts:
Thank you for your hints. For some files, I already have more patches
currently being load-tested on my machines here. For other, I might
need some more help. I see this rather as an step-by-step effort and
not as one-time action.
Andi
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] mips/loongson: unify compiler flags and load location for Loongson 2E and 2F
2011-08-25 23:44 ` Matt Turner
@ 2011-08-26 7:45 ` Andreas Barth
0 siblings, 0 replies; 9+ messages in thread
From: Andreas Barth @ 2011-08-26 7:45 UTC (permalink / raw)
To: Matt Turner; +Cc: linux-mips, debian-mips
* Matt Turner (mattst88@gmail.com) [110826 01:45]:
> I think we can simplify this a bit. How about something like what I've
> attached? (I didn't touch the load location stuff)
I thought about that as well before sending in the patch.
As I want to remove the "I'm building for this machine now"-stuff
as far as possible, a CPU_LOONGSON2_GENERIC-option needs to either
depend on exactly one machine being selected, or some way to specify
which machine should be builded for.
Not too important now, but I wanted to avoid touching this part later
on again.
Andi
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2011-08-26 7:45 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-21 1:05 [PATCH] mips/loongson: unify compiler flags and load location for Loongson 2E and 2F Andreas Barth
2011-08-22 0:19 ` Matt Turner
2011-08-22 8:06 ` Andreas Barth
2011-08-22 20:15 ` Matt Turner
2011-08-25 8:00 ` Andreas Barth
2011-08-25 23:44 ` Matt Turner
2011-08-26 7:45 ` Andreas Barth
2011-08-26 3:21 ` wu zhangjin
2011-08-26 7:36 ` Andreas Barth
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.