From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:51021) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULUQm-00068v-9f for qemu-devel@nongnu.org; Fri, 29 Mar 2013 04:13:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ULUQk-0005sJ-SU for qemu-devel@nongnu.org; Fri, 29 Mar 2013 04:13:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58925) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULUQk-0005sB-KY for qemu-devel@nongnu.org; Fri, 29 Mar 2013 04:12:58 -0400 Date: Fri, 29 Mar 2013 09:12:38 +0100 From: Igor Mammedov Message-ID: <20130329091238.6c935eec@thinkpad.mammed.net> In-Reply-To: <1364541767.31713.87.camel@liguang.fnst.cn.fujitsu.com> References: <1363876125-8264-1-git-send-email-imammedo@redhat.com> <1363876125-8264-8-git-send-email-imammedo@redhat.com> <20130328115501.51ff4ee6@thinkpad.mammed.net> <1364541767.31713.87.camel@liguang.fnst.cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 07/12] target-i386: Add ICC_BUS and attach apic, kvmvapic and cpu to it List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: li guang Cc: kwolf@redhat.com, peter.maydell@linaro.org, aliguori@us.ibm.com, ehabkost@redhat.com, mst@redhat.com, jan.kiszka@siemens.com, stefano.stabellini@eu.citrix.com, claudio.fontana@huawei.com, qemu-devel@nongnu.org, aderumier@odiso.com, armbru@redhat.com, blauwirbel@gmail.com, quintela@redhat.com, alex.williamson@redhat.com, kraxel@redhat.com, anthony.perard@citrix.com, yang.z.zhang@intel.com, pbonzini@redhat.com, lcapitulino@redhat.com, afaerber@suse.de, rth@twiddle.net On Fri, 29 Mar 2013 15:22:47 +0800 li guang wrote: > =E5=9C=A8 2013-03-28=E5=9B=9B=E7=9A=84 11:55 +0100=EF=BC=8CIgor Mammedov= =E5=86=99=E9=81=93=EF=BC=9A > > On Wed, 27 Mar 2013 11:57:53 +0100 > > Paolo Bonzini wrote: > >=20 > > > Il 21/03/2013 15:28, Igor Mammedov ha scritto: =20 > > > > Introduce hot-pluggable ICC_BUS and convert APIC devices from SysBu= sDevice > > > > to ICCDevice wich has ICC_BUS as default one. > > > >=20 > > > > * attach APIC and kvmvapic to ICC_BUS during creation > > > > * use memory API directly instead of using SysBus proxy functions > > > > * introduce get_icc_bus() for getting access to system wide ICC_BUS > > > > * make ICC_BUS default one for X86CPU class, so that device_add wo= uld > > > > set it for CPU instead of SysBus > > > > * attach cold-pluged CPUs to icc_bus in softmmu mode, so they coul= d be > > > > uplugged in future > > > > * if kvmvapic init() fails return -1 instead of aborting. > [...] > > > > +}; > > > > + > > > > +static BusState *icc_bus; > > > > + > > > > +BusState *get_icc_bus(void) > > > > +{ > > > > + if (icc_bus =3D=3D NULL) { > > > > + icc_bus =3D g_malloc0(icc_bus_info.instance_size); > > > > + qbus_create_inplace(icc_bus, TYPE_ICC_BUS, NULL, "icc-bus"= ); > > > > + icc_bus->allow_hotplug =3D 1; > > > > + OBJECT(icc_bus)->free =3D g_free; =20 > > >=20 > > > You can just use qbus_create. > > > =20 > > > > + object_property_add_child(container_get(qdev_get_machine(), > > > > + "/unattached"), =20 > > >=20 > > > Please put it straight under /machine, not /unattached. =20 > >=20 > > sure > >=20 > > >=20 > > > But actually, you lack a device that instantiates the bus. That devi= ce > > > would be a simple container device similar hw/a15mpcore.c, and would = =20 > >=20 > > About a year ago something like that device was proposed "cpu_sockets",= but >=20 > what about link implementation which was mentioned by Andreas > few days ago at a thread discussion for acpi memory hotplug? > (http://list-archives.org/2012/12/18/qemu-devel-nongnu-org/rfc-patch-v4-0= 0-30-acpi-memory-hotplug/f/4115902514) > do consider to implement a link<> property between CPU and cpu_socket? since CPU slowly moving towards being able to be added via device_add, there is a limited usefulness in link<> property. It still could be used to expose possible APIC IDs to user so that user won't have calculate them by itself. But it requires fixing device_realize first so I haven't included it in this series. >=20 > > there was suggestion to drop it: > > http://lists.gnu.org/archive/html/qemu-devel/2012-02/msg02157.html > > So I've opted in favor of parent-less bus, but I could create it > > explicitly at board level as you suggest. > >=20 > > However having parent sysbus device for icc-bus will allow to see it via > > monitor info qtree and reset on SysBus could be propagated through it a= s well, > > it may be good to add it later. > >=20 > > > also take care of registering the MSI memory region. Create that dev= ice =20 > >=20 > > it probably impossible to do, because [kvm]apic sets its private callba= cks > > to it when initializing memory region, and CPU just maps it at specified > > address, or this region and APIC might not even exists at all if qemu s= tarted > > with -apic feature flag. > >=20 > > > in the boards, and you won't need a special object_property_add_child. > > >=20 > > > get_icc_bus() would then become simply > > > object_resolve_path_type("icc-bus", TYPE_ICC_BUS, NULL) or something > > > like that. > > >=20 > > > Paolo > > > =20 > > > > + "icc-bus", OBJECT(icc_bus), NULL= ); > > > > + } > > > > + return BUS(icc_bus); > > > > +} > > > > + >=20 >=20 >=20 --=20 Regards, Igor