Part of commit 070ea60 created a new stack within the virtual image for use by
the startup context. Unfortunately the current implementations of virt_to_phys()
as used by some drivers are incorrect which causes issues with some parts of
OpenBIOS, notably the USB stack.
Revert back to using the initial stack in start.S which ensures a 1:1 mapping
between virtual and physical addresses to avoid such problems.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland(a)ilande.co.uk>
---
arch/ppc/qemu/context.c | 1 -
arch/ppc/qemu/ldscript | 6 +-----
arch/ppc/qemu/start.S | 6 ++++++
include/arch/ppc/io.h | 2 +-
4 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/arch/ppc/qemu/context.c b/arch/ppc/qemu/context.c
index 18459b8..65cd4e4 100644
--- a/arch/ppc/qemu/context.c
+++ b/arch/ppc/qemu/context.c
@@ -41,7 +41,6 @@ void of_client_callback(void);
* to start us up.
*/
static struct context main_ctx = {
- .sp = (unsigned long) &_estack - SAVE_SPACE,
.pc = (unsigned long) start_main,
.return_addr = (unsigned long) __exit_context,
};
diff --git a/arch/ppc/qemu/ldscript b/arch/ppc/qemu/ldscript
index 11ebf4b..8027b39 100644
--- a/arch/ppc/qemu/ldscript
+++ b/arch/ppc/qemu/ldscript
@@ -51,11 +51,7 @@ SECTIONS
*(.bss)
*(.bss.*)
*(COMMON)
-
- _stack = .;
- . += CSTACK_SIZE;
- . = ALIGN(16);
- _estack = .;
+ _ebss = .;
}
. = HRESET_ADDR;
diff --git a/arch/ppc/qemu/start.S b/arch/ppc/qemu/start.S
index 33ca1e0..fed1b55 100644
--- a/arch/ppc/qemu/start.S
+++ b/arch/ppc/qemu/start.S
@@ -482,6 +482,12 @@ real_entry:
#endif
bl BRANCH_LABEL(setup_mmu)
+
+ /* load stack pointer into context */
+ LOAD_REG_IMMEDIATE(r4, __context)
+ PPC_LL r4, 0(r4)
+ PPC_STL r1, (2 * ULONG_SIZE)(r4)
+
bl BRANCH_LABEL(__switch_context_nosave)
1: nop
b 1b
diff --git a/include/arch/ppc/io.h b/include/arch/ppc/io.h
index 39c60d7..3449c5b 100644
--- a/include/arch/ppc/io.h
+++ b/include/arch/ppc/io.h
@@ -6,7 +6,7 @@
#define NO_QEMU_PROTOS
#include "arch/common/fw_cfg.h"
-extern char _start, _end, _estack;
+extern char _start, _end;
extern unsigned long virt_offset;
#define phys_to_virt(phys) ((void *) ((unsigned long) (phys) - virt_offset))
--
1.7.10.4