Bug 923030

Summary: fail to assign correct order for the boot device in seabios as we specified the bootindex in qemu-kvm command line (only -M q35)
Product: Red Hat Enterprise Linux 7 Reporter: Sibiao Luo <sluo>
Component: qemu-kvmAssignee: Amos Kong <akong>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: acathrow, ailan, akong, chayang, ehabkost, flang, hhuang, juzhang, knoel, kwolf, michen, pbonzini, qzhang, rhod, sluo, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-1.5.1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 11:54:22 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
pc-i440fx-1.4 boot menu screenshot.
none
q35 boot menu screenshot. none

Description Sibiao Luo 2013-03-19 03:37:17 UTC
Description of problem:
Install guest with passthrough host CD-ROM using scsi-block in Q35, the seabios fail to assign correct order for the boot device in seabios as we specified the bootindex in qemu-kvm command line.
BTW, if use the pc-i440fx-1.4 emulated machine for -M, it have no such issue.

Version-Release number of selected component (if applicable):
host info:
kernel-3.8.0-0.40.el7.x86_64
qemu-kvm-1.4.0-1.el7.x86_64
seabios-bin-1.7.2-0.2.gita810e4e7.el7.noarch
seabios-1.7.2-0.2.gita810e4e7.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Install guest with passthrough host CD-ROM using scsi-block in Q35, and specify the bootindex in cli.
# /usr/libexec/qemu-kvm -S -M q35 -cpu SandyBridge -enable-kvm -m 2048 -smp 4,sockets=2,cores=2,threads=1 -no-kvm-pit-reinjection -usb -device usb-tablet,id=input0 -device usb-mouse,id=mouse -name sluo-test -uuid b03eea94-a502-4142-b541-96f86473a07a -rtc base=localtime,clock=host,driftfix=slew -device virtio-serial-pci,id=virtio-serial0,max_ports=16,vectors=0,bus=pcie.0,addr=0x3 -chardev socket,id=channel1,path=/tmp/helloworld1,server,nowait -device virtserialport,chardev=channel1,name=com.redhat.rhevm.vdsm,bus=virtio-serial0.0,id=port1 -chardev socket,id=channel2,path=/tmp/helloworld2,server,nowait -device virtserialport,chardev=channel2,name=com.redhat.rhevm.vdsm,bus=virtio-serial0.0,id=port2 -drive file=/dev/sr0,if=none,id=drive-disk,format=raw,cache=none,media=cdrom,readonly=on -device virtio-scsi-pci,id=scsi1,addr=0x4 -device scsi-block,bus=scsi1.0,drive=drive-disk,id=cdrom,bootindex=0 -drive file=/home/test-image.qcow2,if=none,id=drive-system-disk,format=qcow2,cache=writeback,aio=native,werror=stop,rerror=stop,serial=QEMU-DISK1 -device virtio-scsi-pci,id=scsi0,addr=0x5 -device scsi-hd,bus=scsi0.0,drive=drive-system-disk,id=system-disk,bootindex=1 -netdev tap,id=hostnet0,vhost=off,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet0,id=virtio-net-pci0,mac=08:2E:5F:0A:1D:B1,bus=pcie.0,addr=0x6,event_idx=off,bootindex=2 -device virtio-balloon-pci,id=ballooning,bus=pcie.0,addr=0x7 -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0 -serial unix:/tmp/ttyS0,server,nowait -k en-us -boot menu=on -vnc :1 -monitor stdio -drive file=/usr/share/virtio-win/virtio-win-1.6.3.iso,if=none,id=drive-ide-disk,media=cdrom,format=raw,cache=none -device ide-drive,drive=drive-ide-disk,id=ide-disk,bootindex=3
2.press F12 during POST.
  
Actual results:
after step 2, we can see the order of boot device as following, i will attach the screenshot later.
Press F12 for boot menu.

Select boot device:

1. virtio-scsi Drive QEMU QEMU HARDDISK 1.4.
2. Legacy option rom
3. Floppy [drive A]
4. DVD/CD [AHCI/5: QEMU DVD-ROM ATAPI-4 DVD/CD]
5. DVD/CD [virtio-scsi Drive QEMU QEMU CD-ROM 1.4.]
6. iPXE (PCI 00:06.0)

Expected results:
the order of the boot device in seabios should the same to we specified the bootindex in qemu-kvm command line.
Press F12 for boot menu.

Select boot device:

1. DVD/CD [virtio-scsi Drive QEMU QEMU CD-ROM 1.4.]
2. virtio-scsi Drive QEMU QEMU HARDDISK 1.4.
3. iPXE (PCI 00:06.0)
4. DVD/CD [ata1-0: QEMU DVD-ROM ATAPI-4 DVD/CD]
5. Legacy option rom
6. Floppy [drive A]

