From patchwork Fri Nov 12 07:24:11 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isaku Yamahata X-Patchwork-Id: 70934 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 A8D2FB7126 for ; Fri, 12 Nov 2010 18:25:55 +1100 (EST) Received: from localhost ([127.0.0.1]:35138 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PGo19-0003gK-Sl for incoming@patchwork.ozlabs.org; Fri, 12 Nov 2010 02:25:51 -0500 Received: from [140.186.70.92] (port=52109 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PGnzh-000378-1o for qemu-devel@nongnu.org; Fri, 12 Nov 2010 02:24:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PGnzc-0004fa-QJ for qemu-devel@nongnu.org; Fri, 12 Nov 2010 02:24:20 -0500 Received: from mail.valinux.co.jp ([210.128.90.3]:50710) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PGnzc-0004ee-Fy for qemu-devel@nongnu.org; Fri, 12 Nov 2010 02:24:16 -0500 Received: from ps.local.valinux.co.jp (vagw.valinux.co.jp [210.128.90.14]) by mail.valinux.co.jp (Postfix) with SMTP id CB7F5873E1; Fri, 12 Nov 2010 16:24:11 +0900 (JST) Received: (nullmailer pid 21658 invoked by uid 1000); Fri, 12 Nov 2010 07:24:11 -0000 Date: Fri, 12 Nov 2010 16:24:11 +0900 From: Isaku Yamahata To: Cam Macdonell Message-ID: <20101112072411.GG29605@valinux.co.jp> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.19 (2009-01-05) 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: "qemu-devel@nongnu.org Developers" , "Michael S. Tsirkin" Subject: [Qemu-devel] Re: Cannot not unplug cold-plugged devices 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 On Thu, Nov 11, 2010 at 11:29:39PM -0700, Cam Macdonell wrote: > Hi, > > I was trying to do a "device_del" on my ivshmem device and it won't > work unless the device is added via hotplug. If the device is > coldplugged (added at startup) then nothing happens. I think I > tracked this behaviour to the patch below. > > Is not allowing coldplugged devices to be unplugged the desired behaviour? Oh, my bad. Does the following patch help? From 45914b2fc95750b65685dfb98a435f58e38b45ba Mon Sep 17 00:00:00 2001 Message-Id: <45914b2fc95750b65685dfb98a435f58e38b45ba.1289546596.git.yamahata@valinux.co.jp> From: Isaku Yamahata Date: Fri, 12 Nov 2010 16:21:35 +0900 Subject: [PATCH] acpi/piix4: allow pci hotplug for cold plugged device. This patch fixes 5beb8ad503c88a76f2b8106c3b74b4ce485a60e1 reported by Cam Macdonell . Before the change set, cold plugged device can be hot unplugged. This patch unbreaks it. Signed-off-by: Isaku Yamahata --- hw/acpi_piix4.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c index 66c7885..bca330e 100644 --- a/hw/acpi_piix4.c +++ b/hw/acpi_piix4.c @@ -621,8 +621,10 @@ 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) + /* qemu initialization case */ + if (state && !dev->qdev.hotplugged) { return 0; + } s->pci0_status.up = 0; s->pci0_status.down = 0;