From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=52477 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OPd4a-000697-Av for qemu-devel@nongnu.org; Fri, 18 Jun 2010 11:01:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OPd4Y-00071J-RG for qemu-devel@nongnu.org; Fri, 18 Jun 2010 11:01:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:63507) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OPd4Y-000718-JN for qemu-devel@nongnu.org; Fri, 18 Jun 2010 11:01:34 -0400 Subject: Re: [Qemu-devel] [RFC PATCH 1/5] qdev: Create qdev_get_dev_path() From: Alex Williamson In-Reply-To: <4C1B3987.7000402@siemens.com> References: <20100614054923.879.33717.stgit@localhost.localdomain> <4C17492A.4050207@siemens.com> <201006151228.03533.paul@codesourcery.com> <1276635192.12015.901.camel@x201> <1276813540.3216.52.camel@x201> <4C1B3987.7000402@siemens.com> Content-Type: text/plain; charset="UTF-8" Date: Fri, 18 Jun 2010 09:01:23 -0600 Message-ID: <1276873283.4669.37.camel@x201> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: "chrisw@redhat.com" , "kraxel@redhat.com" , "kvm@vger.kernel.org" , "qemu-devel@nongnu.org" , Markus Armbruster , "avi@redhat.com" , Paul Brook On Fri, 2010-06-18 at 11:16 +0200, Jan Kiszka wrote: > Alex Williamson wrote: > > On Wed, 2010-06-16 at 10:23 +0200, Markus Armbruster wrote: > >> Alex Williamson writes: > >> > >>> On Tue, 2010-06-15 at 12:28 +0100, Paul Brook wrote: > >>>>>> Alex proposed to disambiguate by adding "identified properties of the > >>>>>> immediate parent bus and device" to the path component. For PCI, these > >>>>>> are dev.fn. Likewise for any other bus where devices have unambigous > >>>>>> bus address. The driver name carries no information! > >>>>> From user POV, driver names are very handly to address a device > >>>>> intuitively - except for the case you have tones of devices on the same > >>>>> bus that are handled by the same driver. For that case we need to > >>>>> augment the device name with a useful per-bus ID, derived from the bus > >>>>> address where available, otherwise based on instance numbers. > >>>> This is where I think you're missing a trick. We don't need to augment the > >>>> name, we just need to allow the bus id to be used instead. > >>> For the case of a hot remove, I agree. If the user specifies "pci_del > >>> pci.0/03.0", that's completely sufficient because we don't care what's > >>> in that slot, just remove it. However, I still see some use cases for > >>> device names in the path. Take for example: > >>> > >>> (A): /i440FX-pcihost/pci.0/e1000.05.0 > >>> > >>> vs > >>> > >>> (B): /pci.0/05.0 > >>> > >>> (removing both the root bridge driver name and the device driver name) > >> / is the main system bus. System bus defines no bus address at the > >> moment. Therefore, you have to use the driver name i440FX-pcihost. > > > > So is the general rule "If a device's parent bus does not provide an > > address, print device name"? > > What is the device name? dev->info->name > > > >> /i440FX-pcihost/pci.0 is the PCI bus. PCI bus defines a bus address: > >> dev.fn. Therefore, you can either use the bus address @05.0, or the > >> driver name e1000. > >> > >> We have "/i440FX-pcihost/pci.0/e1000" vs. "/i440FX-pcihost/pci.0/@05.0". > > > > I object to being able to use anything but an address under a bus that > > supports hotplug, but that aside, I think the paths for my example > > system look like below. Note that anything behind and including the $ > > is not the canonical path, that begins the free form, usage specific > > string, here filled by missing device names (open to suggestions other > > than $ here). > > What about ":" instead of "$"? Visually more appealing IMO. Sure, that works. > > Note that were isa devices do not have a bus identifier, > > I'm using the device name, > > Don't understand. Why don't they have their I/O base as prefix? This is > inconsistent, and if we consider anything behind "$" (or ":") > informative, the bus address is mandatory for any device (on a bus with > an addressing scheme). Not all isa devices expose an iobase property. isa doesn't have an addressing scheme, it's basically a free for all of grabbing addresses and interrupts and hoping they don't conflict with no means to uniquely address a specific device. That's why isa cards are loaded with jumpers so you can try to move them around. > > which I think follows the same rule as > > i440FX-pcihost. Can we agree this is the goal? Thanks, > > It looks almost acceptable from my POV. We just need to define how to > get hold of devices on buses without an addressing scheme (e.g. the > system bus). Using the driver name is insufficient once you have > 1 > devices of the same type. Introducing device instance numbers to those > buses would be straightforward IMO. Yep, as I mentioned, I can live with instance numbers for devices that do not live on a hotpluggable bus. Where will the instance number go? A property on the parent bus, the device, field in the DeviceState? Thanks, Alex