[edk2-devel] [PATCH v2] OvmfPkg: Call PlatformInitializeConsole for GPU passthrough case

Stefan Berger posted 1 patch 2 years, 4 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/edk2 tags/patchew/20211217023722.280863-1-stefanb@linux.ibm.com
There is a newer version of this series
OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c      | 7 +++++++
OvmfPkg/Library/PlatformBootManagerLibBhyve/BdsPlatform.c | 5 +++++
OvmfPkg/Library/PlatformBootManagerLibGrub/BdsPlatform.c  | 5 +++++
3 files changed, 17 insertions(+)
[edk2-devel] [PATCH v2] OvmfPkg: Call PlatformInitializeConsole for GPU passthrough case
Posted by Stefan Berger 2 years, 4 months ago
For GPU passthrough support we have to initialize the console after
EfiBootManagerDispatchDeferredImages() has loaded ROMs, so call it after
this. This was the calling order before the TCG physical presence support
had to be moved and the console initialized earlier so user interaction
could be supported before processing TCG physical presence opcodes.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Tested-by: Shivanshu Goyal <shivanshu3@gmail.com>
---
 OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c      | 7 +++++++
 OvmfPkg/Library/PlatformBootManagerLibBhyve/BdsPlatform.c | 5 +++++
 OvmfPkg/Library/PlatformBootManagerLibGrub/BdsPlatform.c  | 5 +++++
 3 files changed, 17 insertions(+)

diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
index 5feadc51d7..0918c35f1f 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -448,6 +448,13 @@ PlatformBootManagerBeforeConsole (
   //
   EfiBootManagerDispatchDeferredImages ();
 
+  //
+  // GPU passthrough only allows Console enablement after ROM image load
+  //
+  PlatformInitializeConsole (
+    XenDetected () ? gXenPlatformConsole : gPlatformConsole
+    );
+
   FrontPageTimeout = GetFrontPageTimeoutFromQemu ();
   PcdStatus        = PcdSet16S (PcdPlatformBootTimeOut, FrontPageTimeout);
   ASSERT_RETURN_ERROR (PcdStatus);
diff --git a/OvmfPkg/Library/PlatformBootManagerLibBhyve/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLibBhyve/BdsPlatform.c
index 119f24b330..bf2701965f 100644
--- a/OvmfPkg/Library/PlatformBootManagerLibBhyve/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLibBhyve/BdsPlatform.c
@@ -434,6 +434,11 @@ PlatformBootManagerBeforeConsole (
   //
   EfiBootManagerDispatchDeferredImages ();
 
+  //
+  // GPU passthrough only allows Console enablement after ROM image load
+  //
+  PlatformInitializeConsole (gPlatformConsole);
+
   PlatformRegisterOptionsAndKeys ();
 
   //
diff --git a/OvmfPkg/Library/PlatformBootManagerLibGrub/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLibGrub/BdsPlatform.c
index 9c6848bbff..a402589206 100644
--- a/OvmfPkg/Library/PlatformBootManagerLibGrub/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLibGrub/BdsPlatform.c
@@ -392,6 +392,11 @@ PlatformBootManagerBeforeConsole (
   //
   EfiBootManagerDispatchDeferredImages ();
 
+  //
+  // GPU passthrough only allows Console enablement after ROM image load
+  //
+  PlatformInitializeConsole (gPlatformConsole);
+
   Status = gRT->SetVariable (
                   EFI_TIME_OUT_VARIABLE_NAME,
                   &gEfiGlobalVariableGuid,
-- 
2.31.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#85034): https://edk2.groups.io/g/devel/message/85034
Mute This Topic: https://groups.io/mt/87782120/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-