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

[XenPPC] [xenppc-unstable] [XEND][POWERPC] copy all cpu properties from

To: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Subject: [XenPPC] [xenppc-unstable] [XEND][POWERPC] copy all cpu properties from system device tree
From: Xen patchbot-xenppc-unstable <patchbot-xenppc-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 22 Aug 2006 20:01:20 +0000
Delivery-date: Tue, 22 Aug 2006 13:04:33 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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>
Reply-to: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-ppc-devel-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Hollis Blanchard <hollisb@xxxxxxxxxx>
# Node ID b985b2e85bf343f136ec2ceb55176edb62832f81
# Parent  e0973ea10547390bb50722d7622edf5adb2e47de
[XEND][POWERPC] copy all cpu properties from system device tree
- fixes problem with newer versions of SLOF firmware, which don't export all
  the properties older versions did
Signed-off-by: Hollis Blanchard <hollisb@xxxxxxxxxx>
---
 tools/python/xen/xend/FlatDeviceTree.py |   48 ++++++++++++++++----------------
 1 files changed, 25 insertions(+), 23 deletions(-)

diff -r e0973ea10547 -r b985b2e85bf3 tools/python/xen/xend/FlatDeviceTree.py
--- a/tools/python/xen/xend/FlatDeviceTree.py   Tue Aug 22 14:44:11 2006 -0500
+++ b/tools/python/xen/xend/FlatDeviceTree.py   Tue Aug 22 14:51:26 2006 -0500
@@ -20,6 +20,7 @@ import os
 import os
 import sys
 import struct
+import stat
 import re
 
 _OF_DT_HEADER = int("d00dfeed", 16) # avoid signed/unsigned FutureWarning
@@ -238,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.'''
@@ -271,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,970@0')
+        _copytree(cpu, 'cpus/PowerPC,970@0', _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,970@0', prop))
-            cpu.addprop(prop, val)
-            # XXX 64-bit, more
-
-        # L2 cache
-        l2 = cpu.addnode('l2-cache')
-        l2.addprop('name', 'l2-cache\0')
-        l2.addprop('device_type', 'cache\0')
-        for prop in ('d-cache-size', 'd-cache-sets',
-                     'i-cache-size', 'i-cache-sets',
-                     'cache-unified'):
-            fullprop = os.path.join('cpus/PowerPC,970@%d/l2-cache' % i, prop)
-            val = _getprop(fullprop)
-            l2.addprop(prop, val)
+        cpu.setprop('ibm,pft-size', 0, pft_size)
 
         # set default CPU
         if cpu0 == None:

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

<Prev in Thread] Current Thread [Next in Thread>
  • [XenPPC] [xenppc-unstable] [XEND][POWERPC] copy all cpu properties from system device tree, Xen patchbot-xenppc-unstable <=