Commit eae6bcbfd87c94fd2399b334c2b0a3a9cfa51f52

Authored by Blue Swirl
1 parent 0d0a7e69

Call piix4_reset() on system reset.

Also zero pci_irq_levels on reset to avoid stuck irq after reset.

Based on 15a1956a by Gleb Natapov.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Showing 1 changed file with 5 additions and 1 deletions
hw/piix_pci.c
@@ -272,8 +272,9 @@ static void piix3_reset(void *opaque) @@ -272,8 +272,9 @@ static void piix3_reset(void *opaque)
272 memset(pci_irq_levels, 0, sizeof(pci_irq_levels)); 272 memset(pci_irq_levels, 0, sizeof(pci_irq_levels));
273 } 273 }
274 274
275 -static void piix4_reset(PCIDevice *d) 275 +static void piix4_reset(void *opaque)
276 { 276 {
  277 + PCIDevice *d = opaque;
277 uint8_t *pci_conf = d->config; 278 uint8_t *pci_conf = d->config;
278 279
279 pci_conf[0x04] = 0x07; // master, memory and I/O 280 pci_conf[0x04] = 0x07; // master, memory and I/O
@@ -307,6 +308,8 @@ static void piix4_reset(PCIDevice *d) @@ -307,6 +308,8 @@ static void piix4_reset(PCIDevice *d)
307 pci_conf[0xab] = 0x00; 308 pci_conf[0xab] = 0x00;
308 pci_conf[0xac] = 0x00; 309 pci_conf[0xac] = 0x00;
309 pci_conf[0xae] = 0x00; 310 pci_conf[0xae] = 0x00;
  311 +
  312 + memset(pci_irq_levels, 0, sizeof(pci_irq_levels));
310 } 313 }
311 314
312 static void piix_save(QEMUFile* f, void *opaque) 315 static void piix_save(QEMUFile* f, void *opaque)
@@ -366,5 +369,6 @@ int piix4_init(PCIBus *bus, int devfn) @@ -366,5 +369,6 @@ int piix4_init(PCIBus *bus, int devfn)
366 369
367 370
368 piix4_reset(d); 371 piix4_reset(d);
  372 + qemu_register_reset(piix4_reset, 0, d);
369 return d->devfn; 373 return d->devfn;
370 } 374 }