aboutsummaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2009-07-31 12:25:41 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-08-10 13:05:28 -0500
commitd176c495b6664b72dc1e595f6e89dc5648aa248b (patch)
tree8007516b5e4a7bc56cd806e92b0be7028ce643bb /vl.c
parent14b41872fd4ccdb750d539f1f317ae0e070f73a4 (diff)
downloadqemu-d176c495b6664b72dc1e595f6e89dc5648aa248b.zip
qemu-d176c495b6664b72dc1e595f6e89dc5648aa248b.tar.gz
qemu-d176c495b6664b72dc1e595f6e89dc5648aa248b.tar.bz2
qdev-ify virtio-blk.
First user of the new drive property. With this patch applied host and guest config can be specified separately, like this: -drive if=none,id=disk1,file=/path/to/disk.img -device virtio-blk-pci,drive=disk1 You can set any property for virtio-blk-pci now. You can set the pci address via addr=. You can switch the device into 0.10 compat mode using class=0x0180. As this is per device you can have one 0.10 and one 0.11 virtio block device in a single virtual machine. Old syntax continues to work. Internally it does the same as the two lines above though. One side effect this has is a different initialization order, which might result in a different pci address being assigned by default. Long term plan here is to have this working for all block devices, i.e. once all scsi is properly qdev-ified you will be able to do something like this: -drive if=none,id=sda,file=/path/to/disk.img -device lsi,id=lsi,addr=<pciaddr> -device scsi-disk,drive=sda,bus=lsi.0,lun=<n> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Message-Id:
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/vl.c b/vl.c
index 5bf3051..9b390e7 100644
--- a/vl.c
+++ b/vl.c
@@ -2197,9 +2197,16 @@ DriveInfo *drive_init(QemuOpts *opts, void *opaque,
break;
case IF_PFLASH:
case IF_MTD:
- case IF_VIRTIO:
case IF_NONE:
break;
+ case IF_VIRTIO:
+ /* add virtio block device */
+ opts = qemu_opts_create(&qemu_device_opts, NULL, 0);
+ qemu_opt_set(opts, "driver", "virtio-blk-pci");
+ qemu_opt_set(opts, "drive", dinfo->id);
+ if (devaddr)
+ qemu_opt_set(opts, "addr", devaddr);
+ break;
case IF_COUNT:
abort();
}