Re: [Qemu-devel] [RFC PATCH 1/5] qdev: Create qdev_get_dev_path()

Alex Williamson
2010-06-18T15:21:24Z

On Fri, 2010-06-18 at 16:03 +0200, Markus Armbruster wrote:
> Alex Williamson <alex.williamson@redhat.com> writes:
> > On Wed, 2010-06-16 at 10:23 +0200, Markus Armbruster wrote:
> >> Alex Williamson <alex.williamson@redhat.com> writes:
> >> >
> >> > (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"?
>
> I think the general rule for constructing a *canonical* qdev path should
> be:
>
> * If it's the main system bus, the path is /.
>
> * If it's another bus, the path is P/B, where P is the canonical path of
> the device providing the bus, and B is the bus name. Unambiguous,
> since no device ever defines two buses with the same name.
>
> * If it's a device, the path is P/D, where P is the canonical path of
> the bus. If the bus defines bus addresses, then D is @A, where A is
> the device's bus address.
>
> We haven't made up our minds whether the else case exists, or what to
> do if it does. The simple "else D is the device model driver's name"
> works only if the bus can't take multiple device models with the same
> driver.

It certainly exists today, so do we make up bus addresses, do we use
driver name + instance number, or ...? Both of these cases need to make
sure they're not artificially imposing a creation order than we can't
guarantee across migration. Hopefully Paul has a better suggestion than
creation order.

> The canonical path is not the only path. For instance, a qdev ID is a
> valid path, but it's not canonical. /i440FX-pcihost/pci.0/e1000 is
> another valid, non-canonical path.

Is it not canonical because of "e1000" or because or "i440FX-pcihost".
It seems like both to me with the nuance that i440FX-pcihost doesn't
support multiple instances, so we know which one it is. Is the correct
canonical path for this then:

/<TBD>/pci.0/@d.f

How do we make progress on defining that TBD and all the ones under isa
buses? Thanks,

Alex