public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 1/1] OvmfPkg/FvbServicesSmm: use the VmgExitLibNull
@ 2022-02-15 15:16 Brijesh Singh
  2022-02-15 16:14 ` dann frazier
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Brijesh Singh @ 2022-02-15 15:16 UTC (permalink / raw)
  To: devel
  Cc: James Bottomley, Min Xu, Jiewen Yao, Tom Lendacky, Jordan Justen,
	Ard Biesheuvel, Erdem Aktas, Michael Roth, Gerd Hoffmann,
	Brijesh Singh, Aaron Young, Dann Frazier, Michael Roth

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3835

The commit ade62c18f4742301bbef474ac10518bde5972fba caused a boot failure
when OVMF is build with SECURE_BOOT/SMM enabled.

This happen because the above commit extended the BaseMemEncryptSevLib.inf
to include VmgExitLib. The FvbServicesSmm uses the functions provided
by the MemEncryptSevLib to clear the memory encryption mask from the
page table. It created a dependency, as shown below

OvmfPkg/FvbServicesSmm.inf
 ---> MemEncryptSevLib                   class
 ---> "OvmfPkg/BaseMemEncryptSevLib/DxeMemEncryptSevLib.inf"  instance
 ---> VmgExitLib
 ---> "OvmfPkg/VmgExitLib"    instance
 ---> LocalApicLib                       class
 ---> UefiCpuPkg/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf    instance
 ---> TimerLib                           class
 ---> "OvmfPkg/AcpiTimerLib/DxeAcpiTimerLib.inf"              instance
 ---> PciLib                             class
 ---> "OvmfPkg/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf"     instance

The LocalApicLib provides a constructor, execution of the constructor
causes an exception. The SEV-ES and SEV-SNP do not support the SMM, so
skip including the VmgExitLib chain. Use the module override to use the
VmgExitLibNull to avoid the inclusion of unneeded LocalApicLib dependency
chain in FvbServicesSmm. We ran similar issue for AmdSevDxe driver,
see commit 19914edc5a0202cc7830f819ffac7e7b2368166a

After the patch, the dependency look like this:

OvmfPkg/FvbServicesSmm.inf
 ---> MemEncryptSevLib                   class
 ---> "OvmfPkg/BaseMemEncryptSevLib/DxeMemEncryptSevLib.inf"  instance
 ---> VmgExitLib
 ---> "UefiCpuPkg/Library/VmgExitLibNull"    instance

Fixes: ade62c18f4742301bbef474ac10518bde5972fba
Reported-by: Aaron Young <aaron.young@oracle.com>
Cc: Dann Frazier <dann.frazier@canonical.com>
Cc: Michael Roth <michael.roth@amd.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Min Xu <min.m.xu@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
---
 OvmfPkg/CloudHv/CloudHvX64.dsc | 5 ++++-
 OvmfPkg/OvmfPkgIa32.dsc        | 5 ++++-
 OvmfPkg/OvmfPkgIa32X64.dsc     | 5 ++++-
 OvmfPkg/OvmfPkgX64.dsc         | 5 ++++-
 4 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/OvmfPkg/CloudHv/CloudHvX64.dsc b/OvmfPkg/CloudHv/CloudHvX64.dsc
index 8ac9227c5f50..3172100310b1 100644
--- a/OvmfPkg/CloudHv/CloudHvX64.dsc
+++ b/OvmfPkg/CloudHv/CloudHvX64.dsc
@@ -906,7 +906,10 @@ [Components]
   #
   # Variable driver stack (SMM)
   #
-  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf
+  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf {
+    <LibraryClasses>
+    VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
+  }
   MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
   MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {
     <LibraryClasses>
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 29eea82571c5..85abed24c1a7 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -956,7 +956,10 @@ [Components]
   #
   # Variable driver stack (SMM)
   #
-  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf
+  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf {
+    <LibraryClasses>
+    VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
+  }
   MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
   MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {
     <LibraryClasses>
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 56d3c49ab21a..a9c1daecc1a8 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -974,7 +974,10 @@ [Components.X64]
   #
   # Variable driver stack (SMM)
   #
-  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf
+  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf {
+    <LibraryClasses>
+    VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
+  }
   MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
   MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {
     <LibraryClasses>
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index f0924c0f9d0a..718399299f57 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -971,7 +971,10 @@ [Components]
   #
   # Variable driver stack (SMM)
   #
-  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf
+  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf {
+    <LibraryClasses>
+    VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
+  }
   MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
   MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {
     <LibraryClasses>
-- 
2.25.1


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

* Re: [PATCH 1/1] OvmfPkg/FvbServicesSmm: use the VmgExitLibNull
  2022-02-15 15:16 [PATCH 1/1] OvmfPkg/FvbServicesSmm: use the VmgExitLibNull Brijesh Singh
@ 2022-02-15 16:14 ` dann frazier
  2022-02-16  2:51 ` Yao, Jiewen
       [not found] ` <16D42481B2DB4BF7.16436@groups.io>
  2 siblings, 0 replies; 7+ messages in thread
From: dann frazier @ 2022-02-15 16:14 UTC (permalink / raw)
  To: Brijesh Singh
  Cc: devel, James Bottomley, Min Xu, Jiewen Yao, Tom Lendacky,
	Jordan Justen, Ard Biesheuvel, Erdem Aktas, Michael Roth,
	Gerd Hoffmann, Aaron Young

On Tue, Feb 15, 2022 at 09:16:38AM -0600, Brijesh Singh wrote:
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3835
> 
> The commit ade62c18f4742301bbef474ac10518bde5972fba caused a boot failure
> when OVMF is build with SECURE_BOOT/SMM enabled.
> 
> This happen because the above commit extended the BaseMemEncryptSevLib.inf
> to include VmgExitLib. The FvbServicesSmm uses the functions provided
> by the MemEncryptSevLib to clear the memory encryption mask from the
> page table. It created a dependency, as shown below
> 
> OvmfPkg/FvbServicesSmm.inf
>  ---> MemEncryptSevLib                   class
>  ---> "OvmfPkg/BaseMemEncryptSevLib/DxeMemEncryptSevLib.inf"  instance
>  ---> VmgExitLib
>  ---> "OvmfPkg/VmgExitLib"    instance
>  ---> LocalApicLib                       class
>  ---> UefiCpuPkg/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf    instance
>  ---> TimerLib                           class
>  ---> "OvmfPkg/AcpiTimerLib/DxeAcpiTimerLib.inf"              instance
>  ---> PciLib                             class
>  ---> "OvmfPkg/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf"     instance
> 
> The LocalApicLib provides a constructor, execution of the constructor
> causes an exception. The SEV-ES and SEV-SNP do not support the SMM, so
> skip including the VmgExitLib chain. Use the module override to use the
> VmgExitLibNull to avoid the inclusion of unneeded LocalApicLib dependency
> chain in FvbServicesSmm. We ran similar issue for AmdSevDxe driver,
> see commit 19914edc5a0202cc7830f819ffac7e7b2368166a
> 
> After the patch, the dependency look like this:
> 
> OvmfPkg/FvbServicesSmm.inf
>  ---> MemEncryptSevLib                   class
>  ---> "OvmfPkg/BaseMemEncryptSevLib/DxeMemEncryptSevLib.inf"  instance
>  ---> VmgExitLib
>  ---> "UefiCpuPkg/Library/VmgExitLibNull"    instance
> 
> Fixes: ade62c18f4742301bbef474ac10518bde5972fba
> Reported-by: Aaron Young <aaron.young@oracle.com>
> Cc: Dann Frazier <dann.frazier@canonical.com>
> Cc: Michael Roth <michael.roth@amd.com>
> Cc: James Bottomley <jejb@linux.ibm.com>
> Cc: Min Xu <min.m.xu@intel.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Tom Lendacky <thomas.lendacky@amd.com>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Erdem Aktas <erdemaktas@google.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>

Thanks for the quick fix Brijesh!

Tested-by: dann frazier <dann.frazier@canonical.com>

  -dann

