Received: from eggs.gnu.org ([140.186.70.92]:59615) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RtMRu-0006gm-2m for qemu-devel@nongnu.org; Fri, 03 Feb 2012 11:57:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RtMRn-0003mc-P7 for qemu-devel@nongnu.org; Fri, 03 Feb 2012 11:57:22 -0500 Received: from cantor2.suse.de ([195.135.220.15]:35214 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RtMRn-0003mW-FH for qemu-devel@nongnu.org; Fri, 03 Feb 2012 11:57:15 -0500 References: <1328201142-26145-1-git-send-email-pbonzini@redhat.com> <1328201142-26145-2-git-send-email-pbonzini@redhat.com> <4F2AC1D2.9090606@codemonkey.ws> <4F2AC7F0.7080204@redhat.com> <4F2ADDA6.4070603@codemonkey.ws> <0225E1B3-010A-4A76-852A-60B6DBD3C331@suse.de> <4F2C0D66.8080906@codemonkey.ws> In-Reply-To: <4F2C0D66.8080906@codemonkey.ws> Mime-Version: 1.0 (1.0) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Message-Id: From: Alexander Graf Date: Fri, 3 Feb 2012 17:57:42 +0100 Subject: Re: [Qemu-devel] [PATCH 01/16] qdev: fix hot-unplug List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Paolo Bonzini , "qemu-devel@nongnu.org" On 03.02.2012, at 17:37, Anthony Liguori wrote: > On 02/02/2012 01:07 PM, Alexander Graf wrote: >>=20 >> On 02.02.2012, at 20:01, Anthony Liguori wrote: >>=20 >>> On 02/02/2012 11:29 AM, Paolo Bonzini wrote: >>>> On 02/02/2012 06:03 PM, Anthony Liguori wrote: >>>>>>=20 >>>>>=20 >>>>> Is this still needed with qom-upstream.14? I fixed a bug on .14 that >>>>> involved child properties that was making device-del sometimes fail. >>>>=20 >>>> Not sure, I tried with .13 but, from the look of it, it should still be= there. >>>> Regarding the .13->.14 diff: >>>>=20 >>>> - you need QTAILQ_FOREACH_SAFE in object_property_del_child. >>>=20 >>> Ack. >>>=20 >>>>=20 >>>> - you need to check for the existence of the non-aliased name when acce= ssing the >>>> alias table, because s390 does not have PCI. >>>=20 >>> I don't think that's the right strategy as it means that s390 only works= if we don't include the PCI objects in the build (regardless of whether it u= ses PCI). This would be defeated if/when we move to having all device objec= ts in a single shared library used by all of the qemu executables. >>>=20 >>> I'd prefer to just drop the aliases for s390. I don't see a lot of valu= e in it and I don't think there are tons of s390 users that will be affected= . >>=20 >> The reason for the aliases is to make -drive and -net work. If you have a= lternatives to aliases there, I'm happy to go with them. >=20 > Um, but I see (in s390-virtio.c): >=20 >=20 > for(i =3D 0; i < nb_nics; i++) { > NICInfo *nd =3D &nd_table[i]; > DeviceState *dev; >=20 > if (!nd->model) { > nd->model =3D g_strdup("virtio"); > } >=20 > if (strcmp(nd->model, "virtio")) { > fprintf(stderr, "S390 only supports VirtIO nics\n"); > exit(1); > } >=20 > dev =3D qdev_create((BusState *)s390_bus, "virtio-net-s390"); > qdev_set_nic_properties(dev, nd); > qdev_init_nofail(dev); > } >=20 > /* Create VirtIO disk drives */ > for(i =3D 0; i < MAX_BLK_DEVS; i++) { > DriveInfo *dinfo; > DeviceState *dev; >=20 > dinfo =3D drive_get(IF_IDE, 0, i); > if (!dinfo) { > continue; > } >=20 > dev =3D qdev_create((BusState *)s390_bus, "virtio-blk-s390"); > qdev_prop_set_drive_nofail(dev, "drive", dinfo->bdrv); > qdev_init_nofail(dev); > } >=20 > So s390 totally ignores the -drive if Nope, since virtio drives aren't handled through the IF_ legacy stuff but th= rough qden instantiation. We only fake virtio disks for -hda here (which sho= uld be replaced by a default_virtio option in the machine config). > parameter and will only accept virtio for -net. It only supports virtio at all, yes. No MMIO there ;). >=20 > =46rom what I can tell, it's not an issue. But if we need it, we can do: >=20 > diff --git a/arch_init.h b/arch_init.h > index 828256c..bfbd9e1 100644 > --- a/arch_init.h > +++ b/arch_init.h > @@ -32,4 +32,9 @@ int tcg_available(void); > int kvm_available(void); > int xen_available(void); >=20 > +static inline int target_get_arch(void) > +{ > + return arch_type; We could also have a machine type field that could be PCI or S390, right? I s= omehow don't like globals. And just because it's s390 doesn't tell us anything. Maybe someone clever wi= ll find a way to expose PCI in a later machine type and use that for all dev= ices? The same thing goes for arm and their mmio virtio too btw. > +} > + > #endif > diff --git a/blockdev.c b/blockdev.c > index 7e4c548..caa9205 100644 > --- a/blockdev.c > +++ b/blockdev.c > @@ -565,7 +565,15 @@ DriveInfo *drive_init(QemuOpts *opts, int default_to_= scsi) > case IF_VIRTIO: > /* add virtio block device */ > opts =3D qemu_opts_create(qemu_find_opts("device"), NULL, 0); > - qemu_opt_set(opts, "driver", "virtio-blk"); > + switch(target_get_arch()) { > + case QEMU_ARCH_S390X: > + qemu_opt_set(opts, "driver", "virtio-blk-s390"); > + break; > + default: > + qemu_opt_set(opts, "driver", "virtio-blk-pci"); > + break; > + } > + > qemu_opt_set(opts, "drive", dinfo->id); > if (devaddr) > qemu_opt_set(opts, "addr", devaddr); > diff --git a/blockdev.c b/blockdev.c > index 7e4c548..caa9205 100644 > --- a/blockdev.c > +++ b/blockdev.c > @@ -565,7 +565,15 @@ DriveInfo *drive_init(QemuOpts *opts, int default_to_= scsi) > case IF_VIRTIO: > /* add virtio block device */ > opts =3D qemu_opts_create(qemu_find_opts("device"), NULL, 0); > - qemu_opt_set(opts, "driver", "virtio-blk"); > + switch(target_get_arch()) { > + case QEMU_ARCH_S390X: > + qemu_opt_set(opts, "driver", "virtio-blk-s390"); > + break; > + default: > + qemu_opt_set(opts, "driver", "virtio-blk-pci"); > + break; > + } > + > qemu_opt_set(opts, "drive", dinfo->id); > if (devaddr) > qemu_opt_set(opts, "addr", devaddr); >=20 >=20 > Can you confirm what we actually need here? Every time you grep for virtio-xxx-pci in the code without an s390 branch it= 's wrong. Pretty simple, eh? :) Alex >=20 > Regards, >=20 > Anthony Liguori >=20 >>=20 >>=20 >> Alex >>=20 >>=20 >=20