hw/intc/gicv3: Add CPU hotplug realize hook
GICv3 exposes individual CPU realization capability through this hook. It will be used for hotplugged CPU. Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com> Signed-off-by: Salil Mehta <salil.mehta@huawei.com> (cherry picked from commit e376844ee4fefdb6ffabb751d4d08363bc1a4faf)
This commit is contained in:
parent
bb9e0177f0
commit
a76764d7b7
171
hw-intc-gicv3-Add-CPU-hotplug-realize-hook.patch
Normal file
171
hw-intc-gicv3-Add-CPU-hotplug-realize-hook.patch
Normal file
@ -0,0 +1,171 @@
|
||||
From e94b8dc43d416b3ebf316faf14309fe4c4d0b4f0 Mon Sep 17 00:00:00 2001
|
||||
From: Keqian Zhu <zhukeqian1@huawei.com>
|
||||
Date: Mon, 6 Apr 2020 11:26:35 +0800
|
||||
Subject: [PATCH] hw/intc/gicv3: Add CPU hotplug realize hook
|
||||
|
||||
GICv3 exposes individual CPU realization capability through
|
||||
this hook. It will be used for hotplugged CPU.
|
||||
|
||||
Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com>
|
||||
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
|
||||
---
|
||||
hw/intc/arm_gicv3.c | 17 ++++++++++++++++-
|
||||
hw/intc/arm_gicv3_common.c | 8 ++++++++
|
||||
hw/intc/arm_gicv3_kvm.c | 11 +++++++++++
|
||||
include/hw/intc/arm_gicv3.h | 2 ++
|
||||
include/hw/intc/arm_gicv3_common.h | 4 ++++
|
||||
5 files changed, 41 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/hw/intc/arm_gicv3.c b/hw/intc/arm_gicv3.c
|
||||
index 40016cb84a..9591cfbcc0 100644
|
||||
--- a/hw/intc/arm_gicv3.c
|
||||
+++ b/hw/intc/arm_gicv3.c
|
||||
@@ -376,6 +376,19 @@ static const MemoryRegionOps gic_ops[] = {
|
||||
}
|
||||
};
|
||||
|
||||
+static void gicv3_cpu_realize(GICv3State *s, int i)
|
||||
+{
|
||||
+ gicv3_init_one_cpuif(s, i);
|
||||
+}
|
||||
+
|
||||
+static void arm_gicv3_cpu_hotplug_realize(GICv3State *s, int ncpu)
|
||||
+{
|
||||
+ ARMGICv3Class *agc = ARM_GICV3_GET_CLASS(s);
|
||||
+
|
||||
+ agc->parent_cpu_hotplug_realize(s, ncpu);
|
||||
+ gicv3_cpu_realize(s, ncpu);
|
||||
+}
|
||||
+
|
||||
static void arm_gic_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
/* Device instance realize function for the GIC sysbus device */
|
||||
@@ -393,7 +406,7 @@ static void arm_gic_realize(DeviceState *dev, Error **errp)
|
||||
gicv3_init_irqs_and_mmio(s, gicv3_set_irq, gic_ops);
|
||||
|
||||
for (i = 0; i < s->num_cpu; i++) {
|
||||
- gicv3_init_one_cpuif(s, i);
|
||||
+ gicv3_cpu_realize(s, i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -403,6 +416,8 @@ static void arm_gicv3_class_init(ObjectClass *klass, void *data)
|
||||
ARMGICv3CommonClass *agcc = ARM_GICV3_COMMON_CLASS(klass);
|
||||
ARMGICv3Class *agc = ARM_GICV3_CLASS(klass);
|
||||
|
||||
+ agc->parent_cpu_hotplug_realize = agcc->cpu_hotplug_realize;
|
||||
+ agcc->cpu_hotplug_realize = arm_gicv3_cpu_hotplug_realize;
|
||||
agcc->post_load = arm_gicv3_post_load;
|
||||
device_class_set_parent_realize(dc, arm_gic_realize, &agc->parent_realize);
|
||||
}
|
||||
diff --git a/hw/intc/arm_gicv3_common.c b/hw/intc/arm_gicv3_common.c
|
||||
index 1a11d1986d..f8ef6817a4 100644
|
||||
--- a/hw/intc/arm_gicv3_common.c
|
||||
+++ b/hw/intc/arm_gicv3_common.c
|
||||
@@ -311,6 +311,11 @@ static void arm_gicv3_common_cpu_realize(GICv3State *s, int ncpu)
|
||||
gicv3_set_gicv3state(cpu, &s->cpu[ncpu]);
|
||||
}
|
||||
|
||||
+static void arm_gicv3_common_cpu_hotplug_realize(GICv3State *s, int ncpu)
|
||||
+{
|
||||
+ arm_gicv3_common_cpu_realize(s, ncpu);
|
||||
+}
|
||||
+
|
||||
static void arm_gicv3_common_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
GICv3State *s = ARM_GICV3_COMMON(dev);
|
||||
@@ -371,6 +376,7 @@ static void arm_gicv3_common_realize(DeviceState *dev, Error **errp)
|
||||
|
||||
for (i = 0; i < s->num_cpu; i++) {
|
||||
CPUState *cpu = qemu_get_cpu(i);
|
||||
+
|
||||
uint64_t cpu_affid;
|
||||
|
||||
arm_gicv3_common_cpu_realize(s, i);
|
||||
@@ -537,12 +543,14 @@ static Property arm_gicv3_common_properties[] = {
|
||||
static void arm_gicv3_common_class_init(ObjectClass *klass, void *data)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
+ ARMGICv3CommonClass *agcc = ARM_GICV3_COMMON_CLASS(klass);
|
||||
ARMLinuxBootIfClass *albifc = ARM_LINUX_BOOT_IF_CLASS(klass);
|
||||
|
||||
dc->reset = arm_gicv3_common_reset;
|
||||
dc->realize = arm_gicv3_common_realize;
|
||||
device_class_set_props(dc, arm_gicv3_common_properties);
|
||||
dc->vmsd = &vmstate_gicv3;
|
||||
+ agcc->cpu_hotplug_realize = arm_gicv3_common_cpu_hotplug_realize;
|
||||
albifc->arm_linux_init = arm_gic_common_linux_init;
|
||||
}
|
||||
|
||||
diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c
|
||||
index 596b31998b..95271e754b 100644
|
||||
--- a/hw/intc/arm_gicv3_kvm.c
|
||||
+++ b/hw/intc/arm_gicv3_kvm.c
|
||||
@@ -76,6 +76,7 @@ struct KVMARMGICv3Class {
|
||||
ARMGICv3CommonClass parent_class;
|
||||
DeviceRealize parent_realize;
|
||||
void (*parent_reset)(DeviceState *dev);
|
||||
+ CPUHotplugRealize parent_cpu_hotplug_realize;
|
||||
};
|
||||
|
||||
static void kvm_arm_gicv3_set_irq(void *opaque, int irq, int level)
|
||||
@@ -771,6 +772,14 @@ static void kvm_arm_gicv3_cpu_realize(GICv3State *s, int ncpu)
|
||||
define_arm_cp_regs(cpu, gicv3_cpuif_reginfo);
|
||||
}
|
||||
|
||||
+static void kvm_arm_gicv3_cpu_hotplug_realize(GICv3State *s, int ncpu)
|
||||
+{
|
||||
+ KVMARMGICv3Class *kagcc = KVM_ARM_GICV3_GET_CLASS(s);
|
||||
+
|
||||
+ kagcc->parent_cpu_hotplug_realize(s, ncpu);
|
||||
+ kvm_arm_gicv3_cpu_realize(s, ncpu);
|
||||
+}
|
||||
+
|
||||
static void kvm_arm_gicv3_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
GICv3State *s = KVM_ARM_GICV3(dev);
|
||||
@@ -881,6 +890,8 @@ static void kvm_arm_gicv3_class_init(ObjectClass *klass, void *data)
|
||||
ARMGICv3CommonClass *agcc = ARM_GICV3_COMMON_CLASS(klass);
|
||||
KVMARMGICv3Class *kgc = KVM_ARM_GICV3_CLASS(klass);
|
||||
|
||||
+ kgc->parent_cpu_hotplug_realize = agcc->cpu_hotplug_realize;
|
||||
+ agcc->cpu_hotplug_realize = kvm_arm_gicv3_cpu_hotplug_realize;
|
||||
agcc->pre_save = kvm_arm_gicv3_get;
|
||||
agcc->post_load = kvm_arm_gicv3_put;
|
||||
device_class_set_parent_realize(dc, kvm_arm_gicv3_realize,
|
||||
diff --git a/include/hw/intc/arm_gicv3.h b/include/hw/intc/arm_gicv3.h
|
||||
index a81a6ae7ec..e360556bd5 100644
|
||||
--- a/include/hw/intc/arm_gicv3.h
|
||||
+++ b/include/hw/intc/arm_gicv3.h
|
||||
@@ -26,6 +26,8 @@ struct ARMGICv3Class {
|
||||
ARMGICv3CommonClass parent_class;
|
||||
/*< public >*/
|
||||
|
||||
+ CPUHotplugRealize parent_cpu_hotplug_realize;
|
||||
+
|
||||
DeviceRealize parent_realize;
|
||||
};
|
||||
|
||||
diff --git a/include/hw/intc/arm_gicv3_common.h b/include/hw/intc/arm_gicv3_common.h
|
||||
index fc38e4b7dc..c208a191ff 100644
|
||||
--- a/include/hw/intc/arm_gicv3_common.h
|
||||
+++ b/include/hw/intc/arm_gicv3_common.h
|
||||
@@ -306,11 +306,15 @@ typedef struct ARMGICv3CommonClass ARMGICv3CommonClass;
|
||||
DECLARE_OBJ_CHECKERS(GICv3State, ARMGICv3CommonClass,
|
||||
ARM_GICV3_COMMON, TYPE_ARM_GICV3_COMMON)
|
||||
|
||||
+typedef void (*CPUHotplugRealize)(GICv3State *s, int ncpu);
|
||||
+
|
||||
struct ARMGICv3CommonClass {
|
||||
/*< private >*/
|
||||
SysBusDeviceClass parent_class;
|
||||
/*< public >*/
|
||||
|
||||
+ CPUHotplugRealize cpu_hotplug_realize;
|
||||
+
|
||||
void (*pre_save)(GICv3State *s);
|
||||
void (*post_load)(GICv3State *s);
|
||||
};
|
||||
--
|
||||
2.27.0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user