From: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: Stefan Hajnoczi <stefanha@gmail.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
Avi Kivity <avi@redhat.com>,
Anthony Liguori <anthony@codemonkey.ws>,
Jan Kiszka <jan.kiszka@siemens.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: [Qemu-devel] [patch v4 04/16] pci: remove pci device from mem view when unplug
Date: Mon, 22 Oct 2012 17:23:47 +0800 [thread overview]
Message-ID: <1350897839-29593-5-git-send-email-pingfank@linux.vnet.ibm.com> (raw)
In-Reply-To: <1350897839-29593-1-git-send-email-pingfank@linux.vnet.ibm.com>
Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
---
hw/acpi_piix4.c | 2 +-
hw/pci.c | 13 ++++++++++++-
hw/pci.h | 1 +
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c
index c56220b..a78b0e3 100644
--- a/hw/acpi_piix4.c
+++ b/hw/acpi_piix4.c
@@ -305,7 +305,7 @@ static void acpi_piix_eject_slot(PIIX4PMState *s, unsigned slots)
if (pc->no_hotplug) {
slot_free = false;
} else {
- qdev_free(qdev);
+ qdev_unplug_complete(qdev, NULL);
}
}
}
diff --git a/hw/pci.c b/hw/pci.c
index 4d95984..3e2a081 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -850,7 +850,6 @@ static int pci_unregister_device(DeviceState *dev)
PCIDevice *pci_dev = PCI_DEVICE(dev);
PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(pci_dev);
- pci_unregister_io_regions(pci_dev);
pci_del_option_rom(pci_dev);
if (pc->exit) {
@@ -861,6 +860,17 @@ static int pci_unregister_device(DeviceState *dev)
return 0;
}
+static void pci_unmap_device(DeviceState *dev)
+{
+ PCIDevice *pci_dev = PCI_DEVICE(dev);
+ PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(pci_dev);
+
+ pci_unregister_io_regions(pci_dev);
+ if (pc->unmap) {
+ pc->unmap(pci_dev);
+ }
+}
+
void pci_register_bar(PCIDevice *pci_dev, int region_num,
uint8_t type, MemoryRegion *memory)
{
@@ -2064,6 +2074,7 @@ static void pci_device_class_init(ObjectClass *klass, void *data)
DeviceClass *k = DEVICE_CLASS(klass);
k->init = pci_qdev_init;
k->unplug = pci_unplug_device;
+ k->unmap = pci_unmap_device;
k->exit = pci_unregister_device;
k->bus_type = TYPE_PCI_BUS;
k->props = pci_props;
diff --git a/hw/pci.h b/hw/pci.h
index 4b6ab3d..09bbe2b 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -154,6 +154,7 @@ typedef struct PCIDeviceClass {
DeviceClass parent_class;
int (*init)(PCIDevice *dev);
+ void (*unmap)(PCIDevice *dev);
PCIUnregisterFunc *exit;
PCIConfigReadFunc *config_read;
PCIConfigWriteFunc *config_write;
--
1.7.4.4
next prev parent reply other threads:[~2012-10-22 9:24 UTC|newest]
Thread overview: 102+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-22 9:23 [Qemu-devel] [patch v4 00/16] push mmio dispatch out of big lock Liu Ping Fan
2012-10-22 9:23 ` [Qemu-devel] [patch v4 01/16] atomic: introduce atomic operations Liu Ping Fan
2012-10-22 9:23 ` [Qemu-devel] [patch v4 02/16] qom: apply atomic on object's refcount Liu Ping Fan
2012-10-22 9:23 ` [Qemu-devel] [patch v4 03/16] hotplug: introduce qdev_unplug_complete() to remove device from views Liu Ping Fan
2012-10-22 9:23 ` Liu Ping Fan [this message]
2012-10-22 9:23 ` [Qemu-devel] [patch v4 05/16] memory: introduce ref, unref interface for MemoryRegionOps Liu Ping Fan
2012-10-22 9:38 ` Avi Kivity
2012-10-23 11:51 ` Paolo Bonzini
2012-10-23 11:55 ` Avi Kivity
2012-10-23 11:57 ` Paolo Bonzini
2012-10-23 12:02 ` Avi Kivity
2012-10-23 12:06 ` Paolo Bonzini
2012-10-23 12:15 ` Avi Kivity
2012-10-23 12:32 ` Paolo Bonzini
2012-10-23 14:49 ` Avi Kivity
2012-10-23 15:26 ` Paolo Bonzini
2012-10-23 16:09 ` Avi Kivity
2012-10-24 7:29 ` Paolo Bonzini
2012-10-25 16:28 ` Avi Kivity
2012-10-26 15:05 ` Paolo Bonzini
2012-10-23 12:04 ` Jan Kiszka
2012-10-23 12:12 ` Paolo Bonzini
2012-10-23 12:16 ` Jan Kiszka
2012-10-23 12:28 ` Avi Kivity
2012-10-23 12:40 ` Jan Kiszka
2012-10-23 14:37 ` Avi Kivity
2012-10-22 9:23 ` [Qemu-devel] [patch v4 06/16] memory: document ref, unref interface Liu Ping Fan
2012-10-22 9:23 ` [Qemu-devel] [patch v4 07/16] memory: make mmio dispatch able to be out of biglock Liu Ping Fan
2012-10-23 12:12 ` Jan Kiszka
2012-10-23 12:36 ` Avi Kivity
2012-10-24 6:31 ` liu ping fan
2012-10-24 6:56 ` liu ping fan
2012-10-25 8:57 ` Avi Kivity
2012-10-22 9:23 ` [Qemu-devel] [patch v4 08/16] QemuThread: make QemuThread as tls to store extra info Liu Ping Fan
2012-10-22 9:30 ` Jan Kiszka
2012-10-22 17:13 ` Peter Maydell
2012-10-23 5:58 ` liu ping fan
2012-10-23 11:48 ` Paolo Bonzini
2012-10-23 11:50 ` Peter Maydell
2012-10-23 11:51 ` Jan Kiszka
2012-10-23 12:00 ` Paolo Bonzini
2012-10-23 12:27 ` Peter Maydell
2012-11-18 10:02 ` Brad Smith
2012-11-18 16:14 ` Paolo Bonzini
2012-11-18 16:15 ` Paolo Bonzini
2012-10-22 9:23 ` [Qemu-devel] [patch v4 09/16] memory: introduce mmio request pending to anti nested DMA Liu Ping Fan
2012-10-22 10:28 ` Avi Kivity
2012-10-23 12:38 ` Gleb Natapov
2012-10-24 6:31 ` liu ping fan
2012-10-22 9:23 ` [Qemu-devel] [patch v4 10/16] memory: introduce lock ops for MemoryRegionOps Liu Ping Fan
2012-10-22 10:30 ` Avi Kivity
2012-10-23 5:53 ` liu ping fan
2012-10-23 8:53 ` Jan Kiszka
2012-10-22 9:23 ` [Qemu-devel] [patch v4 11/16] vcpu: push mmio dispatcher out of big lock Liu Ping Fan
2012-10-22 10:31 ` Avi Kivity
2012-10-22 10:36 ` Jan Kiszka
2012-10-22 9:23 ` [Qemu-devel] [patch v4 12/16] e1000: apply fine lock on e1000 Liu Ping Fan
2012-10-22 10:37 ` Avi Kivity
2012-10-23 9:04 ` Jan Kiszka
2012-10-24 6:31 ` liu ping fan
2012-10-24 7:17 ` Jan Kiszka
2012-10-25 9:01 ` Avi Kivity
2012-10-25 9:31 ` Jan Kiszka
2012-10-25 16:21 ` Avi Kivity
2012-10-25 16:39 ` Jan Kiszka
2012-10-25 17:02 ` Avi Kivity
2012-10-25 18:48 ` Jan Kiszka
2012-10-29 5:24 ` liu ping fan
2012-10-24 7:29 ` liu ping fan
2012-10-25 13:34 ` Jan Kiszka
2012-10-25 16:23 ` Avi Kivity
2012-10-25 16:41 ` Jan Kiszka
2012-10-25 17:03 ` Avi Kivity
2012-10-29 5:24 ` liu ping fan
2012-10-31 7:03 ` Jan Kiszka
2012-10-22 9:23 ` [Qemu-devel] [patch v4 13/16] e1000: add busy flag to anti broken device state Liu Ping Fan
2012-10-22 10:40 ` Avi Kivity
2012-10-23 5:52 ` liu ping fan
2012-10-23 9:06 ` Avi Kivity
2012-10-23 9:07 ` Jan Kiszka
2012-10-23 9:32 ` liu ping fan
2012-10-23 9:37 ` Avi Kivity
2012-10-24 6:36 ` liu ping fan
2012-10-25 8:55 ` Avi Kivity
2012-10-25 9:00 ` Peter Maydell
2012-10-25 9:04 ` Avi Kivity
2012-10-26 3:05 ` liu ping fan
2012-10-26 3:08 ` liu ping fan
2012-10-26 10:25 ` Jan Kiszka
2012-10-29 5:24 ` liu ping fan
2012-10-29 7:50 ` Peter Maydell
2012-10-22 9:23 ` [Qemu-devel] [patch v4 14/16] qdev: introduce stopping state Liu Ping Fan
2012-10-22 9:23 ` [Qemu-devel] [patch v4 15/16] e1000: introduce unmap() to fix unplug issue Liu Ping Fan
2012-10-22 9:23 ` [Qemu-devel] [patch v4 16/16] e1000: implement MemoryRegionOps's ref&lock interface Liu Ping Fan
2012-10-25 14:04 ` [Qemu-devel] [patch v4 00/16] push mmio dispatch out of big lock Peter Maydell
2012-10-25 16:44 ` Jan Kiszka
2012-10-25 17:07 ` Avi Kivity
2012-10-25 17:13 ` Peter Maydell
2012-10-25 18:13 ` Marcelo Tosatti
2012-10-25 19:00 ` Jan Kiszka
2012-10-25 19:06 ` Peter Maydell
2012-10-29 15:24 ` Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1350897839-29593-5-git-send-email-pingfank@linux.vnet.ibm.com \
--to=pingfank@linux.vnet.ibm.com \
--cc=anthony@codemonkey.ws \
--cc=avi@redhat.com \
--cc=jan.kiszka@siemens.com \
--cc=mtosatti@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).