From patchwork Fri Nov 12 06:29:39 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Cannot not unplug cold-plugged devices Date: Thu, 11 Nov 2010 20:29:39 -0000 From: Cam Macdonell X-Patchwork-Id: 70929 Message-Id: To: "qemu-devel@nongnu.org Developers" Cc: Isaku Yamahata , "Michael S. Tsirkin" 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? Thanks, Cam commit 5beb8ad503c88a76f2b8106c3b74b4ce485a60e1 Author: Isaku Yamahata Date: Mon Sep 6 16:46:18 2010 +0900 pci: call hotplug callback even when not hotplug case for later use. 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 Signed-off-by: Michael S. Tsirkin if (state) { 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;