From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33696) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQsKz-0007vs-Sn for qemu-devel@nongnu.org; Wed, 03 Feb 2016 02:58:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aQsKu-0003Ur-P9 for qemu-devel@nongnu.org; Wed, 03 Feb 2016 02:58:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43586) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQsKu-0003UU-Jm for qemu-devel@nongnu.org; Wed, 03 Feb 2016 02:58:48 -0500 Message-ID: <1454486326.4967.22.camel@redhat.com> From: Gerd Hoffmann Date: Wed, 03 Feb 2016 08:58:46 +0100 In-Reply-To: <56B0F286.9090206@suse.de> References: <1453804885-15544-1-git-send-email-kraxel@redhat.com> <1453804885-15544-4-git-send-email-kraxel@redhat.com> <87vb67kzde.fsf@blackfin.pond.sub.org> <56B0F286.9090206@suse.de> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 3/4] usb-bot: hotplug support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andreas =?ISO-8859-1?Q?F=E4rber?= Cc: Paolo Bonzini , Markus Armbruster , qemu-devel@nongnu.org On Di, 2016-02-02 at 19:16 +0100, Andreas F=C3=A4rber wrote: > Am 02.02.2016 um 14:36 schrieb Markus Armbruster: > > Gerd Hoffmann writes: > >=20 > >> This patch marks usb-bot as hot-pluggable device, makes attached > >> property settable and turns off auto-attach in case the device > >> was hotplugged. > >> > >> Hot-plugging a usb-bot device with one or more scsi devices can be > >> done this way now: > >> > >> (1) device-add usb-bot,id=3Dfoo > >> (2) device-add scsi-{hd,cd},bus=3Dfoo.0,lun=3D0 > >> (2b) optionally add more devices (luns 0 ... 15). > >> (3) qom-set foo.attached =3D true > >=20 > > This isn't exactly pretty, but it beats no hot plug. > >=20 > > A general solution for hot plugging composite devices could perhaps be > > prettier, but I'm not aware of any recent work in the area. Andreas, > > Paolo? >=20 > Not aware, no. Essentially we'd need a DeviceClass::dont_realize flag, > right? Naa, not that simple I think. We would need some way to create a group of devices, then plug them all at once. Case one is multi-function pci. Case two are usb storage devices (bot + uas aka bulk-only-transport and usb-attached-scsi). I'm not aware of other cases. Multifunction pci has been handled recently with a pci-specific hack: pci functions are not visible to the guest until function 0 is plugged. So you just have to plug them in the correct order (function 0 last) to get things going. Works because the common pci slot implicitly groups devices. So this is handles the usb storage devices with a usb specific hack: usb devices can exist without being visible to the guest (attached=3Dfalse). We can use that to create the device group (usb storage adapter and the scsi device(s) connected to it) without the guest seeing a half-composed device, when done we go flip the visibility. cheers, Gerd