From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=46040 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OIOIe-0001tY-TJ for qemu-devel@nongnu.org; Sat, 29 May 2010 11:50:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OIH73-0000YR-7L for qemu-devel@nongnu.org; Sat, 29 May 2010 04:09:46 -0400 Received: from fmmailgate03.web.de ([217.72.192.234]:41509) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OIH72-0000YC-Nn for qemu-devel@nongnu.org; Sat, 29 May 2010 04:09:45 -0400 Message-ID: <4C00CBBE.7030402@web.de> Date: Sat, 29 May 2010 10:09:34 +0200 From: Jan Kiszka MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH v2 03/15] qdev: Allow device addressing via 'driver.instance' References: In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig1735C663540A8E55D278AE52" Sender: jan.kiszka@web.de List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: Anthony Liguori , Juan Quintela , Jan Kiszka , qemu-devel@nongnu.org, Luiz Capitulino , Avi Kivity This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig1735C663540A8E55D278AE52 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Markus Armbruster wrote: > Jan Kiszka writes: >=20 >> From: Jan Kiszka >> >> Extend qbus_find_dev to allow addressing of devices without an unique = id >> via an optional per-bus instance number. The new formats are >> 'driver.instance' and 'alias.instance'. >> >> Signed-off-by: Jan Kiszka >> --- >> docs/qdev-device-use.txt | 12 +++++++++++- >> hw/qdev.c | 23 ++++++++++++++++++----- >> 2 files changed, 29 insertions(+), 6 deletions(-) >> >> diff --git a/docs/qdev-device-use.txt b/docs/qdev-device-use.txt >> index 9ac1fa1..5939481 100644 >> --- a/docs/qdev-device-use.txt >> +++ b/docs/qdev-device-use.txt >> @@ -1,6 +1,6 @@ >> =3D How to convert to -device & friends =3D >> =20 >> -=3D=3D=3D Specifying Bus and Address on Bus =3D=3D=3D >> +=3D=3D=3D Specifying Bus, Address on Bus, and Devices =3D=3D=3D >> =20 >> In qdev, each device has a parent bus. Some devices provide one or >> more buses for children. You can specify a device's parent bus with >> @@ -24,6 +24,16 @@ Furthermore, if a device only hosts a single bus, t= he bus name can be >> omitted in the path. Example: /i440FX-pcihost/PIIX3 abbreviates >> /i440FX-pcihost/pci.0/PIIX3/isa.0 as none of the buses has siblings. >> =20 >> +Existing devices can be addressed either via a unique ID if it was >> +assigned during creation or via the device tree path: >> + >> +/full_bus_address/driver_name[.instance_number] >> + or >> +abbreviated_bus_address/driver_name[.instance_number] >> + >> +Example: /i440FX-pcihost/pci.0/e1000.2 addresses the second e1000 >> +adapter on the bus 'pci.0'. >> + >> Note: the USB device address can't be controlled at this time. >=20 > "instance number" isn't defined in this document. True, only implicitly via the example. >=20 > I understand the problem you're trying to solve; I've had it myself man= y > times. But is inventing an instance number the right solution? >=20 > The two e1000 devices already have a perfectly fine unique identifier o= n > their bus: their bus address. What about recognizing bus addresses in > paths? Requires a suitable restriction on device names and IDs to avoi= d > ambiguity, say "start with letter". >=20 > qdev currently doesn't abstract bus addresses, but that's fixable. You would also have to specify unique addressing scheme to those buses that do not have it yet. E.g. what should be the address of a ISA bus device? The base of its first ioport range? But if it does not have any as it only injects ISA IRQs? Jan --------------enig1735C663540A8E55D278AE52 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iEYEARECAAYFAkwAy8UACgkQitSsb3rl5xSUlQCg4Ww8ciry5i3di87P44DUrzbs kNEAoKDGTjje5YrlRA40d31JLINHSacV =yCsK -----END PGP SIGNATURE----- --------------enig1735C663540A8E55D278AE52--