Skip to contentSkip to conversation

Fix bugs in the ATAPI cdrom driver

RFC PATCH In review Brandon Philips 4 participants 4 messages Aug 17, 2007 – Aug 19, 2007

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 Fix bugs in the ATAPI cdrom driver

The new libata-eh in the Linux kernel is throwing a fit over the QEMU cdrom device for two reasons:

1) DRQ can be set with ERR_STAT set. This is a violation of the ATAPI state machine.

2) After a TEST_UNIT_READY ATAPI command is sent ERR_STAT is getting set which is correct. But, when the OS issues another ATAPI command ERR_STAT is still set. Which is bad since the next expected command from the OS is REQUEST_SENSE to find out why ERR_STAT is set.

bug this fixes: https://bugzilla.novell.com/show_bug.cgi?id=291775

---
 hw/ide.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
hw/ide.c +4 -1
Index: qemu-0.9.0/hw/ide.c
===================================================================
@@ -586,7 +586,9 @@ static void ide_transfer_start(IDEState 
     s->end_transfer_func = end_transfer_func;
     s->data_ptr = buf;
     s->data_end = buf + size;
-    s->status |= DRQ_STAT;
+    /* don't violate the HSM */
+    if (!(s->status & ERR_STAT))
+        s->status |= DRQ_STAT;
 }
 
 static void ide_transfer_stop(IDEState *s)
@@ -1805,6 +1807,7 @@ static void ide_ioport_write(void *opaqu
             /* overlapping commands not supported */
             if (s->feature & 0x02)
                 goto abort_cmd;
+            s->status = READY_STAT;
             s->atapi_dma = s->feature & 1;
             s->nsector = 1;
             ide_transfer_start(s, s->io_buffer, ATAPI_PACKET_SIZE, 
#1 lore raw
Quoted 2 lines · Brandon Philips

The new libata-eh in the Linux kernel is throwing a fit over the QEMU cdrom device for two reasons:

Nice thanks, was suffering from this issue as well.

Tested with some linux 2.6.23-rc3 guests, looks great now.

Signature · 2 lines
Matthew Kent <[email protected]>
http://magoazul.com
#2 lore raw
Quoted 7 lines · Matthew Kent
Quoted 2 lines · Brandon Philips

The new libata-eh in the Linux kernel is throwing a fit over the QEMU cdrom device for two reasons:

Nice thanks, was suffering from this issue as well.

Tested with some linux 2.6.23-rc3 guests, looks great now.

Great. I would like to see someone from the QEMU project sign off on the correctness of the code too before we carry the patch in our package.

Thanks for testing!

Brandon

#3 lore raw
Quoted 5 lines · Brandon Philips
Quoted 4 lines · Matthew Kent
Quoted 2 lines · Brandon Philips

The new libata-eh in the Linux kernel is throwing a fit over the QEMU cdrom device for two reasons:

Quoted 7 lines
Quoted 3 lines

Nice thanks, was suffering from this issue as well.

Tested with some linux 2.6.23-rc3 guests, looks great now.

Great. I would like to see someone from the QEMU project sign off on the correctness of the code too before we carry the patch in our package.

Committed.

Thiemo