Skip to contentSkip to conversation

PATCH: ide.c: send irq for WIN_DIAGNOSE

Qemu-devel Tristan Gingold 2 participants 6 messages Nov 29, 2007 – Dec 10, 2007

lore
Share & tools
lore
#0 lore raw

Hi,

according to ATA std:
The pending interrupt condition shall be set by:
− the completion of a command; or

This patch sends an irq for WIN_DIAGNOSE (and WIN_SRST)

Tristan.

Index: hw/ide.c
===================================================================
RCS file: /sources/qemu/qemu/hw/ide.c,v
retrieving revision 1.72
diff -c -r1.72 ide.c
*** hw/ide.c 18 Nov 2007 01:44:37 -0000 1.72
--- hw/ide.c 29 Nov 2007 12:57:51 -0000
***************
*** 2038,2054 ****

              }
              ide_set_irq(s);
              break;
-         case WIN_DIAGNOSE:
-             ide_set_signature(s);
-             s->status = 0x00; /* NOTE: READY is _not_ set */
-             s->error = 0x01;
-             break;
          case WIN_SRST:
              if (!s->is_cdrom)
                  goto abort_cmd;
              ide_set_signature(s);
              s->status = 0x00; /* NOTE: READY is _not_ set */
              s->error = 0x01;
              break;
          case WIN_PACKETCMD:
              if (!s->is_cdrom)
--- 2038,2051 ----
              }
              ide_set_irq(s);
              break;
          case WIN_SRST:
              if (!s->is_cdrom)
                  goto abort_cmd;
+         case WIN_DIAGNOSE:
              ide_set_signature(s);
              s->status = 0x00; /* NOTE: READY is _not_ set */
              s->error = 0x01;
+ 	    ide_set_irq(s);
              break;
          case WIN_PACKETCMD:
              if (!s->is_cdrom)
#1 lore raw
Quoted 1 line · Tristan Gingold

according to ATA std:

which ATA std?

Quoted 4 lines

The pending interrupt condition shall be set by:
??? the completion of a command; or

This patch sends an irq for WIN_DIAGNOSE (and WIN_SRST)

DEVICE RESET or DEVICE DIAGNOSTIC in T13/1153D revision 18 don't ask for an irq.

what is the use case you are trying to solve? which guest OS?

Carlo

#2 lore raw
Quoted 4 lines · Carlo Marcelo Arenas Belon
Quoted 1 line · Tristan Gingold

according to ATA std:

which ATA std?

A rather old one: ATA-3

Quoted 7 lines
Quoted 4 lines

The pending interrupt condition shall be set by:
??? the completion of a command; or

This patch sends an irq for WIN_DIAGNOSE (and WIN_SRST)

DEVICE RESET or DEVICE DIAGNOSTIC in T13/1153D revision 18 don't ask for an irq.

Well, not just after the command is executed. But according to 9.5.1 of 1153D:

l) After completing the above steps, Device 0 shall assert INTRQ if nIEN is cleared to zero.

So the IRQ is asserted at the end of diagnostic.

Quoted 1 line

what is the use case you are trying to solve? which guest OS?

The OS timeout during diagnostic.

Tristan.

#3 lore raw
Quoted 12 lines · Tristan Gingold
Quoted 10 lines · Carlo Marcelo Arenas Belon
Quoted 4 lines · Tristan Gingold

The pending interrupt condition shall be set by:
??? the completion of a command; or

This patch sends an irq for WIN_DIAGNOSE (and WIN_SRST)

DEVICE RESET or DEVICE DIAGNOSTIC in T13/1153D revision 18 don't ask for an
irq.

Quoted 7 lines

Well, not just after the command is executed. But according to 9.5.1 of 1153D:

l) After completing the above steps, Device 0 shall assert INTRQ if nIEN is cleared to zero.

So the IRQ is asserted at the end of diagnostic.

right my bad, missed that on my copy of ATA-4 while looking for a match to your description of the mis-implementation, but why are you asserting one also for the reset?

If I am reading the spec and the code right, the patch should be instead :

Index: hw/ide.c
===================================================================
RCS file: /sources/qemu/qemu/hw/ide.c,v
retrieving revision 1.72

ide.c +1 -0
diff -u -r1.72 ide.c
@@ -2042,6 +2053,7 @@
             ide_set_signature(s);
             s->status = 0x00; /* NOTE: READY is _not_ set */
             s->error = 0x01;
+            ide_set_irq(s);
             break;
         case WIN_SRST:
             if (!s->is_cdrom)
Quoted 3 lines
Quoted 1 line

what is the use case you are trying to solve? which guest OS?

The OS timeout during diagnostic.

is there a way to reproduce that timeout on the guest OS you are using? if using Linux and smartctl, you will get a timeout but not because of this but because SMART is not supported (which might be also a bug, but at least not this bug)

Carlo

#4 lore raw
Quoted 3 lines · Carlo Marcelo Arenas Belon

right my bad, missed that on my copy of ATA-4 while looking for a match to your description of the mis-implementation, but why are you asserting one also for the reset?

My fault. I tried to make code common too quickly!

Quoted 1 line

If I am reading the spec and the code right, the patch should be instead :

Looks ok to me.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

what is the use case you are trying to solve? which guest OS?

The OS timeout during diagnostic.

is there a way to reproduce that timeout on the guest OS you are using?

Sure. I will try asap.

Tristan.

#5 lore raw
In reply to Carlo Marcelo Arenas Belon
Quoted 17 lines

Index: hw/ide.c
===================================================================
RCS file: /sources/qemu/qemu/hw/ide.c,v
retrieving revision 1.72
diff -u -r1.72 ide.c

ide.c +1 -0
@@ -2042,6 +2053,7 @@
             ide_set_signature(s);
             s->status = 0x00; /* NOTE: READY is _not_ set */
             s->error = 0x01;
+            ide_set_irq(s);
             break;
         case WIN_SRST:
             if (!s->is_cdrom)
Quoted 1 line

is there a way to reproduce that timeout on the guest OS you are using?

I confirm this fixes the timeout issue.
Tristan.