summaryrefslogtreecommitdiff
path: root/board/qemu
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2016-05-10 22:50:07 +0200
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>2016-05-11 15:27:15 +0200
commitcc72cf2ca62ccc2adb3c5acb9553f418006c8425 (patch)
treec767e3f3b253dd8bd70a2187fa778b24660b1c5d /board/qemu
parent7a9407a5fceefa26fa34fe6ea0558805babfd3f9 (diff)
m68k: fix open issues with qemu coldfire
Enable kernel drivers for networking and add a simple busybox config with basic network tools. Add kernel patch from Linux git to fix hush segfaults while using signal handler. Signed-off-by: Waldemar Brodkorb <wbx@openadk.org> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'board/qemu')
-rw-r--r--board/qemu/m68k-mcf5208/linux-4.5.config7
-rw-r--r--board/qemu/m68k-mcf5208/patches/linux/0001-fix-do_sigreturn.patch100
2 files changed, 107 insertions, 0 deletions
diff --git a/board/qemu/m68k-mcf5208/linux-4.5.config b/board/qemu/m68k-mcf5208/linux-4.5.config
index bf30bf425..09a89d725 100644
--- a/board/qemu/m68k-mcf5208/linux-4.5.config
+++ b/board/qemu/m68k-mcf5208/linux-4.5.config
@@ -19,3 +19,10 @@ CONFIG_SERIAL_MCF_BAUDRATE=115200
CONFIG_SERIAL_MCF_CONSOLE=y
CONFIG_BOOTPARAM=y
CONFIG_BOOTPARAM_STRING="console=ttyS0,115200"
+CONFIG_NET=y
+CONFIG_PACKET=y
+CONFIG_UNIX=y
+CONFIG_INET=y
+CONFIG_NETDEVICES=y
+CONFIG_NET_VENDOR_FREESCALE=y
+CONFIG_FEC=y
diff --git a/board/qemu/m68k-mcf5208/patches/linux/0001-fix-do_sigreturn.patch b/board/qemu/m68k-mcf5208/patches/linux/0001-fix-do_sigreturn.patch
new file mode 100644
index 000000000..c52a4e228
--- /dev/null
+++ b/board/qemu/m68k-mcf5208/patches/linux/0001-fix-do_sigreturn.patch
@@ -0,0 +1,100 @@
+From a95517992a37488c0bc8b629c47c570e580e407d Mon Sep 17 00:00:00 2001
+From: Greg Ungerer <gerg@uclinux.org>
+Date: Mon, 15 Feb 2016 16:36:29 +1000
+Subject: m68k: Use conventional function parameters for do_sigreturn
+
+Create conventional stack parameters for the calls to do_sigreturn and
+do_rt_sigreturn. The current C code for do_sigreturn and do_rt_sigreturn
+dig into the stack to create local pointers to the saved switch stack
+and the pt_regs structs.
+
+The motivation for this change is a problem with non-MMU targets that
+have broken signal return paths on newer versions of gcc. It appears as
+though gcc has determined that the pointers into the saved stack structs,
+and the saved structs themselves, are function parameters and updates to
+them will be lost on function return, so they are optimized away. This
+results in large parts of restore_sigcontext() and mangle_kernel_stack()
+functions being removed. Of course this results in non-functional code
+causing kernel oops. This problem has been observed with gcc version
+5.2 and 5.3, and probably exists in earlier versions as well.
+
+Using conventional stack parameter pointers passed to these functions has
+the advantage of the code here not needing to know the exact details of
+how the underlying entry handler layed these structs out on the stack.
+So the rather ugly pointer setup casting and arg referencing can be
+removed.
+
+The resulting code after this change is a few bytes larger (due to the
+overhead of creating the stack args and their tear down). Not being hot
+paths I don't think this is too much of a problem here.
+
+An alternative solution is to put a barrier() in the do_sigreturn() code,
+but this doesn't feel quite as clean as this solution.
+
+This change has been compile tested on all defconfigs, and run tested on
+Atari (through aranym), ColdFire with MMU (M5407EVB) and ColdFire with
+no-MMU (QEMU and M5208EVB).
+
+Signed-off-by: Greg Ungerer <gerg@uclinux.org>
+Acked-by: Andreas Schwab <schwab@linux-m68k.org>
+Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
+---
+ arch/m68k/kernel/entry.S | 6 ++++++
+ arch/m68k/kernel/signal.c | 8 ++------
+ 2 files changed, 8 insertions(+), 6 deletions(-)
+
+diff --git a/arch/m68k/kernel/entry.S b/arch/m68k/kernel/entry.S
+index b54ac7a..97cd3ea 100644
+--- a/arch/m68k/kernel/entry.S
++++ b/arch/m68k/kernel/entry.S
+@@ -71,13 +71,19 @@ ENTRY(__sys_vfork)
+
+ ENTRY(sys_sigreturn)
+ SAVE_SWITCH_STACK
++ movel %sp,%sp@- | switch_stack pointer
++ pea %sp@(SWITCH_STACK_SIZE+4) | pt_regs pointer
+ jbsr do_sigreturn
++ addql #8,%sp
+ RESTORE_SWITCH_STACK
+ rts
+
+ ENTRY(sys_rt_sigreturn)
+ SAVE_SWITCH_STACK
++ movel %sp,%sp@- | switch_stack pointer
++ pea %sp@(SWITCH_STACK_SIZE+4) | pt_regs pointer
+ jbsr do_rt_sigreturn
++ addql #8,%sp
+ RESTORE_SWITCH_STACK
+ rts
+
+diff --git a/arch/m68k/kernel/signal.c b/arch/m68k/kernel/signal.c
+index af1c4f3..2dcee3a 100644
+--- a/arch/m68k/kernel/signal.c
++++ b/arch/m68k/kernel/signal.c
+@@ -737,10 +737,8 @@ badframe:
+ return 1;
+ }
+
+-asmlinkage int do_sigreturn(unsigned long __unused)
++asmlinkage int do_sigreturn(struct pt_regs *regs, struct switch_stack *sw)
+ {
+- struct switch_stack *sw = (struct switch_stack *) &__unused;
+- struct pt_regs *regs = (struct pt_regs *) (sw + 1);
+ unsigned long usp = rdusp();
+ struct sigframe __user *frame = (struct sigframe __user *)(usp - 4);
+ sigset_t set;
+@@ -764,10 +762,8 @@ badframe:
+ return 0;
+ }
+
+-asmlinkage int do_rt_sigreturn(unsigned long __unused)
++asmlinkage int do_rt_sigreturn(struct pt_regs *regs, struct switch_stack *sw)
+ {
+- struct switch_stack *sw = (struct switch_stack *) &__unused;
+- struct pt_regs *regs = (struct pt_regs *) (sw + 1);
+ unsigned long usp = rdusp();
+ struct rt_sigframe __user *frame = (struct rt_sigframe __user *)(usp - 4);
+ sigset_t set;
+--
+cgit v0.12
+