Additional info:

Comment 1 Sibiao Luo 2013-03-19 03:42:33 UTC
If use the pc-i440fx-1.4 emulated machine for -M.

Qemu-kvm command line:

# /usr/libexec/qemu-kvm -S -M pc-i440fx-1.4 -cpu SandyBridge -enable-kvm -m 2048 -smp 4,sockets=2,cores=2,threads=1 -no-kvm-pit-reinjection -usb -device usb-tablet,id=input0 -device usb-mouse,id=mouse -name sluo-test -uuid b03eea94-a502-4142-b541-96f86473a07a -rtc base=localtime,clock=host,driftfix=slew -device virtio-serial-pci,id=virtio-serial0,max_ports=16,vectors=0,bus=pci.0,addr=0x3 -chardev socket,id=channel1,path=/tmp/helloworld1,server,nowait -device virtserialport,chardev=channel1,name=com.redhat.rhevm.vdsm,bus=virtio-serial0.0,id=port1 -chardev socket,id=channel2,path=/tmp/helloworld2,server,nowait -device virtserialport,chardev=channel2,name=com.redhat.rhevm.vdsm,bus=virtio-serial0.0,id=port2 -drive file=/dev/sr0,if=none,id=drive-disk,format=raw,cache=none,media=cdrom,readonly=on -device virtio-scsi-pci,id=scsi1,addr=0x4 -device scsi-block,bus=scsi1.0,drive=drive-disk,id=cdrom,bootindex=0 -drive file=/home/test-image.qcow2,if=none,id=drive-system-disk,format=qcow2,cache=writeback,aio=native,werror=stop,rerror=stop,serial=QEMU-DISK1 -device virtio-scsi-pci,id=scsi0,addr=0x5 -device scsi-hd,bus=scsi0.0,drive=drive-system-disk,id=system-disk,bootindex=1 -netdev tap,id=hostnet0,vhost=off,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet0,id=virtio-net-pci0,mac=08:2E:5F:0A:1D:B1,bus=pci.0,addr=0x6,event_idx=off,bootindex=2 -device virtio-balloon-pci,id=ballooning,bus=pci.0,addr=0x7 -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0 -serial unix:/tmp/ttyS0,server,nowait -k en-us -boot menu=on -vnc :1 -monitor stdio -drive file=/usr/share/virtio-win/virtio-win-1.6.3.iso,if=none,id=drive-ide-disk,media=cdrom,format=raw,cache=none -device ide-drive,drive=drive-ide-disk,id=ide-disk,bootindex=3

Result:
Press F12 for boot menu.

Select boot device:

1. DVD/CD [virtio-scsi Drive QEMU QEMU CD-ROM 1.4.]
2. virtio-scsi Drive QEMU QEMU HARDDISK 1.4.
3. iPXE (PCI 00:06.0)
4. DVD/CD [ata1-0: QEMU DVD-ROM ATAPI-4 DVD/CD]
5. Legacy option rom
6. Floppy [drive A]

Comment 2 Sibiao Luo 2013-03-19 03:44:45 UTC
Created attachment 712375 [details]
pc-i440fx-1.4 boot menu screenshot.

Comment 3 Sibiao Luo 2013-03-19 03:45:12 UTC
Created attachment 712376 [details]
q35 boot menu screenshot.

Comment 4 Sibiao Luo 2013-03-19 03:50:03 UTC
(In reply to comment #0)
> Expected results:
> the order of the boot device in seabios should the same to we specified the
> bootindex in qemu-kvm command line.
> Press F12 for boot menu.
> 
> Select boot device:
> 
> 1. DVD/CD [virtio-scsi Drive QEMU QEMU CD-ROM 1.4.]
> 2. virtio-scsi Drive QEMU QEMU HARDDISK 1.4.
> 3. iPXE (PCI 00:06.0)
> 4. DVD/CD [ata1-0: QEMU DVD-ROM ATAPI-4 DVD/CD]
> 5. Legacy option rom
> 6. Floppy [drive A]
> 
Sorry, the correct expected results should be as following:

Press F12 for boot menu.

Select boot device:

1. DVD/CD [virtio-scsi Drive QEMU QEMU CD-ROM 1.4.] <-------------for passthrough host CD-ROM
2. virtio-scsi Drive QEMU QEMU HARDDISK 1.4.        <-------------for system
3. iPXE (PCI 00:06.0)
4. DVD/CD [AHCI/5: QEMU DVD-ROM ATAPI-4 DVD/CD]     <-------------for whql driver
5. Legacy option rom
6. Floppy [drive A]

Comment 5 langfang 2013-05-24 08:43:26 UTC
Hit the same problem if boot guest( scsi_hd disk)

Version:

# uname -r 
3.9.0-0.55.el7.x86_64
# rpm -q qemu-kvm
qemu-kvm-1.4.0-4.el7.x86_64

1.Boot guest 

"-M q35 ..-boot menu=on..-drive file=/root/rhel7.0-64-newinstall.qcow3,if=none,id=drive-virtio-disk1,format=qcow2,cache=none,aio=native  -device virtio-scsi-pci,id=bus2  -device scsi-hd,bus=bus2.0,drive=drive-virtio-disk1,id=virtio-scsi-pci1,bootindex=0" 

Result:
1.AHCI/5: QEMU HARDDISK  ATA-7 Hard-Disk (5120 MiBytes)
2. virtio-scsi Drive QEMU QEMU HARDDISK 1.4.        
3. Legacy option rom
4. Floppy [drive A]
5. DVD/CD [AHCI/0: QEMU DVD-ROM ATAPI-4 DVD/CD]     
6. iPXE (PCI 00:04.0)


addtional info:
1)If use "-M i440FX + PIIX" not hit the problem

2)/usr/libexec/qemu-kvm -cpu Penryn  -enable-kvm -m 4G -smp 2,sockets=2,cores=1,threads=1 -name win8-64 -uuid `uuidgen` -drive file=/home/test.qcow2,if=none,id=drive-system-disk,format=qcow2 -device ide-drive,drive=drive-system-disk,id=system-disk -netdev tap,id=hostnet1,script=/etc/qemu-ifup -device rtl8139,netdev=hostnet1,id=net1,mac=34:ef:18:6e:2a:31,addr=0x4 -qmp tcp:0:4445,server,nowait -usb -device usb-tablet -serial unix:/tmp/tty0,server,nowait -drive if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 -monitor stdio  -spice port=5830,disable-ticketing -vga qxl -boot menu=on -drive file=/root/rhel7.0-64-newinstall.qcow3,if=none,id=drive-virtio-disk1,format=qcow2,cache=none,aio=native  -device virtio-scsi-pci,id=bus2  -device scsi-hd,bus=bus2.0,drive=drive-virtio-disk1,id=virtio-scsi-pci1,bootindex=0

Comment 6 Amos Kong 2013-05-28 11:54:03 UTC
The fw_dev_paths to seabios by qemu:

/q35-pcihost@i0cf8/scsi@4/channel@0/disk@0,0
/q35-pcihost@i0cf8/ethernet@2/ethernet-phy@0
/q35-pcihost@i0cf8/pci8086,2922@1f,2/drive@5/disk@0
/q35-pcihost@i0cf8/ethernet@3/ethernet-phy@0


but we only match '/pci@i0cf8', this should be fixed in seabios.

--- a/src/boot.c
+++ b/src/boot.c
@@ -97,7 +97,7 @@ find_prio(const char *glob)
     return -1;
 }
 
-#define FW_PCI_DOMAIN "/pci@i0cf8"
+#define FW_PCI_DOMAIN "/*@i0cf8"

Comment 7 Amos Kong 2013-05-28 12:11:03 UTC
Applied above patch, bootindex of nic/ide-disk works.
bootindex of scsi-disk still doesn't work (I already fixed the bz 967444 in qemu), it seems another seabios issue.

Comment 8 Amos Kong 2013-05-30 02:55:33 UTC
(In reply to Amos Kong from comment #7)
> Applied above patch, bootindex of nic/ide-disk works.

Take this to me. I already posted patches  to (qemu & seabios) upstream.

[QEMU PATCH] pci: change typename of q35 to pci-q35 
[SeaBIOS PATCH v2] boot: fix fw_dev_path pattern to match q35 


> bootindex of scsi-disk still doesn't work (I already fixed the bz 967444 in
> qemu), it seems another seabios issue.

It caused by my dirty patch queue, no other issue with scsi.

Comment 11 Amos Kong 2013-11-07 06:02:51 UTC
*** Bug 947364 has been marked as a duplicate of this bug. ***

Comment 12 Sibiao Luo 2013-11-18 05:42:05 UTC
verify this issue on qemu-kvm-1.5.3-19.el7.x86_64 with the same steps that did not met such issue any more, so this issue has been fixed correctly.

host info:
3.10.0-41.el7.x86_64
qemu-kvm-1.5.3-19.el7.x86_64
seabios-1.7.2.2-4.el7.x86_64

Results:
It has correct boot device bootindex as specified in cli.

Best Regards,
sluo

Comment 13 Ludek Smid 2014-06-13 11:54:22 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.