WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ppc-devel

Re: [XenPPC] [xenppc-unstable] [TOOLS][POWERPC] use python "quad" encodi

To: Orran Krieger <okrieg@xxxxxxxxxx>, "Maria A. Butrico" <butrico@xxxxxxxxxx>, "Amos P. Waterland" <apw@xxxxxxxxxx>
Subject: Re: [XenPPC] [xenppc-unstable] [TOOLS][POWERPC] use python "quad" encoding for 2 cell devtree values
From: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
Date: Wed, 18 Oct 2006 16:40:31 -0400
Cc: XenPPC-devel <xen-ppc-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Wed, 18 Oct 2006 13:40:42 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <E1GaHu4-0002zH-Ts@xxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-ppc-devel-request@lists.xensource.com?subject=help>
List-id: Xen PPC development <xen-ppc-devel.lists.xensource.com>
List-post: <mailto:xen-ppc-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=unsubscribe>
References: <E1GaHu4-0002zH-Ts@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-ppc-devel-bounces@xxxxxxxxxxxxxxxxxxx
The following changeset should fix the issue with DomU >=2G where our python devtree code can only handle ints and math from a 2G value promotes the type to long which before this patch we could not encode.

Please test on larger systems.
-JX
On Oct 18, 2006, at 4:20 PM, Xen patchbot-xenppc-unstable wrote:

# HG changeset patch
# User Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
# Node ID d18a0c0b77d7004631559d4e2f9d31744fe9b34a
# Parent  ece7037c72c6b7944ede2261ec1fe99c1489cff4
[TOOLS][POWERPC] use python "quad" encoding for 2 cell devtree values
When creating a 2G DomU pyhton chokes when it sees a long type.  If a
value is of type long, or promoted to long it should be "packed" as a
quad.

Signed-off-by: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
---
 tools/python/xen/xend/FlatDeviceTree.py |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff -r ece7037c72c6 -r d18a0c0b77d7 tools/python/xen/xend/ FlatDeviceTree.py --- a/tools/python/xen/xend/FlatDeviceTree.py Wed Oct 18 11:29:57 2006 -0400 +++ b/tools/python/xen/xend/FlatDeviceTree.py Wed Oct 18 16:07:33 2006 -0400
@@ -37,8 +37,10 @@ def _bincat(seq, separator=''):
     '''Concatenate the contents of seq into a bytestream.'''
     strs = []
     for item in seq:
-        if type(item) == type(0):
+        if isinstance(item, int):
             strs.append(struct.pack(">I", item))
+        elif isinstance(item, long):
+            strs.append(struct.pack(">Q", item))
         else:
             try:
                 strs.append(item.to_bin())
@@ -287,9 +289,9 @@ def build(imghandler):
     root.addprop('compatible', 'Momentum,Maple\0')

     xen = root.addnode('xen')
-    xen.addprop('start-info', 0, 0x3ffc000, 0, 0x1000)
+    xen.addprop('start-info', long(0x3ffc000), long(0x1000))
     xen.addprop('version', 'Xen-3.0-unstable\0')
-    xen.addprop('reg', 0, imghandler.vm.domid, 0, 0)
+    xen.addprop('reg', long(imghandler.vm.domid), long(0))
     xen.addprop('domain-name', imghandler.vm.getName() + '\0')
     xencons = xen.addnode('console')
     xencons.addprop('interrupts', 1, 0)
@@ -301,14 +303,14 @@ def build(imghandler):

     # RMA node
     rma = root.addnode('memory@0')
-    rma.addprop('reg', 0, 0, 0, rma_bytes)
+    rma.addprop('reg', long(0), long(rma_bytes))
     rma.addprop('device_type', 'memory\0')

     # all the rest in a single node
     remaining = totalmem - rma_bytes
     if remaining > 0:
         mem = root.addnode('memory@1')
-        mem.addprop('reg', 0, rma_bytes, 0, remaining)
+        mem.addprop('reg', long(rma_bytes), long(remaining))
         mem.addprop('device_type', 'memory\0')

     # add CPU nodes
@@ -346,8 +348,8 @@ def build(imghandler):
     chosen.addprop('interrupt-controller', xen.get_phandle())
     chosen.addprop('bootargs', imghandler.cmdline + '\0')
     # xc_linux_load.c will overwrite these 64-bit properties later
-    chosen.addprop('linux,initrd-start', 0, 0)
-    chosen.addprop('linux,initrd-end', 0, 0)
+    chosen.addprop('linux,initrd-start', long(0))
+    chosen.addprop('linux,initrd-end', long(0))

     if 1:
         f = file('/tmp/domU.dtb', 'w')

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


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