File kvm-qemu-no-hot-unplug-for-certain-devices.patch of Package kvm
This patch is in the spirit of upstream fixes which exclude certain
devices from taking part in hot-unplug handling, specifically those
which do not have complete hot-unplug handling, and for which we do
not want to even try to allow hot-unplug. See bnc#690781.
Signed-off-by: Bruce Rogers <brogers@novell.com
Index: qemu-kvm-0.12.5/hw/acpi.c
===================================================================
--- qemu-kvm-0.12.5.orig/hw/acpi.c
+++ qemu-kvm-0.12.5/hw/acpi.c
@@ -720,7 +720,8 @@ static void pciej_write(void *opaque, ui
QLIST_FOREACH_SAFE(qdev, &bus->children, sibling, next) {
dev = DO_UPCAST(PCIDevice, qdev, qdev);
- if (PCI_SLOT(dev->devfn) == slot) {
+ if (PCI_SLOT(dev->devfn) == slot && (qdev->info == NULL ||
+ !qdev->info->no_hotplug)) {
qdev_free(qdev);
}
}
Index: qemu-kvm-0.12.5/hw/vga-pci.c
===================================================================
--- qemu-kvm-0.12.5.orig/hw/vga-pci.c
+++ qemu-kvm-0.12.5/hw/vga-pci.c
@@ -131,6 +131,7 @@ static PCIDeviceInfo vga_info = {
.qdev.name = "VGA",
.qdev.size = sizeof(PCIVGAState),
.qdev.vmsd = &vmstate_vga_pci,
+ .qdev.no_hotplug = 1,
.init = pci_vga_initfn,
.config_write = pci_vga_write_config,
.qdev.props = (Property[]) {
Index: qemu-kvm-0.12.5/hw/qdev.h
===================================================================
--- qemu-kvm-0.12.5.orig/hw/qdev.h
+++ qemu-kvm-0.12.5/hw/qdev.h
@@ -128,6 +128,8 @@ struct DeviceInfo {
size_t size;
Property *props;
int no_user;
+ /* Kludge! for use with hot-unplug unsafe pci devices only: */
+ int no_hotplug;
/* callbacks */
qdev_resetfn reset;
Index: qemu-kvm-0.12.5/hw/cirrus_vga.c
===================================================================
--- qemu-kvm-0.12.5.orig/hw/cirrus_vga.c
+++ qemu-kvm-0.12.5/hw/cirrus_vga.c
@@ -3242,6 +3242,7 @@ static PCIDeviceInfo cirrus_vga_info = {
.qdev.desc = "Cirrus CLGD 54xx VGA",
.qdev.size = sizeof(PCICirrusVGAState),
.qdev.vmsd = &vmstate_pci_cirrus_vga,
+ .qdev.no_hotplug = 1,
.init = pci_cirrus_vga_initfn,
.romfile = VGABIOS_CIRRUS_FILENAME,
.config_write = pci_cirrus_write_config,
Index: qemu-kvm-0.12.5/hw/ide/piix.c
===================================================================
--- qemu-kvm-0.12.5.orig/hw/ide/piix.c
+++ qemu-kvm-0.12.5/hw/ide/piix.c
@@ -216,11 +216,13 @@ static PCIDeviceInfo piix_ide_info[] = {
.qdev.name = "piix3-ide",
.qdev.size = sizeof(PCIIDEState),
.qdev.no_user = 1,
+ .qdev.no_hotplug = 1,
.init = pci_piix3_ide_initfn,
},{
.qdev.name = "piix4-ide",
.qdev.size = sizeof(PCIIDEState),
.qdev.no_user = 1,
+ .qdev.no_hotplug = 1,
.init = pci_piix4_ide_initfn,
},{
.qdev.name = "ICH6 IDE",
Index: qemu-kvm-0.12.5/hw/piix_pci.c
===================================================================
--- qemu-kvm-0.12.5.orig/hw/piix_pci.c
+++ qemu-kvm-0.12.5/hw/piix_pci.c
@@ -347,6 +347,7 @@ static PCIDeviceInfo i440fx_info[] = {
.qdev.size = sizeof(PCII440FXState),
.qdev.vmsd = &vmstate_i440fx,
.qdev.no_user = 1,
+ .qdev.no_hotplug = 1,
.init = i440fx_initfn,
.config_write = i440fx_write_config,
},{
@@ -355,6 +356,7 @@ static PCIDeviceInfo i440fx_info[] = {
.qdev.size = sizeof(PIIX3State),
.qdev.vmsd = &vmstate_piix3,
.qdev.no_user = 1,
+ .qdev.no_hotplug = 1,
.init = piix3_initfn,
},{
/* end of list */
Index: qemu-kvm-0.12.5/hw/vmware_vga.c
===================================================================
--- qemu-kvm-0.12.5.orig/hw/vmware_vga.c
+++ qemu-kvm-0.12.5/hw/vmware_vga.c
@@ -1243,6 +1243,7 @@ static PCIDeviceInfo vmsvga_info = {
.qdev.name = "vmware-svga",
.qdev.size = sizeof(struct pci_vmsvga_state_s),
.qdev.vmsd = &vmstate_vmware_vga,
+ .qdev.no_hotplug = 1,
.init = pci_vmsvga_initfn,
};
Index: qemu-kvm-0.12.5/hw/piix4.c
===================================================================
--- qemu-kvm-0.12.5.orig/hw/piix4.c
+++ qemu-kvm-0.12.5/hw/piix4.c
@@ -115,6 +115,7 @@ static PCIDeviceInfo piix4_info[] = {
.qdev.desc = "ISA bridge",
.qdev.size = sizeof(PCIDevice),
.qdev.no_user = 1,
+ .qdev.no_hotplug = 1,
.init = piix4_initfn,
},{
/* end of list */