x86:acpi:piix4: reinitialize PM1.CNT on reset
PATCH 1/1 x86:acpi:piix4: reinitialize PM1.CNT on reset
Commit 6be8cf56bc8b made sure that SCI is enabled in PM1.CNT on reset in acpi_only mode by modifying acpi_pm1_cnt_reset() and that worked for q35 as expected.
The function was introduced by commit
eaba51c573a (acpi, acpi_piix, vt82c686: factor out PM1_CNT logic)
that forgot to actually call it at piix4 reset time and as result SCI_EN wasn't set as was expected by 6be8cf56bc8b in acpi_only mode.
So Windows crashes when it notices that SCI_EN is not set and FADT is
not providing information about how to enable it anymore.
Reproducer:
qemu-system-x86_64 -enable-kvm -M pc-i440fx-6.0,smm=off -cdrom any_windows_10x64.iso
Fix it by calling acpi_pm1_cnt_reset() at piix4 reset time.
---
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
--- hw/acpi/piix4.c | 1 + 1 file changed, 1 insertion(+)
hw/acpi/piix4.c +1 -0
@@ -325,6 +325,7 @@ static void piix4_pm_reset(DeviceState *dev)/* Mark SMM as already inited (until KVM supports SMM). */ pci_conf[0x5B ] =0x02 ; } +acpi_pm1_cnt_reset (&s->ar);pm_io_space_update (s);acpi_pcihp_reset (&s->acpi_pci_hotplug, !s->use_acpi_root_pci_hotplug); }
Signature · 1 line
2.27.0
The fix itself looks good to me for the reported issue. Should more registers be reset in theory?
But it would cause other issues.
i.e.acpi_pm1_evt_reset(&s->ar);acpi_pm_tmr_reset(&s->ar);acpi_gpe_reset(&s->ar);
Thanks,
Quoted 46 lines · Igor Mammedov
Commit
6be8cf56bc8bmade sure that SCI is enabled in PM1.CNT on reset inacpi_onlymode by modifyingacpi_pm1_cnt_reset()and that worked for q35 as expected.The function was introduced by commit
eaba51c573a(acpi,acpi_piix, vt82c686: factor outPM1_CNTlogic)
that forgot to actually call it at piix4 reset time and as resultSCI_ENwasn't set as was expected by6be8cf56bc8binacpi_onlymode.So Windows crashes when it notices that
SCI_ENis not set and FADT is not providing information about how to enable it anymore. Reproducer:qemu-system-x86_64 -enable-kvm -M pc-i440fx-6.0,smm=off -cdrom any_windows_10x64.isoFix it by calling
acpi_pm1_cnt_reset()at piix4 reset time.Fixes 6be8cf56bc8b (acpi/core: always set SCI_EN when SMM isn't supported)Signed-off-by Igor Mammedov <[email protected]>---
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]--- hw/acpi/piix4.c | 1 + 1 file changed, 1 insertion(+)hw/acpi/piix4.c +1
-0@@ -325,6 +325,7 @@ static void piix4_pm_reset(DeviceState *dev)/* Mark SMM as already inited (until KVM supports SMM). */ pci_conf[0x5B ] =0x02 ; } +acpi_pm1_cnt_reset (&s->ar);pm_io_space_update (s);acpi_pcihp_reset (&s->acpi_pci_hotplug, !s->use_acpi_root_pci_hotplug); }Signature · 1 line
2.27.0
Signature · 1 line
Isaku Yamahata <[email protected]>
Quoted 8 lines · On Tue, 16 Mar 2021 13:56:03 -0700 Isaku Yamahata <[email protected]>…
The fix itself looks good to me for the reported issue. Should more registers be reset in theory?
But it would cause other issues.i.e.
acpi_pm1_evt_reset(&s->ar);acpi_pm_tmr_reset(&s->ar);acpi_gpe_reset(&s->ar);
It's very possible we should reset other registers too. Can you look into it, please?
Quoted 2 lines
Reviewed-by Isaku Yamahata <[email protected]>
Thanks!
Quoted 54 lines
Thanks,
Quoted 46 lines · Igor Mammedov
Commit
6be8cf56bc8bmade sure that SCI is enabled in PM1.CNT on reset inacpi_onlymode by modifyingacpi_pm1_cnt_reset()and that worked for q35 as expected.The function was introduced by commit
eaba51c573a(acpi,acpi_piix, vt82c686: factor outPM1_CNTlogic)
that forgot to actually call it at piix4 reset time and as resultSCI_ENwasn't set as was expected by6be8cf56bc8binacpi_onlymode.So Windows crashes when it notices that
SCI_ENis not set and FADT is not providing information about how to enable it anymore. Reproducer:qemu-system-x86_64 -enable-kvm -M pc-i440fx-6.0,smm=off -cdrom any_windows_10x64.isoFix it by calling
acpi_pm1_cnt_reset()at piix4 reset time.Fixes 6be8cf56bc8b (acpi/core: always set SCI_EN when SMM isn't supported)Signed-off-by Igor Mammedov <[email protected]>---
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]--- hw/acpi/piix4.c | 1 + 1 file changed, 1 insertion(+)hw/acpi/piix4.c +1
-0@@ -325,6 +325,7 @@ static void piix4_pm_reset(DeviceState *dev)/* Mark SMM as already inited (until KVM supports SMM). */ pci_conf[0x5B ] =0x02 ; } +acpi_pm1_cnt_reset (&s->ar);pm_io_space_update (s);acpi_pcihp_reset (&s->acpi_pci_hotplug, !s->use_acpi_root_pci_hotplug); }Signature · 1 line
2.27.0
PATCH 1/1 acpi:piix4, vt82c686: reinitialize acpi PM device on reset
From: Isaku Yamahata <[email protected]>
Commit 6be8cf56bc8b made sure that SCI is enabled in PM1.CNT on reset in acpi_only mode by modifying acpi_pm1_cnt_reset() and that worked for q35 as expected.
The function was introduced by commit
eaba51c573a (acpi, acpi_piix, vt82c686: factor out PM1_CNT logic)
that forgot to actually call it at piix4 reset time and as result SCI_EN wasn't set as was expected by 6be8cf56bc8b in acpi_only mode.
So Windows crashes when it notices that SCI_EN is not set and FADT is
not providing information about how to enable it anymore.
Reproducer:
qemu-system-x86_64 -enable-kvm -M pc-i440fx-6.0,smm=off -cdrom any_windows_10x64.iso
Fix it by calling acpi_pm1_cnt_reset() at piix4 reset time.
Occasionally this patch adds reset acpi PM related registers on piix4/vt582c686 reset time and de-assert sci. piix4_pm_realize() initializes acpi pm tmr, evt, cnt and gpe. via_pm_realize() initializes acpi pm tmr, evt and cnt. reset them on device reset. pm_reset() in ich9.c correctly calls corresponding reset functions.
---
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
--- hw/acpi/piix4.c | 7 +++++++ hw/isa/vt82c686.c | 5 +++++ 2 files changed, 12 insertions(+)
hw/acpi/piix4.c +7 -0
@@ -325,6 +325,13 @@ static void piix4_pm_reset(DeviceState *dev)/* Mark SMM as already inited (until KVM supports SMM). */ pci_conf[0x5B ] =0x02 ; } + +acpi_pm1_evt_reset (&s->ar); +acpi_pm1_cnt_reset (&s->ar); +acpi_pm_tmr_reset (&s->ar); +acpi_gpe_reset (&s->ar); +acpi_update_sci (&s->ar, s->irq); +pm_io_space_update (s);acpi_pcihp_reset (&s->acpi_pci_hotplug, !s->use_acpi_root_pci_hotplug); }
hw/isa/vt82c686.c +5 -0
@@ -167,6 +167,11 @@ static void via_pm_reset(DeviceState *d)/* SMBus IO base */ pci_set_long (s->dev.config +0x90 ,1 ); +acpi_pm1_evt_reset (&s->ar); +acpi_pm1_cnt_reset (&s->ar); +acpi_pm_tmr_reset (&s->ar); +pm_update_sci (s); +pm_io_space_update (s);smb_io_space_update (s); }
Signature · 1 line
2.25.1
Re: [PATCH] acpi:piix4, vt82c686: reinitialize acpi PM device on reset
Quoted 25 lines · On Wed, Mar 17, 2021 at 02:49:31PM -0700, [email protected] wrote:
From: Isaku Yamahata <[email protected]>
Commit
6be8cf56bc8bmade sure that SCI is enabled in PM1.CNT on reset inacpi_onlymode by modifyingacpi_pm1_cnt_reset()and that worked for q35 as expected.The function was introduced by commit
eaba51c573a(acpi,acpi_piix, vt82c686: factor outPM1_CNTlogic)
that forgot to actually call it at piix4 reset time and as resultSCI_ENwasn't set as was expected by6be8cf56bc8binacpi_onlymode.So Windows crashes when it notices that
SCI_ENis not set and FADT is not providing information about how to enable it anymore. Reproducer:qemu-system-x86_64 -enable-kvm -M pc-i440fx-6.0,smm=off -cdrom any_windows_10x64.isoFix it by calling
acpi_pm1_cnt_reset()at piix4 reset time.Occasionally this patch adds reset acpi PM related registers on piix4/vt582c686 reset time and de-assert sci.
piix4_pm_realize()initializes acpi pm tmr, evt, cnt and gpe.via_pm_realize()initializes acpi pm tmr, evt and cnt. reset them on device reset.pm_reset()inich9.ccorrectly calls corresponding reset functions.
Quoted 5 lines
Fixes 6be8cf56bc8b (acpi/core: always set SCI_EN when SMM isn't supported)Reported-by Reinoud Zandijk <[email protected]>Co-developed-by Igor Mammedov <[email protected]>Signed-off-by Igor Mammedov <[email protected]>Signed-off-by Isaku Yamahata <[email protected]>
Caused regressions reported by Peter. Pls reproduce and debug, then repost. Thanks!
Quoted 51 lines
---
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]--- hw/acpi/piix4.c | 7 +++++++ hw/isa/vt82c686.c | 5 +++++ 2 files changed, 12 insertions(+)hw/acpi/piix4.c +7
-0@@ -325,6 +325,13 @@ static void piix4_pm_reset(DeviceState *dev)/* Mark SMM as already inited (until KVM supports SMM). */ pci_conf[0x5B ] =0x02 ; } + +acpi_pm1_evt_reset (&s->ar); +acpi_pm1_cnt_reset (&s->ar); +acpi_pm_tmr_reset (&s->ar); +acpi_gpe_reset (&s->ar); +acpi_update_sci (&s->ar, s->irq); +pm_io_space_update (s);acpi_pcihp_reset (&s->acpi_pci_hotplug, !s->use_acpi_root_pci_hotplug); }hw/isa/vt82c686.c +5
-0@@ -167,6 +167,11 @@ static void via_pm_reset(DeviceState *d)/* SMBus IO base */ pci_set_long (s->dev.config +0x90 ,1 ); +acpi_pm1_evt_reset (&s->ar); +acpi_pm1_cnt_reset (&s->ar); +acpi_pm_tmr_reset (&s->ar); +pm_update_sci (s); +pm_io_space_update (s);smb_io_space_update (s); }Signature · 1 line
2.25.1
It works fine now with the patch