@ -88,13 +88,11 @@
# include "hw/net/ne2000-isa.h"
# include "standard-headers/asm-x86/bootparam.h"
# include "hw/virtio/virtio-iommu.h"
# include "hw/virtio/virtio-pmem-pci.h"
# include "hw/virtio/virtio-mem-pci.h"
# include "hw/virtio/virtio-md-pci.h"
# include "hw/i386/kvm/xen_overlay.h"
# 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"
@ -1493,68 +1491,6 @@ static void pc_memory_unplug(HotplugHandler *hotplug_dev,
error_propagate ( errp , local_err ) ;
}
static void pc_virtio_md_pci_pre_plug ( HotplugHandler * hotplug_dev ,
DeviceState * dev , Error * * errp )
{
HotplugHandler * hotplug_dev2 = qdev_get_bus_hotplug_handler ( dev ) ;
Error * local_err = NULL ;
if ( ! hotplug_dev2 & & dev - > hotplugged ) {
/*
* Without a bus hotplug handler , we cannot control the plug / unplug
* order . We should never reach this point when hotplugging on x86 ,
* however , better add a safety net .
*/
error_setg ( errp , " hotplug of virtio based memory devices not supported "
" on this bus. " ) ;
return ;
}
/*
* First , see if we can plug this memory device at all . If that
* succeeds , branch of to the actual hotplug handler .
*/
memory_device_pre_plug ( MEMORY_DEVICE ( dev ) , MACHINE ( hotplug_dev ) , NULL ,
& local_err ) ;
if ( ! local_err & & hotplug_dev2 ) {
hotplug_handler_pre_plug ( hotplug_dev2 , dev , & local_err ) ;
}
error_propagate ( errp , local_err ) ;
}
static void pc_virtio_md_pci_plug ( HotplugHandler * hotplug_dev ,
DeviceState * dev , Error * * errp )
{
HotplugHandler * hotplug_dev2 = qdev_get_bus_hotplug_handler ( dev ) ;
Error * local_err = NULL ;
/*
* Plug the memory device first and then branch off to the actual
* hotplug handler . If that one fails , we can easily undo the memory
* device bits .
*/
memory_device_plug ( MEMORY_DEVICE ( dev ) , MACHINE ( hotplug_dev ) ) ;
if ( hotplug_dev2 ) {
hotplug_handler_plug ( hotplug_dev2 , dev , & local_err ) ;
if ( local_err ) {
memory_device_unplug ( MEMORY_DEVICE ( dev ) , MACHINE ( hotplug_dev ) ) ;
}
}
error_propagate ( errp , local_err ) ;
}
static void pc_virtio_md_pci_unplug_request ( HotplugHandler * hotplug_dev ,
DeviceState * dev , Error * * errp )
{
/* We don't support hot unplug of virtio based memory devices */
error_setg ( errp , " virtio based memory devices cannot be unplugged. " ) ;
}
static void pc_virtio_md_pci_unplug ( HotplugHandler * hotplug_dev ,
DeviceState * dev , Error * * errp )
{
/* We don't support hot unplug of virtio based memory devices */
}
static void pc_machine_device_pre_plug_cb ( HotplugHandler * hotplug_dev ,
DeviceState * dev , Error * * errp )
{
@ -1562,9 +1498,8 @@ static void pc_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev,
pc_memory_pre_plug ( hotplug_dev , dev , errp ) ;
} else if ( object_dynamic_cast ( OBJECT ( dev ) , TYPE_CPU ) ) {
x86_cpu_pre_plug ( hotplug_dev , dev , errp ) ;
} else if ( object_dynamic_cast ( OBJECT ( dev ) , TYPE_VIRTIO_PMEM_PCI ) | |
object_dynamic_cast ( OBJECT ( dev ) , TYPE_VIRTIO_MEM_PCI ) ) {
pc_virtio_md_pci_pre_plug ( hotplug_dev , dev , errp ) ;
} else if ( object_dynamic_cast ( OBJECT ( dev ) , TYPE_VIRTIO_MD_PCI ) ) {
virtio_md_pci_pre_plug ( VIRTIO_MD_PCI ( dev ) , MACHINE ( hotplug_dev ) , errp ) ;
} else if ( object_dynamic_cast ( OBJECT ( dev ) , TYPE_VIRTIO_IOMMU_PCI ) ) {
/* Declare the APIC range as the reserved MSI region */
char * resv_prop_str = g_strdup_printf ( " 0xfee00000:0xfeefffff:%d " ,
@ -1596,9 +1531,8 @@ static void pc_machine_device_plug_cb(HotplugHandler *hotplug_dev,
pc_memory_plug ( hotplug_dev , dev , errp ) ;
} else if ( object_dynamic_cast ( OBJECT ( dev ) , TYPE_CPU ) ) {
x86_cpu_plug ( hotplug_dev , dev , errp ) ;
} else if ( object_dynamic_cast ( OBJECT ( dev ) , TYPE_VIRTIO_PMEM_PCI ) | |
object_dynamic_cast ( OBJECT ( dev ) , TYPE_VIRTIO_MEM_PCI ) ) {
pc_virtio_md_pci_plug ( hotplug_dev , dev , errp ) ;
} else if ( object_dynamic_cast ( OBJECT ( dev ) , TYPE_VIRTIO_MD_PCI ) ) {
virtio_md_pci_plug ( VIRTIO_MD_PCI ( dev ) , MACHINE ( hotplug_dev ) , errp ) ;
}
}
@ -1609,9 +1543,9 @@ static void pc_machine_device_unplug_request_cb(HotplugHandler *hotplug_dev,
pc_memory_unplug_request ( hotplug_dev , dev , errp ) ;
} else if ( object_dynamic_cast ( OBJECT ( dev ) , TYPE_CPU ) ) {
x86_cpu_unplug_request_cb ( hotplug_dev , dev , errp ) ;
} else if ( object_dynamic_cast ( OBJECT ( dev ) , TYPE_VIRTIO_PMEM_PCI ) | |
object_dynamic_cast ( OBJECT ( dev ) , TYPE_VIRTIO_MEM_PCI ) ) {
pc_virtio_md_pci_unplug_request ( hotplug_dev , dev , errp ) ;
} else if ( object_dynamic_cast ( OBJECT ( dev ) , TYPE_VIRTIO_MD_PCI ) ) {
virtio_md_pci_unplug_request ( VIRTIO_MD_PCI ( dev ) , MACHINE ( hotplug_dev ) ,
errp ) ;
} else {
error_setg ( errp , " acpi: device unplug request for not supported device "
" type: %s " , object_get_typename ( OBJECT ( dev ) ) ) ;
@ -1625,9 +1559,8 @@ static void pc_machine_device_unplug_cb(HotplugHandler *hotplug_dev,
pc_memory_unplug ( hotplug_dev , dev , errp ) ;
} else if ( object_dynamic_cast ( OBJECT ( dev ) , TYPE_CPU ) ) {
x86_cpu_unplug_cb ( hotplug_dev , dev , errp ) ;
} else if ( object_dynamic_cast ( OBJECT ( dev ) , TYPE_VIRTIO_PMEM_PCI ) | |
object_dynamic_cast ( OBJECT ( dev ) , TYPE_VIRTIO_MEM_PCI ) ) {
pc_virtio_md_pci_unplug ( hotplug_dev , dev , errp ) ;
} else if ( object_dynamic_cast ( OBJECT ( dev ) , TYPE_VIRTIO_MD_PCI ) ) {
virtio_md_pci_unplug ( VIRTIO_MD_PCI ( dev ) , MACHINE ( hotplug_dev ) , errp ) ;
} else {
error_setg ( errp , " acpi: device unplug for not supported device "
" type: %s " , object_get_typename ( OBJECT ( dev ) ) ) ;
@ -1639,8 +1572,7 @@ static HotplugHandler *pc_get_hotplug_handler(MachineState *machine,
{
if ( object_dynamic_cast ( OBJECT ( dev ) , TYPE_PC_DIMM ) | |
object_dynamic_cast ( OBJECT ( dev ) , TYPE_CPU ) | |
object_dynamic_cast ( OBJECT ( dev ) , TYPE_VIRTIO_PMEM_PCI ) | |
object_dynamic_cast ( OBJECT ( dev ) , TYPE_VIRTIO_MEM_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_X86_IOMMU_DEVICE ) ) {
return HOTPLUG_HANDLER ( machine ) ;