[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-arm] [PATCH 3/3] arm/virt: Implement hot_add_cpu interface
From: |
Li Zhang |
Subject: |
[Qemu-arm] [PATCH 3/3] arm/virt: Implement hot_add_cpu interface |
Date: |
Fri, 26 May 2017 17:21:08 +0800 |
From: Li Zhang <address@hidden>
This patch is to add add_hot_cpu interface.
Signed-off-by: Li Zhang <address@hidden>
---
hw/arm/virt.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 31314c1..c7e8322 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -527,6 +527,24 @@ out:
error_propagate(errp, err);
}
+static void virt_hot_add_cpu(const int64_t id, Error **errp)
+{
+ MachineState *ms = MACHINE(qdev_get_machine());
+ VirtMachineState *vms = VIRT_MACHINE(ms);
+
+ if (id < 0 || id >= max_cpus) {
+ error_setg(errp, "Invalid CPU id: %" PRIi64, id);
+ return;
+ }
+
+ virt_new_cpu(ms, id, errp);
+ if (errp) {
+ return;
+ }
+
+ fdt_add_cpu_node(vms, id);
+}
+
static void fdt_add_its_gic_node(VirtMachineState *vms)
{
vms->msi_phandle = qemu_fdt_alloc_phandle(vms->fdt);
@@ -1654,6 +1672,7 @@ static void virt_machine_class_init(ObjectClass *oc, void
*data)
mc->minimum_page_bits = 12;
mc->possible_cpu_arch_ids = virt_possible_cpu_arch_ids;
mc->cpu_index_to_instance_props = virt_cpu_index_to_props;
+ mc->hot_add_cpu = virt_hot_add_cpu;
}
static const TypeInfo virt_machine_info = {
--
2.7.4