From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:59668) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R4DsR-00040T-B5 for qemu-devel@nongnu.org; Thu, 15 Sep 2011 11:29:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R4DsP-0001h6-Hs for qemu-devel@nongnu.org; Thu, 15 Sep 2011 11:29:23 -0400 Received: from e5.ny.us.ibm.com ([32.97.182.145]:43298) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R4DsP-0001gg-Bj for qemu-devel@nongnu.org; Thu, 15 Sep 2011 11:29:21 -0400 Received: from d01relay03.pok.ibm.com (d01relay03.pok.ibm.com [9.56.227.235]) by e5.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id p8FEwca6017350 for ; Thu, 15 Sep 2011 10:58:39 -0400 Received: from d03av06.boulder.ibm.com (d03av06.boulder.ibm.com [9.17.195.245]) by d01relay03.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p8FFTDBM248764 for ; Thu, 15 Sep 2011 11:29:13 -0400 Received: from d03av06.boulder.ibm.com (loopback [127.0.0.1]) by d03av06.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p8FFYlRd010978 for ; Thu, 15 Sep 2011 09:34:48 -0600 Message-ID: <4E7219B4.9050109@us.ibm.com> Date: Thu, 15 Sep 2011 10:28:52 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <4E70EC90.8000904@us.ibm.com> <20110915063121.GW21417@redhat.com> <4E720435.3060509@codemonkey.ws> <4E720855.1090501@redhat.com> <20110915142534.GC11524@redhat.com> In-Reply-To: <20110915142534.GC11524@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC] Plan for moving forward with QOM List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gleb Natapov Cc: Peter Maydell , Jan Kiszka , qemu-devel , Markus Armbruster , Gerd Hoffmann , "Edgar E. Iglesias" , Paolo Bonzini On 09/15/2011 09:25 AM, Gleb Natapov wrote: > On Thu, Sep 15, 2011 at 04:14:45PM +0200, Paolo Bonzini wrote: >> On 09/15/2011 03:57 PM, Anthony Liguori wrote: >>> >>> void generate_tree(Device *node) >>> { >>> if (IS_PCI_BUS(node)) { >>> for (i = 0; i< 32; i++) { >>> generate_tree(lookup_device(get_property(node, "slot[%d]", i))); >>> } >>> } else if (IS_ISA_BUS(node)) { >>> .... >>> } else { >>> // leaf node, generate path segment >>> } >>> } >>> >>> There are certainly ways to walk the graph generically (by coloring or >>> following the composition paths) but that won't give you the desired >>> ordering. >> >> It seems easier to go backwards from the target device. > That what we do in qdev. > >> >> Each device most likely will have a canonical parent link, and >> together they will give the OF path. >> > Yeah, this canonical parent link should be marked somehow. There is no canonical parent link. A device may have multiple (more or less equivalent) parents. What should be treated as the "canonical" link depends on what you're trying to do. In the case of OF, you want to treat the bus as a parent. If a device happens to sit on multiple buses, I'm not really sure what you do. Regards, Anthony Liguori > > -- > Gleb. >