qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v7 7/7] hw/i386/pc: Support hv-balloon


From: David Hildenbrand
Subject: Re: [PATCH v7 7/7] hw/i386/pc: Support hv-balloon
Date: Wed, 27 Sep 2023 12:49:53 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1

On 28.08.23 18:48, Maciej S. Szmigiero wrote:
From: "Maciej S. Szmigiero" <maciej.szmigiero@oracle.com>

Add the necessary plumbing for the hv-balloon driver to the PC machine.

Co-developed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
---
  hw/i386/Kconfig |  1 +
  hw/i386/pc.c    | 22 ++++++++++++++++++++++
  2 files changed, 23 insertions(+)

diff --git a/hw/i386/Kconfig b/hw/i386/Kconfig
index 9051083c1e78..349cf0d32fad 100644
--- a/hw/i386/Kconfig
+++ b/hw/i386/Kconfig
@@ -45,6 +45,7 @@ config PC
      select ACPI_VMGENID
      select VIRTIO_PMEM_SUPPORTED
      select VIRTIO_MEM_SUPPORTED
+    select HV_BALLOON_SUPPORTED
config PC_PCI
      bool
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 54838c0c411d..d979479cab5e 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -28,6 +28,7 @@
  #include "hw/i386/pc.h"
  #include "hw/char/serial.h"
  #include "hw/char/parallel.h"
+#include "hw/hyperv/hv-balloon.h"
  #include "hw/i386/topology.h"
  #include "hw/i386/fw_cfg.h"
  #include "hw/i386/vmport.h"
@@ -93,6 +94,7 @@
  #include "hw/i386/kvm/xen_evtchn.h"
  #include "hw/i386/kvm/xen_gnttab.h"
  #include "hw/i386/kvm/xen_xenstore.h"
+#include "hw/mem/memory-device.h"
  #include "sysemu/replay.h"
  #include "target/i386/cpu.h"
  #include "e820_memory_layout.h"
@@ -1494,6 +1496,21 @@ static void pc_memory_unplug(HotplugHandler *hotplug_dev,
      error_propagate(errp, local_err);
  }
+static void pc_hv_balloon_pre_plug(HotplugHandler *hotplug_dev,
+                                   DeviceState *dev, Error **errp)
+{
+    /* The vmbus handler has no hotplug handler; we should never end up here. 
*/
+    g_assert(!dev->hotplugged);
+    memory_device_pre_plug(MEMORY_DEVICE(dev), MACHINE(hotplug_dev), NULL,
+                           errp);
+}
+
+static void pc_hv_balloon_plug(HotplugHandler *hotplug_dev,
+                               DeviceState *dev, Error **errp)
+{
+    memory_device_plug(MEMORY_DEVICE(dev), MACHINE(hotplug_dev));
+}
+


Maybe we want to have hv_balloon_pre_plug() and hv_balloon_plug(), but this here should be good enough for now.

Reviewed-by: David Hildenbrand <david@redhat.com>

--
Cheers,

David / dhildenb




reply via email to

[Prev in Thread] Current Thread [Next in Thread]