[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 5/7] add hot_add_cpu hook to QEMUMachine and exp
From: |
li guang |
Subject: |
Re: [Qemu-devel] [PATCH 5/7] add hot_add_cpu hook to QEMUMachine and export machine_args |
Date: |
Tue, 30 Apr 2013 13:47:47 +0800 |
在 2013-04-29一的 17:02 +0200,Igor Mammedov写道:
> hot_add_cpu hook should be overriden by target that implements
> cpu hot-add via cpu-add QMP command.
>
> Make machine_args available globaly, it allows to reuse
> machine_args->cpu_model during hotplug, instead of adding target
> specific globals to keep a copy of cpu_model.
>
> Signed-off-by: Igor Mammedov <address@hidden>
> ---
> v2:
> * convert stack veriable args to global machine_args
> * don't move current_machine before machine->init(), override hot_add_cpu
> staticaly instead.
> ---
> include/hw/boards.h | 3 +++
> vl.c | 8 ++++++--
> 2 files changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/include/hw/boards.h b/include/hw/boards.h
> index 425bdc7..657f379 100644
> --- a/include/hw/boards.h
> +++ b/include/hw/boards.h
> @@ -18,6 +18,8 @@ typedef struct QEMUMachineInitArgs {
> const char *cpu_model;
> } QEMUMachineInitArgs;
>
> +extern QEMUMachineInitArgs machine_args;
> +
I'm goint to think whether we can pus machine_args into
current_machine, that is add QEMUMachineInitArgs member
for QEMUMachine.
by this, we can avoid this global extern.
> typedef void QEMUMachineInitFunc(QEMUMachineInitArgs *args);
>
> 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;
>
> int qemu_register_machine(QEMUMachine *m);
> diff --git a/vl.c b/vl.c
> index 1e7d474..3fe5e94 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
>
> +QEMUMachineInitArgs machine_args;
> +
> static const char *data_dir[16];
> static int data_dir_idx;
> const char *bios_name = NULL;
> @@ -4291,7 +4293,8 @@ int main(int argc, char **argv, char **envp)
>
> qdev_machine_init();
>
> - QEMUMachineInitArgs args = { .ram_size = ram_size,
> + machine_args = (QEMUMachineInitArgs){
> + .ram_size = ram_size,
> .boot_device = (boot_devices[0] == '\0') ?
> machine->boot_order :
> boot_devices,
> @@ -4299,7 +4302,8 @@ int main(int argc, char **argv, char **envp)
> .kernel_cmdline = kernel_cmdline,
> .initrd_filename = initrd_filename,
> .cpu_model = cpu_model };
> - machine->init(&args);
> +
> + machine->init(&machine_args);
>
> cpu_synchronize_all_post_init();
>
- [Qemu-devel] [PATCH 0/7 v7 for 1.5] target-i386: CPU hot-add with cpu-add QMP command, Igor Mammedov, 2013/04/29
- [Qemu-devel] [PATCH 1/7] target-i386: Introduce ICC bus/device/bridge, Igor Mammedov, 2013/04/29
- [Qemu-devel] [PATCH 2/7] target-i386: Attach ICC bus to CPU on its creation, Igor Mammedov, 2013/04/29
- [Qemu-devel] [PATCH 5/7] add hot_add_cpu hook to QEMUMachine and export machine_args, Igor Mammedov, 2013/04/29
- Re: [Qemu-devel] [PATCH 5/7] add hot_add_cpu hook to QEMUMachine and export machine_args,
li guang <=
- [Qemu-devel] [PATCH 6/7] target-i386: implement machine->hot_add_cpu hook, Igor Mammedov, 2013/04/29
- [Qemu-devel] [PATCH 4/7] pc: pass QEMUMachineInitArgs down to pc_cpus_init(), Igor Mammedov, 2013/04/29
- [Qemu-devel] [PATCH 3/7] target-i386: Move APIC to ICC bus, Igor Mammedov, 2013/04/29
- [Qemu-devel] [PATCH 7/7] QMP: add cpu-add command, Igor Mammedov, 2013/04/29