[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 14/15] target-i386: implement machine->hot_add_cpu h
From: |
Igor Mammedov |
Subject: |
[Qemu-devel] [PATCH 14/15] target-i386: implement machine->hot_add_cpu hook |
Date: |
Thu, 25 Apr 2013 16:05:36 +0200 |
Signed-off-by: Igor Mammedov <address@hidden>
---
v2:
* override .hot_add_cpu staticaly starting with 1.5 machine
---
hw/i386/pc.c | 19 +++++++++++++++++++
hw/i386/pc_piix.c | 1 +
hw/i386/pc_q35.c | 1 +
include/hw/i386/pc.h | 1 +
4 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index b768b66..bc668a6 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -914,6 +914,25 @@ static X86CPU *pc_new_cpu(const char *cpu_model, int64_t
apic_id, Error **errp)
return cpu;
}
+void pc_hot_add_cpu(const int64_t id, Error **errp)
+{
+ int64_t apic_id = 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 >= max_cpus) {
+ error_setg(errp, "Unable to add CPU: %" PRIi64
+ ", max allowed: %d", id, max_cpus - 1);
+ return;
+ }
+
+ pc_new_cpu(machine_args.cpu_model, apic_id, errp);
+}
+
void pc_cpus_init(QEMUMachineInitArgs *args)
{
int i;
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 4cc6682..e8308df 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -291,6 +291,7 @@ static QEMUMachine pc_i440fx_machine_v1_5 = {
.alias = "pc",
.desc = "Standard PC (i440FX + PIIX, 1996)",
.init = pc_init_pci,
+ .hot_add_cpu = pc_hot_add_cpu,
.max_cpus = 255,
.is_default = 1,
DEFAULT_MACHINE_OPTIONS,
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 98b9bab..03f0cb4 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -209,6 +209,7 @@ static QEMUMachine pc_q35_machine_v1_5 = {
.alias = "q35",
.desc = "Standard PC (Q35 + ICH9, 2009)",
.init = pc_q35_init,
+ .hot_add_cpu = pc_hot_add_cpu,
.max_cpus = 255,
DEFAULT_MACHINE_OPTIONS,
};
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index d0815c5..16629fb 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -79,6 +79,7 @@ extern int fd_bootchk;
void pc_register_ferr_irq(qemu_irq irq);
void pc_acpi_smi_interrupt(void *opaque, int irq, int level);
+void pc_hot_add_cpu(const int64_t id, Error **errp);
void pc_cpus_init(QEMUMachineInitArgs *args);
void pc_acpi_init(const char *default_dsdt);
void *pc_memory_init(MemoryRegion *system_memory,
--
1.7.1
- [Qemu-devel] [PATCH 06/15] target-i386: cpu: attach ICC bus to CPU on its creation, (continued)
- [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, 2013/04/25
- [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 <=
- [Qemu-devel] [PATCH 15/15] QMP: add cpu-add command, Igor Mammedov, 2013/04/25