From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:35651) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UV3Rh-00074v-6t for qemu-devel@nongnu.org; Wed, 24 Apr 2013 13:25:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UV3Rc-0004dw-EZ for qemu-devel@nongnu.org; Wed, 24 Apr 2013 13:25:29 -0400 Received: from cantor2.suse.de ([195.135.220.15]:53069 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UV3Rc-0004da-65 for qemu-devel@nongnu.org; Wed, 24 Apr 2013 13:25:24 -0400 Message-ID: <5178157D.9010204@suse.de> Date: Wed, 24 Apr 2013 19:25:17 +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-20-git-send-email-imammedo@redhat.com> In-Reply-To: <1366705795-24732-20-git-send-email-imammedo@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 19/21] add hot_add_cpu hook to QEMUMachine and export machine_args 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: > hot_add_cpu hook should be overriden by target that implements > cpu hot-add via cpu-add QMP command. >=20 > Make machine_args available to machine init code, it allows > to centralize cpu_model starage instead of adding target > specific globals to keep it. >=20 > Signed-off-by: Igor Mammedov > --- > include/hw/boards.h | 3 +++ > vl.c | 6 +++++- > 2 files changed, 8 insertions(+), 1 deletions(-) >=20 > diff --git a/include/hw/boards.h b/include/hw/boards.h > index 425bdc7..de8f92a 100644 > --- a/include/hw/boards.h > +++ b/include/hw/boards.h > @@ -18,6 +18,8 @@ typedef struct QEMUMachineInitArgs { > const char *cpu_model; > } QEMUMachineInitArgs; > =20 > +extern QEMUMachineInitArgs *machine_args; > + > typedef void QEMUMachineInitFunc(QEMUMachineInitArgs *args); > =20 > typedef void QEMUMachineResetFunc(void); > @@ -43,6 +45,7 @@ typedef struct QEMUMachine { > GlobalProperty *compat_props; > struct QEMUMachine *next; > const char *hw_version; > + void (*hot_add_cpu)(const int64_t id, Error **errp); > } QEMUMachine; > =20 > int qemu_register_machine(QEMUMachine *m); > diff --git a/vl.c b/vl.c > index 5612c33..6a612e6 100644 > --- a/vl.c > +++ b/vl.c > @@ -179,6 +179,8 @@ int main(int argc, char **argv) > #define MAX_VIRTIO_CONSOLES 1 > #define MAX_SCLP_CONSOLES 1 > =20 > +QEMUMachineInitArgs *machine_args; > + > static const char *data_dir[16]; > static int data_dir_idx; > const char *bios_name =3D NULL; > @@ -4295,13 +4297,15 @@ int main(int argc, char **argv, char **envp) > .kernel_cmdline =3D kernel_cmdline, > .initrd_filename =3D initrd_filename, > .cpu_model =3D cpu_model }; > + machine_args =3D &args; args is a stack variable, so making it global does not strike me as a good idea... (I did have a patch to split main() in two at one time) > + current_machine =3D machine; > + > machine->init(&args); > =20 > cpu_synchronize_all_post_init(); > =20 > set_numa_modes(); > =20 > - current_machine =3D machine; Did you look up why it was placed here? Eduardo? I'm not strongly opinionated but I wonder whether we may want to leave it after machine->init? Andreas > =20 > /* init USB devices */ > if (usb_enabled(false)) { >=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