qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
	qemu-devel <qemu-devel@nongnu.org>
Subject: [Qemu-devel] [patch 06/19] qemu: record devfn on block driver instance
Date: Tue, 10 Feb 2009 18:30:57 -0200	[thread overview]
Message-ID: <20090210203207.164528699@emt.localdomain> (raw)
In-Reply-To: 20090210203051.064692466@emt.localdomain

[-- Attachment #1: record-pcidev-on-bdrv --]
[-- Type: text/plain, Size: 2416 bytes --]

Record PCIDev on the BlockDriverState structure to locate for release
on hot-removal.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

Index: trunk/block_int.h
===================================================================
--- trunk.orig/block_int.h
+++ trunk/block_int.h
@@ -127,6 +127,7 @@ struct BlockDriverState {
     int type;
     char device_name[32];
     BlockDriverState *next;
+    void *private;
 };
 
 struct BlockDriverAIOCB {
Index: trunk/hw/ide.c
===================================================================
--- trunk.orig/hw/ide.c
+++ trunk/hw/ide.c
@@ -28,6 +28,7 @@
 #include "scsi-disk.h"
 #include "pcmcia.h"
 #include "block.h"
+#include "block_int.h"
 #include "qemu-timer.h"
 #include "sysemu.h"
 #include "ppc_mac.h"
@@ -3352,6 +3353,7 @@ void pci_piix3_ide_init(PCIBus *bus, Blo
 {
     PCIIDEState *d;
     uint8_t *pci_conf;
+    int i;
 
     /* register a function 1 of PIIX3 */
     d = (PCIIDEState *)pci_register_device(bus, "PIIX3 IDE",
@@ -3378,6 +3380,10 @@ void pci_piix3_ide_init(PCIBus *bus, Blo
     ide_init_ioport(&d->ide_if[0], 0x1f0, 0x3f6);
     ide_init_ioport(&d->ide_if[2], 0x170, 0x376);
 
+    for (i = 0; i < 4; i++)
+        if (hd_table[i])
+            hd_table[i]->private = &d->dev;
+
     register_savevm("ide", 0, 2, pci_ide_save, pci_ide_load, d);
 }
 
Index: trunk/hw/lsi53c895a.c
===================================================================
--- trunk.orig/hw/lsi53c895a.c
+++ trunk/hw/lsi53c895a.c
@@ -13,6 +13,7 @@
 #include "hw.h"
 #include "pci.h"
 #include "scsi-disk.h"
+#include "block_int.h"
 
 //#define DEBUG_LSI
 //#define DEBUG_LSI_REG
@@ -1958,6 +1959,7 @@ void lsi_scsi_attach(void *opaque, Block
     s->scsi_dev[id] = scsi_generic_init(bd, 1, lsi_command_complete, s);
     if (s->scsi_dev[id] == NULL)
         s->scsi_dev[id] = scsi_disk_init(bd, 1, lsi_command_complete, s);
+    bd->private = &s->pci_dev;
 }
 
 void *lsi_scsi_init(PCIBus *bus, int devfn)
Index: trunk/hw/virtio-blk.c
===================================================================
--- trunk.orig/hw/virtio-blk.c
+++ trunk/hw/virtio-blk.c
@@ -314,6 +314,7 @@ void *virtio_blk_init(PCIBus *bus, Block
     s->vdev.reset = virtio_blk_reset;
     s->bs = bs;
     s->rq = NULL;
+    bs->private = &s->vdev.pci_dev;
     bdrv_guess_geometry(s->bs, &cylinders, &heads, &secs);
     bdrv_set_geometry_hint(s->bs, cylinders, heads, secs);
 

-- 

  parent reply	other threads:[~2009-02-10 20:47 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-10 20:30 [Qemu-devel] [patch 00/19] acpi pci hotplug Marcelo Tosatti
2009-02-10 20:30 ` [Qemu-devel] [patch 01/19] qemu: add pci helper functions Marcelo Tosatti
2009-02-10 20:30 ` [Qemu-devel] [patch 02/19] qemu: return PCIDevice on net device init and record devfn Marcelo Tosatti
2009-02-10 20:30 ` [Qemu-devel] [patch 03/19] qemu: dynamic drive/drive_opt index allocation Marcelo Tosatti
2009-02-10 20:30 ` [Qemu-devel] [patch 04/19] qemu: dynamic nic info " Marcelo Tosatti
2009-02-10 20:30 ` [Qemu-devel] [patch 05/19] qemu: drive removal support Marcelo Tosatti
2009-02-10 20:30 ` Marcelo Tosatti [this message]
2009-02-10 20:30 ` [Qemu-devel] [patch 07/19] qemu: move drives_opt for external use Marcelo Tosatti
2009-02-10 20:30 ` [Qemu-devel] [patch 08/19] qemu: net/drive add/remove tweaks Marcelo Tosatti
2009-02-10 20:31 ` [Qemu-devel] [patch 09/19] qemu: add net_client_uninit / qemu_find_vlan_client Marcelo Tosatti
2009-02-10 20:31 ` [Qemu-devel] [patch 10/19] qemu: add cpu_unregister_io_memory and make io mem table index dynamic Marcelo Tosatti
2009-02-10 20:31 ` [Qemu-devel] [patch 11/19] qemu: add qemu_free_irqs Marcelo Tosatti
2009-02-10 20:31 ` [Qemu-devel] [patch 12/19] qemu: add pci_unregister_device Marcelo Tosatti
2009-02-10 20:31 ` [Qemu-devel] [patch 13/19] qemu: warn if PCI region is not power of two Marcelo Tosatti
2009-02-10 20:31 ` [Qemu-devel] [patch 14/19] qemu: LSI SCSI and e1000 unregister callbacks Marcelo Tosatti
2009-02-10 20:31 ` [Qemu-devel] [patch 15/19] qemu: zero ioport_opaque on isa_unassign_ioport Marcelo Tosatti
2009-02-10 20:31 ` [Qemu-devel] [patch 16/19] qemu: initialize hot add system / acpi gpe Marcelo Tosatti
2009-02-10 20:31 ` [Qemu-devel] [patch 17/19] qemu: pci hotplug GPE support Marcelo Tosatti
2009-02-10 20:31 ` [Qemu-devel] [patch 18/19] From: Markus Armbruster <armbru@pond.sub.org> Marcelo Tosatti
2009-02-10 20:31 ` [Qemu-devel] [patch 19/19] qemu: PCI device, disk and host network hot-add / hot-remove Marcelo Tosatti
2009-02-11  2:26   ` [Qemu-devel] " Anthony Liguori
2009-02-11 15:00     ` Marcelo Tosatti
2009-02-11 15:32       ` Avi Kivity
2009-02-11 12:42 ` [Qemu-devel] [patch 00/19] acpi pci hotplug Markus Armbruster
2009-02-11 15:19 ` [Qemu-devel] " Anthony Liguori

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=20090210203207.164528699@emt.localdomain \
    --to=mtosatti@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=qemu-devel@nongnu.org \
    /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).