Skip to contentSkip to conversation

call ide_reset when resetting the piix

PATCH In review Naphtali Sprei 3 participants 5 messages Jul 27, 2009 – Aug 2, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 call ide_reset when resetting the piix

In some cases reboot sequence fails to detect the ide device in the rombios sequence for ata_detect, since ioport writes are ignored when the ide device status indicates busy or data request in progres. The ide if must be reset when system reset.

---
 hw/ide.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
hw/ide.c +8 -6
index f3787f2..4bf0987 100644
@@ -3352,6 +3352,8 @@ static void piix3_reset(void *opaque)
 
     for (i = 0; i < 2; i++)
         ide_dma_cancel(&d->bmdma[i]);
+    for (i = 0; i < 4; i++)
+        ide_reset(&d->ide_if[i]);
 
     pci_conf[0x04] = 0x00;
     pci_conf[0x05] = 0x00;
@@ -3383,9 +3385,6 @@ void pci_piix3_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn,
     pci_config_set_class(pci_conf, PCI_CLASS_STORAGE_IDE);
     pci_conf[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL; // header_type
 
-    qemu_register_reset(piix3_reset, 0, d);
-    piix3_reset(d);
-
     pci_register_bar((PCIDevice *)d, 4, 0x10,
                            PCI_ADDRESS_SPACE_IO, bmdma_map);
 
@@ -3398,6 +3397,9 @@ void pci_piix3_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn,
         if (hd_table[i])
             hd_table[i]->private = &d->dev;
 
+    qemu_register_reset(piix3_reset, 0, d);
+    piix3_reset(d);
+
     register_savevm("ide", 0, 2, pci_ide_save, pci_ide_load, d);
 }
 
@@ -3423,9 +3425,6 @@ void pci_piix4_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn,
     pci_config_set_class(pci_conf, PCI_CLASS_STORAGE_IDE);
     pci_conf[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL; // header_type
 
-    qemu_register_reset(piix3_reset, 0, d);
-    piix3_reset(d);
-
     pci_register_bar((PCIDevice *)d, 4, 0x10,
                            PCI_ADDRESS_SPACE_IO, bmdma_map);
 
@@ -3434,6 +3433,9 @@ void pci_piix4_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn,
     ide_init_ioport(&d->ide_if[0], 0x1f0, 0x3f6);
     ide_init_ioport(&d->ide_if[2], 0x170, 0x376);
 
+    qemu_register_reset(piix3_reset, 0, d);
+    piix3_reset(d);
+
     register_savevm("ide", 0, 2, pci_ide_save, pci_ide_load, d);
 }
 
Signature · 1 line
1.5.5.6
#1 lore raw
Quoted 4 lines · Naphtali Sprei

In some cases reboot sequence fails to detect the ide device in the rombios sequence for ata_detect, since ioport writes are ignored when the ide device status indicates busy or data request in progres. The ide if must be reset when system reset.

Does this fix any particular bugs? Is this a candidate for stable branch?

Quoted 63 lines
---
 hw/ide.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
hw/ide.c +8 -6
index f3787f2..4bf0987 100644
@@ -3352,6 +3352,8 @@ static void piix3_reset(void *opaque)
 
     for (i = 0; i < 2; i++)
         ide_dma_cancel(&d->bmdma[i]);
+    for (i = 0; i < 4; i++)
+        ide_reset(&d->ide_if[i]);
 
     pci_conf[0x04] = 0x00;
     pci_conf[0x05] = 0x00;
@@ -3383,9 +3385,6 @@ void pci_piix3_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn,
     pci_config_set_class(pci_conf, PCI_CLASS_STORAGE_IDE);
     pci_conf[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL; // header_type
 
-    qemu_register_reset(piix3_reset, 0, d);
-    piix3_reset(d);
-
     pci_register_bar((PCIDevice *)d, 4, 0x10,
                            PCI_ADDRESS_SPACE_IO, bmdma_map);
 
@@ -3398,6 +3397,9 @@ void pci_piix3_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn,
         if (hd_table[i])
             hd_table[i]->private = &d->dev;
 
+    qemu_register_reset(piix3_reset, 0, d);
+    piix3_reset(d);
+
     register_savevm("ide", 0, 2, pci_ide_save, pci_ide_load, d);
 }
 
@@ -3423,9 +3425,6 @@ void pci_piix4_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn,
     pci_config_set_class(pci_conf, PCI_CLASS_STORAGE_IDE);
     pci_conf[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL; // header_type
 
-    qemu_register_reset(piix3_reset, 0, d);
-    piix3_reset(d);
-
     pci_register_bar((PCIDevice *)d, 4, 0x10,
                            PCI_ADDRESS_SPACE_IO, bmdma_map);
 
@@ -3434,6 +3433,9 @@ void pci_piix4_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn,
     ide_init_ioport(&d->ide_if[0], 0x1f0, 0x3f6);
     ide_init_ioport(&d->ide_if[2], 0x170, 0x376);
 
+    qemu_register_reset(piix3_reset, 0, d);
+    piix3_reset(d);
+
     register_savevm("ide", 0, 2, pci_ide_save, pci_ide_load, d);
 }
 
