From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mir2F-0005bK-1E for qemu-devel@nongnu.org; Wed, 02 Sep 2009 10:42:07 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mir2A-0005Vn-8o for qemu-devel@nongnu.org; Wed, 02 Sep 2009 10:42:06 -0400 Received: from [199.232.76.173] (port=36220 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mir2A-0005Va-24 for qemu-devel@nongnu.org; Wed, 02 Sep 2009 10:42:02 -0400 Received: from mail-ew0-f223.google.com ([209.85.219.223]:51411) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mir29-0005gS-JB for qemu-devel@nongnu.org; Wed, 02 Sep 2009 10:42:01 -0400 Received: by ewy23 with SMTP id 23so932881ewy.8 for ; Wed, 02 Sep 2009 07:42:00 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <4A9E1247.9040009@redhat.com> References: <4A9B85E5.8040902@redhat.com> <4A9CD334.6000407@redhat.com> <4A9E1247.9040009@redhat.com> From: Blue Swirl Date: Wed, 2 Sep 2009 17:41:40 +0300 Message-ID: Subject: Re: [Qemu-devel] [PATCH, RFC 0/5] Improve device info handling Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: qemu-devel On Wed, Sep 2, 2009 at 9:35 AM, Gerd Hoffmann wrote: > =C2=A0Hi, > >>> drives are host side state, they don't go into qdev. >> >> My idea was that boards (like pc) should be in the long run >> represented by a qdev. > > The qdev root is the main_system_bus right now, I don't see a need to cha= nge > that. =C2=A0All core devices (cpus, memory, pic, ...) can be children of = the main > system bus. That level is too low, because the metamachine level would not be interested in the internals of the pc device (except generic parameters like memory, number of CPUs etc), but how it connects to the host devices. >> But shouldn't the drives, network and char devices be qdevs too, >> wouldn't it help the metamachine (or "pc" device)? > > We have to clearly separate between host state and guest state. > qdev is about guest state. Yes, it's about guest state _now_, but why limit it to that? But if host devices as a class are really different from guest device, we could have something similar to qdev but for host devices. I still don't see a need for a special type. > A disk has two sides: =C2=A0The host side (virtual drive foo is a lvm vol= ume in > raw format / a file in qcow2 format / a iso image / whatever else) and th= e > guest side (this virtual drive is a master ide disk / scsi disk with id 3= / > virtio disk / ...). =C2=A0Only the later is represented by qdev. =C2=A0Th= e link > between the two is a property. There is no need for a link. Instead of the property stuff, the pc qdev should make available mappable objects (drive placeholders), the metamachine would plug in the host drives by mapping the drive to a host drive. It's just like device vs. address: drive placeholder vs. host drive. In fact, maybe we should have more devices at metamachine level: "pc" qdev and "host" qdev (hdev if you can convince me). Maybe other virtual objects too, like vlans, monitor, gdbstub etc. > Likewise for chardevs and network. Consider vlan: DeviceState *gdev, *hdev, *vlan; VLAN *gvlan, *hvlan; hdev =3D qdev_create(NULL, "host"); qdev_init(hdev); gdev =3D qdev_create(NULL, "pc"); qdev_init(gdev); vlan =3D qdev_create(NULL, "vlan"); qdev_init(gdev); gvlan =3D qdev_get_vlan_in(gdev, 0); // Analogous to gpio hvlan =3D qdev_get_vlan_in(hdev, 0); vlan_map(vlan, gvlan); vlan_map(vlan, hvlan); Beautiful, isn't it? ;-)