Skip to contentSkip to conversation

ahci -device ide-hd|ide-cd select a bus already in use

Qemu-devel Fabio Fantoni 2 participants 3 messages Dec 3, 2013

lore
Share & tools
lore
#0 lore raw

I started to test/implement q35 cipset on xen hvm domUs.
I found that ide disks and cdrom don't works with q35 using old qemu parameters without -device, this is not a blocking problem. I tried with new qemu parameters and ahci and the disk works.
When I tried to add more that one ahci disk/cdrom devices qemu gave this error:

Quoted 3 lines

qemu-system-i386: -device ide-cd,drive=drive-sata-disk1,id=sata1: Can't create IDE unit 1, bus supports only 1 units
qemu-system-i386: -device ide-cd,drive=drive-sata-disk1,id=sata1: Device initialization failed.
qemu-system-i386: -device ide-cd,drive=drive-sata-disk1,id=sata1: Device 'ide-cd' could not be initialized

I used qemu 1.6.1 for the test and searching online I found the same problem was reported also on fedora, ubuntu and red hat bugtrackers.
Looking for the solution on qemu-devel and git I found this patch:
http://git.qemu.org/?p=qemu.git;a=commit;h=0ee20e665840d8a887c145b368ee121cb86a028e
It is applied on qemu 1.6 but it seems it doesn't solve the problem of the selection of full bus but it only show an error when it happens.
Xen with old qemu parameters use index instead of bus and unit but it seems missing if I try to use it on -device.
I also read docs/qdev-device-use.txt but it doesn't mention index with new -device ide-hd|ide-cd parameters and I found nothing about if=none or any ahci disks informations, I think that this document needs to be updated/improved.

Thanks for any reply.

#1 lore raw
Quoted 25 lines · Fabio Fantoni

I started to test/implement q35 cipset on xen hvm domUs. I found that ide disks and cdrom don't works with q35 using old qemu parameters without -device, this is not a blocking problem. I tried with new qemu parameters and ahci and the disk works. When I tried to add more that one ahci disk/cdrom devices qemu gave this error:

Quoted 6 lines

qemu-system-i386: -device ide-cd,drive=drive-sata-disk1,id=sata1:
Can't create IDE unit 1, bus supports only 1 units
qemu-system-i386: -device ide-cd,drive=drive-sata-disk1,id=sata1:
Device initialization failed.
qemu-system-i386: -device ide-cd,drive=drive-sata-disk1,id=sata1:
Device 'ide-cd' could not be initialized

I used qemu 1.6.1 for the test and searching online I found the same problem was reported also on fedora, ubuntu and red hat bugtrackers. Looking for the solution on qemu-devel and git I found this patch:
http://git.qemu.org/?p=qemu.git;a=commit;h=0ee20e665840d8a887c145b368ee121cb86a028e
It is applied on qemu 1.6 but it seems it doesn't solve the problem of the selection of full bus but it only show an error when it happens. Xen with old qemu parameters use index instead of bus and unit but it seems missing if I try to use it on -device.
I also read docs/qdev-device-use.txt but it doesn't mention index with new -device ide-hd|ide-cd parameters and I found nothing about if=none or any ahci disks informations, I think that this document needs to be updated/improved.

Quoted 1 line

Thanks for any reply.

You didn't tell us your complete command line. Your error messages suggest you try to add more than one device to the same IDE bus, like this:

    $ qemu -nodefaults -S -display none -monitor stdio -M q35 -drive if=none,id=drive0,file=test.qcow2 -drive if=none,id=drive1 -device ide-hd,drive=drive0 -device ide-cd,drive=drive1
    QEMU 1.7.50 monitor - type 'help' for more information
    (qemu) upstream-qemu: -device ide-cd,drive=drive1: Can't create IDE unit 1, bus supports only 1 units
    upstream-qemu: -device ide-cd,drive=drive1: Device initialization failed.
    upstream-qemu: -device ide-cd,drive=drive1: Device 'ide-cd' could not be initialized

Old IDE provides buses ide.0 and ide.1, and each bus can have up to two units, master and slave.

AHCI provides buses ide.0 .. ide.6, but each bus can have only one unit.

