public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 1/1] OvmfPkg/NestedInterruptTplLib: replace ASSERT() with a warning logged.
@ 2023-04-28  9:10 Gerd Hoffmann
  2023-04-28 11:26 ` Michael Brown
  0 siblings, 1 reply; 5+ messages in thread
From: Gerd Hoffmann @ 2023-04-28  9:10 UTC (permalink / raw)
  To: devel
  Cc: Oliver Steffen, Jiewen Yao, Ard Biesheuvel, Pawel Polawski,
	Gerd Hoffmann, Jordan Justen, Michael Brown, Laszlo Ersek

OVMF can't guarantee that the ASSERT() doesn't happen.  Misbehaving
EFI applications can trigger this.  So log a warning instead and try
to continue.

Reproducer: Fetch windows 11 22H2 iso image, boot it in qemu with OVMF.

Traced to BootServices->Stall() being called with IPL=TPL_HIGH_LEVEL
and Interrupts /enabled/ while windows is booting.

Cc: Michael Brown <mcb30@ipxe.org>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 OvmfPkg/Library/NestedInterruptTplLib/Tpl.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/OvmfPkg/Library/NestedInterruptTplLib/Tpl.c b/OvmfPkg/Library/NestedInterruptTplLib/Tpl.c
index e19d98878eb7..cd65a5c995a0 100644
--- a/OvmfPkg/Library/NestedInterruptTplLib/Tpl.c
+++ b/OvmfPkg/Library/NestedInterruptTplLib/Tpl.c
@@ -39,7 +39,15 @@ NestedInterruptRaiseTPL (
   //
   ASSERT (GetInterruptState () == FALSE);
   InterruptedTPL = gBS->RaiseTPL (TPL_HIGH_LEVEL);
-  ASSERT (InterruptedTPL < TPL_HIGH_LEVEL);
+  if (InterruptedTPL >= TPL_HIGH_LEVEL) {
+    DEBUG ((
+      DEBUG_WARN,
+      "%a: Called at IPL %d, trying to fixup and continue...\n",
+      __func__,
+      InterruptedTPL
+      ));
+    InterruptedTPL = TPL_HIGH_LEVEL - 1;
+  }
 
   return InterruptedTPL;
 }
-- 
2.40.0


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

end of thread, other threads:[~2023-05-03  6:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-28  9:10 [PATCH 1/1] OvmfPkg/NestedInterruptTplLib: replace ASSERT() with a warning logged Gerd Hoffmann
2023-04-28 11:26 ` Michael Brown
2023-04-28 13:38   ` Gerd Hoffmann
2023-04-28 14:50     ` [edk2-devel] " Michael Brown
2023-05-03  6:27       ` Gerd Hoffmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox