arm/virt: Add CPU hotplug framework
Establish the CPU hotplug framework for arm/virt, we will add necessary code legs to this framework gradually to realize CPU hotplug finally. Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com> Signed-off-by: Salil Mehta <salil.mehta@huawei.com> (cherry picked from commit 9dfe0cc4e9970f93b817068efd0bd6e0d98ca0b2)
This commit is contained in:
parent
5d3abd0f50
commit
cfbdd7e3d7
69
arm-virt-Add-CPU-hotplug-framework.patch
Normal file
69
arm-virt-Add-CPU-hotplug-framework.patch
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
From 209b3e4e522b8f7f41e495feaade96ee9a91e46a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Keqian Zhu <zhukeqian1@huawei.com>
|
||||||
|
Date: Fri, 3 Apr 2020 16:16:18 +0800
|
||||||
|
Subject: [PATCH] arm/virt: Add CPU hotplug framework
|
||||||
|
|
||||||
|
Establish the CPU hotplug framework for arm/virt, we will add
|
||||||
|
necessary code legs to this framework gradually to realize CPU
|
||||||
|
hotplug finally.
|
||||||
|
|
||||||
|
Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com>
|
||||||
|
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
|
||||||
|
---
|
||||||
|
hw/arm/virt.c | 19 ++++++++++++++++++-
|
||||||
|
1 file changed, 18 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
|
||||||
|
index 9b73c479c4..11155fcb70 100644
|
||||||
|
--- a/hw/arm/virt.c
|
||||||
|
+++ b/hw/arm/virt.c
|
||||||
|
@@ -2586,6 +2586,18 @@ static void virt_memory_plug(HotplugHandler *hotplug_dev,
|
||||||
|
dev, &error_abort);
|
||||||
|
}
|
||||||
|
|
||||||
|
+static void virt_cpu_pre_plug(HotplugHandler *hotplug_dev,
|
||||||
|
+ DeviceState *dev, Error **errp)
|
||||||
|
+{
|
||||||
|
+ /* Currently nothing to do */
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void virt_cpu_plug(HotplugHandler *hotplug_dev,
|
||||||
|
+ DeviceState *dev, Error **errp)
|
||||||
|
+{
|
||||||
|
+ /* Currently nothing to do */
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static void virt_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev,
|
||||||
|
DeviceState *dev, Error **errp)
|
||||||
|
{
|
||||||
|
@@ -2619,6 +2631,8 @@ static void virt_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev,
|
||||||
|
qdev_prop_set_uint32(dev, "len-reserved-regions", 1);
|
||||||
|
qdev_prop_set_string(dev, "reserved-regions[0]", resv_prop_str);
|
||||||
|
g_free(resv_prop_str);
|
||||||
|
+ } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
|
||||||
|
+ virt_cpu_pre_plug(hotplug_dev, dev, errp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -2637,6 +2651,8 @@ static void virt_machine_device_plug_cb(HotplugHandler *hotplug_dev,
|
||||||
|
}
|
||||||
|
if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
|
||||||
|
virt_memory_plug(hotplug_dev, dev, errp);
|
||||||
|
+ } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
|
||||||
|
+ virt_cpu_plug(hotplug_dev, dev, errp);
|
||||||
|
}
|
||||||
|
if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_IOMMU_PCI)) {
|
||||||
|
PCIDevice *pdev = PCI_DEVICE(dev);
|
||||||
|
@@ -2717,7 +2733,8 @@ static HotplugHandler *virt_machine_get_hotplug_handler(MachineState *machine,
|
||||||
|
MachineClass *mc = MACHINE_GET_CLASS(machine);
|
||||||
|
|
||||||
|
if (device_is_dynamic_sysbus(mc, dev) ||
|
||||||
|
- (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM))) {
|
||||||
|
+ (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) ||
|
||||||
|
+ (object_dynamic_cast(OBJECT(dev), TYPE_CPU))) {
|
||||||
|
return HOTPLUG_HANDLER(machine);
|
||||||
|
}
|
||||||
|
if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_IOMMU_PCI)) {
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user