Blob Blame History Raw
From 437d5386e39a7955bf7a08c3af4d34ac74d677a2 Mon Sep 17 00:00:00 2001
From: Igor Mammedov <imammedo@redhat.com>
Date: Wed, 31 Jan 2018 10:44:31 +0100
Subject: [PATCH 8/8] spapr: disable memory hotplug

RH-Author: Igor Mammedov <imammedo@redhat.com>
Message-id: <1517395471-44118-1-git-send-email-imammedo@redhat.com>
Patchwork-id: 78748
O-Subject: [RHV7.5 qemu-kvm-ma PATCH v3] spapr: disable memory hotplug
Bugzilla: 1535952
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1535952
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=15146188
Upstream: RHEL-only

Disable memory hotplug for qemu-kvm-ma variant of QEMU where
shouldn't be supported.
Use CONFIG_RHV to switch feature off only for qemu-kvm-ma and
not to affect RHEV variant built from the same source code.

PS:
Disable only (un)plug entry points from device_add/del and
leave the rest of hotplug hw intact so that -ma machine
could be migrated to -rhev.
Note: backward migration would be broken if source -rhev
machine used pc-dimm devices (either with -device/device_add)

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
 hw/ppc/spapr.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 4f1ab14..6c4c088 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -2992,6 +2992,9 @@ out:
 static void spapr_memory_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
                                   Error **errp)
 {
+#if !defined(CONFIG_RHV)
+    error_setg(errp, "Memory hotplug not supported for this machine");
+#else
     PCDIMMDevice *dimm = PC_DIMM(dev);
     PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(dimm);
     MemoryRegion *mr;
@@ -3019,6 +3022,7 @@ static void spapr_memory_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
 
 out:
     g_free(mem_dev);
+#endif
 }
 
 struct sPAPRDIMMState {
@@ -3132,6 +3136,9 @@ void spapr_lmb_release(DeviceState *dev)
 static void spapr_memory_unplug_request(HotplugHandler *hotplug_dev,
                                         DeviceState *dev, Error **errp)
 {
+#if !defined(CONFIG_RHV)
+    error_setg(errp, "Memory hot unplug not supported for this machine");
+#else
     sPAPRMachineState *spapr = SPAPR_MACHINE(hotplug_dev);
     Error *local_err = NULL;
     PCDIMMDevice *dimm = PC_DIMM(dev);
@@ -3186,6 +3193,7 @@ static void spapr_memory_unplug_request(HotplugHandler *hotplug_dev,
                                               nr_lmbs, spapr_drc_index(drc));
 out:
     error_propagate(errp, local_err);
+#endif
 }
 
 static void *spapr_populate_hotplug_cpu_dt(CPUState *cs, int *fdt_offset,
-- 
1.8.3.1