Blame 0012-all-vga-refuse-hotplugging.patch

Justin M. Forbes a81953
From a659f6b472d95503657ac68a52242ce769006f17 Mon Sep 17 00:00:00 2001
Justin M. Forbes a81953
From: Gerd Hoffmann <kraxel@redhat.com>
Justin M. Forbes a81953
Date: Tue, 11 May 2010 22:28:44 +0200
Justin M. Forbes a81953
Subject: [PATCH 12/39] all vga: refuse hotplugging.
Justin M. Forbes a81953
Justin M. Forbes a81953
Try to pci hotplug a vga card, watch qemu die with hw_error().
Justin M. Forbes a81953
This patch fixes it.
Justin M. Forbes a81953
---
Justin M. Forbes a81953
 hw/cirrus_vga.c |    4 ++++
Justin M. Forbes a81953
 hw/vga-pci.c    |    4 ++++
Justin M. Forbes a81953
 hw/vmware_vga.c |    4 ++++
Justin M. Forbes a81953
 3 files changed, 12 insertions(+), 0 deletions(-)
Justin M. Forbes a81953
Justin M. Forbes a81953
diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c
Justin M. Forbes a81953
index efa7a42..dadaa80 100644
Justin M. Forbes a81953
--- a/hw/cirrus_vga.c
Justin M. Forbes a81953
+++ b/hw/cirrus_vga.c
Justin M. Forbes a81953
@@ -3206,6 +3206,10 @@ static int pci_cirrus_vga_initfn(PCIDevice *dev)
Justin M. Forbes a81953
      uint8_t *pci_conf = d->dev.config;
Justin M. Forbes a81953
      int device_id = CIRRUS_ID_CLGD5446;
Justin M. Forbes a81953
Justin M. Forbes a81953
+     if (dev->qdev.hotplugged) {
Justin M. Forbes a81953
+         return -1;
Justin M. Forbes a81953
+     }
Justin M. Forbes a81953
+
Justin M. Forbes a81953
      /* setup VGA */
Justin M. Forbes a81953
      vga_common_init(&s->vga, VGA_RAM_SIZE);
Justin M. Forbes a81953
      cirrus_init_common(s, device_id, 1);
Justin M. Forbes a81953
diff --git a/hw/vga-pci.c b/hw/vga-pci.c
Justin M. Forbes a81953
index 8e1ed35..4e673a5 100644
Justin M. Forbes a81953
--- a/hw/vga-pci.c
Justin M. Forbes a81953
+++ b/hw/vga-pci.c
Justin M. Forbes a81953
@@ -81,6 +81,10 @@ static int pci_vga_initfn(PCIDevice *dev)
Justin M. Forbes a81953
      VGACommonState *s = &d->vga;
Justin M. Forbes a81953
      uint8_t *pci_conf = d->dev.config;
Justin M. Forbes a81953
Justin M. Forbes a81953
+     if (dev->qdev.hotplugged) {
Justin M. Forbes a81953
+         return -1;
Justin M. Forbes a81953
+     }
Justin M. Forbes a81953
+
Justin M. Forbes a81953
      // vga + console init
Justin M. Forbes a81953
      vga_common_init(s, VGA_RAM_SIZE);
Justin M. Forbes a81953
      vga_init(s);
Justin M. Forbes a81953
diff --git a/hw/vmware_vga.c b/hw/vmware_vga.c
Justin M. Forbes a81953
index 682f287..7ff89aa 100644
Justin M. Forbes a81953
--- a/hw/vmware_vga.c
Justin M. Forbes a81953
+++ b/hw/vmware_vga.c
Justin M. Forbes a81953
@@ -1232,6 +1232,10 @@ static int pci_vmsvga_initfn(PCIDevice *dev)
Justin M. Forbes a81953
     struct pci_vmsvga_state_s *s =
Justin M. Forbes a81953
         DO_UPCAST(struct pci_vmsvga_state_s, card, dev);
Justin M. Forbes a81953
Justin M. Forbes a81953
+    if (dev->qdev.hotplugged) {
Justin M. Forbes a81953
+        return -1;
Justin M. Forbes a81953
+    }
Justin M. Forbes a81953
+
Justin M. Forbes a81953
     pci_config_set_vendor_id(s->card.config, PCI_VENDOR_ID_VMWARE);
Justin M. Forbes a81953
     pci_config_set_device_id(s->card.config, SVGA_PCI_DEVICE_ID);
Justin M. Forbes a81953
     pci_config_set_class(s->card.config, PCI_CLASS_DISPLAY_VGA);
Justin M. Forbes a81953
-- 
Justin M. Forbes a81953
1.7.2.3
Justin M. Forbes a81953