79c4324644
Change-Id: I2d302dda68298877c65c99147f5bf22186a59aac
63 lines
2.1 KiB
Diff
63 lines
2.1 KiB
Diff
From 965eb25b03f6977a7656dce3ac5cdb4c95bfe003 Mon Sep 17 00:00:00 2001
|
|
From: Keqian Zhu <zhukeqian1@huawei.com>
|
|
Date: Fri, 10 Apr 2020 13:50:40 +0800
|
|
Subject: [PATCH] arm/virt: Add cpu_hotplug_enabled field
|
|
|
|
Some conditions must be satisfied to support CPU hotplug, including
|
|
ACPI, GED, 64bit CPU, GICv3.
|
|
|
|
Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com>
|
|
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
|
|
---
|
|
hw/arm/virt.c | 7 +++++++
|
|
include/hw/arm/virt.h | 1 +
|
|
2 files changed, 8 insertions(+)
|
|
|
|
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
|
|
index b1224fb1e4..45a0a045b1 100644
|
|
--- a/hw/arm/virt.c
|
|
+++ b/hw/arm/virt.c
|
|
@@ -2008,6 +2008,7 @@ static void machvirt_init(MachineState *machine)
|
|
{
|
|
VirtMachineState *vms = VIRT_MACHINE(machine);
|
|
VirtMachineClass *vmc = VIRT_MACHINE_GET_CLASS(machine);
|
|
+ MachineState *ms = MACHINE(machine);
|
|
MachineClass *mc = MACHINE_GET_CLASS(machine);
|
|
const CPUArchIdList *possible_cpus;
|
|
MemoryRegion *sysmem = get_system_memory();
|
|
@@ -2017,6 +2018,7 @@ static void machvirt_init(MachineState *machine)
|
|
bool has_ged = !vmc->no_ged;
|
|
unsigned int smp_cpus = machine->smp.cpus;
|
|
unsigned int max_cpus = machine->smp.max_cpus;
|
|
+ ObjectClass *cpu_class;
|
|
|
|
/*
|
|
* In accelerated mode, the memory map is computed earlier in kvm_type()
|
|
@@ -2106,6 +2108,11 @@ static void machvirt_init(MachineState *machine)
|
|
create_fdt(vms);
|
|
qemu_log("cpu init start\n");
|
|
|
|
+ cpu_class = object_class_by_name(ms->cpu_type);
|
|
+ vms->cpu_hotplug_enabled = has_ged && firmware_loaded &&
|
|
+ virt_is_acpi_enabled(vms) && vms->gic_version == 3 &&
|
|
+ !!object_class_dynamic_cast(cpu_class, TYPE_AARCH64_CPU);
|
|
+
|
|
possible_cpus = mc->possible_cpu_arch_ids(machine);
|
|
assert(possible_cpus->len == max_cpus);
|
|
for (n = 0; n < possible_cpus->len; n++) {
|
|
diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
|
|
index 947d41f767..c371d377e0 100644
|
|
--- a/include/hw/arm/virt.h
|
|
+++ b/include/hw/arm/virt.h
|
|
@@ -149,6 +149,7 @@ struct VirtMachineState {
|
|
bool its;
|
|
bool tcg_its;
|
|
bool virt;
|
|
+ bool cpu_hotplug_enabled;
|
|
bool ras;
|
|
bool mte;
|
|
OnOffAuto acpi;
|
|
--
|
|
2.27.0
|
|
|