> ---
>  OvmfPkg/CloudHv/CloudHvX64.dsc | 5 ++++-
>  OvmfPkg/OvmfPkgIa32.dsc        | 5 ++++-
>  OvmfPkg/OvmfPkgIa32X64.dsc     | 5 ++++-
>  OvmfPkg/OvmfPkgX64.dsc         | 5 ++++-
>  4 files changed, 16 insertions(+), 4 deletions(-)
> 
> diff --git a/OvmfPkg/CloudHv/CloudHvX64.dsc b/OvmfPkg/CloudHv/CloudHvX64.dsc
> index 8ac9227c5f50..3172100310b1 100644
> --- a/OvmfPkg/CloudHv/CloudHvX64.dsc
> +++ b/OvmfPkg/CloudHv/CloudHvX64.dsc
> @@ -906,7 +906,10 @@ [Components]
>    #
>    # Variable driver stack (SMM)
>    #
> -  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf
> +  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf {
> +    <LibraryClasses>
> +    VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
> +  }
>    MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
>    MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {
>      <LibraryClasses>
> diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
> index 29eea82571c5..85abed24c1a7 100644
> --- a/OvmfPkg/OvmfPkgIa32.dsc
> +++ b/OvmfPkg/OvmfPkgIa32.dsc
> @@ -956,7 +956,10 @@ [Components]
>    #
>    # Variable driver stack (SMM)
>    #
> -  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf
> +  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf {
> +    <LibraryClasses>
> +    VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
> +  }
>    MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
>    MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {
>      <LibraryClasses>
> diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
> index 56d3c49ab21a..a9c1daecc1a8 100644
> --- a/OvmfPkg/OvmfPkgIa32X64.dsc
> +++ b/OvmfPkg/OvmfPkgIa32X64.dsc
> @@ -974,7 +974,10 @@ [Components.X64]
>    #
>    # Variable driver stack (SMM)
>    #
> -  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf
> +  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf {
> +    <LibraryClasses>
> +    VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
> +  }
>    MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
>    MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {
>      <LibraryClasses>
> diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
> index f0924c0f9d0a..718399299f57 100644
> --- a/OvmfPkg/OvmfPkgX64.dsc
> +++ b/OvmfPkg/OvmfPkgX64.dsc
> @@ -971,7 +971,10 @@ [Components]
>    #
>    # Variable driver stack (SMM)
>    #
> -  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf
> +  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf {
> +    <LibraryClasses>
> +    VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
> +  }
>    MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
>    MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {
>      <LibraryClasses>

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

* Re: [PATCH 1/1] OvmfPkg/FvbServicesSmm: use the VmgExitLibNull
  2022-02-15 15:16 [PATCH 1/1] OvmfPkg/FvbServicesSmm: use the VmgExitLibNull Brijesh Singh
  2022-02-15 16:14 ` dann frazier
@ 2022-02-16  2:51 ` Yao, Jiewen
       [not found] ` <16D42481B2DB4BF7.16436@groups.io>
  2 siblings, 0 replies; 7+ messages in thread
From: Yao, Jiewen @ 2022-02-16  2:51 UTC (permalink / raw)
  To: Brijesh Singh, devel@edk2.groups.io
  Cc: James Bottomley, Xu, Min M, Tom Lendacky, Justen, Jordan L,
	Ard Biesheuvel, Aktas, Erdem, Michael Roth, Gerd Hoffmann,
	Aaron Young, Dann Frazier, Michael Roth

Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>

> -----Original Message-----
> From: Brijesh Singh <brijesh.singh@amd.com>
> Sent: Tuesday, February 15, 2022 11:17 PM
> To: devel@edk2.groups.io
> Cc: James Bottomley <jejb@linux.ibm.com>; Xu, Min M <min.m.xu@intel.com>;
> Yao, Jiewen <jiewen.yao@intel.com>; Tom Lendacky
> <thomas.lendacky@amd.com>; Justen, Jordan L <jordan.l.justen@intel.com>;
> Ard Biesheuvel <ardb+tianocore@kernel.org>; Aktas, Erdem
> <erdemaktas@google.com>; Michael Roth <Michael.Roth@amd.com>; Gerd
> Hoffmann <kraxel@redhat.com>; Brijesh Singh <brijesh.singh@amd.com>;
> Aaron Young <aaron.young@oracle.com>; Dann Frazier
> <dann.frazier@canonical.com>; Michael Roth <michael.roth@amd.com>
> Subject: [PATCH 1/1] OvmfPkg/FvbServicesSmm: use the VmgExitLibNull
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3835
> 
> The commit ade62c18f4742301bbef474ac10518bde5972fba caused a boot
> failure
> when OVMF is build with SECURE_BOOT/SMM enabled.
> 
> This happen because the above commit extended the
> BaseMemEncryptSevLib.inf
> to include VmgExitLib. The FvbServicesSmm uses the functions provided
> by the MemEncryptSevLib to clear the memory encryption mask from the
> page table. It created a dependency, as shown below
> 
> OvmfPkg/FvbServicesSmm.inf
>  ---> MemEncryptSevLib                   class
>  ---> "OvmfPkg/BaseMemEncryptSevLib/DxeMemEncryptSevLib.inf"  instance
>  ---> VmgExitLib
>  ---> "OvmfPkg/VmgExitLib"    instance
>  ---> LocalApicLib                       class
>  ---> UefiCpuPkg/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf    instance
>  ---> TimerLib                           class
>  ---> "OvmfPkg/AcpiTimerLib/DxeAcpiTimerLib.inf"              instance
>  ---> PciLib                             class
>  ---> "OvmfPkg/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf"     instance
> 
> The LocalApicLib provides a constructor, execution of the constructor
> causes an exception. The SEV-ES and SEV-SNP do not support the SMM, so
> skip including the VmgExitLib chain. Use the module override to use the
> VmgExitLibNull to avoid the inclusion of unneeded LocalApicLib dependency
> chain in FvbServicesSmm. We ran similar issue for AmdSevDxe driver,
> see commit 19914edc5a0202cc7830f819ffac7e7b2368166a
> 
> After the patch, the dependency look like this:
> 
> OvmfPkg/FvbServicesSmm.inf
>  ---> MemEncryptSevLib                   class
>  ---> "OvmfPkg/BaseMemEncryptSevLib/DxeMemEncryptSevLib.inf"  instance
>  ---> VmgExitLib
>  ---> "UefiCpuPkg/Library/VmgExitLibNull"    instance
> 
> Fixes: ade62c18f4742301bbef474ac10518bde5972fba
> Reported-by: Aaron Young <aaron.young@oracle.com>
> Cc: Dann Frazier <dann.frazier@canonical.com>
> Cc: Michael Roth <michael.roth@amd.com>
> Cc: James Bottomley <jejb@linux.ibm.com>
> Cc: Min Xu <min.m.xu@intel.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Tom Lendacky <thomas.lendacky@amd.com>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Erdem Aktas <erdemaktas@google.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
> ---
>  OvmfPkg/CloudHv/CloudHvX64.dsc | 5 ++++-
>  OvmfPkg/OvmfPkgIa32.dsc        | 5 ++++-
>  OvmfPkg/OvmfPkgIa32X64.dsc     | 5 ++++-
>  OvmfPkg/OvmfPkgX64.dsc         | 5 ++++-
>  4 files changed, 16 insertions(+), 4 deletions(-)
> 
> diff --git a/OvmfPkg/CloudHv/CloudHvX64.dsc
> b/OvmfPkg/CloudHv/CloudHvX64.dsc
> index 8ac9227c5f50..3172100310b1 100644
> --- a/OvmfPkg/CloudHv/CloudHvX64.dsc
> +++ b/OvmfPkg/CloudHv/CloudHvX64.dsc
> @@ -906,7 +906,10 @@ [Components]
>    #
>    # Variable driver stack (SMM)
>    #
> -  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf
> +  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf {
> +    <LibraryClasses>
> +    VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
> +  }
>    MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
>    MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {
>      <LibraryClasses>
> diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
> index 29eea82571c5..85abed24c1a7 100644
> --- a/OvmfPkg/OvmfPkgIa32.dsc
> +++ b/OvmfPkg/OvmfPkgIa32.dsc
> @@ -956,7 +956,10 @@ [Components]
>    #
>    # Variable driver stack (SMM)
>    #
> -  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf
> +  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf {
> +    <LibraryClasses>
> +    VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
> +  }
>    MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
>    MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {
>      <LibraryClasses>
> diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
> index 56d3c49ab21a..a9c1daecc1a8 100644
> --- a/OvmfPkg/OvmfPkgIa32X64.dsc
> +++ b/OvmfPkg/OvmfPkgIa32X64.dsc
> @@ -974,7 +974,10 @@ [Components.X64]
>    #
>    # Variable driver stack (SMM)
>    #
> -  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf
> +  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf {
> +    <LibraryClasses>
> +    VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
> +  }
>    MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
>    MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {
>      <LibraryClasses>
> diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
> index f0924c0f9d0a..718399299f57 100644
> --- a/OvmfPkg/OvmfPkgX64.dsc
> +++ b/OvmfPkg/OvmfPkgX64.dsc
> @@ -971,7 +971,10 @@ [Components]
>    #
>    # Variable driver stack (SMM)
>    #
> -  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf
> +  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf {
> +    <LibraryClasses>
> +    VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
> +  }
>    MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
>    MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {
>      <LibraryClasses>
> --
> 2.25.1


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

* Re: [edk2-devel] [PATCH 1/1] OvmfPkg/FvbServicesSmm: use the VmgExitLibNull
       [not found] ` <16D42481B2DB4BF7.16436@groups.io>
@ 2022-02-16  2:55   ` Yao, Jiewen
  2022-02-16  5:54     ` 回复: " gaoliming
  0 siblings, 1 reply; 7+ messages in thread
From: Yao, Jiewen @ 2022-02-16  2:55 UTC (permalink / raw)
  To: devel@edk2.groups.io, Yao, Jiewen, Brijesh Singh
  Cc: James Bottomley, Xu, Min M, Tom Lendacky, Justen, Jordan L,
	Ard Biesheuvel, Aktas, Erdem, Michael Roth, Gerd Hoffmann,
	Aaron Young, Dann Frazier, Gao, Liming

+ Liming

Since it is an issue https://bugzilla.tianocore.org/show_bug.cgi?id=3835 in RC1, I assume we need merge it soon.

Please double confirm.

Thank you
Yao, Jiewen


> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Yao, Jiewen
> Sent: Wednesday, February 16, 2022 10:52 AM
> To: Brijesh Singh <brijesh.singh@amd.com>; devel@edk2.groups.io
> Cc: James Bottomley <jejb@linux.ibm.com>; Xu, Min M <min.m.xu@intel.com>;
> Tom Lendacky <thomas.lendacky@amd.com>; Justen, Jordan L
> <jordan.l.justen@intel.com>; Ard Biesheuvel <ardb+tianocore@kernel.org>;
> Aktas, Erdem <erdemaktas@google.com>; Michael Roth
> <Michael.Roth@amd.com>; Gerd Hoffmann <kraxel@redhat.com>; Aaron
> Young <aaron.young@oracle.com>; Dann Frazier
> <dann.frazier@canonical.com>; Michael Roth <michael.roth@amd.com>
> Subject: Re: [edk2-devel] [PATCH 1/1] OvmfPkg/FvbServicesSmm: use the
> VmgExitLibNull
> 
> Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
> 
> > -----Original Message-----
> > From: Brijesh Singh <brijesh.singh@amd.com>
> > Sent: Tuesday, February 15, 2022 11:17 PM
> > To: devel@edk2.groups.io
> > Cc: James Bottomley <jejb@linux.ibm.com>; Xu, Min M
> <min.m.xu@intel.com>;
> > Yao, Jiewen <jiewen.yao@intel.com>; Tom Lendacky
> > <thomas.lendacky@amd.com>; Justen, Jordan L <jordan.l.justen@intel.com>;
> > Ard Biesheuvel <ardb+tianocore@kernel.org>; Aktas, Erdem
> > <erdemaktas@google.com>; Michael Roth <Michael.Roth@amd.com>; Gerd
> > Hoffmann <kraxel@redhat.com>; Brijesh Singh <brijesh.singh@amd.com>;
> > Aaron Young <aaron.young@oracle.com>; Dann Frazier
> > <dann.frazier@canonical.com>; Michael Roth <michael.roth@amd.com>
> > Subject: [PATCH 1/1] OvmfPkg/FvbServicesSmm: use the VmgExitLibNull
> >
> > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3835
> >
> > The commit ade62c18f4742301bbef474ac10518bde5972fba caused a boot
> > failure
> > when OVMF is build with SECURE_BOOT/SMM enabled.
> >
> > This happen because the above commit extended the
> > BaseMemEncryptSevLib.inf
> > to include VmgExitLib. The FvbServicesSmm uses the functions provided
> > by the MemEncryptSevLib to clear the memory encryption mask from the
> > page table. It created a dependency, as shown below
> >
> > OvmfPkg/FvbServicesSmm.inf
> >  ---> MemEncryptSevLib                   class
> >  ---> "OvmfPkg/BaseMemEncryptSevLib/DxeMemEncryptSevLib.inf"  instance
> >  ---> VmgExitLib
> >  ---> "OvmfPkg/VmgExitLib"    instance
> >  ---> LocalApicLib                       class
> >  ---> UefiCpuPkg/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf    instance
> >  ---> TimerLib                           class
> >  ---> "OvmfPkg/AcpiTimerLib/DxeAcpiTimerLib.inf"              instance
> >  ---> PciLib                             class
> >  ---> "OvmfPkg/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf"     instance
> >
> > The LocalApicLib provides a constructor, execution of the constructor
> > causes an exception. The SEV-ES and SEV-SNP do not support the SMM, so
> > skip including the VmgExitLib chain. Use the module override to use the
> > VmgExitLibNull to avoid the inclusion of unneeded LocalApicLib dependency
> > chain in FvbServicesSmm. We ran similar issue for AmdSevDxe driver,
> > see commit 19914edc5a0202cc7830f819ffac7e7b2368166a
> >
> > After the patch, the dependency look like this:
> >
> > OvmfPkg/FvbServicesSmm.inf
> >  ---> MemEncryptSevLib                   class
> >  ---> "OvmfPkg/BaseMemEncryptSevLib/DxeMemEncryptSevLib.inf"  instance
> >  ---> VmgExitLib
> >  ---> "UefiCpuPkg/Library/VmgExitLibNull"    instance
> >
> > Fixes: ade62c18f4742301bbef474ac10518bde5972fba
> > Reported-by: Aaron Young <aaron.young@oracle.com>
> > Cc: Dann Frazier <dann.frazier@canonical.com>
> > Cc: Michael Roth <michael.roth@amd.com>
> > Cc: James Bottomley <jejb@linux.ibm.com>
> > Cc: Min Xu <min.m.xu@intel.com>
> > Cc: Jiewen Yao <jiewen.yao@intel.com>
> > Cc: Tom Lendacky <thomas.lendacky@amd.com>
> > Cc: Jordan Justen <jordan.l.justen@intel.com>
> > Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> > Cc: Erdem Aktas <erdemaktas@google.com>
> > Cc: Gerd Hoffmann <kraxel@redhat.com>
> > Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
> > ---
> >  OvmfPkg/CloudHv/CloudHvX64.dsc | 5 ++++-
> >  OvmfPkg/OvmfPkgIa32.dsc        | 5 ++++-
> >  OvmfPkg/OvmfPkgIa32X64.dsc     | 5 ++++-
> >  OvmfPkg/OvmfPkgX64.dsc         | 5 ++++-
> >  4 files changed, 16 insertions(+), 4 deletions(-)
> >
> > diff --git a/OvmfPkg/CloudHv/CloudHvX64.dsc
> > b/OvmfPkg/CloudHv/CloudHvX64.dsc
> > index 8ac9227c5f50..3172100310b1 100644
> > --- a/OvmfPkg/CloudHv/CloudHvX64.dsc
> > +++ b/OvmfPkg/CloudHv/CloudHvX64.dsc
> > @@ -906,7 +906,10 @@ [Components]
> >    #
> >    # Variable driver stack (SMM)
> >    #
> > -  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf
> > +  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf {
> > +    <LibraryClasses>
> > +    VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
> > +  }
> >
> MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
> >    MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {
> >      <LibraryClasses>
> > diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
> > index 29eea82571c5..85abed24c1a7 100644
> > --- a/OvmfPkg/OvmfPkgIa32.dsc
> > +++ b/OvmfPkg/OvmfPkgIa32.dsc
> > @@ -956,7 +956,10 @@ [Components]
> >    #
> >    # Variable driver stack (SMM)
> >    #
> > -  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf
> > +  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf {
> > +    <LibraryClasses>
> > +    VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
> > +  }
> >
> MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
> >    MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {
> >      <LibraryClasses>
> > diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
> > index 56d3c49ab21a..a9c1daecc1a8 100644
> > --- a/OvmfPkg/OvmfPkgIa32X64.dsc
> > +++ b/OvmfPkg/OvmfPkgIa32X64.dsc
> > @@ -974,7 +974,10 @@ [Components.X64]
> >    #
> >    # Variable driver stack (SMM)
> >    #
> > -  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf
> > +  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf {
> > +    <LibraryClasses>
> > +    VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
> > +  }
> >
> MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
> >    MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {
> >      <LibraryClasses>
> > diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
> > index f0924c0f9d0a..718399299f57 100644
> > --- a/OvmfPkg/OvmfPkgX64.dsc
> > +++ b/OvmfPkg/OvmfPkgX64.dsc
> > @@ -971,7 +971,10 @@ [Components]
> >    #
> >    # Variable driver stack (SMM)
> >    #
> > -  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf
> > +  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf {
> > +    <LibraryClasses>
> > +    VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
> > +  }
> >
> MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
> >    MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {
> >      <LibraryClasses>
> > --
> > 2.25.1
> 
> 
> 
> 
> 


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

* 回复: [edk2-devel] [PATCH 1/1] OvmfPkg/FvbServicesSmm: use the VmgExitLibNull
  2022-02-16  2:55   ` [edk2-devel] " Yao, Jiewen
@ 2022-02-16  5:54     ` gaoliming
  2022-02-16  5:56       ` Yao, Jiewen
       [not found]       ` <16D42E9E0BFAD166.18853@groups.io>
  0 siblings, 2 replies; 7+ messages in thread
From: gaoliming @ 2022-02-16  5:54 UTC (permalink / raw)
  To: devel, jiewen.yao, 'Brijesh Singh'
  Cc: 'James Bottomley', 'Xu, Min M',
	'Tom Lendacky', 'Justen, Jordan L',
	'Ard Biesheuvel', 'Aktas, Erdem',
	'Michael Roth', 'Gerd Hoffmann',
	'Aaron Young', 'Dann Frazier'

Jiewen:
  I agree to merge this patch for this stable tag 202202. Can you create PR
for it?

Thanks
Liming
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Yao, Jiewen
> 发送时间: 2022年2月16日 10:55
> 收件人: devel@edk2.groups.io; Yao, Jiewen <jiewen.yao@intel.com>; Brijesh
> Singh <brijesh.singh@amd.com>
> 抄送: James Bottomley <jejb@linux.ibm.com>; Xu, Min M
> <min.m.xu@intel.com>; Tom Lendacky <thomas.lendacky@amd.com>;
> Justen, Jordan L <jordan.l.justen@intel.com>; Ard Biesheuvel
> <ardb+tianocore@kernel.org>; Aktas, Erdem <erdemaktas@google.com>;
> Michael Roth <Michael.Roth@amd.com>; Gerd Hoffmann
> <kraxel@redhat.com>; Aaron Young <aaron.young@oracle.com>; Dann
> Frazier <dann.frazier@canonical.com>; Gao, Liming
> <gaoliming@byosoft.com.cn>
> 主题: Re: [edk2-devel] [PATCH 1/1] OvmfPkg/FvbServicesSmm: use the
> VmgExitLibNull
> 
> + Liming
> 
> Since it is an issue https://bugzilla.tianocore.org/show_bug.cgi?id=3835
in
> RC1, I assume we need merge it soon.
> 
> Please double confirm.
> 
> Thank you
> Yao, Jiewen
> 
> 
> > -----Original Message-----
> > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Yao,
> Jiewen
> > Sent: Wednesday, February 16, 2022 10:52 AM
> > To: Brijesh Singh <brijesh.singh@amd.com>; devel@edk2.groups.io
> > Cc: James Bottomley <jejb@linux.ibm.com>; Xu, Min M
> <min.m.xu@intel.com>;
> > Tom Lendacky <thomas.lendacky@amd.com>; Justen, Jordan L
> > <jordan.l.justen@intel.com>; Ard Biesheuvel <ardb+tianocore@kernel.org>;
> > Aktas, Erdem <erdemaktas@google.com>; Michael Roth
> > <Michael.Roth@amd.com>; Gerd Hoffmann <kraxel@redhat.com>; Aaron
> > Young <aaron.young@oracle.com>; Dann Frazier
> > <dann.frazier@canonical.com>; Michael Roth <michael.roth@amd.com>
> > Subject: Re: [edk2-devel] [PATCH 1/1] OvmfPkg/FvbServicesSmm: use the
> > VmgExitLibNull
> >
> > Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
> >
> > > -----Original Message-----
> > > From: Brijesh Singh <brijesh.singh@amd.com>
> > > Sent: Tuesday, February 15, 2022 11:17 PM
> > > To: devel@edk2.groups.io
> > > Cc: James Bottomley <jejb@linux.ibm.com>; Xu, Min M
> > <min.m.xu@intel.com>;
> > > Yao, Jiewen <jiewen.yao@intel.com>; Tom Lendacky
> > > <thomas.lendacky@amd.com>; Justen, Jordan L
> <jordan.l.justen@intel.com>;
> > > Ard Biesheuvel <ardb+tianocore@kernel.org>; Aktas, Erdem
> > > <erdemaktas@google.com>; Michael Roth <Michael.Roth@amd.com>;
> Gerd
> > > Hoffmann <kraxel@redhat.com>; Brijesh Singh <brijesh.singh@amd.com>;
> > > Aaron Young <aaron.young@oracle.com>; Dann Frazier
> > > <dann.frazier@canonical.com>; Michael Roth <michael.roth@amd.com>
> > > Subject: [PATCH 1/1] OvmfPkg/FvbServicesSmm: use the VmgExitLibNull
> > >
> > > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3835
> > >
> > > The commit ade62c18f4742301bbef474ac10518bde5972fba caused a
> boot
> > > failure
> > > when OVMF is build with SECURE_BOOT/SMM enabled.
> > >
> > > This happen because the above commit extended the
> > > BaseMemEncryptSevLib.inf
> > > to include VmgExitLib. The FvbServicesSmm uses the functions provided
> > > by the MemEncryptSevLib to clear the memory encryption mask from the
> > > page table. It created a dependency, as shown below
> > >
> > > OvmfPkg/FvbServicesSmm.inf
> > >  ---> MemEncryptSevLib                   class
> > >  ---> "OvmfPkg/BaseMemEncryptSevLib/DxeMemEncryptSevLib.inf"
> instance
> > >  ---> VmgExitLib
> > >  ---> "OvmfPkg/VmgExitLib"    instance
> > >  ---> LocalApicLib                       class
> > >  ---> UefiCpuPkg/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
> instance
> > >  ---> TimerLib                           class
> > >  ---> "OvmfPkg/AcpiTimerLib/DxeAcpiTimerLib.inf"
> instance
> > >  ---> PciLib                             class
> > >  ---> "OvmfPkg/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf"
> instance
> > >
> > > The LocalApicLib provides a constructor, execution of the constructor
> > > causes an exception. The SEV-ES and SEV-SNP do not support the SMM, so
> > > skip including the VmgExitLib chain. Use the module override to use
the
> > > VmgExitLibNull to avoid the inclusion of unneeded LocalApicLib
> dependency
> > > chain in FvbServicesSmm. We ran similar issue for AmdSevDxe driver,
> > > see commit 19914edc5a0202cc7830f819ffac7e7b2368166a
> > >
> > > After the patch, the dependency look like this:
> > >
> > > OvmfPkg/FvbServicesSmm.inf
> > >  ---> MemEncryptSevLib                   class
> > >  ---> "OvmfPkg/BaseMemEncryptSevLib/DxeMemEncryptSevLib.inf"
> instance
> > >  ---> VmgExitLib
> > >  ---> "UefiCpuPkg/Library/VmgExitLibNull"    instance
> > >
> > > Fixes: ade62c18f4742301bbef474ac10518bde5972fba
> > > Reported-by: Aaron Young <aaron.young@oracle.com>
> > > Cc: Dann Frazier <dann.frazier@canonical.com>
> > > Cc: Michael Roth <michael.roth@amd.com>
> > > Cc: James Bottomley <jejb@linux.ibm.com>
> > > Cc: Min Xu <min.m.xu@intel.com>
> > > Cc: Jiewen Yao <jiewen.yao@intel.com>
> > > Cc: Tom Lendacky <thomas.lendacky@amd.com>
> > > Cc: Jordan Justen <jordan.l.justen@intel.com>
> > > Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> > > Cc: Erdem Aktas <erdemaktas@google.com>
> > > Cc: Gerd Hoffmann <kraxel@redhat.com>
> > > Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
> > > ---
> > >  OvmfPkg/CloudHv/CloudHvX64.dsc | 5 ++++-
> > >  OvmfPkg/OvmfPkgIa32.dsc        | 5 ++++-
> > >  OvmfPkg/OvmfPkgIa32X64.dsc     | 5 ++++-
> > >  OvmfPkg/OvmfPkgX64.dsc         | 5 ++++-
> > >  4 files changed, 16 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/OvmfPkg/CloudHv/CloudHvX64.dsc
> > > b/OvmfPkg/CloudHv/CloudHvX64.dsc
> > > index 8ac9227c5f50..3172100310b1 100644
> > > --- a/OvmfPkg/CloudHv/CloudHvX64.dsc
> > > +++ b/OvmfPkg/CloudHv/CloudHvX64.dsc
> > > @@ -906,7 +906,10 @@ [Components]
> > >    #
> > >    # Variable driver stack (SMM)
> > >    #
> > > -  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf
> > > +  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf {
> > > +    <LibraryClasses>
> > > +    VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
> > > +  }
> > >
> >
> MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
> > >    MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {
> > >      <LibraryClasses>
> > > diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
> > > index 29eea82571c5..85abed24c1a7 100644
> > > --- a/OvmfPkg/OvmfPkgIa32.dsc
> > > +++ b/OvmfPkg/OvmfPkgIa32.dsc
> > > @@ -956,7 +956,10 @@ [Components]
> > >    #
> > >    # Variable driver stack (SMM)
> > >    #
> > > -  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf
> > > +  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf {
> > > +    <LibraryClasses>
> > > +    VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
> > > +  }
> > >
> >
> MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
> > >    MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {
> > >      <LibraryClasses>
> > > diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc
> b/OvmfPkg/OvmfPkgIa32X64.dsc
> > > index 56d3c49ab21a..a9c1daecc1a8 100644
> > > --- a/OvmfPkg/OvmfPkgIa32X64.dsc
> > > +++ b/OvmfPkg/OvmfPkgIa32X64.dsc
> > > @@ -974,7 +974,10 @@ [Components.X64]
> > >    #
> > >    # Variable driver stack (SMM)
> > >    #
> > > -  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf
> > > +  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf {
> > > +    <LibraryClasses>
> > > +    VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
> > > +  }
> > >
> >
> MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
> > >    MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {
> > >      <LibraryClasses>
> > > diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
> > > index f0924c0f9d0a..718399299f57 100644
> > > --- a/OvmfPkg/OvmfPkgX64.dsc
> > > +++ b/OvmfPkg/OvmfPkgX64.dsc
> > > @@ -971,7 +971,10 @@ [Components]
> > >    #
> > >    # Variable driver stack (SMM)
> > >    #
> > > -  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf
> > > +  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf {
> > > +    <LibraryClasses>
> > > +    VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
> > > +  }
> > >
> >
> MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
> > >    MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {
> > >      <LibraryClasses>
> > > --
> > > 2.25.1
> >
> >
> >
> >
> >
> 
> 
> 
> 
> 




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

* Re: [edk2-devel] [PATCH 1/1] OvmfPkg/FvbServicesSmm: use the VmgExitLibNull
  2022-02-16  5:54     ` 回复: " gaoliming
@ 2022-02-16  5:56       ` Yao, Jiewen
       [not found]       ` <16D42E9E0BFAD166.18853@groups.io>
  1 sibling, 0 replies; 7+ messages in thread
From: Yao, Jiewen @ 2022-02-16  5:56 UTC (permalink / raw)
  To: devel@edk2.groups.io, Gao, Liming, 'Brijesh Singh'
  Cc: 'James Bottomley', Xu, Min M, 'Tom Lendacky',
	Justen, Jordan L, 'Ard Biesheuvel', Aktas, Erdem,
	'Michael Roth', 'Gerd Hoffmann',
	'Aaron Young', 'Dann Frazier'

Yes. Will do it soon.


> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of gaoliming
> Sent: Wednesday, February 16, 2022 1:55 PM
> To: devel@edk2.groups.io; Yao, Jiewen <jiewen.yao@intel.com>; 'Brijesh Singh'
> <brijesh.singh@amd.com>
> Cc: 'James Bottomley' <jejb@linux.ibm.com>; Xu, Min M <min.m.xu@intel.com>;
> 'Tom Lendacky' <thomas.lendacky@amd.com>; Justen, Jordan L
> <jordan.l.justen@intel.com>; 'Ard Biesheuvel' <ardb+tianocore@kernel.org>;
> Aktas, Erdem <erdemaktas@google.com>; 'Michael Roth'
> <Michael.Roth@amd.com>; 'Gerd Hoffmann' <kraxel@redhat.com>; 'Aaron
> Young' <aaron.young@oracle.com>; 'Dann Frazier'
> <dann.frazier@canonical.com>
> Subject: 回复: [edk2-devel] [PATCH 1/1] OvmfPkg/FvbServicesSmm: use the
> VmgExitLibNull
> 
> Jiewen:
>   I agree to merge this patch for this stable tag 202202. Can you create PR
> for it?
> 
> Thanks
> Liming
> > -----邮件原件-----
> > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Yao, Jiewen
> > 发送时间: 2022年2月16日 10:55
> > 收件人: devel@edk2.groups.io; Yao, Jiewen <jiewen.yao@intel.com>; Brijesh
> > Singh <brijesh.singh@amd.com>
> > 抄送: James Bottomley <jejb@linux.ibm.com>; Xu, Min M
> > <min.m.xu@intel.com>; Tom Lendacky <thomas.lendacky@amd.com>;
> > Justen, Jordan L <jordan.l.justen@intel.com>; Ard Biesheuvel
> > <ardb+tianocore@kernel.org>; Aktas, Erdem <erdemaktas@google.com>;
> > Michael Roth <Michael.Roth@amd.com>; Gerd Hoffmann
> > <kraxel@redhat.com>; Aaron Young <aaron.young@oracle.com>; Dann
> > Frazier <dann.frazier@canonical.com>; Gao, Liming
> > <gaoliming@byosoft.com.cn>
> > 主题: Re: [edk2-devel] [PATCH 1/1] OvmfPkg/FvbServicesSmm: use the
> > VmgExitLibNull
> >
> > + Liming
> >
> > Since it is an issue https://bugzilla.tianocore.org/show_bug.cgi?id=3835
> in
> > RC1, I assume we need merge it soon.
> >
> > Please double confirm.
> >
> > Thank you
> > Yao, Jiewen
> >
> >
> > > -----Original Message-----
> > > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Yao,
> > Jiewen
> > > Sent: Wednesday, February 16, 2022 10:52 AM
> > > To: Brijesh Singh <brijesh.singh@amd.com>; devel@edk2.groups.io
> > > Cc: James Bottomley <jejb@linux.ibm.com>; Xu, Min M
> > <min.m.xu@intel.com>;
> > > Tom Lendacky <thomas.lendacky@amd.com>; Justen, Jordan L
> > > <jordan.l.justen@intel.com>; Ard Biesheuvel <ardb+tianocore@kernel.org>;
> > > Aktas, Erdem <erdemaktas@google.com>; Michael Roth
> > > <Michael.Roth@amd.com>; Gerd Hoffmann <kraxel@redhat.com>; Aaron
> > > Young <aaron.young@oracle.com>; Dann Frazier
> > > <dann.frazier@canonical.com>; Michael Roth <michael.roth@amd.com>
> > > Subject: Re: [edk2-devel] [PATCH 1/1] OvmfPkg/FvbServicesSmm: use the
> > > VmgExitLibNull
> > >
> > > Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
> > >
> > > > -----Original Message-----
> > > > From: Brijesh Singh <brijesh.singh@amd.com>
> > > > Sent: Tuesday, February 15, 2022 11:17 PM
> > > > To: devel@edk2.groups.io
> > > > Cc: James Bottomley <jejb@linux.ibm.com>; Xu, Min M
> > > <min.m.xu@intel.com>;
> > > > Yao, Jiewen <jiewen.yao@intel.com>; Tom Lendacky
> > > > <thomas.lendacky@amd.com>; Justen, Jordan L
> > <jordan.l.justen@intel.com>;
> > > > Ard Biesheuvel <ardb+tianocore@kernel.org>; Aktas, Erdem
> > > > <erdemaktas@google.com>; Michael Roth <Michael.Roth@amd.com>;
> > Gerd
> > > > Hoffmann <kraxel@redhat.com>; Brijesh Singh <brijesh.singh@amd.com>;
> > > > Aaron Young <aaron.young@oracle.com>; Dann Frazier
> > > > <dann.frazier@canonical.com>; Michael Roth <michael.roth@amd.com>
> > > > Subject: [PATCH 1/1] OvmfPkg/FvbServicesSmm: use the VmgExitLibNull
> > > >
> > > > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3835
> > > >
> > > > The commit ade62c18f4742301bbef474ac10518bde5972fba caused a
> > boot
> > > > failure
> > > > when OVMF is build with SECURE_BOOT/SMM enabled.
> > > >
> > > > This happen because the above commit extended the
> > > > BaseMemEncryptSevLib.inf
> > > > to include VmgExitLib. The FvbServicesSmm uses the functions provided
> > > > by the MemEncryptSevLib to clear the memory encryption mask from the
> > > > page table. It created a dependency, as shown below
> > > >
> > > > OvmfPkg/FvbServicesSmm.inf
> > > >  ---> MemEncryptSevLib                   class
> > > >  ---> "OvmfPkg/BaseMemEncryptSevLib/DxeMemEncryptSevLib.inf"
> > instance
> > > >  ---> VmgExitLib
> > > >  ---> "OvmfPkg/VmgExitLib"    instance
> > > >  ---> LocalApicLib                       class
> > > >  ---> UefiCpuPkg/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
> > instance
> > > >  ---> TimerLib                           class
> > > >  ---> "OvmfPkg/AcpiTimerLib/DxeAcpiTimerLib.inf"
> > instance
> > > >  ---> PciLib                             class
> > > >  ---> "OvmfPkg/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf"
> > instance
> > > >
> > > > The LocalApicLib provides a constructor, execution of the constructor
> > > > causes an exception. The SEV-ES and SEV-SNP do not support the SMM, so
> > > > skip including the VmgExitLib chain. Use the module override to use
> the
> > > > VmgExitLibNull to avoid the inclusion of unneeded LocalApicLib
> > dependency
> > > > chain in FvbServicesSmm. We ran similar issue for AmdSevDxe driver,
> > > > see commit 19914edc5a0202cc7830f819ffac7e7b2368166a
> > > >
> > > > After the patch, the dependency look like this:
> > > >
> > > > OvmfPkg/FvbServicesSmm.inf
> > > >  ---> MemEncryptSevLib                   class
> > > >  ---> "OvmfPkg/BaseMemEncryptSevLib/DxeMemEncryptSevLib.inf"
> > instance
> > > >  ---> VmgExitLib
> > > >  ---> "UefiCpuPkg/Library/VmgExitLibNull"    instance
> > > >
> > > > Fixes: ade62c18f4742301bbef474ac10518bde5972fba
> > > > Reported-by: Aaron Young <aaron.young@oracle.com>
> > > > Cc: Dann Frazier <dann.frazier@canonical.com>
> > > > Cc: Michael Roth <michael.roth@amd.com>
> > > > Cc: James Bottomley <jejb@linux.ibm.com>
> > > > Cc: Min Xu <min.m.xu@intel.com>
> > > > Cc: Jiewen Yao <jiewen.yao@intel.com>
> > > > Cc: Tom Lendacky <thomas.lendacky@amd.com>
> > > > Cc: Jordan Justen <jordan.l.justen@intel.com>
> > > > Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> > > > Cc: Erdem Aktas <erdemaktas@google.com>
> > > > Cc: Gerd Hoffmann <kraxel@redhat.com>
> > > > Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
> > > > ---
> > > >  OvmfPkg/CloudHv/CloudHvX64.dsc | 5 ++++-
> > > >  OvmfPkg/OvmfPkgIa32.dsc        | 5 ++++-
> > > >  OvmfPkg/OvmfPkgIa32X64.dsc     | 5 ++++-
> > > >  OvmfPkg/OvmfPkgX64.dsc         | 5 ++++-
> > > >  4 files changed, 16 insertions(+), 4 deletions(-)
> > > >
> > > > diff --git a/OvmfPkg/CloudHv/CloudHvX64.dsc
> > > > b/OvmfPkg/CloudHv/CloudHvX64.dsc
> > > > index 8ac9227c5f50..3172100310b1 100644
> > > > --- a/OvmfPkg/CloudHv/CloudHvX64.dsc
> > > > +++ b/OvmfPkg/CloudHv/CloudHvX64.dsc
> > > > @@ -906,7 +906,10 @@ [Components]
> > > >    #
> > > >    # Variable driver stack (SMM)
> > > >    #
> > > > -  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf
> > > > +  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf {
> > > > +    <LibraryClasses>
> > > > +    VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
> > > > +  }
> > > >
> > >
> > MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
> > > >    MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {
> > > >      <LibraryClasses>
> > > > diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
> > > > index 29eea82571c5..85abed24c1a7 100644
> > > > --- a/OvmfPkg/OvmfPkgIa32.dsc
> > > > +++ b/OvmfPkg/OvmfPkgIa32.dsc
> > > > @@ -956,7 +956,10 @@ [Components]
> > > >    #
> > > >    # Variable driver stack (SMM)
> > > >    #
> > > > -  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf
> > > > +  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf {
> > > > +    <LibraryClasses>
> > > > +    VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
> > > > +  }
> > > >
> > >
> > MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
> > > >    MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {
> > > >      <LibraryClasses>
> > > > diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc
> > b/OvmfPkg/OvmfPkgIa32X64.dsc
> > > > index 56d3c49ab21a..a9c1daecc1a8 100644
> > > > --- a/OvmfPkg/OvmfPkgIa32X64.dsc
> > > > +++ b/OvmfPkg/OvmfPkgIa32X64.dsc
> > > > @@ -974,7 +974,10 @@ [Components.X64]
> > > >    #
> > > >    # Variable driver stack (SMM)
> > > >    #
> > > > -  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf
> > > > +  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf {
> > > > +    <LibraryClasses>
> > > > +    VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
> > > > +  }
> > > >
> > >
> > MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
> > > >    MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {
> > > >      <LibraryClasses>
> > > > diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
> > > > index f0924c0f9d0a..718399299f57 100644
> > > > --- a/OvmfPkg/OvmfPkgX64.dsc
> > > > +++ b/OvmfPkg/OvmfPkgX64.dsc
> > > > @@ -971,7 +971,10 @@ [Components]
> > > >    #
> > > >    # Variable driver stack (SMM)
> > > >    #
> > > > -  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf
> > > > +  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf {
> > > > +    <LibraryClasses>
> > > > +    VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
> > > > +  }
> > > >
> > >
> > MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
> > > >    MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {
> > > >      <LibraryClasses>
> > > > --
> > > > 2.25.1
> > >
> > >
> > >
> > >
> > >
> >
> >
> >
> >
> >
> 
> 
> 
> 
> 
> 
> 


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

* Re: [edk2-devel] [PATCH 1/1] OvmfPkg/FvbServicesSmm: use the VmgExitLibNull
       [not found]       ` <16D42E9E0BFAD166.18853@groups.io>
@ 2022-02-16  7:00         ` Yao, Jiewen
  0 siblings, 0 replies; 7+ messages in thread
From: Yao, Jiewen @ 2022-02-16  7:00 UTC (permalink / raw)
  To: devel@edk2.groups.io, Yao, Jiewen, Gao, Liming,
	'Brijesh Singh'
  Cc: 'James Bottomley', Xu, Min M, 'Tom Lendacky',
	Justen, Jordan L, 'Ard Biesheuvel', Aktas, Erdem,
	'Michael Roth', 'Gerd Hoffmann',
	'Aaron Young', 'Dann Frazier'

Merged https://github.com/tianocore/edk2/pull/2525

https://github.com/tianocore/edk2/commit/c28e376edc46e6db6e4a551c94b6ac90df0d8d6e

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Yao, Jiewen
> Sent: Wednesday, February 16, 2022 1:57 PM
> To: devel@edk2.groups.io; Gao, Liming <gaoliming@byosoft.com.cn>; 'Brijesh
> Singh' <brijesh.singh@amd.com>
> Cc: 'James Bottomley' <jejb@linux.ibm.com>; Xu, Min M <min.m.xu@intel.com>;
> 'Tom Lendacky' <thomas.lendacky@amd.com>; Justen, Jordan L
> <jordan.l.justen@intel.com>; 'Ard Biesheuvel' <ardb+tianocore@kernel.org>;
> Aktas, Erdem <erdemaktas@google.com>; 'Michael Roth'
> <Michael.Roth@amd.com>; 'Gerd Hoffmann' <kraxel@redhat.com>; 'Aaron
> Young' <aaron.young@oracle.com>; 'Dann Frazier'
> <dann.frazier@canonical.com>
> Subject: Re: [edk2-devel] [PATCH 1/1] OvmfPkg/FvbServicesSmm: use the
> VmgExitLibNull
> 
> Yes. Will do it soon.
> 
> 
> > -----Original Message-----
> > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of gaoliming
> > Sent: Wednesday, February 16, 2022 1:55 PM
> > To: devel@edk2.groups.io; Yao, Jiewen <jiewen.yao@intel.com>; 'Brijesh
> Singh'
> > <brijesh.singh@amd.com>
> > Cc: 'James Bottomley' <jejb@linux.ibm.com>; Xu, Min M
> <min.m.xu@intel.com>;
> > 'Tom Lendacky' <thomas.lendacky@amd.com>; Justen, Jordan L
> > <jordan.l.justen@intel.com>; 'Ard Biesheuvel' <ardb+tianocore@kernel.org>;
> > Aktas, Erdem <erdemaktas@google.com>; 'Michael Roth'
> > <Michael.Roth@amd.com>; 'Gerd Hoffmann' <kraxel@redhat.com>; 'Aaron
> > Young' <aaron.young@oracle.com>; 'Dann Frazier'
> > <dann.frazier@canonical.com>
> > Subject: 回复: [edk2-devel] [PATCH 1/1] OvmfPkg/FvbServicesSmm: use the
> > VmgExitLibNull
> >
> > Jiewen:
> >   I agree to merge this patch for this stable tag 202202. Can you create PR
> > for it?
> >
> > Thanks
> > Liming
> > > -----邮件原件-----
> > > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Yao, Jiewen
> > > 发送时间: 2022年2月16日 10:55
> > > 收件人: devel@edk2.groups.io; Yao, Jiewen <jiewen.yao@intel.com>;
> Brijesh
> > > Singh <brijesh.singh@amd.com>
> > > 抄送: James Bottomley <jejb@linux.ibm.com>; Xu, Min M
> > > <min.m.xu@intel.com>; Tom Lendacky <thomas.lendacky@amd.com>;
> > > Justen, Jordan L <jordan.l.justen@intel.com>; Ard Biesheuvel
> > > <ardb+tianocore@kernel.org>; Aktas, Erdem <erdemaktas@google.com>;
> > > Michael Roth <Michael.Roth@amd.com>; Gerd Hoffmann
> > > <kraxel@redhat.com>; Aaron Young <aaron.young@oracle.com>; Dann
> > > Frazier <dann.frazier@canonical.com>; Gao, Liming
> > > <gaoliming@byosoft.com.cn>
> > > 主题: Re: [edk2-devel] [PATCH 1/1] OvmfPkg/FvbServicesSmm: use the
> > > VmgExitLibNull
> > >
> > > + Liming
> > >
> > > Since it is an issue https://bugzilla.tianocore.org/show_bug.cgi?id=3835
> > in
> > > RC1, I assume we need merge it soon.
> > >
> > > Please double confirm.
> > >
> > > Thank you
> > > Yao, Jiewen
> > >
> > >
> > > > -----Original Message-----
> > > > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Yao,
> > > Jiewen
> > > > Sent: Wednesday, February 16, 2022 10:52 AM
> > > > To: Brijesh Singh <brijesh.singh@amd.com>; devel@edk2.groups.io
> > > > Cc: James Bottomley <jejb@linux.ibm.com>; Xu, Min M
> > > <min.m.xu@intel.com>;
> > > > Tom Lendacky <thomas.lendacky@amd.com>; Justen, Jordan L
> > > > <jordan.l.justen@intel.com>; Ard Biesheuvel
> <ardb+tianocore@kernel.org>;
> > > > Aktas, Erdem <erdemaktas@google.com>; Michael Roth
> > > > <Michael.Roth@amd.com>; Gerd Hoffmann <kraxel@redhat.com>; Aaron
> > > > Young <aaron.young@oracle.com>; Dann Frazier
> > > > <dann.frazier@canonical.com>; Michael Roth <michael.roth@amd.com>
> > > > Subject: Re: [edk2-devel] [PATCH 1/1] OvmfPkg/FvbServicesSmm: use the
> > > > VmgExitLibNull
> > > >
> > > > Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
> > > >
> > > > > -----Original Message-----
> > > > > From: Brijesh Singh <brijesh.singh@amd.com>
> > > > > Sent: Tuesday, February 15, 2022 11:17 PM
> > > > > To: devel@edk2.groups.io
> > > > > Cc: James Bottomley <jejb@linux.ibm.com>; Xu, Min M
> > > > <min.m.xu@intel.com>;
> > > > > Yao, Jiewen <jiewen.yao@intel.com>; Tom Lendacky
> > > > > <thomas.lendacky@amd.com>; Justen, Jordan L
> > > <jordan.l.justen@intel.com>;
> > > > > Ard Biesheuvel <ardb+tianocore@kernel.org>; Aktas, Erdem
> > > > > <erdemaktas@google.com>; Michael Roth <Michael.Roth@amd.com>;
> > > Gerd
> > > > > Hoffmann <kraxel@redhat.com>; Brijesh Singh
> <brijesh.singh@amd.com>;
> > > > > Aaron Young <aaron.young@oracle.com>; Dann Frazier
> > > > > <dann.frazier@canonical.com>; Michael Roth <michael.roth@amd.com>
> > > > > Subject: [PATCH 1/1] OvmfPkg/FvbServicesSmm: use the VmgExitLibNull
> > > > >
> > > > > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3835
> > > > >
> > > > > The commit ade62c18f4742301bbef474ac10518bde5972fba caused a
> > > boot
> > > > > failure
> > > > > when OVMF is build with SECURE_BOOT/SMM enabled.
> > > > >
> > > > > This happen because the above commit extended the
> > > > > BaseMemEncryptSevLib.inf
> > > > > to include VmgExitLib. The FvbServicesSmm uses the functions provided
> > > > > by the MemEncryptSevLib to clear the memory encryption mask from the
> > > > > page table. It created a dependency, as shown below
> > > > >
> > > > > OvmfPkg/FvbServicesSmm.inf
> > > > >  ---> MemEncryptSevLib                   class
> > > > >  ---> "OvmfPkg/BaseMemEncryptSevLib/DxeMemEncryptSevLib.inf"
> > > instance
> > > > >  ---> VmgExitLib
> > > > >  ---> "OvmfPkg/VmgExitLib"    instance
> > > > >  ---> LocalApicLib                       class
> > > > >  ---> UefiCpuPkg/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
> > > instance
> > > > >  ---> TimerLib                           class
> > > > >  ---> "OvmfPkg/AcpiTimerLib/DxeAcpiTimerLib.inf"
> > > instance
> > > > >  ---> PciLib                             class
> > > > >  ---> "OvmfPkg/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf"
> > > instance
> > > > >
> > > > > The LocalApicLib provides a constructor, execution of the constructor
> > > > > causes an exception. The SEV-ES and SEV-SNP do not support the SMM,
> so
> > > > > skip including the VmgExitLib chain. Use the module override to use
> > the
> > > > > VmgExitLibNull to avoid the inclusion of unneeded LocalApicLib
> > > dependency
> > > > > chain in FvbServicesSmm. We ran similar issue for AmdSevDxe driver,
> > > > > see commit 19914edc5a0202cc7830f819ffac7e7b2368166a
> > > > >
> > > > > After the patch, the dependency look like this:
> > > > >
> > > > > OvmfPkg/FvbServicesSmm.inf
> > > > >  ---> MemEncryptSevLib                   class
> > > > >  ---> "OvmfPkg/BaseMemEncryptSevLib/DxeMemEncryptSevLib.inf"
> > > instance
> > > > >  ---> VmgExitLib
> > > > >  ---> "UefiCpuPkg/Library/VmgExitLibNull"    instance
> > > > >
> > > > > Fixes: ade62c18f4742301bbef474ac10518bde5972fba
> > > > > Reported-by: Aaron Young <aaron.young@oracle.com>
> > > > > Cc: Dann Frazier <dann.frazier@canonical.com>
> > > > > Cc: Michael Roth <michael.roth@amd.com>
> > > > > Cc: James Bottomley <jejb@linux.ibm.com>
> > > > > Cc: Min Xu <min.m.xu@intel.com>
> > > > > Cc: Jiewen Yao <jiewen.yao@intel.com>
> > > > > Cc: Tom Lendacky <thomas.lendacky@amd.com>
> > > > > Cc: Jordan Justen <jordan.l.justen@intel.com>
> > > > > Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> > > > > Cc: Erdem Aktas <erdemaktas@google.com>
> > > > > Cc: Gerd Hoffmann <kraxel@redhat.com>
> > > > > Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
> > > > > ---
> > > > >  OvmfPkg/CloudHv/CloudHvX64.dsc | 5 ++++-
> > > > >  OvmfPkg/OvmfPkgIa32.dsc        | 5 ++++-
> > > > >  OvmfPkg/OvmfPkgIa32X64.dsc     | 5 ++++-
> > > > >  OvmfPkg/OvmfPkgX64.dsc         | 5 ++++-
> > > > >  4 files changed, 16 insertions(+), 4 deletions(-)
> > > > >
> > > > > diff --git a/OvmfPkg/CloudHv/CloudHvX64.dsc
> > > > > b/OvmfPkg/CloudHv/CloudHvX64.dsc
> > > > > index 8ac9227c5f50..3172100310b1 100644
> > > > > --- a/OvmfPkg/CloudHv/CloudHvX64.dsc
> > > > > +++ b/OvmfPkg/CloudHv/CloudHvX64.dsc
> > > > > @@ -906,7 +906,10 @@ [Components]
> > > > >    #
> > > > >    # Variable driver stack (SMM)
> > > > >    #
> > > > > -  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf
> > > > > +  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf {
> > > > > +    <LibraryClasses>
> > > > > +    VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
> > > > > +  }
> > > > >
> > > >
> > >
> MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
> > > > >    MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {
> > > > >      <LibraryClasses>
> > > > > diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
> > > > > index 29eea82571c5..85abed24c1a7 100644
> > > > > --- a/OvmfPkg/OvmfPkgIa32.dsc
> > > > > +++ b/OvmfPkg/OvmfPkgIa32.dsc
> > > > > @@ -956,7 +956,10 @@ [Components]
> > > > >    #
> > > > >    # Variable driver stack (SMM)
> > > > >    #
> > > > > -  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf
> > > > > +  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf {
> > > > > +    <LibraryClasses>
> > > > > +    VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
> > > > > +  }
> > > > >
> > > >
> > >
> MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
> > > > >    MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {
> > > > >      <LibraryClasses>
> > > > > diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc
> > > b/OvmfPkg/OvmfPkgIa32X64.dsc
> > > > > index 56d3c49ab21a..a9c1daecc1a8 100644
> > > > > --- a/OvmfPkg/OvmfPkgIa32X64.dsc
> > > > > +++ b/OvmfPkg/OvmfPkgIa32X64.dsc
> > > > > @@ -974,7 +974,10 @@ [Components.X64]
> > > > >    #
> > > > >    # Variable driver stack (SMM)
> > > > >    #
> > > > > -  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf
> > > > > +  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf {
> > > > > +    <LibraryClasses>
> > > > > +    VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
> > > > > +  }
> > > > >
> > > >
> > >
> MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
> > > > >    MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {
> > > > >      <LibraryClasses>
> > > > > diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
> > > > > index f0924c0f9d0a..718399299f57 100644
> > > > > --- a/OvmfPkg/OvmfPkgX64.dsc
> > > > > +++ b/OvmfPkg/OvmfPkgX64.dsc
> > > > > @@ -971,7 +971,10 @@ [Components]
> > > > >    #
> > > > >    # Variable driver stack (SMM)
> > > > >    #
> > > > > -  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf
> > > > > +  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf {
> > > > > +    <LibraryClasses>
> > > > > +    VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
> > > > > +  }
> > > > >
> > > >
> > >
> MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
> > > > >    MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {
> > > > >      <LibraryClasses>
> > > > > --
> > > > > 2.25.1
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > >
> > >
> >
> >
> >
> >
> >
> >
> >
> 
> 
> 
> 
> 


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

end of thread, other threads:[~2022-02-16  7:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-15 15:16 [PATCH 1/1] OvmfPkg/FvbServicesSmm: use the VmgExitLibNull Brijesh Singh
2022-02-15 16:14 ` dann frazier
2022-02-16  2:51 ` Yao, Jiewen
     [not found] ` <16D42481B2DB4BF7.16436@groups.io>
2022-02-16  2:55   ` [edk2-devel] " Yao, Jiewen
2022-02-16  5:54     ` 回复: " gaoliming
2022-02-16  5:56       ` Yao, Jiewen
     [not found]       ` <16D42E9E0BFAD166.18853@groups.io>
2022-02-16  7:00         ` Yao, Jiewen

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