qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH for-6.0] x86:acpi:piix4: reinitialize PM1.CNT on reset
@ 2021-03-16 20:29 Igor Mammedov
  2021-03-16 20:56 ` Isaku Yamahata
  2021-03-17 16:37 ` [PATCH for-6.0] x86:acpi:piix4: reinitialize PM1.CNT " Reinoud Zandijk
  0 siblings, 2 replies; 6+ messages in thread
From: Igor Mammedov @ 2021-03-16 20:29 UTC (permalink / raw)
  To: qemu-devel
  Cc: isaku.yamahata, berrange, mst, f4bug, reinoud, pbonzini, isaku.yamahata

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.

Fixes: 6be8cf56bc8b (acpi/core: always set SCI_EN when SMM isn't supported)
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
CC: isaku.yamahata@intel.com
CC: mst@redhat.com
CC: reinoud@NetBSD.org
CC: isaku.yamahata@gmail.com
CC: berrange@redhat.com
CC: pbonzini@redhat.com
CC: f4bug@amsat.org
---
 hw/acpi/piix4.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index 1efc0ded9f..7cab438015 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -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);
 }
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH for-6.0] x86:acpi:piix4: reinitialize PM1.CNT on reset
  2021-03-16 20:29 [PATCH for-6.0] x86:acpi:piix4: reinitialize PM1.CNT on reset Igor Mammedov
@ 2021-03-16 20:56 ` Isaku Yamahata
  2021-03-17  9:41   ` Igor Mammedov
  2021-03-17 16:37 ` [PATCH for-6.0] x86:acpi:piix4: reinitialize PM1.CNT " Reinoud Zandijk
  1 sibling, 1 reply; 6+ messages in thread
From: Isaku Yamahata @ 2021-03-16 20:56 UTC (permalink / raw)
  To: Igor Mammedov
  Cc: isaku.yamahata, berrange, mst, f4bug, qemu-devel, reinoud,
	pbonzini, isaku.yamahata

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);

Reviewed-by: Isaku Yamahata <isaku.yamahata@intel.com>

Thanks,


On Tue, Mar 16, 2021 at 04:29:56PM -0400,
Igor Mammedov <imammedo@redhat.com> wrote:

> 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.
> 
> Fixes: 6be8cf56bc8b (acpi/core: always set SCI_EN when SMM isn't supported)
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
> CC: isaku.yamahata@intel.com
> CC: mst@redhat.com
> CC: reinoud@NetBSD.org
> CC: isaku.yamahata@gmail.com
> CC: berrange@redhat.com
> CC: pbonzini@redhat.com
> CC: f4bug@amsat.org
> ---
>  hw/acpi/piix4.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
> index 1efc0ded9f..7cab438015 100644
> --- a/hw/acpi/piix4.c
> +++ b/hw/acpi/piix4.c
> @@ -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);
>  }
> -- 
> 2.27.0
> 
> 

-- 
Isaku Yamahata <isaku.yamahata@gmail.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH for-6.0] x86:acpi:piix4: reinitialize PM1.CNT on reset
  2021-03-16 20:56 ` Isaku Yamahata
@ 2021-03-17  9:41   ` Igor Mammedov
  2021-03-17 21:49     ` [PATCH] acpi:piix4, vt82c686: reinitialize acpi PM device " isaku.yamahata
  0 siblings, 1 reply; 6+ messages in thread
From: Igor Mammedov @ 2021-03-17  9:41 UTC (permalink / raw)
  To: Isaku Yamahata
  Cc: isaku.yamahata, berrange, mst, f4bug, qemu-devel, reinoud, pbonzini

On Tue, 16 Mar 2021 13:56:03 -0700
Isaku Yamahata <isaku.yamahata@gmail.com> wrote:

> 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?

> 
> Reviewed-by: Isaku Yamahata <isaku.yamahata@intel.com>

Thanks!

> 
> Thanks,
> 
> 
> On Tue, Mar 16, 2021 at 04:29:56PM -0400,
> Igor Mammedov <imammedo@redhat.com> wrote:
> 
> > 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.
> > 
> > Fixes: 6be8cf56bc8b (acpi/core: always set SCI_EN when SMM isn't supported)
> > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > ---
> > CC: isaku.yamahata@intel.com
> > CC: mst@redhat.com
> > CC: reinoud@NetBSD.org
> > CC: isaku.yamahata@gmail.com
> > CC: berrange@redhat.com
> > CC: pbonzini@redhat.com
> > CC: f4bug@amsat.org
> > ---
> >  hw/acpi/piix4.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
> > index 1efc0ded9f..7cab438015 100644
> > --- a/hw/acpi/piix4.c
> > +++ b/hw/acpi/piix4.c
> > @@ -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);
> >  }
> > -- 
> > 2.27.0
> > 
> >   
> 



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH for-6.0] x86:acpi:piix4: reinitialize PM1.CNT on reset
  2021-03-16 20:29 [PATCH for-6.0] x86:acpi:piix4: reinitialize PM1.CNT on reset Igor Mammedov
  2021-03-16 20:56 ` Isaku Yamahata
@ 2021-03-17 16:37 ` Reinoud Zandijk
  1 sibling, 0 replies; 6+ messages in thread
