[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 13/15] add hot_add_cpu hook to QEMUMachine and expor
From: |
Igor Mammedov |
Subject: |
[Qemu-devel] [PATCH 13/15] add hot_add_cpu hook to QEMUMachine and export machine_args |
Date: |
Thu, 25 Apr 2013 16:05:35 +0200 |
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;
+
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 5981db0..faf5e4b 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;
@@ -4273,7 +4275,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,
@@ -4281,7 +4284,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();
--
1.7.1
- Re: [Qemu-devel] [PATCH 04/15] target-i386: introduce apic-id property, (continued)
- [Qemu-devel] [PATCH 02/15] cpu: add helper cpu_exists(), to check if CPU with specified id exists, Igor Mammedov, 2013/04/25
- [Qemu-devel] [PATCH 05/15] target-i386: introduce ICC bus/device/bridge, Igor Mammedov, 2013/04/25
- [Qemu-devel] [PATCH 06/15] target-i386: cpu: attach ICC bus to CPU on its creation, Igor Mammedov, 2013/04/25
- [Qemu-devel] [PATCH 07/15] target-i386: replace MSI_SPACE_SIZE with APIC_SPACE_SIZE, Igor Mammedov, 2013/04/25
- [Qemu-devel] [PATCH 08/15] target-i386: kvmvapic: make expilict dependency on sysbus.h, Igor Mammedov, 2013/04/25
- [Qemu-devel] [PATCH 09/15] target-i386: move APIC to ICC bus, Igor Mammedov, 2013/04/25
- [Qemu-devel] [PATCH 10/15] extend memory_region_find() and use it in kvm/ioapic, Igor Mammedov, 2013/04/25
- [Qemu-devel] [PATCH 13/15] add hot_add_cpu hook to QEMUMachine and export machine_args,
Igor Mammedov <=
- [Qemu-devel] [PATCH 12/15] pc: pass QEMUMachineInitArgs down to pc_cpus_init(), Igor Mammedov, 2013/04/25
- [Qemu-devel] [PATCH 11/15] target-i386: move IOAPIC to ICC bus, Igor Mammedov, 2013/04/25
- [Qemu-devel] [PATCH 14/15] target-i386: implement machine->hot_add_cpu hook, Igor Mammedov, 2013/04/25
- [Qemu-devel] [PATCH 15/15] QMP: add cpu-add command, Igor Mammedov, 2013/04/25