Re: [XenPPC] [PATCH] Rolled up bootargs simplification

2006-10-05 Thread Amos Waterland
On Wed, Oct 04, 2006 at 05:34:05PM -0500, Hollis Blanchard wrote:
> On Mon, 2006-10-02 at 11:46 -0400, Amos Waterland wrote:
> > This patch has been in use by an internal IBM project for some time.
> > It enables two important things: allowing developers and cluster
> > administrators the option of overriding the bootargs supplied by
> > firmware, and the ability to take a single gold master xen binary and
> > customize its bootargs across a cluster with a simple and well-tested
> > post-processing tool.
> 
> Thanks for your patience Amos; I believe the commits I just made should
> solve your problem. Basically removing the boot wrapper (and that's
> bugged me for a while for other reasons) allows us to collapse three
> command line buffers into one, and that makes me happy. :)
> 
> bicl (http://www.cs.unm.edu/~k42/tools/bicl) acts directly on the
> command line that was built in at compile time. If that buffer is empty
> at runtime, firmware arguments will be used.
> 
> Note that changing the CMDLINE at compile time does not properly replace
> the previous CMDLINE; you would have to make clean or remove
> xen/arch/powerpc/cmdline.o by hand. I'd happily accept a Makefile patch
> for that.

I have tested the commits pretty heavily and things work fine.  Thanks.

I am doing automated reliability runs now like this:

 $ bicl xen "xen dom0_mem=%M --"
 $ for i in 128M 192M 1G 2G 7G; do 
 cp xen xen.$i &&
   bicl xen.$i "$(bicl xen | sed "s,%M,$i,")" &&
 netboot-js21-blade -f xen.$i; done


___
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel


Re: [XenPPC] [PATCH] Rolled up bootargs simplification

2006-10-04 Thread Hollis Blanchard
On Mon, 2006-10-02 at 11:46 -0400, Amos Waterland wrote:
> 
> This patch has been in use by an internal IBM project for some time.
> It
> enables two important things: allowing developers and cluster
> administrators the option of overriding the bootargs supplied by
> firmware, and the ability to take a single gold master xen binary and
> customize its bootargs across a cluster with a simple and well-tested
> post-processing tool.

Thanks for your patience Amos; I believe the commits I just made should
solve your problem. Basically removing the boot wrapper (and that's
bugged me for a while for other reasons) allows us to collapse three
command line buffers into one, and that makes me happy. :)

