From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:37917) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UV3Xq-0004Bk-9r for qemu-devel@nongnu.org; Wed, 24 Apr 2013 13:31:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UV3Xo-0007E8-Q2 for qemu-devel@nongnu.org; Wed, 24 Apr 2013 13:31:50 -0400 Received: from cantor2.suse.de ([195.135.220.15]:53264 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UV3Xo-0007Dw-Gl for qemu-devel@nongnu.org; Wed, 24 Apr 2013 13:31:48 -0400 Message-ID: <51781700.2030201@suse.de> Date: Wed, 24 Apr 2013 19:31:44 +0200 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1366705795-24732-1-git-send-email-imammedo@redhat.com> <1366705795-24732-21-git-send-email-imammedo@redhat.com> In-Reply-To: <1366705795-24732-21-git-send-email-imammedo@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 20/21] target-i386: implement machine->hot_add_cpu hook List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: kwolf@redhat.com, peter.maydell@linaro.org, aliguori@us.ibm.com, ehabkost@redhat.com, gleb@redhat.com, mst@redhat.com, jan.kiszka@siemens.com, quintela@redhat.com, claudio.fontana@huawei.com, qemu-devel@nongnu.org, aderumier@odiso.com, lcapitulino@redhat.com, blauwirbel@gmail.com, anthony.perard@citrix.com, alex.williamson@redhat.com, kraxel@redhat.com, yang.z.zhang@intel.com, pbonzini@redhat.com, stefano.stabellini@eu.citrix.com, armbru@redhat.com, rth@twiddle.net Am 23.04.2013 10:29, schrieb Igor Mammedov: > Signed-off-by: Igor Mammedov > --- > hw/i386/pc.c | 22 ++++++++++++++++++++++ > 1 files changed, 22 insertions(+), 0 deletions(-) >=20 > diff --git a/hw/i386/pc.c b/hw/i386/pc.c > index 5e50127..b649ed5 100644 > --- a/hw/i386/pc.c > +++ b/hw/i386/pc.c > @@ -54,6 +54,7 @@ > #include "qemu/config-file.h" > #include "hw/acpi/acpi.h" > #include "hw/cpu/icc_bus.h" > +#include "hw/boards.h" > =20 > /* debug PC/ISA interrupts */ > //#define DEBUG_IRQ > @@ -914,6 +915,25 @@ static X86CPU *pc_new_cpu(const char *cpu_model, i= nt64_t apic_id, Error **errp) > return cpu; > } > =20 > +static void do_cpu_hot_add(const int64_t id, Error **errp) > +{ > + int64_t apic_id =3D x86_cpu_apic_id_from_index(id); > + > + if (cpu_exists(apic_id)) { > + error_setg(errp, "Unable to add CPU: %" PRIi64 > + ", it already exists", id); > + return; > + } > + > + if (id >=3D max_cpus) { > + error_setg(errp, "Unable to add CPU: %" PRIi64 > + ", max allowed: %d", id, max_cpus - 1); Why -1? > + return; > + } > + > + pc_new_cpu(machine_args->cpu_model, apic_id, errp); > +} > + > void pc_cpus_init(const char *cpu_model) > { > int i; > @@ -928,7 +948,9 @@ void pc_cpus_init(const char *cpu_model) > #else > cpu_model =3D "qemu32"; > #endif > + machine_args->cpu_model =3D cpu_model; This could be avoided by changing argument to const char **. :) Caller will have access to QEMUMachineArgs*. > } > + current_machine->hot_add_cpu =3D do_cpu_hot_add; That kind of answers my previous question, but why can't we have this statically in the QEMUMachine(s)? Andreas > =20 > icc_bridge =3D SYS_BUS_DEVICE(object_resolve_path_type("icc-bridge= ", > TYPE_ICC_BRIDGE, NULL= )); >=20 --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg