71 lines
2.2 KiB
Diff
71 lines
2.2 KiB
Diff
|
|
From 343b61303152b06f9e1ba6d09a405faeaa3fcc98 Mon Sep 17 00:00:00 2001
|
||
|
|
From: Keqian Zhu <zhukeqian1@huawei.com>
|
||
|
|
Date: Tue, 26 Mar 2024 22:12:58 +0800
|
||
|
|
Subject: [PATCH] intc/gicv3: Fixes for vcpu hotplug
|
||
|
|
|
||
|
|
1. Some types of machine don't support possible_cpus
|
||
|
|
callback.
|
||
|
|
2. The cpu_update_notifier is register only when machine
|
||
|
|
support vcpu hotplug, so do notifier_remove() unconditi-
|
||
|
|
onally is wrong.
|
||
|
|
|
||
|
|
Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com>
|
||
|
|
---
|
||
|
|
cpu-common.c | 4 ++++
|
||
|
|
hw/intc/arm_gicv3_common.c | 9 +++++++--
|
||
|
|
2 files changed, 11 insertions(+), 2 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/cpu-common.c b/cpu-common.c
|
||
|
|
index da52e45760..54e63b3f77 100644
|
||
|
|
--- a/cpu-common.c
|
||
|
|
+++ b/cpu-common.c
|
||
|
|
@@ -113,6 +113,10 @@ CPUState *qemu_get_possible_cpu(int index)
|
||
|
|
MachineState *ms = MACHINE(qdev_get_machine());
|
||
|
|
const CPUArchIdList *possible_cpus = ms->possible_cpus;
|
||
|
|
|
||
|
|
+ if (possible_cpus == NULL) {
|
||
|
|
+ return qemu_get_cpu(index);
|
||
|
|
+ }
|
||
|
|
+
|
||
|
|
assert((index >= 0) && (index < possible_cpus->len));
|
||
|
|
|
||
|
|
return CPU(possible_cpus->cpus[index].cpu);
|
||
|
|
diff --git a/hw/intc/arm_gicv3_common.c b/hw/intc/arm_gicv3_common.c
|
||
|
|
index d051024a30..5667d9f40b 100644
|
||
|
|
--- a/hw/intc/arm_gicv3_common.c
|
||
|
|
+++ b/hw/intc/arm_gicv3_common.c
|
||
|
|
@@ -25,6 +25,7 @@
|
||
|
|
#include "qapi/error.h"
|
||
|
|
#include "qemu/module.h"
|
||
|
|
#include "qemu/error-report.h"
|
||
|
|
+#include "hw/boards.h"
|
||
|
|
#include "hw/core/cpu.h"
|
||
|
|
#include "hw/intc/arm_gicv3_common.h"
|
||
|
|
#include "hw/qdev-properties.h"
|
||
|
|
@@ -446,7 +447,7 @@ static void arm_gicv3_common_realize(DeviceState *dev, Error **errp)
|
||
|
|
s->cpu = g_new0(GICv3CPUState, s->num_cpu);
|
||
|
|
|
||
|
|
for (i = 0; i < s->num_cpu; i++) {
|
||
|
|
- CPUState *cpu = qemu_get_possible_cpu(i);
|
||
|
|
+ CPUState *cpu = qemu_get_possible_cpu(i) ? : qemu_get_cpu(i);
|
||
|
|
uint64_t cpu_affid;
|
||
|
|
|
||
|
|
if (qemu_enabled_cpu(cpu)) {
|
||
|
|
@@ -506,8 +507,12 @@ static void arm_gicv3_common_realize(DeviceState *dev, Error **errp)
|
||
|
|
static void arm_gicv3_finalize(Object *obj)
|
||
|
|
{
|
||
|
|
GICv3State *s = ARM_GICV3_COMMON(obj);
|
||
|
|
+ Object *ms = qdev_get_machine();
|
||
|
|
+ MachineClass *mc = MACHINE_GET_CLASS(ms);
|
||
|
|
|
||
|
|
- notifier_remove(&s->cpu_update_notifier);
|
||
|
|
+ if (mc->has_hotpluggable_cpus) {
|
||
|
|
+ notifier_remove(&s->cpu_update_notifier);
|
||
|
|
+ }
|
||
|
|
g_free(s->redist_region_count);
|
||
|
|
}
|
||
|
|
|
||
|
|
--
|
||
|
|
2.27.0
|
||
|
|
|