bicl (http://www.cs.unm.edu/~k42/tools/bicl) acts directly on the
command line that was built in at compile time. If that buffer is empty
at runtime, firmware arguments will be used.

Note that changing the CMDLINE at compile time does not properly replace
the previous CMDLINE; you would have to make clean or remove
xen/arch/powerpc/cmdline.o by hand. I'd happily accept a Makefile patch
for that.

-- 
Hollis Blanchard
IBM Linux Technology Center


___
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel


[XenPPC] [PATCH] Rolled up bootargs simplification

2006-10-02 Thread Amos Waterland
Merge in Jimi's idea of handling the seperator phrase entirely in boot_of.

Set and document clear precedence rules for boot argument processing.
Support the same builtin command line format in the 32-bit xen binary as
the 32-bit zImage binary does.  Remove dead default_bootargs code.

This patch has been in use by an internal IBM project for some time.  It
enables two important things: allowing developers and cluster
administrators the option of overriding the bootargs supplied by
firmware, and the ability to take a single gold master xen binary and
customize its bootargs across a cluster with a simple and well-tested
post-processing tool.

Signed-off-by: Amos Waterland <[EMAIL PROTECTED]>

---

 b/xen/arch/powerpc/boot/arg32.c |   22 ++
 xen/arch/powerpc/Makefile   |5 -
 xen/arch/powerpc/boot/boot32.S  |5 +
 xen/arch/powerpc/boot_of.c  |   24 +++-
 xen/arch/powerpc/ofd_fixup.c|   19 ---
 xen/arch/powerpc/xen.lds.S  |4 
 6 files changed, 54 insertions(+), 25 deletions(-)

diff -r dbfb5fc0b9b2 xen/arch/powerpc/Makefile
--- a/xen/arch/powerpc/Makefile Fri Sep 29 11:29:32 2006 -0400
+++ b/xen/arch/powerpc/Makefile Thu Sep 28 14:41:54 2006 -0400
@@ -130,7 +130,10 @@ boot32.o: boot/boot32.S
$(CC) -m32 -Wa,-a32,-mppc64bridge \
-D__ASSEMBLY__ -D__BRIDGE64__ $(CFLAGS) -c $< -o $@
 
-$(TARGET): boot32.o $(TARGET).bin.o
+arg32.o: boot/arg32.c
+   $(CC) -m32 -DCMDLINE="\"$(IMAGENAME) $(CMDLINE)\"" -c $< -o $@
+
+$(TARGET): boot32.o arg32.o $(TARGET).bin.o
$(CC) -m32 -N -Wl,-melf32ppclinux -static -nostdlib \
-Wl,-Ttext,$(boot32_link_base)  -Wl,-Tdata,$(xen_link_base) \
$(CFLAGS) $^ -o $@
diff -r dbfb5fc0b9b2 xen/arch/powerpc/boot/boot32.S
--- a/xen/arch/powerpc/boot/boot32.SFri Sep 29 11:29:32 2006 -0400
+++ b/xen/arch/powerpc/boot/boot32.SThu Sep 28 14:41:54 2006 -0400
@@ -36,6 +36,11 @@ _start:
 ## 51 12  1000 ME   Machine Check Enable
 
 _real_start:   
+   # pass the builtin command line as argument to hype_init
+   li  7, 0
+   oris7, 7, [EMAIL PROTECTED]
+   ori 7, 7, [EMAIL PROTECTED]
+   
# pass the original msr as argument to hype_init
mfmsr   8
 
diff -r dbfb5fc0b9b2 xen/arch/powerpc/boot_of.c
--- a/xen/arch/powerpc/boot_of.cFri Sep 29 11:29:32 2006 -0400
+++ b/xen/arch/powerpc/boot_of.cMon Oct 02 11:37:04 2006 -0400
@@ -40,11 +40,12 @@ 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;
+
+static char bootargs[COMMAND_LINE_SIZE];
 
 extern struct ns16550_defaults ns16550;
 
@@ -460,13 +461,24 @@ static void boot_of_probemem(multiboot_i
 }
 }
 
-static void boot_of_bootargs(multiboot_info_t *mbi)
+static void
+boot_of_bootargs(multiboot_info_t *mbi, char *wrapper_builtin_cmdline)
 {
 int rc;
 
-rc = of_getprop(bof_chosen, "bootargs", &bootargs, sizeof (bootargs));
-if (rc == OF_FAILURE || bootargs[0] == '\0') {
+/* Boot argument precedence rules:
+ *  1. Arguments from 32-bit wrapper override all else
+ *  2. Builtin arguments in 64-bit image override firmware
+ *  3. Firmware is used if neither of the above exist
+ */
+if (wrapper_builtin_cmdline[0] != 0) {
+strlcpy(bootargs, wrapper_builtin_cmdline, sizeof(bootargs));
+} else if (builtin_cmdline[0] != 0) {
 strlcpy(bootargs, builtin_cmdline, sizeof(bootargs));
+} else {
+rc = of_getprop(bof_chosen, "bootargs", &bootargs, sizeof (bootargs));
+if (rc > sizeof (bootargs))
+of_panic("bootargs[] not big enough for /chosen/bootargs\n");
 }
 
 mbi->flags |= MBI_CMDLINE;
@@ -1023,6 +1035,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);
@@ -1197,7 +1211,7 @@ multiboot_info_t __init *boot_of_init(
 
 boot_of_fix_maple();
 boot_of_probemem(&mbi);
-boot_of_bootargs(&mbi);
+boot_of_bootargs(&mbi, (char *)r7);
 oft = boot_of_module(r3, r4, &mbi);
 boot_of_cpus();
 boot_of_serial(oft);
diff -r dbfb5fc0b9b2 xen/arch/powerpc/ofd_fixup.c
--- a/xen/arch/powerpc/ofd_fixup.c  Fri Sep 29 11:29:32 2006 -0400
+++ b/xen/arch/powerpc/ofd_fixup.c  Thu Sep 28 14:41:54 2006 -0400
@@ -244,12 +244,6 @@ static ofdn_t ofd_xics_props(void *m)
 }
 #endif
 
-/*
- * Good things you can stick here:
- *   init=/bin/bash ip=dhcp root=/dev/hda2 ide=nodma 
-