From patchwork Wed May 26 08:43:17 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 53594 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id D7F08B7D1A for ; Wed, 26 May 2010 18:44:13 +1000 (EST) Received: from localhost ([127.0.0.1]:39141 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OHCDj-0001sh-6z for incoming@patchwork.ozlabs.org; Wed, 26 May 2010 04:44:11 -0400 Received: from [140.186.70.92] (port=60219 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OHCCw-0001sX-BO for qemu-devel@nongnu.org; Wed, 26 May 2010 04:43:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OHCCu-0004FS-V8 for qemu-devel@nongnu.org; Wed, 26 May 2010 04:43:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37843) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OHCCu-0004FH-Mv for qemu-devel@nongnu.org; Wed, 26 May 2010 04:43:20 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o4Q8hJnk028653 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 26 May 2010 04:43:19 -0400 Received: from zweiblum.home.kraxel.org (vpn1-7-204.ams2.redhat.com [10.36.7.204]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o4Q8hIZE014599; Wed, 26 May 2010 04:43:18 -0400 Received: by zweiblum.home.kraxel.org (Postfix, from userid 500) id 1EB0E7012B; Wed, 26 May 2010 10:43:17 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Wed, 26 May 2010 10:43:17 +0200 Message-Id: <1274863397-15005-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH] all vga: refuse hotplugging. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Try to pci hotplug a vga card, watch qemu die with hw_error(). This patch fixes it. Signed-off-by: Gerd Hoffmann --- hw/cirrus_vga.c | 4 ++++ hw/vga-pci.c | 4 ++++ hw/vmware_vga.c | 4 ++++ 3 files changed, 12 insertions(+), 0 deletions(-) diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c index ba48289..5175725 100644 --- a/hw/cirrus_vga.c +++ b/hw/cirrus_vga.c @@ -3188,6 +3188,10 @@ static int pci_cirrus_vga_initfn(PCIDevice *dev) uint8_t *pci_conf = d->dev.config; int device_id = CIRRUS_ID_CLGD5446; + if (dev->qdev.hotplugged) { + return -1; + } + /* setup VGA */ vga_common_init(&s->vga, VGA_RAM_SIZE); cirrus_init_common(s, device_id, 1); diff --git a/hw/vga-pci.c b/hw/vga-pci.c index c8d260c..a2de201 100644 --- a/hw/vga-pci.c +++ b/hw/vga-pci.c @@ -79,6 +79,10 @@ static int pci_vga_initfn(PCIDevice *dev) VGACommonState *s = &d->vga; uint8_t *pci_conf = d->dev.config; + if (dev->qdev.hotplugged) { + return -1; + } + // vga + console init vga_common_init(s, VGA_RAM_SIZE); vga_init(s); diff --git a/hw/vmware_vga.c b/hw/vmware_vga.c index 4e7a75d..d12d86f 100644 --- a/hw/vmware_vga.c +++ b/hw/vmware_vga.c @@ -1232,6 +1232,10 @@ static int pci_vmsvga_initfn(PCIDevice *dev) struct pci_vmsvga_state_s *s = DO_UPCAST(struct pci_vmsvga_state_s, card, dev); + if (dev->qdev.hotplugged) { + return -1; + } + pci_config_set_vendor_id(s->card.config, PCI_VENDOR_ID_VMWARE); pci_config_set_device_id(s->card.config, SVGA_PCI_DEVICE_ID); s->card.config[PCI_COMMAND] = PCI_COMMAND_IO |