Skip to contentSkip to conversation

SeaBIOS cdrom regression with Vista

DISCUSSION Avi Kivity 4 participants 12 messages Nov 17, 2009 – Nov 26, 2009 KVM

lore
Share & tools
lore

Avi Kivity

author
#0 lore raw

qemu-kvm's switch to seabios uncovered a regression with cdrom handling. Vista x64 no longer recognizes the cdrom, while pc-bios still works. Installing works, but that uses int 13, not the native driver. Haven't investigated further yet.

Command line:

qemu -drive file=/root/kvm-autotest/client/tests/kvm/images/winvista-64.qcow2,if=ide,cache=writeback -m 512 -smp 2 -cdrom /root/kvm-autotest/client/tests/kvm/isos/windows/winutils.iso -snapshot

b496fe34317ead61cf5ae019506fadc8f9ad6556 in qemu-kvm.git.

Signature · 1 line
error compiling committee.c: too many arguments to function
#1 lore raw
Quoted 5 lines · Avi Kivity

qemu-kvm's switch to seabios uncovered a regression with cdrom handling. Vista x64 no longer recognizes the cdrom, while pc-bios still works. Installing works, but that uses int 13, not the native driver. Haven't investigated further yet.

Quoted 9 lines

Command line:

qemu -drive file=/root/kvm-autotest/client/tests/kvm/images/winvista-64.qcow2,if=ide,cache=writeback -m 512 -smp 2 -cdrom /root/kvm-autotest/client/tests/kvm/isos/windows/winutils.iso -snapshot

b496fe34317ead61cf5ae019506fadc8f9ad6556 in qemu-kvm.git.

This QEMU patch was reported to fix a CDROM problem with fedora:
[PATCH] pci: Fix function pci_default_write_config

Maybe it's a related problem.

Regards,
Stefan

#2 lore raw
In reply to Avi Kivity
Quoted 4 lines · Avi Kivity

qemu-kvm's switch to seabios uncovered a regression with cdrom handling. Vista x64 no longer recognizes the cdrom, while pc-bios still works. Installing works, but that uses int 13, not the native driver. Haven't investigated further yet.

Thanks for reporting Avi. I will take a look as well.

The only things I can think of that could impact the OS recognizing a cdrom would be: the cdrom left in an odd state (seems unlikely as the OS usually does a full reset), ACPI differences, or int1348 errors.

-Kevin

#3 lore raw
Quoted 7 lines · Kevin O'Connor
Quoted 4 lines · Avi Kivity

qemu-kvm's switch to seabios uncovered a regression with cdrom handling. Vista x64 no longer recognizes the cdrom, while pc-bios still works. Installing works, but that uses int 13, not the native driver. Haven't investigated further yet.

Thanks for reporting Avi. I will take a look as well.

I'm able to reproduce this problem on my machine with a 32bit vista install. I'll let you know what I find.

-Kevin

author
#4 lore raw
Quoted 9 lines · Kevin O'Connor
Quoted 7 lines · Kevin O'Connor
Quoted 5 lines · Avi Kivity

qemu-kvm's switch to seabios uncovered a regression with cdrom handling. Vista x64 no longer recognizes the cdrom, while pc-bios still works. Installing works, but that uses int 13, not the native driver. Haven't investigated further yet.

Quoted 5 lines
Quoted 2 lines

Thanks for reporting Avi. I will take a look as well.

I'm able to reproduce this problem on my machine with a 32bit vista install. I'll let you know what I find.

This reproduces with qemu upstream as well. The Windows error log complains that the cdrom driver wouldn't load, but nothing else.

Signature · 1 line
error compiling committee.c: too many arguments to function
author
#10 lore raw
In reply to Avi Kivity
Quoted 10 lines · Avi Kivity

qemu-kvm's switch to seabios uncovered a regression with cdrom handling. Vista x64 no longer recognizes the cdrom, while pc-bios still works. Installing works, but that uses int 13, not the native driver. Haven't investigated further yet.

Command line:

qemu -drive file=/root/kvm-autotest/client/tests/kvm/images/winvista-64.qcow2,if=ide,cache=writeback -m 512 -smp 2 -cdrom
/root/kvm-autotest/client/tests/kvm/isos/windows/winutils.iso -snapshot

b496fe34317ead61cf5ae019506fadc8f9ad6556 in qemu-kvm.git.

I've temporarily reverted to bochs bios until this issue is resolved.

Signature · 1 line
error compiling committee.c: too many arguments to function
#11 lore raw
Quoted 13 lines · Avi Kivity
Quoted 12 lines · Avi Kivity

qemu-kvm's switch to seabios uncovered a regression with cdrom handling. Vista x64 no longer recognizes the cdrom, while pc-bios still works. Installing works, but that uses int 13, not the native driver. Haven't investigated further yet.

Command line:

qemu -drive file=/root/kvm-autotest/client/tests/kvm/images/winvista-64.qcow2,if=ide,cache=writeback -m 512 -smp 2 -cdrom /root/kvm-autotest/client/tests/kvm/isos/windows/winutils.iso -snapshot

Quoted 4 lines
Quoted 2 lines

b496fe34317ead61cf5ae019506fadc8f9ad6556 in qemu-kvm.git.

I've temporarily reverted to bochs bios until this issue is resolved.

Make sure my second linuxboot patch (fix linuxboot with bochsbios) is applied then, as otherwise -kernel will break.

Alex

#5 lore raw
In reply to Kevin O'Connor
Quoted 8 lines · Kevin O'Connor
Quoted 4 lines · Avi Kivity

qemu-kvm's switch to seabios uncovered a regression with cdrom handling. Vista x64 no longer recognizes the cdrom, while pc-bios still works. Installing works, but that uses int 13, not the native driver. Haven't investigated further yet.

The only things I can think of that could impact the OS recognizing a cdrom would be: the cdrom left in an odd state (seems unlikely as the OS usually does a full reset), ACPI differences, or int1348 errors.

I've looked into this, and it looks like the cdrom is left in an odd state. At this point, I think SeaBIOS is tickling a bug outside of seabios (eg, in Vista or qemu). I would appreciate it someone with cdrom knowledge of qemu could help.

Here is what I'm seeing.

As reported, the following fails:
qemu -hda winvista -cdrom util.iso

The following also fails:
qemu -hdc winvista -drive file=util.iso,media=cdrom,index=0

However, this works!?
qemu -hdc winvista -drive file=util.iso,media=cdrom,index=1

And this works (both cdroms are seen):
qemu -hdc winvista -drive file=util.iso,media=cdrom,index=0 -drive file=util2.iso,media=cdrom,index=1

The following also works:
qemu -hda winvista -hdc someotherdrive

And this works too:
qemu -hdd winvista -cdrom util.iso

So, basically, something is causing vista to not like the cdrom, but only when the cdrom is a master and there is no slave.

Tracking this further, if I apply the patch to seabios below, I find that it still fails, but if I uncomment the first check then everything works. This leads me to believe that sending an "identify packet device" request to a non-existent slave when a cdrom is master is causing that cdrom master to not be liked by vista.

SeaBIOS has a different ata drive detection mechanism than bochs - it needs it in order to work on real hardware. So, this explains why bochs bios doesn't show this issue. (Seabios tries to send an "identify packet device" and then an "identify device" command to detect a drive; bochs bios looks for a signature in the ata registers after an ata reset.)

Any thoughts?
-Kevin

src/ata.c +5 -0
@@ -713,9 +713,14 @@ ata_detect(void *data)
             last_reset_ataid = ataid;
         }
 
+//        if (slave)
+//            continue;
+
         // check for ATAPI
         u16 buffer[256];
         struct drive_s *drive_g = init_drive_atapi(&dummy, buffer);
+        if (slave)
+            continue;
         if (!drive_g) {
             // Didn't find an ATAPI drive - look for ATA drive.
             u8 st = inb(iobase1+ATA_CB_STAT);
#6 lore raw
Quoted 4 lines · Kevin O'Connor

I've looked into this, and it looks like the cdrom is left in an odd state. At this point, I think SeaBIOS is tickling a bug outside of seabios (eg, in Vista or qemu). I would appreciate it someone with cdrom knowledge of qemu could help.

[...]

Quoted 6 lines

SeaBIOS has a different ata drive detection mechanism than bochs - it needs it in order to work on real hardware. So, this explains why bochs bios doesn't show this issue. (Seabios tries to send an "identify packet device" and then an "identify device" command to detect a drive; bochs bios looks for a signature in the ata registers after an ata reset.)

It looks like I spoke too soon. It appears the SeaBIOS init can leave the ATA controller in an interrupts disabled state. This appears to confuse Vista. So, this is a SeaBIOS bug - I'll implement a fix.

The patch below enables Vista to see the cdrom (though, it's not a real fix).

-Kevin

src/ata.c +1 -0
@@ -237,6 +237,7 @@ send_cmd(struct drive_s *drive_g, struct ata_pio_command *cmd)
         return -4;
     }
     if (!(status & ATA_CB_STAT_DRQ)) {
+    outb(ATA_CB_DC_HD15, iobase2+ATA_CB_DC);
         dprintf(6, "send_cmd : DRQ not set (status %02x)\n", status);
         return -5;
     }
#7 lore raw
Quoted 13 lines · Kevin O'Connor
Quoted 4 lines · Kevin O'Connor

I've looked into this, and it looks like the cdrom is left in an odd state. At this point, I think SeaBIOS is tickling a bug outside of seabios (eg, in Vista or qemu). I would appreciate it someone with cdrom knowledge of qemu could help.

[...]

Quoted 6 lines

SeaBIOS has a different ata drive detection mechanism than bochs - it needs it in order to work on real hardware. So, this explains why bochs bios doesn't show this issue. (Seabios tries to send an "identify packet device" and then an "identify device" command to detect a drive; bochs bios looks for a signature in the ata registers after an ata reset.)

Quoted 3 lines

It looks like I spoke too soon. It appears the SeaBIOS init can leave the ATA controller in an interrupts disabled state. This appears to confuse Vista. So, this is a SeaBIOS bug - I'll implement a fix.

I've committed a fix to SeaBIOS - commit 42bc3940.

-Kevin

author
#8 lore raw
Quoted 7 lines · Kevin O'Connor
Quoted 5 lines

It looks like I spoke too soon. It appears the SeaBIOS init can leave the ATA controller in an interrupts disabled state. This appears to confuse Vista. So, this is a SeaBIOS bug - I'll implement a fix.

I've committed a fix to SeaBIOS - commit 42bc3940.

Many thanks.

Anthony, can you expedite this fix through qemu.git?

Signature · 1 line
error compiling committee.c: too many arguments to function
author
#9 lore raw
In reply to Kevin O'Connor
Quoted 7 lines · Kevin O'Connor
Quoted 5 lines

It looks like I spoke too soon. It appears the SeaBIOS init can leave the ATA controller in an interrupts disabled state. This appears to confuse Vista. So, this is a SeaBIOS bug - I'll implement a fix.

I've committed a fix to SeaBIOS - commit 42bc3940.

I confirm that it works with my regression tests. I now see no regressions except for gpxe/pmm (which I haven't retested yet, stay tuned).

Signature · 1 line
error compiling committee.c: too many arguments to function