From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42148) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aY9sP-0001C5-1l for qemu-devel@nongnu.org; Tue, 23 Feb 2016 05:07:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aY9sL-0005xS-Ct for qemu-devel@nongnu.org; Tue, 23 Feb 2016 05:07:28 -0500 Received: from e28smtp07.in.ibm.com ([125.16.236.7]:42257) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aY9sK-0005ww-LC for qemu-devel@nongnu.org; Tue, 23 Feb 2016 05:07:25 -0500 Received: from localhost by e28smtp07.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 23 Feb 2016 15:37:21 +0530 Date: Tue, 23 Feb 2016 15:19:11 +0530 From: Bharata B Rao Message-ID: <20160223094911.GB21081@in.ibm.com> References: <20160223052431.GS2808@voom.fritz.box> <20160223094026.GA21081@in.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160223094026.GA21081@in.ibm.com> Subject: Re: [Qemu-devel] CPU hotplug, again Reply-To: bharata@linux.vnet.ibm.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Gibson Cc: thuth@redhat.com, ehabkost@redhat.com, armbru@redhat.com, agraf@suse.de, qemu-devel@nongnu.org, qemu-ppc@nongnu.org, pbonzini@redhat.com, imammedo@redhat.com, Andreas =?iso-8859-1?Q?F=E4rber?= On Tue, Feb 23, 2016 at 03:10:26PM +0530, Bharata B Rao wrote: > > 5) QOM-links > > Andreas, You have often talked about setting up links from machine object > to the CPU objects. Would the below code correctly capture that idea of > yours ? > > #define SPAPR_MACHINE_CPU_CORE_PROP "core" > > /* MachineClass.init for sPAPR */ > static void ppc_spapr_init(MachineState *machine) > { > sPAPRMachineState *spapr = SPAPR_MACHINE(machine); > int spapr_smp_cores = smp_cpus / smp_threads; > int spapr_max_cores = max_cpus / smp_threads; > > ... > for (i = 0; i < spapr_max_cores; i++) { > Object *obj = object_new(TYPE_SPAPR_CPU_CORE); > sPAPRCPUCore *core = SPAPR_CPU_CORE(obj); > char name[32]; > > snprintf(name, sizeof(name), "%s[%d]", SPAPR_MACHINE_CPU_CORE_PROP, i); > > /* > * Create links from machine objects to all possible cores. > */ > object_property_add_link(OBJECT(spapr), name, TYPE_SPAPR_CPU_CORE, > (Object **)&spapr->core[i], > NULL, NULL, &error_abort); > > /* > * Set the QOM link from machine object to core object for all > * boot time CPUs specified with -smp. For rest of the hotpluggable > * cores this is done from the core hotplug path. > */ > if (i < spapr_smp_cores) { > object_property_set_link(OBJECT(spapr), OBJECT(core), > SPAPR_MACHINE_CPU_CORE_PROP, &error_abort); > } BTW s/SPAPR_MACHINE_CPU_CORE_PROP/name in object_property_set_link() above.