aboutsummaryrefslogtreecommitdiff
path: root/hw/pc.c
diff options
context:
space:
mode:
authoraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2008-12-04 19:52:44 +0000
committeraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2008-12-04 19:52:44 +0000
commit6e02c38dadfe4cf02b0da6135adfd8d9352b90e1 (patch)
tree6de8b1fa9342550d2c7da2be7aef83b80a17a4b0 /hw/pc.c
parent967f97fa00b2d301584d08c614d446423c65c15a (diff)
Add virtio-blk support
Virtio-blk is a paravirtual block device based on VirtIO. It can be used by specifying the if=virtio parameter to the -drive parameter. When using -enable-kvm, it can achieve very good performance compared to IDE or SCSI. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5870 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/pc.c')
-rw-r--r--hw/pc.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/hw/pc.c b/hw/pc.c
index 1486b683a8..25dedc8999 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -33,6 +33,7 @@
#include "boards.h"
#include "console.h"
#include "fw_cfg.h"
+#include "virtio-blk.h"
/* output Bochs bios info messages */
//#define DEBUG_BIOS
@@ -1092,6 +1093,18 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
}
}
}
+
+ /* Add virtio block devices */
+ if (pci_enabled) {
+ int index;
+ int unit_id = 0;
+
+ while ((index = drive_get_index(IF_VIRTIO, 0, unit_id)) != -1) {
+ virtio_blk_init(pci_bus, 0x1AF4, 0x1001,
+ drives_table[index].bdrv);
+ unit_id++;
+ }
+ }
}
static void pc_init_pci(ram_addr_t ram_size, int vga_ram_size,