diff options
author | Markus Armbruster <armbru@pond.sub.org> | 2009-06-18 15:14:10 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-06-22 10:15:29 -0500 |
commit | c2cc47a449c3e16f7dd4d19a536c649ec56a9ac9 (patch) | |
tree | 77920d6d5fd89eb2d8513b49c1205a3656b28429 /hw | |
parent | 1f5f6638c063514f193ca447d49fa95f8a574a69 (diff) | |
download | qemu-c2cc47a449c3e16f7dd4d19a536c649ec56a9ac9.tar.gz qemu-c2cc47a449c3e16f7dd4d19a536c649ec56a9ac9.tar.bz2 qemu-c2cc47a449c3e16f7dd4d19a536c649ec56a9ac9.zip |
Support addr=... in option argument of -drive if=virtio
Make drive_init() accept addr=, put the value into struct DriveInfo.
Use it in all the places that create virtio-blk-pci devices:
pc_init1(), bamboo_init(), mpc8544ds_init().
Don't support addr= in third argument of monitor command pci_add and
second argument of drive_add, because that clashes with their first
arguments. Admittedly unelegant.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/pc.c | 5 | ||||
-rw-r--r-- | hw/pci-hotplug.c | 8 | ||||
-rw-r--r-- | hw/ppc440_bamboo.c | 4 | ||||
-rw-r--r-- | hw/ppce500_mpc8544ds.c | 4 |
4 files changed, 18 insertions, 3 deletions
@@ -848,6 +848,7 @@ static void pc_init1(ram_addr_t ram_size, ram_addr_t below_4g_mem_size, above_4g_mem_size = 0; int bios_size, isa_bios_size, oprom_area_size; PCIBus *pci_bus; + PCIDevice *pci_dev; int piix3_devfn = -1; CPUState *env; qemu_irq *cpu_irq; @@ -1161,7 +1162,9 @@ static void pc_init1(ram_addr_t ram_size, int unit_id = 0; while ((index = drive_get_index(IF_VIRTIO, 0, unit_id)) != -1) { - pci_create_simple(pci_bus, -1, "virtio-blk-pci"); + pci_dev = pci_create("virtio-blk-pci", + drives_table[index].devaddr); + qdev_init(&pci_dev->qdev); unit_id++; } } diff --git a/hw/pci-hotplug.c b/hw/pci-hotplug.c index 031643e09f..952e27a9f7 100644 --- a/hw/pci-hotplug.c +++ b/hw/pci-hotplug.c @@ -70,6 +70,10 @@ void drive_hot_add(Monitor *mon, const char *pci_addr, const char *opts) drive_idx = add_init_drive(opts); if (drive_idx < 0) return; + if (drives_table[drive_idx].devaddr) { + monitor_printf(mon, "Parameter addr not supported\n"); + return; + } type = drives_table[drive_idx].type; bus = drive_get_max_bus (type); @@ -116,6 +120,10 @@ static PCIDevice *qemu_pci_hot_add_storage(Monitor *mon, drive_idx = add_init_drive(opts); if (drive_idx < 0) return NULL; + if (drives_table[drive_idx].devaddr) { + monitor_printf(mon, "Parameter addr not supported\n"); + return NULL; + } } else if (type == IF_VIRTIO) { monitor_printf(mon, "virtio requires a backing file/device.\n"); return NULL; diff --git a/hw/ppc440_bamboo.c b/hw/ppc440_bamboo.c index f287ec79c2..d9ef3eca82 100644 --- a/hw/ppc440_bamboo.c +++ b/hw/ppc440_bamboo.c @@ -90,6 +90,7 @@ static void bamboo_init(ram_addr_t ram_size, { unsigned int pci_irq_nrs[4] = { 28, 27, 26, 25 }; PCIBus *pcibus; + PCIDevice *pci_dev; CPUState *env; uint64_t elf_entry; uint64_t elf_lowaddr; @@ -110,7 +111,8 @@ static void bamboo_init(ram_addr_t ram_size, /* Add virtio block devices. */ while ((i = drive_get_index(IF_VIRTIO, 0, unit_id)) != -1) { - pci_create_simple(pcibus, -1, "virtio-blk-pci"); + pci_dev = pci_create("virtio-blk-pci", drives_table[i].devaddr); + qdev_init(&pci_dev->qdev); unit_id++; } diff --git a/hw/ppce500_mpc8544ds.c b/hw/ppce500_mpc8544ds.c index aff3ae2356..c0e367de63 100644 --- a/hw/ppce500_mpc8544ds.c +++ b/hw/ppce500_mpc8544ds.c @@ -157,6 +157,7 @@ static void mpc8544ds_init(ram_addr_t ram_size, const char *cpu_model) { PCIBus *pci_bus; + PCIDevice *pci_dev; CPUState *env; uint64_t elf_entry; uint64_t elf_lowaddr; @@ -219,7 +220,8 @@ static void mpc8544ds_init(ram_addr_t ram_size, /* Add virtio block devices. */ while ((i = drive_get_index(IF_VIRTIO, 0, unit_id)) != -1) { - pci_create_simple(pci_bus, -1, "virtio-blk-pci"); + pci_dev = pci_create("virtio-blk-pci", drives_table[i].devaddr); + qdev_init(&pci_dev->qdev); unit_id++; } |