From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36827) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXlVb-0002EO-IZ for qemu-devel@nongnu.org; Mon, 22 Feb 2016 03:06:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aXlVY-0008FS-5K for qemu-devel@nongnu.org; Mon, 22 Feb 2016 03:06:19 -0500 Received: from e23smtp01.au.ibm.com ([202.81.31.143]:50674) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXlVX-0008Ew-Jm for qemu-devel@nongnu.org; Mon, 22 Feb 2016 03:06:16 -0500 Received: from localhost by e23smtp01.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 22 Feb 2016 18:06:09 +1000 Received: from d23relay08.au.ibm.com (d23relay08.au.ibm.com [9.185.71.33]) by d23dlp03.au.ibm.com (Postfix) with ESMTP id 4965D3578052 for ; Mon, 22 Feb 2016 19:06:03 +1100 (EST) Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.235.139]) by d23relay08.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u1M85pBl56951020 for ; Mon, 22 Feb 2016 19:06:03 +1100 Received: from d23av04.au.ibm.com (localhost [127.0.0.1]) by d23av04.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u1M85Rer013915 for ; Mon, 22 Feb 2016 19:05:27 +1100 Date: Mon, 22 Feb 2016 13:35:07 +0530 From: Bharata B Rao Message-ID: <20160222080507.GF9382@in.ibm.com> References: <1456117285-22273-1-git-send-email-bharata@linux.vnet.ibm.com> <1456117285-22273-5-git-send-email-bharata@linux.vnet.ibm.com> <56CAAE58.3060705@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <56CAAE58.3060705@suse.de> Subject: Re: [Qemu-devel] [RFC PATCH v0 4/8] spapr: Introduce CPU core device Reply-To: bharata@linux.vnet.ibm.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andreas =?iso-8859-1?Q?F=E4rber?= Cc: ehabkost@redhat.com, aik@ozlabs.ru, armbru@redhat.com, agraf@suse.de, qemu-devel@nongnu.org, pbonzini@redhat.com, imammedo@redhat.com, david@gibson.dropbear.id.au On Mon, Feb 22, 2016 at 07:44:40AM +0100, Andreas Färber wrote: > Am 22.02.2016 um 06:01 schrieb Bharata B Rao: > > sPAPR CPU core device is a container of CPU thread devices. CPU hotplug is > > performed in the granularity of CPU core device by setting the "realized" > > property of this device to "true". When hotplugged, CPU core creates CPU > > thread devices. > > > > TODO: Right now allows for only homogeneous configurations as we depend > > on global smp_threads and machine->cpu_model. > > > > Signed-off-by: Bharata B Rao > > --- > > hw/ppc/Makefile.objs | 1 + > > hw/ppc/spapr_cpu_package.c | 50 ++++++++++++++++++++++++++++++++++++++ > > include/hw/ppc/spapr_cpu_package.h | 26 ++++++++++++++++++++ > > 3 files changed, 77 insertions(+) > > create mode 100644 hw/ppc/spapr_cpu_package.c > > create mode 100644 include/hw/ppc/spapr_cpu_package.h > > > > diff --git a/hw/ppc/Makefile.objs b/hw/ppc/Makefile.objs > > index c1ffc77..3000982 100644 > > --- a/hw/ppc/Makefile.objs > > +++ b/hw/ppc/Makefile.objs > > @@ -4,6 +4,7 @@ obj-y += ppc.o ppc_booke.o > > obj-$(CONFIG_PSERIES) += spapr.o spapr_vio.o spapr_events.o > > obj-$(CONFIG_PSERIES) += spapr_hcall.o spapr_iommu.o spapr_rtas.o > > obj-$(CONFIG_PSERIES) += spapr_pci.o spapr_rtc.o spapr_drc.o spapr_rng.o > > +obj-$(CONFIG_PSERIES) += spapr_cpu_package.o > > ifeq ($(CONFIG_PCI)$(CONFIG_PSERIES)$(CONFIG_LINUX), yyy) > > obj-y += spapr_pci_vfio.o > > endif > > diff --git a/hw/ppc/spapr_cpu_package.c b/hw/ppc/spapr_cpu_package.c > > new file mode 100644 > > index 0000000..3120a16 > > --- /dev/null > > +++ b/hw/ppc/spapr_cpu_package.c > > @@ -0,0 +1,50 @@ > > +/* > > + * sPAPR CPU package device, acts as container of CPU thread devices. > > + * > > + * Copyright (C) 2016 Bharata B Rao > > + * > > + * This work is licensed under the terms of the GNU GPL, version 2 or later. > > + * See the COPYING file in the top-level directory. > > + */ > > +#include "hw/cpu/package.h" > > +#include "hw/ppc/spapr_cpu_package.h" > > +#include "hw/boards.h" > > +#include > > +#include "qemu/error-report.h" > > + > > +static void spapr_cpu_package_instance_init(Object *obj) > > +{ > > + int i; > > + CPUState *cpu; > > + MachineState *machine = MACHINE(qdev_get_machine()); > > + sPAPRCPUPackage *package = SPAPR_CPU_PACKAGE(obj); > > + > > + /* Create as many CPU threads as specified in the topology */ > > + for (i = 0; i < smp_threads; i++) { > > + cpu = cpu_generic_init(machine->cpu_type, machine->cpu_model); > > No, no, no. This is horribly violating QOM design. > > Please compare the x86 RFC. Are you referring to the in-place initialization of child objects like that you did in socket based x86 hotplug RFC last year ? Regards, Bharata.