Signature · 1 line
1.5.5.6
Signature · 4 lines
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
[email protected]
#2 lore raw
Quoted 2 lines · Ryan Harper

Does this fix any particular bugs? Is this a candidate for stable branch?

Yes, it fixes a particular bug, bug #508664 in redhat's bugzilla.
It's a case where the Sysmark 2007 on MS windows xp, starts running, initializes stuff and does a restart. It fails occasionally.

Naphtali

#3 lore raw
In reply to Naphtali Sprei
Quoted 7 lines · Naphtali Sprei

In some cases reboot sequence fails to detect the ide device in the rombios sequence for ata_detect, since ioport writes are ignored when the ide device status indicates busy or data request in progres. The ide if must be reset when system reset.

What is this against?

hw/ide.c void pci_piix3_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn, · line 3388

Quoted 4 lines
hw/ide.c +0 -3
-    qemu_register_reset(piix3_reset, 0, d);
-    piix3_reset(d);
-

qemu_register_reset hasn't had this signature in a long time. I think you need to rebase against tip.

Regards,

Anthony Liguori

#4 lore raw
Quoted 12 lines · Anthony Liguori
Quoted 8 lines · Naphtali Sprei

In some cases reboot sequence fails to detect the ide device in the rombios
sequence for ata_detect, since ioport writes are ignored when the ide device status indicates busy or data request in progres. The ide if must be reset when system reset.

What is this against?

Quoted 7 lines

Review

Quoted 4 lines
(quoted diff) +0 -3
-    qemu_register_reset(piix3_reset, 0, d);
-    piix3_reset(d);
-

qemu_register_reset hasn't had this signature in a long time. I think you need to rebase against tip.

thanks, rebased against tip. Also added text to comment.

Naphtali

Quoted 6 lines

Regards,

Anthony Liguori

Subject: [PATCH] call ide_reset when resetting the piix

In some cases reboot sequence fails to detect the ide device in the rombios sequence for ata_detect, since ioport writes are ignored when the ide device status indicates busy or data request in progres. The ide if must be reset when system reset.

Moved the location of calling piix3_reset since now it must come after
initialization: ide_init2, it eventually calls ide_dummy_transfer_stop that uses the io_buffer.

---
 hw/ide.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
hw/ide.c +8 -6
index 6cf04a6..7e1b776 100644
@@ -3368,6 +3368,8 @@ static void piix3_reset(void *opaque)
 
     for (i = 0; i < 2; i++)
         ide_dma_cancel(&d->bmdma[i]);
+    for (i = 0; i < 4; i++)
+        ide_reset(&d->ide_if[i]);
 
     pci_conf[0x04] = 0x00;
     pci_conf[0x05] = 0x00;
@@ -3399,9 +3401,6 @@ void pci_piix3_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn,
     pci_config_set_class(pci_conf, PCI_CLASS_STORAGE_IDE);
     pci_conf[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL; // header_type
 
-    qemu_register_reset(piix3_reset, d);
-    piix3_reset(d);
-
     pci_register_bar((PCIDevice *)d, 4, 0x10,
                            PCI_ADDRESS_SPACE_IO, bmdma_map);
 
@@ -3414,6 +3413,9 @@ void pci_piix3_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn,
         if (hd_table[i])
             hd_table[i]->private = &d->dev;
 
+    qemu_register_reset(piix3_reset, d);
+    piix3_reset(d);
+
     register_savevm("ide", 0, 2, pci_ide_save, pci_ide_load, d);
 }
 
@@ -3439,9 +3441,6 @@ void pci_piix4_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn,
     pci_config_set_class(pci_conf, PCI_CLASS_STORAGE_IDE);
     pci_conf[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL; // header_type
 
-    qemu_register_reset(piix3_reset, d);
-    piix3_reset(d);
-
     pci_register_bar((PCIDevice *)d, 4, 0x10,
                            PCI_ADDRESS_SPACE_IO, bmdma_map);
 
@@ -3450,6 +3449,9 @@ void pci_piix4_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn,
     ide_init_ioport(&d->ide_if[0], 0x1f0, 0x3f6);
     ide_init_ioport(&d->ide_if[2], 0x170, 0x376);
 
+    qemu_register_reset(piix3_reset, d);
+    piix3_reset(d);
+
     register_savevm("ide", 0, 2, pci_ide_save, pci_ide_load, d);
 }
 
Signature · 1 line
1.5.5.6