From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 4/6] qdev/compat: virtio-blk-pci 0.10 compatibility.
Date: Wed, 15 Jul 2009 13:48:23 +0200 [thread overview]
Message-ID: <1247658505-838-5-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1247658505-838-1-git-send-email-kraxel@redhat.com>
Add class property to virtio-blk-pci allowing to specify the PCI class.
Add compat property to pc-0.10 to set the old PCI class.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/pc.c | 5 +++++
hw/virtio-pci.c | 16 ++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/hw/pc.c b/hw/pc.c
index 76b9a48..0913860 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1469,6 +1469,11 @@ static QEMUMachine pc_machine_v0_10 = {
.init = pc_init_pci,
.max_cpus = 255,
.compat_props = (CompatProperty[]) {
+ {
+ .driver = "virtio-blk-pci",
+ .property = "class",
+ .value = stringify(PCI_CLASS_STORAGE_OTHER),
+ },
{ /* end of list */ }
},
};
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index 0671967..41ba574 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -86,6 +86,7 @@ typedef struct {
PCIDevice pci_dev;
VirtIODevice *vdev;
uint32_t addr;
+ uint32_t class_code;
} VirtIOPCIProxy;
/* virtio device */
@@ -425,12 +426,15 @@ static void virtio_blk_init_pci(PCIDevice *pci_dev)
VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
VirtIODevice *vdev;
+ if (proxy->class_code != PCI_CLASS_STORAGE_SCSI &&
+ proxy->class_code != PCI_CLASS_STORAGE_OTHER)
+ proxy->class_code = PCI_CLASS_STORAGE_SCSI;
+
vdev = virtio_blk_init(&pci_dev->qdev);
virtio_init_pci(proxy, vdev,
PCI_VENDOR_ID_REDHAT_QUMRANET,
PCI_DEVICE_ID_VIRTIO_BLOCK,
- PCI_CLASS_STORAGE_OTHER,
- 0x00);
+ proxy->class_code, 0x00);
}
static void virtio_console_init_pci(PCIDevice *pci_dev)
@@ -477,6 +481,14 @@ static PCIDeviceInfo virtio_info[] = {
.qdev.name = "virtio-blk-pci",
.qdev.size = sizeof(VirtIOPCIProxy),
.init = virtio_blk_init_pci,
+ .qdev.props = (Property[]) {
+ {
+ .name = "class",
+ .info = &qdev_prop_hex32,
+ .offset = offsetof(VirtIOPCIProxy, class_code),
+ },
+ {/* end of list */}
+ },
},{
.qdev.name = "virtio-net-pci",
.qdev.size = sizeof(VirtIOPCIProxy),
--
1.6.2.5
next prev parent reply other threads:[~2009-07-15 11:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-15 11:48 [Qemu-devel] [PATCH 0/6] qdev: compat properties Gerd Hoffmann
2009-07-15 11:48 ` [Qemu-devel] [PATCH 1/6] cleanup: drop unused struct elements from VirtIOPCIProxy Gerd Hoffmann
2009-07-15 11:48 ` [Qemu-devel] [PATCH 2/6] qdev/compat: compat property infrastructure Gerd Hoffmann
2009-07-15 11:48 ` [Qemu-devel] [PATCH 3/6] qdev/compat: add pc-0.10 machine type Gerd Hoffmann
2009-07-15 11:48 ` Gerd Hoffmann [this message]
2009-07-15 11:48 ` [Qemu-devel] [PATCH 5/6] qdev/compat: virtio-console-pci 0.10 compatibility Gerd Hoffmann
2009-07-15 11:48 ` [Qemu-devel] [PATCH 6/6] qdev/compat: virtio-net-pci " Gerd Hoffmann
-- strict thread matches above, loose matches on Subject: below --
2009-07-13 15:29 [Qemu-devel] [PATCH v3 0/7] qdev: compat properties Gerd Hoffmann
2009-07-13 15:30 ` [Qemu-devel] [PATCH 4/6] qdev/compat: virtio-blk-pci 0.10 compatibility Gerd Hoffmann
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=1247658505-838-5-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--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).