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
This commit is contained in:
aliguori 2008-12-04 19:52:44 +00:00
parent 967f97fa00
commit 6e02c38dad
7 changed files with 346 additions and 5 deletions

13
hw/pc.c
View file

@ -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,