mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
hw/i386/pc: Support hv-balloon
Add the necessary plumbing for the hv-balloon driver to the PC machine. Co-developed-by: David Hildenbrand <david@redhat.com> Reviewed-by: David Hildenbrand <david@redhat.com> Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
This commit is contained in:
parent
259ebed45a
commit
9a52aa40dc
2 changed files with 23 additions and 0 deletions
|
@ -45,6 +45,7 @@ config PC
|
||||||
select ACPI_VMGENID
|
select ACPI_VMGENID
|
||||||
select VIRTIO_PMEM_SUPPORTED
|
select VIRTIO_PMEM_SUPPORTED
|
||||||
select VIRTIO_MEM_SUPPORTED
|
select VIRTIO_MEM_SUPPORTED
|
||||||
|
select HV_BALLOON_SUPPORTED
|
||||||
|
|
||||||
config PC_PCI
|
config PC_PCI
|
||||||
bool
|
bool
|
||||||
|
|
22
hw/i386/pc.c
22
hw/i386/pc.c
|
@ -27,6 +27,7 @@
|
||||||
#include "hw/i386/pc.h"
|
#include "hw/i386/pc.h"
|
||||||
#include "hw/char/serial.h"
|
#include "hw/char/serial.h"
|
||||||
#include "hw/char/parallel.h"
|
#include "hw/char/parallel.h"
|
||||||
|
#include "hw/hyperv/hv-balloon.h"
|
||||||
#include "hw/i386/fw_cfg.h"
|
#include "hw/i386/fw_cfg.h"
|
||||||
#include "hw/i386/vmport.h"
|
#include "hw/i386/vmport.h"
|
||||||
#include "sysemu/cpus.h"
|
#include "sysemu/cpus.h"
|
||||||
|
@ -57,6 +58,7 @@
|
||||||
#include "hw/i386/kvm/xen_evtchn.h"
|
#include "hw/i386/kvm/xen_evtchn.h"
|
||||||
#include "hw/i386/kvm/xen_gnttab.h"
|
#include "hw/i386/kvm/xen_gnttab.h"
|
||||||
#include "hw/i386/kvm/xen_xenstore.h"
|
#include "hw/i386/kvm/xen_xenstore.h"
|
||||||
|
#include "hw/mem/memory-device.h"
|
||||||
#include "e820_memory_layout.h"
|
#include "e820_memory_layout.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include CONFIG_DEVICES
|
#include CONFIG_DEVICES
|
||||||
|
@ -1422,6 +1424,21 @@ static void pc_memory_unplug(HotplugHandler *hotplug_dev,
|
||||||
error_propagate(errp, local_err);
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
static void pc_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev,
|
static void pc_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev,
|
||||||
DeviceState *dev, Error **errp)
|
DeviceState *dev, Error **errp)
|
||||||
{
|
{
|
||||||
|
@ -1452,6 +1469,8 @@ static void pc_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pcms->iommu = dev;
|
pcms->iommu = dev;
|
||||||
|
} else if (object_dynamic_cast(OBJECT(dev), TYPE_HV_BALLOON)) {
|
||||||
|
pc_hv_balloon_pre_plug(hotplug_dev, dev, errp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1464,6 +1483,8 @@ static void pc_machine_device_plug_cb(HotplugHandler *hotplug_dev,
|
||||||
x86_cpu_plug(hotplug_dev, dev, errp);
|
x86_cpu_plug(hotplug_dev, dev, errp);
|
||||||
} else if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_MD_PCI)) {
|
} else if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_MD_PCI)) {
|
||||||
virtio_md_pci_plug(VIRTIO_MD_PCI(dev), MACHINE(hotplug_dev), errp);
|
virtio_md_pci_plug(VIRTIO_MD_PCI(dev), MACHINE(hotplug_dev), errp);
|
||||||
|
} else if (object_dynamic_cast(OBJECT(dev), TYPE_HV_BALLOON)) {
|
||||||
|
pc_hv_balloon_plug(hotplug_dev, dev, errp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1505,6 +1526,7 @@ static HotplugHandler *pc_get_hotplug_handler(MachineState *machine,
|
||||||
object_dynamic_cast(OBJECT(dev), TYPE_CPU) ||
|
object_dynamic_cast(OBJECT(dev), TYPE_CPU) ||
|
||||||
object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_MD_PCI) ||
|
object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_MD_PCI) ||
|
||||||
object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_IOMMU_PCI) ||
|
object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_IOMMU_PCI) ||
|
||||||
|
object_dynamic_cast(OBJECT(dev), TYPE_HV_BALLOON) ||
|
||||||
object_dynamic_cast(OBJECT(dev), TYPE_X86_IOMMU_DEVICE)) {
|
object_dynamic_cast(OBJECT(dev), TYPE_X86_IOMMU_DEVICE)) {
|
||||||
return HOTPLUG_HANDLER(machine);
|
return HOTPLUG_HANDLER(machine);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue