# HG changeset patch # User Jimi Xenidis <[EMAIL PROTECTED]> # Node ID 3583d270140501b208f08335e10105d3f05c52d8 # Parent 1849e7806e199e8feecb280605c53c9949541d9b # Parent a41b8cd01ad287d60a5e59ccffa23b5dd8837af8 merge --- xen/arch/powerpc/boot/boot32.S | 75 --------------------------------------- xen/arch/powerpc/boot/start.S | 51 -------------------------- .hgignore | 7 ++- xen/arch/powerpc/Makefile | 63 ++++++++++++++------------------ xen/arch/powerpc/boot_of.c | 25 ++++++------- xen/arch/powerpc/cmdline.c | 24 ++++++++++++ xen/arch/powerpc/start.S | 62 ++++++++++++++++++++++++++++++++ xen/arch/powerpc/xen.lds.S | 8 +--- xen/include/asm-powerpc/config.h | 1 xen/include/asm-powerpc/mm.h | 2 - xen/include/asm-powerpc/page.h | 1 11 files changed, 134 insertions(+), 185 deletions(-)
diff -r 1849e7806e19 -r 3583d2701405 .hgignore --- a/.hgignore Sun Oct 08 11:34:24 2006 -0400 +++ b/.hgignore Sun Oct 08 11:52:28 2006 -0400 @@ -203,10 +203,11 @@ ^xen/arch/powerpc/dom0\.bin$ ^xen/arch/powerpc/asm-offsets\.s$ ^xen/arch/powerpc/firmware$ -^xen/arch/powerpc/firmware_image$ +^xen/arch/powerpc/firmware_image.bin$ ^xen/arch/powerpc/xen\.lds$ -^xen/arch/powerpc/.xen-syms$ -^xen/arch/powerpc/xen-syms.S$ +^xen/arch/powerpc/\.xen-syms$ +^xen/arch/powerpc/xen-syms\.S$ +^xen/arch/powerpc/cmdline.dep$ ^unmodified_drivers/linux-2.6/\.tmp_versions ^unmodified_drivers/linux-2.6/.*\.cmd$ ^unmodified_drivers/linux-2.6/.*\.ko$ diff -r 1849e7806e19 -r 3583d2701405 xen/arch/powerpc/Makefile --- a/xen/arch/powerpc/Makefile Sun Oct 08 11:34:24 2006 -0400 +++ b/xen/arch/powerpc/Makefile Sun Oct 08 11:52:28 2006 -0400 @@ -9,6 +9,7 @@ obj-y += backtrace.o obj-y += backtrace.o obj-y += bitops.o obj-y += boot_of.o +obj-y += cmdline.o obj-y += dart.o obj-y += dart_u3.o obj-y += dart_u4.o @@ -54,11 +55,6 @@ PPC_C_WARNINGS += -Wshadow PPC_C_WARNINGS += -Wshadow CFLAGS += $(PPC_C_WARNINGS) -LINK=0x400000 -boot32_link_base = $(LINK) -xen_link_offset = 100 -xen_link_base = $(patsubst %000,%$(xen_link_offset),$(LINK)) - # # The following flags are fed to gcc in order to link several # objects into a single ELF segment and to not link in any additional @@ -69,16 +65,8 @@ firmware: of_handler/built_in.o $(TARGET firmware: of_handler/built_in.o $(TARGET_SUBARCH)/memcpy.o of-devtree.o $(CC) $(CFLAGS) $(OMAGIC) -e __ofh_start -Wl,-Ttext,0x0 $^ -o $@ -firmware_image: firmware +firmware_image.bin: firmware $(CROSS_COMPILE)objcopy --output-target=binary $< $@ - -firmware_image.o: firmware_image - $(CROSS_COMPILE)objcopy --input-target=binary \ - --output-target=elf64-powerpc \ - --binary-architecture=powerpc \ - --redefine-sym _binary_$<_start=$(@:%.o=%)_start \ - --redefine-sym _binary_$<_end=$(@:%.o=%)_end \ - --redefine-sym _binary_$<_size=$(@:%.o=%)_size $< $@ # # Hacks for included C files @@ -88,15 +76,27 @@ physdev.o: ../x86/physdev.c HDRS += $(wildcard *.h) +ifneq ($(CMDLINE),) # The first token in the arguments will be silently dropped. -IMAGENAME = xen -CMDLINE = "" -boot_of.o: CFLAGS += -DCMDLINE="\"$(IMAGENAME) $(CMDLINE)\"" +FULL_CMDLINE := xen $(CMDLINE) +endif -start.o: boot/start.S - $(CC) $(CFLAGS) -D__ASSEMBLY__ -c $< -o $@ +ifeq ($(wildcard cmdline.dep),) +cmdline.dep: + echo $(FULL_CMDLINE) > cmdline.dep +else +ifneq ($(FULL_CMDLINE),$(shell cat cmdline.dep)) +cmdline.dep:: + echo $(FULL_CMDLINE) > cmdline.dep +else +cmdline.dep: +endif +endif -TARGET_OPTS = $(OMAGIC) -Wl,-Ttext,$(xen_link_base),-T,xen.lds +cmdline.o: cmdline.dep +cmdline.o: CFLAGS += -DCMDLINE="\"$(FULL_CMDLINE)\"" + +TARGET_OPTS = $(OMAGIC) -Wl,-T,xen.lds TARGET_OPTS += start.o $(ALL_OBJS) .xen-syms: start.o $(ALL_OBJS) xen.lds @@ -118,22 +118,12 @@ xen-syms.o: xen-syms.S $(TARGET)-syms: start.o $(ALL_OBJS) xen-syms.o xen.lds $(CC) $(CFLAGS) $(TARGET_OPTS) xen-syms.o -o $@ -$(TARGET).bin: $(TARGET)-syms - $(CROSS_COMPILE)objcopy --output-target=binary $< $@ - -$(TARGET).bin.o: $(TARGET).bin - $(CROSS_COMPILE)objcopy --input-target=binary \ +# our firmware only loads 32-bit ELF files +$(TARGET): $(TARGET)-syms + $(CROSS_COMPILE)objcopy \ + --input-target=elf64-powerpc \ --output-target=elf32-powerpc \ - --binary-architecture=powerpc $< $@ - -boot32.o: boot/boot32.S - $(CC) -m32 -Wa,-a32,-mppc64bridge \ - -D__ASSEMBLY__ -D__BRIDGE64__ $(CFLAGS) -c $< -o $@ - -$(TARGET): boot32.o $(TARGET).bin.o - $(CC) -m32 -N -Wl,-melf32ppclinux -static -nostdlib \ - -Wl,-Ttext,$(boot32_link_base) -Wl,-Tdata,$(xen_link_base) \ - $(CFLAGS) $^ -o $@ + $^ $@ asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c $(HDRS) $(CC) $(CFLAGS) -S -o $@ $< @@ -146,4 +136,5 @@ dom0.bin: $(DOM0_IMAGE) clean:: $(MAKE) -f $(BASEDIR)/Rules.mk -C of_handler clean - rm -f firmware firmware_image dom0.bin .xen-syms + rm -f firmware firmware_image.bin dom0.bin .xen-syms xen-syms.S \ + xen.lds asm-offsets.s cmdline.dep diff -r 1849e7806e19 -r 3583d2701405 xen/arch/powerpc/boot_of.c --- a/xen/arch/powerpc/boot_of.c Sun Oct 08 11:34:24 2006 -0400 +++ b/xen/arch/powerpc/boot_of.c Sun Oct 08 11:52:28 2006 -0400 @@ -16,6 +16,7 @@ * Copyright (C) IBM Corp. 2005, 2006 * * Authors: Jimi Xenidis <[EMAIL PROTECTED]> + * Hollis Blanchard <[EMAIL PROTECTED]> */ #include <xen/config.h> @@ -40,12 +41,8 @@ static ulong of_vec; static ulong of_vec; static ulong of_msr; static int of_out; -static char bootargs[256]; - -#define COMMAND_LINE_SIZE 512 -static char builtin_cmdline[COMMAND_LINE_SIZE] - __attribute__((section("__builtin_cmdline"))) = CMDLINE; - + +extern char builtin_cmdline[]; extern struct ns16550_defaults ns16550; #undef OF_DEBUG @@ -464,15 +461,17 @@ static void boot_of_bootargs(multiboot_i { int rc; - rc = of_getprop(bof_chosen, "bootargs", &bootargs, sizeof (bootargs)); - if (rc == OF_FAILURE || bootargs[0] == '\0') { - strlcpy(bootargs, builtin_cmdline, sizeof(bootargs)); + if (builtin_cmdline[0] == '\0') { + rc = of_getprop(bof_chosen, "bootargs", builtin_cmdline, + CONFIG_CMDLINE_SIZE); + if (rc > CONFIG_CMDLINE_SIZE) + of_panic("bootargs[] not big enough for /chosen/bootargs\n"); } mbi->flags |= MBI_CMDLINE; - mbi->cmdline = (u32)bootargs; - - of_printf("bootargs = %s\n", bootargs); + mbi->cmdline = (ulong)builtin_cmdline; + + of_printf("bootargs = %s\n", builtin_cmdline); } static int save_props(void *m, ofdn_t n, int pkg) @@ -1023,6 +1022,8 @@ static void * __init boot_of_module(ulon mods[mod].mod_start, mods[mod].mod_end); p = strstr((char *)(ulong)mbi->cmdline, sepr); if (p != NULL) { + /* Xen proper should never know about the dom0 args. */ + *(char *)p = '\0'; p += sizeof (sepr) - 1; mods[mod].string = (u32)(ulong)p; of_printf("%s: dom0 mod string: %s\n", __func__, p); diff -r 1849e7806e19 -r 3583d2701405 xen/arch/powerpc/xen.lds.S --- a/xen/arch/powerpc/xen.lds.S Sun Oct 08 11:34:24 2006 -0400 +++ b/xen/arch/powerpc/xen.lds.S Sun Oct 08 11:52:28 2006 -0400 @@ -12,12 +12,12 @@ SEARCH_DIR("=/usr/local/lib64"); SEARCH_ __DYNAMIC = 0; */ PHDRS { - text PT_LOAD FILEHDR PHDRS; + text PT_LOAD; } SECTIONS { + . = 0x00400000; /* Read-only sections, merged into text segment: */ - PROVIDE (__executable_start = 0x10000000); . = 0x10000000 + SIZEOF_HEADERS; .interp : { *(.interp) } :text .hash : { *(.hash) } .dynsym : { *(.dynsym) } @@ -111,8 +111,6 @@ SECTIONS SORT(CONSTRUCTORS) } - /* Xen addition */ - . = ALIGN(32); __setup_start = .; .setup.init : { *(.setup.init) } @@ -130,8 +128,6 @@ SECTIONS . = __per_cpu_start + (NR_CPUS << PERCPU_SHIFT); . = ALIGN(STACK_SIZE); __per_cpu_end = .; - - /* end Xen addition */ .data1 : { *(.data1) } .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } diff -r 1849e7806e19 -r 3583d2701405 xen/include/asm-powerpc/config.h --- a/xen/include/asm-powerpc/config.h Sun Oct 08 11:34:24 2006 -0400 +++ b/xen/include/asm-powerpc/config.h Sun Oct 08 11:52:28 2006 -0400 @@ -50,6 +50,7 @@ extern char __bss_start[]; #define CONFIG_GDB 1 #define CONFIG_SMP 1 #define CONFIG_PCI 1 +#define CONFIG_CMDLINE_SIZE 512 #define NR_CPUS 16 #ifndef ELFSIZE diff -r 1849e7806e19 -r 3583d2701405 xen/include/asm-powerpc/mm.h --- a/xen/include/asm-powerpc/mm.h Sun Oct 08 11:34:24 2006 -0400 +++ b/xen/include/asm-powerpc/mm.h Sun Oct 08 11:52:28 2006 -0400 @@ -29,6 +29,7 @@ #include <asm/system.h> #include <asm/flushtlb.h> #include <asm/page.h> +#include <asm/debugger.h> #define memguard_guard_range(_p,_l) ((void)0) #define memguard_unguard_range(_p,_l) ((void)0) @@ -287,5 +288,4 @@ extern int steal_page(struct domain *d, /* XXX these just exist until we can stop #including x86 code */ #define access_ok(addr,size) 1 #define array_access_ok(addr,count,size) 1 - #endif diff -r 1849e7806e19 -r 3583d2701405 xen/include/asm-powerpc/page.h --- a/xen/include/asm-powerpc/page.h Sun Oct 08 11:34:24 2006 -0400 +++ b/xen/include/asm-powerpc/page.h Sun Oct 08 11:52:28 2006 -0400 @@ -30,7 +30,6 @@ #include <xen/config.h> #include <asm/cache.h> -#include <asm/debugger.h> #define PFN_DOWN(x) ((x) >> PAGE_SHIFT) #define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT) diff -r 1849e7806e19 -r 3583d2701405 xen/arch/powerpc/cmdline.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xen/arch/powerpc/cmdline.c Sun Oct 08 11:52:28 2006 -0400 @@ -0,0 +1,24 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Copyright (C) IBM Corp. 2006 + * + * Authors: Hollis Blanchard <[EMAIL PROTECTED]> + */ + +#include <asm/config.h> + +char builtin_cmdline[CONFIG_CMDLINE_SIZE] + __attribute__((section("__builtin_cmdline"))) = CMDLINE; diff -r 1849e7806e19 -r 3583d2701405 xen/arch/powerpc/start.S --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xen/arch/powerpc/start.S Sun Oct 08 11:52:28 2006 -0400 @@ -0,0 +1,62 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Copyright (C) 2005, 2006 IBM Corp. + * + * Authors: Jimi Xenidis <[EMAIL PROTECTED]> + * Hollis Blanchard <[EMAIL PROTECTED]> + * + */ + +#include <asm/config.h> +#include <asm/msr.h> +#include <asm/processor.h> +#include <asm/page.h> + + .globl _start +_start: + /* pass the original MSR along */ + mfmsr r8 + + /* set initial MSR */ + li r22, 0 + ori r22, r22, (MSR_SF | MSR_HV) >> 48 + sldi r22, r22, 48 + mtmsrd r22 + +_start64: + /* load up the stack */ + SET_REG_TO_LABEL(r1, cpu0_stack) + + /* call the init function */ + LOADADDR(r21,__start_xen_ppc) + ld r2, 8(r21) + ld r21, 0(r21) + mtctr r21 + bctrl + /* should never return */ + trap + + /* Note! GDB 6.3 makes the very stupid assumption that PC > SP means we are + * in a Linux signal trampoline, and it begins groping for a struct + * rt_sigframe on the stack. Naturally, this fails miserably for our + * backtrace. To work around this behavior, we must make certain that our + * stack is always above our text, e.g. in the data section. */ + .data /* DO NOT REMOVE; see GDB note above */ + .align 4 +cpu0_stack_bottom: + .space STACK_SIZE +cpu0_stack: + .space STACK_FRAME_OVERHEAD diff -r 1849e7806e19 -r 3583d2701405 xen/arch/powerpc/boot/boot32.S --- a/xen/arch/powerpc/boot/boot32.S Sun Oct 08 11:34:24 2006 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -/* - * Copyright (C) 2005 Jimi Xenidis <[EMAIL PROTECTED]>, IBM Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -### 32 bit strapping code so Of will like us - .section ".text" - .align 3 - .globl _start - -_start: - ## Double word align the MSR value below - nop - bl _real_start - ## static value for MSR - .llong 0x9000000000001000 - - ## see also docs/reference/ppc/msr.txt -##bit C Hex Name Desc -## 0 63 80000000 00000000 SF 64-bit Mode -## 3 60 10000000 00000000 HV Hypervisor State iff PR = 0 in hypervisor state. -## 51 12 00000000 00001000 ME Machine Check Enable - -_real_start: - # pass the original msr as argument to hype_init - mfmsr 8 - - ## Set PC - li 21, 0 - oris 21, 21, [EMAIL PROTECTED] - ori 21, 21, [EMAIL PROTECTED] -#ifdef __BRIDGE64__ - ## In 64bit we use rfid to switch from 32bit to 64 bit - mtsrr0 21 - - ## Set MSR - mflr 21 - ld 22, 0(21) - mtsrr1 22 - bl __leap - /* should never return */ - trap -__leap: - rfid -#else - mtctr 21 - bctrl - /* should never return */ - trap -#endif - - -_real_end: - .data - .align 3 - ## Hypervisor starts here, at the first data address - ## linker magic positions _hype64 0x100 after _start - ## hype/ppc64/Makefile.isa -_hype64: - - diff -r 1849e7806e19 -r 3583d2701405 xen/arch/powerpc/boot/start.S --- a/xen/arch/powerpc/boot/start.S Sun Oct 08 11:34:24 2006 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2005 Jimi Xenidis <[EMAIL PROTECTED]>, IBM Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include <asm/config.h> -#include <asm/processor.h> -#include <asm/page.h> - - .globl _start -_start: - /* load up the stack */ - SET_REG_TO_LABEL(r1, cpu0_stack) - - /* call the init function */ - LOADADDR(r21,__start_xen_ppc) - -#ifdef __PPC64__ - ld r2, 8(r21) - ld r21, 0(r21) -#endif - mtctr r21 - bctrl - /* should never return */ - trap - - /* Note! GDB 6.3 makes the very stupid assumption that PC > SP means we are - * in a Linux signal trampoline, and it begins groping for a struct - * rt_sigframe on the stack. Naturally, this fails miserably for our - * backtrace. To work around this behavior, we must make certain that our - * stack is always above our text, e.g. in the data section. */ - .data /* DO NOT REMOVE; see GDB note above */ - .align 4 -cpu0_stack_bottom: - .space STACK_SIZE -cpu0_stack: - .space STACK_FRAME_OVERHEAD _______________________________________________ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel