[XenPPC] [xenppc-unstable] merge

2006-12-17 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 014c4ef0e124a81a072a92bd4cff17e6214d8897
# Parent  4b07d05c1b4e3492199e118d03f89209caffcad2
# Parent  9a758f814f60166dcf4a386bb9835f58c8f68502
merge
---
 xen/arch/powerpc/boot_of.c |   16 
 1 files changed, 12 insertions(+), 4 deletions(-)

diff -r 4b07d05c1b4e -r 014c4ef0e124 xen/arch/powerpc/boot_of.c
--- a/xen/arch/powerpc/boot_of.cSun Dec 17 12:53:12 2006 -0500
+++ b/xen/arch/powerpc/boot_of.cSun Dec 17 12:54:30 2006 -0500
@@ -1070,10 +1070,11 @@ static void * __init boot_of_module(ulon
 static module_t mods[4];
 ulong mod0_start;
 ulong mod0_size;
-static const char sepr[] = " -- ";
+static const char * sepr[] = {" -- ", " || "};
+int sepr_index;
 extern char dom0_start[] __attribute__ ((weak));
 extern char dom0_size[] __attribute__ ((weak));
-const char *p;
+const char *p = NULL;
 int mod;
 void *oft;
 
@@ -1124,11 +1125,18 @@ static void * __init boot_of_module(ulon
 
 of_printf("%s: dom0 mod @ 0x%016x[0x%x]\n", __func__,
   mods[mod].mod_start, mods[mod].mod_end);
-p = strstr((char *)(ulong)mbi->cmdline, sepr);
+
+/* look for delimiter: "--" or "||" */
+for (sepr_index = 0; sepr_index < ARRAY_SIZE(sepr); sepr_index++){
+p = strstr((char *)(ulong)mbi->cmdline, sepr[sepr_index]);
+if (p != NULL)
+break;
+}
+
 if (p != NULL) {
 /* Xen proper should never know about the dom0 args.  */
 *(char *)p = '\0';
-p += sizeof (sepr) - 1;
+p += strlen(sepr[sepr_index]);
 mods[mod].string = (u32)(ulong)p;
 of_printf("%s: dom0 mod string: %s\n", __func__, p);
 }

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


[XenPPC] [xenppc-unstable] merge

2006-10-13 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 3dfeb3e4a03f0f1eb6b015b89e7d7cc2f2d50207
# Parent  9372353e3b095cfaf82d09c8b891d9a2b58ca735
# Parent  ff3ab3fc802484087ecf24521f66c4f7ab44849a
merge
---
 xen/arch/powerpc/Makefile |6 ++
 xen/common/gdbstub.c  |1 +
 2 files changed, 3 insertions(+), 4 deletions(-)

diff -r 9372353e3b09 -r 3dfeb3e4a03f xen/arch/powerpc/Makefile
--- a/xen/arch/powerpc/Makefile Thu Oct 12 17:09:19 2006 -0400
+++ b/xen/arch/powerpc/Makefile Fri Oct 13 11:00:32 2006 -0400
@@ -120,11 +120,9 @@ xen-syms.o: xen-syms.S
$(CC) $(CFLAGS) $(TARGET_OPTS) xen-syms.o -o $@
 
 # our firmware only loads 32-bit ELF files
+OCPYFLAGS := --input-target=elf64-powerpc --output-target=elf32-powerpc
 $(TARGET): $(TARGET)-syms
-   $(CROSS_COMPILE)objcopy \
-   --input-target=elf64-powerpc \
-   --output-target=elf32-powerpc \
-   $^ $@
+   $(CROSS_COMPILE)objcopy $(OCPYFLAGS) $^ $@
 
 asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c $(HDRS)
$(CC) $(CFLAGS) -S -o $@ $<
diff -r 9372353e3b09 -r 3dfeb3e4a03f xen/common/gdbstub.c
--- a/xen/common/gdbstub.c  Thu Oct 12 17:09:19 2006 -0400
+++ b/xen/common/gdbstub.c  Fri Oct 13 11:00:32 2006 -0400
@@ -42,6 +42,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /* Printk isn't particularly safe just after we've trapped to the
debugger. so avoid it. */

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


[XenPPC] [xenppc-unstable] merge

2006-10-08 Thread Xen patchbot-xenppc-unstable
# 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=0x40
-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: $(D

[XenPPC] [xenppc-unstable] merge

2006-09-08 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Hollis Blanchard <[EMAIL PROTECTED]>
# Node ID a79b3252bbe46a13d91586081e7f6be278b07126
# Parent  0fb10fe89f52ba893200166d28a789f7672c6984
# Parent  90ffbced39b16124f53e0aaed468a9dc64cafb5b
merge
Signed-off-by: Hollis Blanchard <[EMAIL PROTECTED]>

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


[XenPPC] [xenppc-unstable] [merge]

2006-09-07 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 715014b9548840332aec42a5bc230818cab05064
# Parent  a9225284962e7056929d16684f562105b9b452f1
# Parent  a6d69c2d85a35a149313bad1639a240ed7f79699
[merge]
---
 tools/libxc/powerpc64/ft_build.c|  551 ---
 tools/libxc/powerpc64/ft_build.h|  127 --
 tools/libxc/powerpc64/Makefile  |2 
 tools/libxc/powerpc64/flatdevtree.c |  636 
 tools/libxc/powerpc64/flatdevtree.h |  106 +
 tools/libxc/powerpc64/flatdevtree_env.h |   94 
 tools/libxc/powerpc64/xc_linux_build.c  |   90 ++--
 7 files changed, 882 insertions(+), 724 deletions(-)

diff -r a9225284962e -r 715014b95488 tools/libxc/powerpc64/Makefile
--- a/tools/libxc/powerpc64/MakefileThu Sep 07 21:46:33 2006 -0400
+++ b/tools/libxc/powerpc64/MakefileThu Sep 07 22:09:06 2006 -0400
@@ -1,4 +1,4 @@ GUEST_SRCS-y += powerpc64/xc_linux_build
 GUEST_SRCS-y += powerpc64/xc_linux_build.c
-GUEST_SRCS-y += powerpc64/ft_build.c
+GUEST_SRCS-y += powerpc64/flatdevtree.c
 
 CTRL_SRCS-y += powerpc64/xc_memory.c
diff -r a9225284962e -r 715014b95488 tools/libxc/powerpc64/xc_linux_build.c
--- a/tools/libxc/powerpc64/xc_linux_build.cThu Sep 07 21:46:33 2006 -0400
+++ b/tools/libxc/powerpc64/xc_linux_build.cThu Sep 07 22:09:06 2006 -0400
@@ -33,7 +33,8 @@
 #include 
 #include 
 
-#include "ft_build.h"
+#include "flatdevtree_env.h"
+#include "flatdevtree.h"
 
 #define INITRD_ADDR (24UL << 20)
 #define DEVTREE_ADDR (16UL << 20)
@@ -164,64 +165,63 @@ static int load_devtree(
 xen_pfn_t *page_array,
 void *devtree,
 unsigned long devtree_addr,
-unsigned long initrd_base,
+uint64_t initrd_base,
 unsigned long initrd_len,
 start_info_t *si,
 unsigned long si_addr)
 {
 uint32_t start_info[4] = {0, si_addr, 0, 0x1000};
 struct boot_param_header *header;
-uint64_t *prop;
+void *chosen;
+void *xen;
+uint64_t initrd_end = initrd_base + initrd_len;
 unsigned int devtree_size;
-unsigned int proplen;
 int rc = 0;
+
+DPRINTF("adding initrd props\n");
+
+chosen = ft_find_node(devtree, "/chosen");
+if (chosen == NULL) {
+DPRINTF("couldn't find /chosen\n");
+return -1;
+}
+
+xen = ft_find_node(devtree, "/xen");
+if (xen == NULL) {
+DPRINTF("couldn't find /xen\n");
+return -1;
+}
+
+/* initrd-start */
+rc = ft_set_prop(&devtree, chosen, "linux,initrd-start",
+&initrd_base, sizeof(initrd_base));
+if (rc < 0) {
+DPRINTF("couldn't set /chosen/linux,initrd-start\n");
+return rc;
+}
+
+/* initrd-end */
+rc = ft_set_prop(&devtree, chosen, "linux,initrd-end",
+&initrd_end, sizeof(initrd_end));
+if (rc < 0) {
+DPRINTF("couldn't set /chosen/linux,initrd-end\n");
+return rc;
+}
+
+/* start-info (XXX being removed soon) */
+rc = ft_set_prop(&devtree, xen, "start-info",
+start_info, sizeof(start_info));
+if (rc < 0) {
+DPRINTF("couldn't set /xen/start-info\n");
+return rc;
+}
 
 header = devtree;
 devtree_size = header->totalsize;
 
-DPRINTF("adding initrd props\n");
-
-   /* initrd-start */
-prop = ft_get_prop(devtree, "/chosen/linux,initrd-start", &proplen);
-if (prop == NULL) {
-DPRINTF("couldn't find linux,initrd-start\n");
-return -1;
-}
-if (proplen != sizeof(*prop)) {
-DPRINTF("couldn't set linux,initrd-start (size %d)\n", proplen);
-return -1;
-}
-*prop = initrd_base;
-
-   /* initrd-end */
-prop = ft_get_prop(devtree, "/chosen/linux,initrd-end", &proplen);
-if (prop == NULL) {
-DPRINTF("couldn't find linux,initrd-end\n");
-return -1;
-}
-if (proplen != sizeof(*prop)) {
-DPRINTF("couldn't set linux,initrd-end (size %d)\n", proplen);
-return -1;
-}
-*prop = initrd_base + initrd_len;
-
-   /* start-info (XXX being removed soon) */
-prop = ft_get_prop(devtree, "/xen/start-info", &proplen);
-if (prop == NULL) {
-DPRINTF("couldn't find /xen/start-info\n");
-return -1;
-}
-if (proplen != sizeof(start_info)) {
-DPRINTF("couldn't set /xen/start-info (size %d)\n", proplen);
-return -1;
-}
-memcpy(prop, start_info, proplen);
-
 DPRINTF("copying device tree to 0x%lx[0x%x]\n", DEVTREE_ADDR, 
devtree_size);
-rc = install_image(xc_handle, domid, page_array, devtree, DEVTREE_ADDR,
+return install_image(xc_handle, domid, page_array, devtree, DEVTREE_ADDR,
devtree_size);
-
-return rc;
 }
 
 unsigned long spin_list[] = {
diff -r a9225284962e -r 715014b95488 tools/libxc/powerpc64/flatdevtree.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +
+++ b/tools/libxc/powerpc64/flatdevtree.c   Thu Sep 07 22:09:06 2006 -0400
@@ -0,0 +1,636 @@
+/*
+ * This program is 

[XenPPC] [xenppc-unstable] [merge] null

2006-08-23 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 00c47d5766100994d1b936873629256874a8d5ba
# Parent  ff2c736fce49fedc8057d61f13df0a79ead22871
# Parent  b2f2c477895af973e727612a3967c68639a2b321
[merge] null
---
 tools/python/xen/xend/FlatDeviceTree.py |2 -
 tools/python/xen/xend/XendDomainInfo.py |   45 
 tools/python/xen/xend/arch.py   |   14 -
 tools/python/xen/xend/image.py  |   41 +++--
 4 files changed, 35 insertions(+), 67 deletions(-)

diff -r ff2c736fce49 -r 00c47d576610 tools/python/xen/xend/FlatDeviceTree.py
--- a/tools/python/xen/xend/FlatDeviceTree.py   Wed Aug 23 05:44:46 2006 -0400
+++ b/tools/python/xen/xend/FlatDeviceTree.py   Wed Aug 23 05:49:29 2006 -0400
@@ -293,7 +293,7 @@ def build(imghandler):
 # identical...
 cpu0 = None
 def _nolinuxprops(fullpath):
-return not os.path.basename(fullpath).startswith('linux,'):
+return not os.path.basename(fullpath).startswith('linux,')
 for i in range(imghandler.vm.getVCpuCount()):
 cpu = cpus.addnode('PowerPC,[EMAIL PROTECTED]')
 _copytree(cpu, 'cpus/PowerPC,[EMAIL PROTECTED]', _nolinuxprops)
diff -r ff2c736fce49 -r 00c47d576610 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Wed Aug 23 05:44:46 2006 -0400
+++ b/tools/python/xen/xend/XendDomainInfo.py   Wed Aug 23 05:49:29 2006 -0400
@@ -30,7 +30,6 @@ import time
 import time
 import threading
 import os
-import math
 
 import xen.lowlevel.xc
 from xen.util import asserts
@@ -1280,37 +1279,27 @@ class XendDomainInfo:
 for v in range(0, self.info['max_vcpu_id']+1):
 xc.vcpu_setaffinity(self.domid, v, self.info['cpus'])
 
-# set domain maxmem in KiB
-xc.domain_setmaxmem(self.domid, self.info['maxmem'] * 1024)
-
-m = self.image.getDomainMemory(self.info['memory'] * 1024)
+# set memory limit
+maxmem = self.image.getRequiredMemory(self.info['maxmem'] * 1024)
+xc.domain_setmaxmem(self.domid, maxmem)
+
+mem_kb = self.image.getRequiredMemory(self.info['memory'] * 1024)
 
 # get the domain's shadow memory requirement
-sm = int(math.ceil(self.image.getDomainShadowMemory(m) / 1024.0))
-if self.info['shadow_memory'] > sm:
-sm = self.info['shadow_memory']
+shadow_kb = self.image.getRequiredShadowMemory(mem_kb)
+shadow_kb_req = self.info['shadow_memory'] * 1024
+if shadow_kb_req > shadow_kb:
+shadow_kb = shadow_kb_req
 
 # Make sure there's enough RAM available for the domain
-balloon.free(m + sm * 1024)
-
-if os.uname()[4] in ('ppc64'):
-self.info['shadow_memory'] = 0
-else:
-# Set up the shadow memory
-sm = xc.shadow_mem_control(self.domid, mb=sm)
-self.info['shadow_memory'] = sm
-
-init_reservation = self.info['memory'] * 1024
-if os.uname()[4] in ('ia64', 'ppc64'):
-# Workaround for architectures that don't yet support
-# ballooning.
-init_reservation = m
-# Following line from [EMAIL PROTECTED]
-# Needed for IA64 until supports ballooning -- okay for PPC64?
-xc.domain_setmaxmem(self.domid, m)
-
-xc.domain_memory_increase_reservation(self.domid, init_reservation,
-  0, 0)
+balloon.free(mem_kb + shadow_kb)
+
+# Set up the shadow memory
+shadow_cur = xc.shadow_mem_control(self.domid, shadow_kb * 1024)
+self.info['shadow_memory'] = shadow_cur
+
+# initial memory allocation
+xc.domain_memory_increase_reservation(self.domid, mem_kb, 0, 0)
 
 self.createChannels()
 
diff -r ff2c736fce49 -r 00c47d576610 tools/python/xen/xend/arch.py
--- a/tools/python/xen/xend/arch.py Wed Aug 23 05:44:46 2006 -0400
+++ b/tools/python/xen/xend/arch.py Wed Aug 23 05:49:29 2006 -0400
@@ -20,12 +20,12 @@ import os
 import os
 
 _types = {
-   "i386": "x86",
-   "i486": "x86",
-   "i586": "x86",
-   "i686": "x86",
-   "ia64": "ia64",
-   "ppc": "powerpc",
-   "ppc64": "powerpc",
+"i386": "x86",
+"i486": "x86",
+"i586": "x86",
+"i686": "x86",
+"ia64": "ia64",
+"ppc": "powerpc",
+"ppc64": "powerpc",
 }
 type = _types.get(os.uname()[4], "unknown")
diff -r ff2c736fce49 -r 00c47d576610 tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.pyWed Aug 23 05:44:46 2006 -0400
+++ b/tools/python/xen/xend/image.pyWed Aug 23 05:49:29 2006 -0400
@@ -146,7 +146,7 @@ class ImageHandler:
 def getRequiredMemory(self, mem_kb):
 return mem_kb
 
-def getDomainShadowMemory(self, mem_kb

[XenPPC] [xenppc-unstable] [merge] conflict

2006-08-22 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID e06e2cca9f39d56344ec96b90ad4a2405b247996
# Parent  f2527015891cfd68f4576a8c63d3ee60e99841e2
# Parent  b985b2e85bf343f136ec2ceb55176edb62832f81
[merge] conflict
---
 tools/python/xen/xend/FlatDeviceTree.py |   87 ++--
 1 files changed, 62 insertions(+), 25 deletions(-)

diff -r f2527015891c -r e06e2cca9f39 tools/python/xen/xend/FlatDeviceTree.py
--- a/tools/python/xen/xend/FlatDeviceTree.py   Tue Aug 22 17:20:58 2006 -0400
+++ b/tools/python/xen/xend/FlatDeviceTree.py   Tue Aug 22 17:26:36 2006 -0400
@@ -20,8 +20,10 @@ import os
 import os
 import sys
 import struct
-
-_OF_DT_HEADER = 0xd00dfeed
+import stat
+import re
+
+_OF_DT_HEADER = int("d00dfeed", 16) # avoid signed/unsigned FutureWarning
 _OF_DT_BEGIN_NODE = 0x1
 _OF_DT_END_NODE = 0x2
 _OF_DT_PROP = 0x3
@@ -50,12 +52,40 @@ def _pad(buf, alignment):
 # not present in Python 2.3:
 #return buf.ljust(_padlen, '\0')
 
+def _indent(item):
+indented = []
+for line in str(item).splitlines(True):
+indented.append('' + line)
+return ''.join(indented)
+
 class _Property:
+_nonprint = re.compile('[\000-\037\200-\377]')
 def __init__(self, node, name, value):
 self.node = node
 self.value = value
 self.name = name
 self.node.tree.stradd(name)
+
+def __str__(self):
+result = self.name
+if self.value:
+searchtext = self.value
+# it's ok for a string to end in NULL
+if searchtext.find('\000') == len(searchtext)-1:
+searchtext = searchtext[:-1]
+m = self._nonprint.search(searchtext)
+if m:
+bytes = struct.unpack("B" * len(self.value), self.value)
+hexbytes = [ '%02x' % b for b in bytes ]
+words = []
+for i in range(0, len(self.value), 4):
+words.append(''.join(hexbytes[i:i+4]))
+v = '<' + ' '.join(words) + '>'
+else:
+v = '"%s"' % self.value
+result += ': ' + v
+return result
+
 def to_bin(self):
 offset = self.node.tree.stroffset(self.name)
 return struct.pack('>III', _OF_DT_PROP, len(self.value), offset) \
@@ -68,6 +98,12 @@ class _Node:
 self.props = {}
 self.children = {}
 self.phandle = 0
+
+def __str__(self):
+propstrs = [ _indent(prop) for prop in self.props.values() ]
+childstrs = [ _indent(child) for child in self.children.values() ]
+return '%s:\n%s\n%s' % (self.name, '\n'.join(propstrs),
+'\n'.join(childstrs))
 
 def to_bin(self):
 name = _pad(self.name + '\0', 4)
@@ -203,6 +239,22 @@ def _getprop(propname):
 f.close()
 return data
 
+def _copynode(node, dirpath, propfilter):
+'''Extract all properties from a node in the system's device tree.'''
+dirents = os.listdir(dirpath)
+for dirent in dirents:
+fullpath = os.path.join(dirpath, dirent)
+st = os.lstat(fullpath)
+if stat.S_ISDIR(st.st_mode):
+child = node.addnode(dirent)
+_copytree(child, fullpath, propfilter)
+elif stat.S_ISREG(st.st_mode) and propfilter(fullpath):
+node.addprop(dirent, _getprop(fullpath))
+
+def _copytree(node, dirpath, propfilter):
+path = os.path.join(_host_devtree_root, dirpath)
+_copynode(node, path, propfilter)
+
 def build(imghandler):
 '''Construct a device tree by combining the domain's configuration and
 the host's device tree.'''
@@ -236,33 +288,18 @@ def build(imghandler):
 cpus.addprop('#size-cells', 0)
 cpus.addprop('#address-cells', 1)
 
-# create a cpu node for each vcpu
+# Copy all properties the system firmware gave us, except for 'linux,'
+# properties, from 'cpus/@0', once for every vcpu. Hopefully all cpus are
+# identical...
 cpu0 = None
+def _nolinuxprops(fullpath):
+return not os.path.basename(fullpath).startswith('linux,'):
 for i in range(imghandler.vm.getVCpuCount()):
 cpu = cpus.addnode('PowerPC,[EMAIL PROTECTED]')
+_copytree(cpu, 'cpus/PowerPC,[EMAIL PROTECTED]', _nolinuxprops)
+# and then overwrite what we need to
 pft_size = imghandler.vm.info.get('pft-size', 0x14)
-cpu.addprop('ibm,pft-size', 0, pft_size)
-cpu.addprop('reg', i)
-cpu.addprop('cpu#', i)
-cpu.addprop('device_type', 'cpu\0')
-for prop in ('d-cache-size', 'd-cache-line-size', 'd-cache-sets',
- 'i-cache-size', 'i-cache-line-size', 'i-cache-sets',
- 'clock-frequency', 'timebase-frequency',
- 'timebases-in-sync'):
-val = _getprop(os.path.join('cpus/PowerPC,[EMAIL PROTECTED]', 
prop))
-cpu.addprop(prop, val)
-# XXX 64-bit, more
-
-# L2 cache
-l2 = cpu.addnode('l2-cache'

[XenPPC] [xenppc-unstable] [merge]

2006-08-20 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 4055b6b010a4ccdd480abae1a97d1ca9de18703e
# Parent  4cffec02b4788bc74d8a0ed7560fadbf332892b1
# Parent  9c72449e4370128446fa902d0183080289bdde12
[merge]
---
 tools/libxc/powerpc64/ft_build.c |  165 +++
 tools/libxc/powerpc64/ft_build.h |   29 --
 2 files changed, 49 insertions(+), 145 deletions(-)

diff -r 4cffec02b478 -r 4055b6b010a4 tools/libxc/powerpc64/ft_build.c
--- a/tools/libxc/powerpc64/ft_build.c  Sun Aug 20 11:08:45 2006 -0400
+++ b/tools/libxc/powerpc64/ft_build.c  Sun Aug 20 11:09:37 2006 -0400
@@ -1,17 +1,22 @@
 /*
- * 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 library is free software; you can redistribute it and/or
+ * modify it under the terms of version 2.1 of the GNU Lesser General Public
+ * License as published by the Free Software Foundation.
  *
- * This program is distributed in the hope that it will be useful,
+ * This library 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser 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.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Copyright Pantelis Antoniou 2006
+ * Copyright (C) IBM Corporation 2006
+ *
+ * Authors: Pantelis Antoniou <[EMAIL PROTECTED]>
+ *  Hollis Blanchard <[EMAIL PROTECTED]>
  */
 
 #include 
@@ -527,126 +532,20 @@ void *ft_get_prop(void *bphp, const char
return NULL;
 }
 
-//
-
-#if 0
-extern unsigned char oftree_dtb[];
-extern unsigned int oftree_dtb_len;
-
-void ft_setup(void *blob, int size, bd_t * bd)
-{
-   DECLARE_GLOBAL_DATA_PTR;
-   char *end;
-   u32 *p;
-   int len;
-   struct ft_cxt cxt;
-   int i, k, nxt;
-   static char tmpenv[256];
-   char *s, *lval, *rval;
-   ulong clock;
-   u32 v;
-
-   /* disable OF tree; booting old kernel */
-   if (getenv("disable_of") != NULL) {
-   memcpy(blob, bd, sizeof(*bd));
-   return;
-   }
-
-   ft_begin(&cxt, blob, size);
-
-   /* fs_add_rsvmap not used */
-
-   ft_begin_tree(&cxt);
-
-   ft_begin_node(&cxt, "");
-
-   ft_end_node(&cxt);
-
-   /* copy RO tree */
-   ft_merge_blob(&cxt, oftree_dtb);
-
-   /* back into root */
-   ft_backtrack_node(&cxt);
-
-   ft_begin_node(&cxt, "u-boot-env");
-
-   for (i = 0; env_get_char(i) != '\0'; i = nxt + 1) {
-   for (nxt = i; env_get_char(nxt) != '\0'; ++nxt) ;
-   s = tmpenv;
-   for (k = i; k < nxt && s < &tmpenv[sizeof(tmpenv) - 1]; ++k)
-   *s++ = env_get_char(k);
-   *s++ = '\0';
-   lval = tmpenv;
-   s = strchr(tmpenv, '=');
-   if (s != NULL) {
-   *s++ = '\0';
-   rval = s;
-   } else
-   continue;
-   ft_prop_str(&cxt, lval, rval);
-   }
-
-   ft_end_node(&cxt);
-
-   ft_begin_node(&cxt, "chosen");
-
-   ft_prop_str(&cxt, "name", "chosen");
-   ft_prop_str(&cxt, "bootargs", getenv("bootargs"));
-   ft_prop_int(&cxt, "linux,platform", 0x600); /* what is this? */
-
-   ft_end_node(&cxt);
-
-   ft_end_node(&cxt);  /* end root */
-
-   ft_end_tree(&cxt);
-
-   /*
-  printf("merged OF-tree\n");
-  ft_dump_blob(blob);
-*/
-
-   /* paste the bd_t at the end of the flat tree */
-   end = (char *)blob +
-   be32_to_cpu(((struct boot_param_header *)blob)->totalsize);
-   memcpy(end, bd, sizeof(*bd));
-
-#ifdef CONFIG_PPC
-
-   for (i = 0; i < sizeof(bd_map)/sizeof(bd_map[0]); i++) {
-   sprintf(tmpenv, "/bd_t/%s", bd_map[i].name);
-   v = *(u32 *)((char *)bd + bd_map[i].offset);
-
-   p = ft_get_prop(blob, tmpenv, &len);
-   if (p != NULL)
-   *p = cpu_to_be32(v);
-   }
-
-   p = ft_get_prop(blob, "/bd_t/enetaddr", &len);
-   if (p != NULL)
-   memcpy(p, bd->bi_enetaddr, 6);
-
-   p = ft_get_prop(

[XenPPC] [xenppc-unstable] merge

2006-08-04 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID c3a10094bfae99139c96aac904116ea54ecbe069
# Parent  f46a34f4dea16dc107404aec8fbabc007506fe65
# Parent  d5af6a21a324163b5371ce8733535ebee46156c5
merge
---
 tools/libxc/xc_ppc_linux_build.c|   38 +--
 xen/arch/powerpc/dom0_ops.c |   43 +---
 xen/arch/powerpc/domain.c   |   29 ++--
 xen/arch/powerpc/powerpc64/ppc970.c |7 +
 xen/include/asm-powerpc/processor.h |1 
 5 files changed, 75 insertions(+), 43 deletions(-)

diff -r f46a34f4dea1 -r c3a10094bfae tools/libxc/xc_ppc_linux_build.c
--- a/tools/libxc/xc_ppc_linux_build.c  Fri Aug 04 17:25:29 2006 -0400
+++ b/tools/libxc/xc_ppc_linux_build.c  Fri Aug 04 17:26:27 2006 -0400
@@ -37,11 +37,6 @@
 #define MEMSIZE (64UL << 20)
 #define INITRD_ADDR (24UL << 20)
 
-int verbose;
-#define VERBOSE(stuff, ...) \
-if (verbose) \
-stuff __VA_ARGS__;
-
 #define ALIGN_UP(addr,size) (((addr)+((size)-1))&(~((size)-1)))
 
 #define max(x,y) ({ \
@@ -56,7 +51,7 @@ static void *load_file(const char *path,
 ssize_t size;
 int fd;
 
-VERBOSE(printf("load_file(%s)\n", path));
+DPRINTF("load_file(%s)\n", path);
 
 fd = open(path, O_RDONLY);
 if (fd < 0) {
@@ -114,7 +109,7 @@ static int init_boot_vcpu(
  * we must make sure this register is 0 */
 ctxt.user_regs.gprs[13] = 0;
 
-VERBOSE(printf("xc_vcpu_setvcpucontext:\n"
+DPRINTF("xc_vcpu_setvcpucontext:\n"
  "  pc 0x%"PRIx64", msr 0x016%"PRIx64"\n"
  "  r1-5 %016"PRIx64" %016"PRIx64" %016"PRIx64" %016"PRIx64
  " %016"PRIx64"\n",
@@ -123,7 +118,7 @@ static int init_boot_vcpu(
  ctxt.user_regs.gprs[2],
  ctxt.user_regs.gprs[3],
  ctxt.user_regs.gprs[4],
- ctxt.user_regs.gprs[5]));
+ ctxt.user_regs.gprs[5]);
 rc = xc_vcpu_setcontext(xc_handle, domid, 0, &ctxt);
 if (rc < 0)
 perror("setdomaininfo");
@@ -181,8 +176,7 @@ static int load_dtb(
 goto out;
 }
 
-VERBOSE(printf("copying device tree to 0x%lx[0x%lx]\n",
-dtb_addr, dtb_size));
+DPRINTF("copying device tree to 0x%lx[0x%lx]\n", dtb_addr, dtb_size);
 rc = install_image(xc_handle, domid, page_array, img, dtb_addr, dtb_size);
 
 out:
@@ -241,7 +235,7 @@ static int load_kernel(
 
 hack_kernel_img(kernel_img);
 
-VERBOSE(printf("probe_elf\n"));
+DPRINTF("probe_elf\n");
 rc = probe_elf(kernel_img, kernel_size, &load_funcs);
 if (rc < 0) {
 rc = -1;
@@ -249,22 +243,22 @@ static int load_kernel(
 goto out;
 }
 
-VERBOSE(printf("parseimage\n"));
+DPRINTF("parseimage\n");
 rc = (load_funcs.parseimage)(kernel_img, kernel_size, dsi);
 if (rc < 0) {
 rc = -1;
 goto out;
 }
 
-VERBOSE(printf("loadimage\n"));
+DPRINTF("loadimage\n");
 (load_funcs.loadimage)(kernel_img, kernel_size, xc_handle, domid,
 page_array, dsi);
 
-VERBOSE(printf("  v_start %016"PRIx64"\n", dsi->v_start));
-VERBOSE(printf("  v_end   %016"PRIx64"\n", dsi->v_end));
-VERBOSE(printf("  v_kernstart %016"PRIx64"\n", dsi->v_kernstart));
-VERBOSE(printf("  v_kernend   %016"PRIx64"\n", dsi->v_kernend));
-VERBOSE(printf("  v_kernentry %016"PRIx64"\n", dsi->v_kernentry));
+DPRINTF("  v_start %016"PRIx64"\n", dsi->v_start);
+DPRINTF("  v_end   %016"PRIx64"\n", dsi->v_end);
+DPRINTF("  v_kernstart %016"PRIx64"\n", dsi->v_kernstart);
+DPRINTF("  v_kernend   %016"PRIx64"\n", dsi->v_kernend);
+DPRINTF("  v_kernentry %016"PRIx64"\n", dsi->v_kernentry);
 
 out:
 free(kernel_img);
@@ -287,7 +281,7 @@ static int load_initrd(
 if (initrd_img == NULL)
 return -1;
 
-VERBOSE(printf("copying initrd to 0x%lx[0x%lx]\n", INITRD_ADDR, *len));
+DPRINTF("copying initrd to 0x%lx[0x%lx]\n", INITRD_ADDR, *len);
 if (install_image(xc_handle, domid, page_array, initrd_img, INITRD_ADDR,
 *len))
 goto out;
@@ -326,9 +320,9 @@ static int get_page_array(int xc_handle,
 int nr_pages;
 int rc;
 
-VERBOSE(printf("xc_get_tot_pages\n"));
+DPRINTF("xc_get_tot_pages\n");
 nr_pages = xc_get_tot_pages(xc_handle, domid);
-VERBOSE(printf("  0x%x\n", nr_pages));
+DPRINTF("  0x%x\n", nr_pages);
 
 *page_array = malloc(nr_pages * sizeof(xen_pfn_t));
 if (*page_array == NULL) {
@@ -336,7 +330,7 @@ static int get_page_array(int xc_handle,
 return -1;
 }
 
-VERBOSE(printf("xc_get_pfn_list\n"));
+DPRINTF("xc_get_pfn_list\n");
 rc = xc_get_pfn_list(xc_handle, domid, *page_array, nr_pages);
 if (rc != nr_pages) {
 perror("Could not get the page frame list");
diff -r f46a34f4dea1 -r c3a10094bfae xen/arch/powerpc/dom0_ops.c
--- a/xen/arch/powerpc/dom0_ops.c   Fri Aug 04 17:25:29 2006 -0400
+++ b/xen/a