From: Reinoud Zandijk @ 2021-03-17 16:37 UTC (permalink / raw)
  To: Igor Mammedov
  Cc: isaku.yamahata, berrange, mst, qemu-devel, f4bug, pbonzini,
	isaku.yamahata

Reported-by: Reinoud Zandijk <reinoud@NetBSD.org>
Tested-by: Reinoud Zandijk <reinoud@NetBSD.org>

It works fine now with the patch



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] acpi:piix4, vt82c686: reinitialize acpi PM device on reset
  2021-03-17  9:41   ` Igor Mammedov
@ 2021-03-17 21:49     ` isaku.yamahata
  2021-03-22 22:57       ` Michael S. Tsirkin
  0 siblings, 1 reply; 6+ messages in thread
From: isaku.yamahata @ 2021-03-17 21:49 UTC (permalink / raw)
  To: qemu-devel
  Cc: isaku.yamahata, berrange, mst, f4bug, Reinoud Zandijk, aurelien,
	pbonzini, Igor Mammedov, isaku.yamahata

From: Isaku Yamahata <isaku.yamahata@intel.com>

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.

Fixes: 6be8cf56bc8b (acpi/core: always set SCI_EN when SMM isn't supported)
Reported-by: Reinoud Zandijk <reinoud@NetBSD.org>
Co-developed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
---
CC: imammedo@redhat.com
CC: isaku.yamahata@intel.com
CC: mst@redhat.com
CC: reinoud@NetBSD.org
CC: isaku.yamahata@gmail.com
CC: berrange@redhat.com
CC: pbonzini@redhat.com
CC: f4bug@amsat.org
CC: aurelien@aurel32.net
---
 hw/acpi/piix4.c   | 7 +++++++
 hw/isa/vt82c686.c | 5 +++++
 2 files changed, 12 insertions(+)

diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index 1efc0ded9f..a00525025b 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -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);
 }
diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c
index 05d084f698..7bacad03e2 100644
--- a/hw/isa/vt82c686.c
+++ b/hw/isa/vt82c686.c
@@ -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);
 }
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] acpi:piix4, vt82c686: reinitialize acpi PM device on reset
  2021-03-17 21:49     ` [PATCH] acpi:piix4, vt82c686: reinitialize acpi PM device " isaku.yamahata
@ 2021-03-22 22:57       ` Michael S. Tsirkin
  0 siblings, 0 replies; 6+ messages in thread
From: Michael S. Tsirkin @ 2021-03-22 22:57 UTC (permalink / raw)
  To: isaku.yamahata
  Cc: isaku.yamahata, berrange, qemu-devel, f4bug, Reinoud Zandijk,
	pbonzini, Igor Mammedov, aurelien

On Wed, Mar 17, 2021 at 02:49:31PM -0700, isaku.yamahata@gmail.com wrote:
> From: Isaku Yamahata <isaku.yamahata@intel.com>
> 
> 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.
> 
> Fixes: 6be8cf56bc8b (acpi/core: always set SCI_EN when SMM isn't supported)
> Reported-by: Reinoud Zandijk <reinoud@NetBSD.org>
> Co-developed-by: Igor Mammedov <imammedo@redhat.com>
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>

Caused regressions reported by Peter. Pls reproduce and debug, then
repost. Thanks!

> ---
> CC: imammedo@redhat.com
> CC: isaku.yamahata@intel.com
> CC: mst@redhat.com
> CC: reinoud@NetBSD.org
> CC: isaku.yamahata@gmail.com
> CC: berrange@redhat.com
> CC: pbonzini@redhat.com
> CC: f4bug@amsat.org
> CC: aurelien@aurel32.net
> ---
>  hw/acpi/piix4.c   | 7 +++++++
>  hw/isa/vt82c686.c | 5 +++++
>  2 files changed, 12 insertions(+)
> 
> diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
> index 1efc0ded9f..a00525025b 100644
> --- a/hw/acpi/piix4.c
> +++ b/hw/acpi/piix4.c
> @@ -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);
>  }
> diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c
> index 05d084f698..7bacad03e2 100644
> --- a/hw/isa/vt82c686.c
> +++ b/hw/isa/vt82c686.c
> @@ -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);
>  }
> -- 
> 2.25.1



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-03-22 22:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-16 20:29 [PATCH for-6.0] x86:acpi:piix4: reinitialize PM1.CNT on reset Igor Mammedov
2021-03-16 20:56 ` Isaku Yamahata
2021-03-17  9:41   ` Igor Mammedov
2021-03-17 21:49     ` [PATCH] acpi:piix4, vt82c686: reinitialize acpi PM device " isaku.yamahata
2021-03-22 22:57       ` Michael S. Tsirkin
2021-03-17 16:37 ` [PATCH for-6.0] x86:acpi:piix4: reinitialize PM1.CNT " Reinoud Zandijk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).