-device is stupid: it picks the first bus it finds, and then the first free unit. Good enough for two devices with IDE, but only one with AHCI.

Use explicit bus and unit parameters. Except you can omit unit=0 with AHCI, because it's the only permissible unit anyway:

    $ qemu -nodefaults -S -display none -monitor stdio -M q35 -drive if=none,id=drive0,file=test.qcow2 -drive if=none,id=drive1 -device ide-hd,drive=drive0,bus=ide.0 -device ide-cd,drive=drive1,bus=ide.1
#2 lore raw

Il 03/12/2013 11:32, Markus Armbruster ha scritto:

Quoted 32 lines
Quoted 25 lines · Fabio Fantoni

I started to test/implement q35 cipset on xen hvm domUs. I found that ide disks and cdrom don't works with q35 using old qemu parameters without -device, this is not a blocking problem. I tried with new qemu parameters and ahci and the disk works. When I tried to add more that one ahci disk/cdrom devices qemu gave this error:

Quoted 6 lines

qemu-system-i386: -device ide-cd,drive=drive-sata-disk1,id=sata1:
Can't create IDE unit 1, bus supports only 1 units
qemu-system-i386: -device ide-cd,drive=drive-sata-disk1,id=sata1:
Device initialization failed.
qemu-system-i386: -device ide-cd,drive=drive-sata-disk1,id=sata1:
Device 'ide-cd' could not be initialized

I used qemu 1.6.1 for the test and searching online I found the same problem was reported also on fedora, ubuntu and red hat bugtrackers. Looking for the solution on qemu-devel and git I found this patch:
http://git.qemu.org/?p=qemu.git;a=commit;h=0ee20e665840d8a887c145b368ee121cb86a028e
It is applied on qemu 1.6 but it seems it doesn't solve the problem of the selection of full bus but it only show an error when it happens. Xen with old qemu parameters use index instead of bus and unit but it seems missing if I try to use it on -device.
I also read docs/qdev-device-use.txt but it doesn't mention index with new -device ide-hd|ide-cd parameters and I found nothing about if=none or any ahci disks informations, I think that this document needs to be updated/improved.

Quoted 1 line

Thanks for any reply.

You didn't tell us your complete command line. Your error messages suggest you try to add more than one device to the same IDE bus, like this:

Quoted 5 lines
     $ qemu -nodefaults -S -display none -monitor stdio -M q35 -drive if=none,id=drive0,file=test.qcow2 -drive if=none,id=drive1 -device ide-hd,drive=drive0 -device ide-cd,drive=drive1
     QEMU 1.7.50 monitor - type 'help' for more information
     (qemu) upstream-qemu: -device ide-cd,drive=drive1: Can't create IDE unit 1, bus supports only 1 units
     upstream-qemu: -device ide-cd,drive=drive1: Device initialization failed.
     upstream-qemu: -device ide-cd,drive=drive1: Device 'ide-cd' could not be initialized

Sorry, these are qemu parameters of my domU:

