Skip to contentSkip to conversation

reset PMBA and PMREGMISC PIIX4 registers.

PATCH In review Gleb Natapov 2 participants 3 messages Aug 7, 2012 – Aug 15, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 reset PMBA and PMREGMISC PIIX4 registers.

The bug causes Windows + OVMF hang after reboot since OVMF checks PMREGMISC to see if IO space is enabled and skip configuration if it is.

hw/acpi_piix4.c +3 -2
index 0aace60..90b46b5 100644
@@ -353,6 +353,9 @@ static void piix4_reset(void *opaque)
     pci_conf[0x5a] = 0;
     pci_conf[0x5b] = 0;
 
+    pci_conf[0x40] = 0x01; /* PM io base read only bit */
+    pci_conf[0x80] = 0;
+
     if (s->kvm_enabled) {
         /* Mark SMM as already inited (until KVM supports SMM). */
         pci_conf[0x5B] = 0x02;
@@ -392,8 +395,6 @@ static int piix4_pm_initfn(PCIDevice *dev)
     pci_conf[0x09] = 0x00;
     pci_conf[0x3d] = 0x01; // interrupt pin 1
 
-    pci_conf[0x40] = 0x01; /* PM io base read only bit */
-
     /* APM */
     apm_init(&s->apm, apm_ctrl_changed, s);
 

--
Gleb.

Reviewed-by on v1 1/1
#1 lore raw
Quoted 29 lines · Gleb Natapov

The bug causes Windows + OVMF hang after reboot since OVMF checks PMREGMISC to see if IO space is enabled and skip configuration if it is.

hw/acpi_piix4.c +3 -3
index 0aace60..90b46b5 100644
@@ -353,6 +353,9 @@ static void piix4_reset(void *opaque)
     pci_conf[0x5a] = 0;
     pci_conf[0x5b] = 0;
 
+    pci_conf[0x40] = 0x01; /* PM io base read only bit */
+    pci_conf[0x80] = 0;
+
     if (s->kvm_enabled) {
         /* Mark SMM as already inited (until KVM supports SMM). */
         pci_conf[0x5B] = 0x02;
@@ -392,8 +395,6 @@ static int piix4_pm_initfn(PCIDevice *dev)
     pci_conf[0x09] = 0x00;
     pci_conf[0x3d] = 0x01; // interrupt pin 1
 
-    pci_conf[0x40] = 0x01; /* PM io base read only bit */
-
     /* APM */
     apm_init(&s->apm, apm_ctrl_changed, s);
 
--
Quoted 1 line

Gleb.

Unless I'm missing something, the patch keeps the "PM io base read only bit" set-up correctly the first time around too, since

piix4_pm_initfn()
qemu_register_reset(piix4_reset, ...);

main()
qemu_system_reset()

FWIW,

Thanks!
Laszlo

#2 lore raw
In reply to Gleb Natapov

Ping.

Quoted 29 lines · Gleb Natapov

The bug causes Windows + OVMF hang after reboot since OVMF checks PMREGMISC to see if IO space is enabled and skip configuration if it is.

hw/acpi_piix4.c +3 -3
index 0aace60..90b46b5 100644
@@ -353,6 +353,9 @@ static void piix4_reset(void *opaque)
     pci_conf[0x5a] = 0;
     pci_conf[0x5b] = 0;
 
+    pci_conf[0x40] = 0x01; /* PM io base read only bit */
+    pci_conf[0x80] = 0;
+
     if (s->kvm_enabled) {
         /* Mark SMM as already inited (until KVM supports SMM). */
         pci_conf[0x5B] = 0x02;
@@ -392,8 +395,6 @@ static int piix4_pm_initfn(PCIDevice *dev)
     pci_conf[0x09] = 0x00;
     pci_conf[0x3d] = 0x01; // interrupt pin 1
 
-    pci_conf[0x40] = 0x01; /* PM io base read only bit */
-
     /* APM */
     apm_init(&s->apm, apm_ctrl_changed, s);
 
--
Quoted 1 line

Gleb.

--
Gleb.