@@ -3174,6 +3174,10 @@ static void virt_cpu_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
virt_update_gic(vms, cs, true);
wire_gic_cpu_irqs(vms, cs);
}
+
+ if (!dev->hotplugged) {
+ cs->cold_booted = true;
+ }
}
static void virt_cpu_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
@@ -3248,6 +3252,18 @@ static void virt_cpu_unplug_request(HotplugHandler *hotplug_dev,
return;
}
+ /*
+ * UEFI ACPI standard change is required to make both 'enabled' and the
+ * 'online-capable' bit co-exist instead of being mutually exclusive.
+ * check virt_acpi_get_gicc_flags() for more details.
+ *
+ * Disable the unplugging of cold-booted vCPUs as a temporary mitigation.
+ */
+ if (cs->cold_booted) {
+ error_setg(errp, "Hot-unplug of cold-booted CPU not supported!");
+ return;
+ }
+
if (cs->cpu_index == first_cpu->cpu_index) {
error_setg(errp, "Boot CPU(id%d=%d:%d:%d:%d) hot-unplug not supported",
first_cpu->cpu_index, cpu->socket_id, cpu->cluster_id,
@@ -571,6 +571,8 @@ struct CPUState {
uint32_t halted;
int32_t exception_index;
+ bool cold_booted;
+
AccelCPUState *accel;
/* Used to keep track of an outstanding cpu throttle thread for migration
Hotpluggable vCPUs must be exposed as "online-capable" according to the new UEFI specification [1][2]. However, marking cold-booted vCPUs as "online-capable" during boot may cause them to go undetected by legacy operating systems, potentially leading to compatibility issues. Hence, both 'online-capable' bit and 'Enabled' bit in GIC CPU Interface flags should not be mutually exclusive as they are now. Since implementing this specification change may take time, it is necessary to temporarily *disable* support for *unplugging* cold-booted vCPUs to maintain compatibility with legacy OS environments. As an alternative and temporary mitigation, we could introduce a property that controls whether cold-booted vCPUs are marked as unpluggable. Community feedback on this approach would be appreciated. References: [1] Original UEFI/ACPI proposed Change Bugzilla – TianoCore Link: https://bugzilla.tianocore.org/show_bug.cgi?id=3706 [2] Advanced Configuration and Power Interface (ACPI) Specification, Release 6.5, Aug 29, 2022 Section: 5.2.12.14 GIC CPU Interface (GICC) Structure / Table 5.37: GICC CPU Interface Flags Link: https://uefi.org/sites/default/files/resources/ACPI_Spec_6_5_Aug29.pdf (Pages 138, 140) Signed-off-by: Salil Mehta <salil.mehta@huawei.com> --- hw/arm/virt.c | 16 ++++++++++++++++ include/hw/core/cpu.h | 2 ++ 2 files changed, 18 insertions(+)