libxl: debug: libxl_dm.c:1327:libxl__spawn_local_dm: Spawning device-model /usr/lib/xen/bin/qemu-system-i386 with arguments:
libxl: debug: libxl_dm.c:1329:libxl__spawn_local_dm: /usr/lib/xen/bin/qemu-system-i386
libxl: debug: libxl_dm.c:1329:libxl__spawn_local_dm: -xen-domid
libxl: debug: libxl_dm.c:1329:libxl__spawn_local_dm: 9
libxl: debug: libxl_dm.c:1329:libxl__spawn_local_dm: -chardev
libxl: debug: libxl_dm.c:1329:libxl__spawn_local_dm: socket,id=libxl-cmd,path=/var/run/xen/qmp-libxl-9,server,nowait
libxl: debug: libxl_dm.c:1329:libxl__spawn_local_dm: -mon
libxl: debug: libxl_dm.c:1329:libxl__spawn_local_dm: chardev=libxl-cmd,mode=control
libxl: debug: libxl_dm.c:1329:libxl__spawn_local_dm: -nodefaults
libxl: debug: libxl_dm.c:1329:libxl__spawn_local_dm: -name
libxl: debug: libxl_dm.c:1329:libxl__spawn_local_dm: W7-q35
libxl: debug: libxl_dm.c:1329:libxl__spawn_local_dm: -vnc
libxl: debug: libxl_dm.c:1329:libxl__spawn_local_dm: 0.0.0.0:0,to=99
libxl: debug: libxl_dm.c:1329:libxl__spawn_local_dm: -k
libxl: debug: libxl_dm.c:1329:libxl__spawn_local_dm: it
libxl: debug: libxl_dm.c:1329:libxl__spawn_local_dm: -device
libxl: debug: libxl_dm.c:1329:libxl__spawn_local_dm: VGA
libxl: debug: libxl_dm.c:1329:libxl__spawn_local_dm: -boot
libxl: debug: libxl_dm.c:1329:libxl__spawn_local_dm: order=d
libxl: debug: libxl_dm.c:1329:libxl__spawn_local_dm: -smp
libxl: debug: libxl_dm.c:1329:libxl__spawn_local_dm: 2,maxcpus=2
libxl: debug: libxl_dm.c:1329:libxl__spawn_local_dm: -device
libxl: debug: libxl_dm.c:1329:libxl__spawn_local_dm: rtl8139,id=nic0,netdev=net0,mac=00:16:3e:3b:27:20
libxl: debug: libxl_dm.c:1329:libxl__spawn_local_dm: -netdev
libxl: debug: libxl_dm.c:1329:libxl__spawn_local_dm: type=tap,id=net0,ifname=vif9.0-emu,script=no,downscript=no
libxl: debug: libxl_dm.c:1329:libxl__spawn_local_dm: -machine
libxl: debug: libxl_dm.c:1329:libxl__spawn_local_dm: q35,accel=xen
libxl: debug: libxl_dm.c:1329:libxl__spawn_local_dm: -device
libxl: debug: libxl_dm.c:1329:libxl__spawn_local_dm: xen-platform
libxl: debug: libxl_dm.c:1329:libxl__spawn_local_dm: -device
libxl: debug: libxl_dm.c:1329:libxl__spawn_local_dm: i82801b11-bridge
libxl: debug: libxl_dm.c:1329:libxl__spawn_local_dm: -drive
libxl: debug: libxl_dm.c:1329:libxl__spawn_local_dm: file=/mnt/vm/disks/W7-q35.disk1.xm,if=none,id=drive-sata-disk0,format=raw,cache=writeback
libxl: debug: libxl_dm.c:1329:libxl__spawn_local_dm: -device
libxl: debug: libxl_dm.c:1329:libxl__spawn_local_dm: ide-drive,drive=drive-sata-disk0,id=sata0
libxl: debug: libxl_dm.c:1329:libxl__spawn_local_dm: -drive
libxl: debug: libxl_dm.c:1329:libxl__spawn_local_dm: file=/mnt/vm/iso/ubcd.iso,if=none,id=drive-sata-disk1,format=raw,cache=writeback
libxl: debug: libxl_dm.c:1329:libxl__spawn_local_dm: -device
libxl: debug: libxl_dm.c:1329:libxl__spawn_local_dm: ide-cd,drive=drive-sata-disk1,id=sata1
libxl: debug: libxl_dm.c:1329:libxl__spawn_local_dm: -m
libxl: debug: libxl_dm.c:1329:libxl__spawn_local_dm: 2032

Probably I can try to use libxl variable used for index on bus instead.

Quoted 5 lines

Old IDE provides buses ide.0 and ide.1, and each bus can have up to two units, master and slave.

AHCI provides buses ide.0 .. ide.6, but each bus can have only one unit.

Default ahci controller of q35 machine is named always ide or can change?
If I use bus in new -device parameters on xen I must be sure to use very stable parameter also on long term.

Thanks for any reply.

Quoted 9 lines

-device is stupid: it picks the first bus it finds, and then the first free unit. Good enough for two devices with IDE, but only one with AHCI.

Use explicit bus and unit parameters. Except you can omit unit=0 with AHCI, because it's the only permissible unit anyway:

     $ qemu -nodefaults -S -display none -monitor stdio -M q35 -drive if=none,id=drive0,file=test.qcow2 -drive if=none,id=drive1 -device ide-hd,drive=drive0,bus=ide.0 -device ide-cd,drive=drive1,bus=ide.1