[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[qemu-s390x] [PATCH v1 3/8] spapr: move all DIMM checks into spapr_memor
From: |
David Hildenbrand |
Subject: |
[qemu-s390x] [PATCH v1 3/8] spapr: move all DIMM checks into spapr_memory_plug |
Date: |
Thu, 7 Jun 2018 18:52:13 +0200 |
Let's clean the hotplug handler up by moving everything into
spapr_memory_plug().
Signed-off-by: David Hildenbrand <address@hidden>
---
hw/ppc/spapr.c | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index d038f3243e..a12be24ca9 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -3136,14 +3136,22 @@ static void spapr_add_lmbs(DeviceState *dev, uint64_t
addr_start, uint64_t size,
}
static void spapr_memory_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
- uint32_t node, Error **errp)
+ Error **errp)
{
Error *local_err = NULL;
sPAPRMachineState *ms = SPAPR_MACHINE(hotplug_dev);
+ sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(ms);
PCDIMMDevice *dimm = PC_DIMM(dev);
PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(dimm);
MemoryRegion *mr;
uint64_t align, size, addr;
+ uint32_t node;
+
+ if (!smc->dr_lmb_enabled) {
+ error_setg(&local_err, "Memory hotplug not supported for this
machine");
+ goto out;
+ }
+ node = object_property_get_uint(OBJECT(dev), PC_DIMM_NODE_PROP, NULL);
mr = ddc->get_memory_region(dimm, &local_err);
if (local_err) {
@@ -3568,19 +3576,8 @@ out:
static void spapr_machine_device_plug(HotplugHandler *hotplug_dev,
DeviceState *dev, Error **errp)
{
- MachineState *ms = MACHINE(hotplug_dev);
- sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(ms);
-
if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
- int node;
-
- if (!smc->dr_lmb_enabled) {
- error_setg(errp, "Memory hotplug not supported for this machine");
- return;
- }
- node = object_property_get_uint(OBJECT(dev), PC_DIMM_NODE_PROP, NULL);
-
- spapr_memory_plug(hotplug_dev, dev, node, errp);
+ spapr_memory_plug(hotplug_dev, dev, errp);
} else if (object_dynamic_cast(OBJECT(dev), TYPE_SPAPR_CPU_CORE)) {
spapr_core_plug(hotplug_dev, dev, errp);
}
--
2.17.0
- Re: [qemu-s390x] [PATCH v1 2/8] spapr: no need to verify the node, (continued)
- Re: [qemu-s390x] [PATCH v1 2/8] spapr: no need to verify the node, Igor Mammedov, 2018/06/08
- Re: [qemu-s390x] [PATCH v1 2/8] spapr: no need to verify the node, David Hildenbrand, 2018/06/08
- Re: [qemu-s390x] [PATCH v1 2/8] spapr: no need to verify the node, Igor Mammedov, 2018/06/08
- Re: [qemu-s390x] [PATCH v1 2/8] spapr: no need to verify the node, David Hildenbrand, 2018/06/08
- Re: [qemu-s390x] [PATCH v1 2/8] spapr: no need to verify the node, Greg Kurz, 2018/06/08
- Re: [qemu-s390x] [PATCH v1 2/8] spapr: no need to verify the node, David Hildenbrand, 2018/06/08
- Re: [qemu-s390x] [PATCH v1 2/8] spapr: no need to verify the node, Cornelia Huck, 2018/06/08
- Re: [qemu-s390x] [PATCH v1 2/8] spapr: no need to verify the node, Greg Kurz, 2018/06/08
- Re: [qemu-s390x] [PATCH v1 2/8] spapr: no need to verify the node, David Gibson, 2018/06/08
- Re: [qemu-s390x] [PATCH v1 2/8] spapr: no need to verify the node, David Hildenbrand, 2018/06/08
[qemu-s390x] [PATCH v1 3/8] spapr: move all DIMM checks into spapr_memory_plug,
David Hildenbrand <=
[qemu-s390x] [PATCH v1 5/8] spapr: introduce machine unplug handler, David Hildenbrand, 2018/06/07
[qemu-s390x] [PATCH v1 4/8] spapr: local error handling in hotplug handler functions, David Hildenbrand, 2018/06/07