From patchwork Mon Sep 6 07:46:18 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isaku Yamahata X-Patchwork-Id: 63882 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 E8409B70E9 for ; Mon, 6 Sep 2010 17:41:50 +1000 (EST) Received: from localhost ([127.0.0.1]:50287 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OsWKp-0005I9-HC for incoming@patchwork.ozlabs.org; Mon, 06 Sep 2010 03:41:47 -0400 Received: from [140.186.70.92] (port=37938 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OsWCO-0000Nf-Vz for qemu-devel@nongnu.org; Mon, 06 Sep 2010 03:33:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OsWCM-0005mP-HM for qemu-devel@nongnu.org; Mon, 06 Sep 2010 03:33:04 -0400 Received: from mail.valinux.co.jp ([210.128.90.3]:42955) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OsWCM-0005lk-8s for qemu-devel@nongnu.org; Mon, 06 Sep 2010 03:33:02 -0400 Received: from ps.local.valinux.co.jp (vagw.valinux.co.jp [210.128.90.14]) by mail.valinux.co.jp (Postfix) with SMTP id BDBCD107A91; Mon, 6 Sep 2010 16:32:56 +0900 (JST) Received: (nullmailer pid 21915 invoked by uid 1000); Mon, 06 Sep 2010 07:46:28 -0000 From: Isaku Yamahata To: qemu-devel@nongnu.org Date: Mon, 6 Sep 2010 16:46:18 +0900 Message-Id: X-Mailer: git-send-email 1.7.1.1 In-Reply-To: References: In-Reply-To: References: X-Virus-Scanned: clamav-milter 0.95.2 at va-mail.local.valinux.co.jp X-Virus-Status: Clean X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: skandasa@cisco.com, etmartin@cisco.com, wexu2@cisco.com, mst@redhat.com, adhyas@gmail.com, yamahata@valinux.co.jp Subject: [Qemu-devel] [PATCH 04/14] pci: call hotplug callback even when not hotplug case for later use. 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 call hotplug callback even when not hotplug case for later use. And move hotplug check into hotplug callback. PCIE slot needs this for card presence detection. Signed-off-by: Isaku Yamahata --- hw/acpi_piix4.c | 3 +++ hw/pci.c | 3 ++- 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c index bfa1d9a..24dfcf2 100644 --- a/hw/acpi_piix4.c +++ b/hw/acpi_piix4.c @@ -611,6 +611,9 @@ static int piix4_device_hotplug(DeviceState *qdev, PCIDevice *dev, int state) PIIX4PMState *s = DO_UPCAST(PIIX4PMState, dev, DO_UPCAST(PCIDevice, qdev, qdev)); + if (!dev->qdev.hotplugged) + return 0; + s->pci0_status.up = 0; s->pci0_status.down = 0; if (state) { diff --git a/hw/pci.c b/hw/pci.c index 754ffb3..bb9ddea 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -1514,7 +1514,8 @@ static int pci_qdev_init(DeviceState *qdev, DeviceInfo *base) pci_dev->romfile = qemu_strdup(info->romfile); pci_add_option_rom(pci_dev); - if (qdev->hotplugged) { + if (bus->hotplug) { + /* lower layer must check qdev->hotplugged */ rc = bus->hotplug(bus->hotplug_qdev, pci_dev, 1); if (rc != 0) { int r = pci_unregister_device(&pci_dev->qdev);