48 lines
1.6 KiB
Diff
48 lines
1.6 KiB
Diff
|
|
From 00a78edf572783c18a1d4945758371c0f175e321 Mon Sep 17 00:00:00 2001
|
||
|
|
From: Keqian Zhu <zhukeqian1@huawei.com>
|
||
|
|
Date: Tue, 26 Mar 2024 15:41:14 +0800
|
||
|
|
Subject: [PATCH] arm/virt: Fix adjudgement of core_id for vcpu hotplugged
|
||
|
|
|
||
|
|
The core_id should between 0 and ms->smp.cores - 1.
|
||
|
|
|
||
|
|
Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com>
|
||
|
|
---
|
||
|
|
hw/arm/virt.c | 14 +++-----------
|
||
|
|
1 file changed, 3 insertions(+), 11 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
|
||
|
|
index 934b0412ef..e60f3431f9 100644
|
||
|
|
--- a/hw/arm/virt.c
|
||
|
|
+++ b/hw/arm/virt.c
|
||
|
|
@@ -3170,8 +3170,6 @@ static void virt_cpu_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
|
||
|
|
ARMCPU *cpu = ARM_CPU(dev);
|
||
|
|
CPUState *cs = CPU(dev);
|
||
|
|
CPUArchId *cpu_slot;
|
||
|
|
- int32_t min_cpuid = 0;
|
||
|
|
- int32_t max_cpuid;
|
||
|
|
|
||
|
|
if (dev->hotplugged && !vms->acpi_dev) {
|
||
|
|
error_setg(errp, "GED acpi device does not exists");
|
||
|
|
@@ -3196,15 +3194,9 @@ static void virt_cpu_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
- max_cpuid = ms->possible_cpus->len - 1;
|
||
|
|
- if (!dev->hotplugged) {
|
||
|
|
- min_cpuid = vms->acpi_dev ? ms->smp.cpus : 0;
|
||
|
|
- max_cpuid = vms->acpi_dev ? max_cpuid : ms->smp.cpus - 1;
|
||
|
|
- }
|
||
|
|
-
|
||
|
|
- if ((cpu->core_id < min_cpuid) || (cpu->core_id > max_cpuid)) {
|
||
|
|
- error_setg(errp, "Invalid core-id %d specified, correct range %d:%d",
|
||
|
|
- cpu->core_id, min_cpuid, max_cpuid);
|
||
|
|
+ if ((cpu->core_id < 0) || (cpu->core_id >= ms->smp.cores)) {
|
||
|
|
+ error_setg(errp, "Invalid core-id %d specified, correct range 0:%u",
|
||
|
|
+ cpu->core_id, ms->smp.cores - 1);
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
--
|
||
|
|
2.27.0
|
||
|
|
|