public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] OvmfPkg/OvmfPkgX64: Use different CcProbeLib when SMM is on or off
@ 2022-05-17 12:43 Min Xu
  2022-05-17 12:47 ` Yao, Jiewen
  2022-05-17 15:19 ` dann frazier
  0 siblings, 2 replies; 5+ messages in thread
From: Min Xu @ 2022-05-17 12:43 UTC (permalink / raw)
  To: devel
  Cc: Min Xu, dann frazier, Erdem Aktas, James Bottomley, Jiewen Yao,
	Tom Lendacky

CcProbeLib is designed to check the vm guest type. The OvmfPkg/CcProbeLib
reads the OvmfWorkArea (0x80B000) to get the vm guest type which is
written by each guest (SEV or TDX guest). But in SMM drivers the access
to OvmfWorkArea is illegal. PiSmmCpuDxeSmm.inf is an example. It uses
IoLib which in OvmfPkgX64 BaseIoLibIntrinsicSev.inf is included. The
IoLib probes if the working guest is td guest by calling CcProbe().

So CcProbeLibNull will be included when SMM_REQUIRE is set. Currently
only TDVF uses CcProbe to check the guest type, and TDVF doesn't
support SMM, so this fix has no side-effect.

Cc: dann frazier <dann.frazier@canonical.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
---
 OvmfPkg/OvmfPkgX64.dsc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 71526bba31..db7f4def7a 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -171,7 +171,6 @@
   PciCapLib|OvmfPkg/Library/BasePciCapLib/BasePciCapLib.inf
   PciCapPciSegmentLib|OvmfPkg/Library/BasePciCapPciSegmentLib/BasePciCapPciSegmentLib.inf
   PciCapPciIoLib|OvmfPkg/Library/UefiPciCapPciIoLib/UefiPciCapPciIoLib.inf
-  CcProbeLib|OvmfPkg/Library/CcProbeLib/CcProbeLib.inf
   IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf
   OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
   SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf
@@ -198,6 +197,9 @@
 
 !if $(SMM_REQUIRE) == FALSE
   LockBoxLib|OvmfPkg/Library/LockBoxLib/LockBoxBaseLib.inf
+  CcProbeLib|OvmfPkg/Library/CcProbeLib/CcProbeLib.inf
+!else
+  CcProbeLib|MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf
 !endif
   CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
   FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf
-- 
2.29.2.windows.2


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

* Re: [PATCH] OvmfPkg/OvmfPkgX64: Use different CcProbeLib when SMM is on or off
  2022-05-17 12:43 [PATCH] OvmfPkg/OvmfPkgX64: Use different CcProbeLib when SMM is on or off Min Xu
@ 2022-05-17 12:47 ` Yao, Jiewen
  2022-05-17 15:22   ` dann frazier
  2022-05-17 15:19 ` dann frazier
  1 sibling, 1 reply; 5+ messages in thread
From: Yao, Jiewen @ 2022-05-17 12:47 UTC (permalink / raw)
  To: Xu, Min M, devel@edk2.groups.io
  Cc: dann frazier, Aktas, Erdem, James Bottomley, Tom Lendacky

Question: Does this patch need catch release 202205 release?



> -----Original Message-----
> From: Xu, Min M <min.m.xu@intel.com>
> Sent: Tuesday, May 17, 2022 8:43 PM
> To: devel@edk2.groups.io
> Cc: Xu, Min M <min.m.xu@intel.com>; dann frazier
> <dann.frazier@canonical.com>; Aktas, Erdem <erdemaktas@google.com>;
> James Bottomley <jejb@linux.ibm.com>; Yao, Jiewen <jiewen.yao@intel.com>;
> Tom Lendacky <thomas.lendacky@amd.com>
> Subject: [PATCH] OvmfPkg/OvmfPkgX64: Use different CcProbeLib when SMM is
> on or off
> 
> CcProbeLib is designed to check the vm guest type. The OvmfPkg/CcProbeLib
> reads the OvmfWorkArea (0x80B000) to get the vm guest type which is
> written by each guest (SEV or TDX guest). But in SMM drivers the access
> to OvmfWorkArea is illegal. PiSmmCpuDxeSmm.inf is an example. It uses
> IoLib which in OvmfPkgX64 BaseIoLibIntrinsicSev.inf is included. The
> IoLib probes if the working guest is td guest by calling CcProbe().
> 
> So CcProbeLibNull will be included when SMM_REQUIRE is set. Currently
> only TDVF uses CcProbe to check the guest type, and TDVF doesn't
> support SMM, so this fix has no side-effect.
> 
> Cc: dann frazier <dann.frazier@canonical.com>
> Cc: Erdem Aktas <erdemaktas@google.com>
> Cc: James Bottomley <jejb@linux.ibm.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Tom Lendacky <thomas.lendacky@amd.com>
> Signed-off-by: Min Xu <min.m.xu@intel.com>
> ---
>  OvmfPkg/OvmfPkgX64.dsc | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
> index 71526bba31..db7f4def7a 100644
> --- a/OvmfPkg/OvmfPkgX64.dsc
> +++ b/OvmfPkg/OvmfPkgX64.dsc
> @@ -171,7 +171,6 @@
>    PciCapLib|OvmfPkg/Library/BasePciCapLib/BasePciCapLib.inf
> 
> PciCapPciSegmentLib|OvmfPkg/Library/BasePciCapPciSegmentLib/BasePciCapP
> ciSegmentLib.inf
>    PciCapPciIoLib|OvmfPkg/Library/UefiPciCapPciIoLib/UefiPciCapPciIoLib.inf
> -  CcProbeLib|OvmfPkg/Library/CcProbeLib/CcProbeLib.inf
>    IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf
> 
> OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/
> OemHookStatusCodeLibNull.inf
>    SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf
> @@ -198,6 +197,9 @@
> 
>  !if $(SMM_REQUIRE) == FALSE
>    LockBoxLib|OvmfPkg/Library/LockBoxLib/LockBoxBaseLib.inf
> +  CcProbeLib|OvmfPkg/Library/CcProbeLib/CcProbeLib.inf
> +!else
> +  CcProbeLib|MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf
>  !endif
> 
> CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/Customize
> dDisplayLib.inf
> 
> FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLi
> b.inf
> --
> 2.29.2.windows.2


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

* Re: [PATCH] OvmfPkg/OvmfPkgX64: Use different CcProbeLib when SMM is on or off
  2022-05-17 12:43 [PATCH] OvmfPkg/OvmfPkgX64: Use different CcProbeLib when SMM is on or off Min Xu
  2022-05-17 12:47 ` Yao, Jiewen
@ 2022-05-17 15:19 ` dann frazier
  1 sibling, 0 replies; 5+ messages in thread
From: dann frazier @ 2022-05-17 15:19 UTC (permalink / raw)
  To: Min Xu; +Cc: devel, Erdem Aktas, James Bottomley, Jiewen Yao, Tom Lendacky

On Tue, May 17, 2022 at 08:43:14PM +0800, Min Xu wrote:
> CcProbeLib is designed to check the vm guest type. The OvmfPkg/CcProbeLib
> reads the OvmfWorkArea (0x80B000) to get the vm guest type which is
> written by each guest (SEV or TDX guest). But in SMM drivers the access
> to OvmfWorkArea is illegal. PiSmmCpuDxeSmm.inf is an example. It uses
> IoLib which in OvmfPkgX64 BaseIoLibIntrinsicSev.inf is included. The
> IoLib probes if the working guest is td guest by calling CcProbe().
> 
> So CcProbeLibNull will be included when SMM_REQUIRE is set. Currently
> only TDVF uses CcProbe to check the guest type, and TDVF doesn't
> support SMM, so this fix has no side-effect.

This is confirmed to fix the issue I reported, thanks!

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

  -dann

> Cc: dann frazier <dann.frazier@canonical.com>
> Cc: Erdem Aktas <erdemaktas@google.com>
> Cc: James Bottomley <jejb@linux.ibm.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Tom Lendacky <thomas.lendacky@amd.com>
> Signed-off-by: Min Xu <min.m.xu@intel.com>
> ---
>  OvmfPkg/OvmfPkgX64.dsc | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
> index 71526bba31..db7f4def7a 100644
> --- a/OvmfPkg/OvmfPkgX64.dsc
> +++ b/OvmfPkg/OvmfPkgX64.dsc
> @@ -171,7 +171,6 @@
>    PciCapLib|OvmfPkg/Library/BasePciCapLib/BasePciCapLib.inf
>    PciCapPciSegmentLib|OvmfPkg/Library/BasePciCapPciSegmentLib/BasePciCapPciSegmentLib.inf
>    PciCapPciIoLib|OvmfPkg/Library/UefiPciCapPciIoLib/UefiPciCapPciIoLib.inf
> -  CcProbeLib|OvmfPkg/Library/CcProbeLib/CcProbeLib.inf
>    IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf
>    OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
>    SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf
> @@ -198,6 +197,9 @@
>  
>  !if $(SMM_REQUIRE) == FALSE
>    LockBoxLib|OvmfPkg/Library/LockBoxLib/LockBoxBaseLib.inf
> +  CcProbeLib|OvmfPkg/Library/CcProbeLib/CcProbeLib.inf
> +!else
> +  CcProbeLib|MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf
>  !endif
>    CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
>    FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf

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

* Re: [PATCH] OvmfPkg/OvmfPkgX64: Use different CcProbeLib when SMM is on or off
  2022-05-17 12:47 ` Yao, Jiewen
@ 2022-05-17 15:22   ` dann frazier
  2022-05-17 15:37     ` [edk2-devel] " Yao, Jiewen
  0 siblings, 1 reply; 5+ messages in thread
From: dann frazier @ 2022-05-17 15:22 UTC (permalink / raw)
  To: Yao, Jiewen
  Cc: Xu, Min M, devel@edk2.groups.io, Aktas, Erdem, James Bottomley,
	Tom Lendacky

On Tue, May 17, 2022 at 12:47:21PM +0000, Yao, Jiewen wrote:
> Question: Does this patch need catch release 202205 release?

It does fix a regression since 202202, so I'd hope so :)

  -dann

> 
> 
> > -----Original Message-----
> > From: Xu, Min M <min.m.xu@intel.com>
> > Sent: Tuesday, May 17, 2022 8:43 PM
> > To: devel@edk2.groups.io
> > Cc: Xu, Min M <min.m.xu@intel.com>; dann frazier
> > <dann.frazier@canonical.com>; Aktas, Erdem <erdemaktas@google.com>;
> > James Bottomley <jejb@linux.ibm.com>; Yao, Jiewen <jiewen.yao@intel.com>;
> > Tom Lendacky <thomas.lendacky@amd.com>
> > Subject: [PATCH] OvmfPkg/OvmfPkgX64: Use different CcProbeLib when SMM is
> > on or off
> > 
> > CcProbeLib is designed to check the vm guest type. The OvmfPkg/CcProbeLib
> > reads the OvmfWorkArea (0x80B000) to get the vm guest type which is
> > written by each guest (SEV or TDX guest). But in SMM drivers the access
> > to OvmfWorkArea is illegal. PiSmmCpuDxeSmm.inf is an example. It uses
> > IoLib which in OvmfPkgX64 BaseIoLibIntrinsicSev.inf is included. The
> > IoLib probes if the working guest is td guest by calling CcProbe().
> > 
> > So CcProbeLibNull will be included when SMM_REQUIRE is set. Currently
> > only TDVF uses CcProbe to check the guest type, and TDVF doesn't
> > support SMM, so this fix has no side-effect.
> > 
> > Cc: dann frazier <dann.frazier@canonical.com>
> > Cc: Erdem Aktas <erdemaktas@google.com>
> > Cc: James Bottomley <jejb@linux.ibm.com>
> > Cc: Jiewen Yao <jiewen.yao@intel.com>
> > Cc: Tom Lendacky <thomas.lendacky@amd.com>
> > Signed-off-by: Min Xu <min.m.xu@intel.com>
> > ---
> >  OvmfPkg/OvmfPkgX64.dsc | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
> > index 71526bba31..db7f4def7a 100644
> > --- a/OvmfPkg/OvmfPkgX64.dsc
> > +++ b/OvmfPkg/OvmfPkgX64.dsc
> > @@ -171,7 +171,6 @@
> >    PciCapLib|OvmfPkg/Library/BasePciCapLib/BasePciCapLib.inf
> > 
> > PciCapPciSegmentLib|OvmfPkg/Library/BasePciCapPciSegmentLib/BasePciCapP
> > ciSegmentLib.inf
> >    PciCapPciIoLib|OvmfPkg/Library/UefiPciCapPciIoLib/UefiPciCapPciIoLib.inf
> > -  CcProbeLib|OvmfPkg/Library/CcProbeLib/CcProbeLib.inf
> >    IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf
> > 
> > OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/
> > OemHookStatusCodeLibNull.inf
> >    SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf
> > @@ -198,6 +197,9 @@
> > 
> >  !if $(SMM_REQUIRE) == FALSE
> >    LockBoxLib|OvmfPkg/Library/LockBoxLib/LockBoxBaseLib.inf
> > +  CcProbeLib|OvmfPkg/Library/CcProbeLib/CcProbeLib.inf
> > +!else
> > +  CcProbeLib|MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf
> >  !endif
> > 
> > CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/Customize
> > dDisplayLib.inf
> > 
> > FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLi
> > b.inf
> 

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

* Re: [edk2-devel] [PATCH] OvmfPkg/OvmfPkgX64: Use different CcProbeLib when SMM is on or off
  2022-05-17 15:22   ` dann frazier
@ 2022-05-17 15:37     ` Yao, Jiewen
  0 siblings, 0 replies; 5+ messages in thread
From: Yao, Jiewen @ 2022-05-17 15:37 UTC (permalink / raw)
  To: devel@edk2.groups.io, dann.frazier@canonical.com
  Cc: Xu, Min M, Aktas, Erdem, James Bottomley, Tom Lendacky

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

Hi Min
Please follow hard free process to proceed.

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



> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of dann frazier
> Sent: Tuesday, May 17, 2022 11:22 PM
> To: Yao, Jiewen <jiewen.yao@intel.com>
> Cc: Xu, Min M <min.m.xu@intel.com>; devel@edk2.groups.io; Aktas, Erdem
> <erdemaktas@google.com>; James Bottomley <jejb@linux.ibm.com>; Tom
> Lendacky <thomas.lendacky@amd.com>
> Subject: Re: [edk2-devel] [PATCH] OvmfPkg/OvmfPkgX64: Use different
> CcProbeLib when SMM is on or off
> 
> On Tue, May 17, 2022 at 12:47:21PM +0000, Yao, Jiewen wrote:
> > Question: Does this patch need catch release 202205 release?
> 
> It does fix a regression since 202202, so I'd hope so :)
> 
>   -dann
> 
> >
> >
> > > -----Original Message-----
> > > From: Xu, Min M <min.m.xu@intel.com>
> > > Sent: Tuesday, May 17, 2022 8:43 PM
> > > To: devel@edk2.groups.io
> > > Cc: Xu, Min M <min.m.xu@intel.com>; dann frazier
> > > <dann.frazier@canonical.com>; Aktas, Erdem <erdemaktas@google.com>;
> > > James Bottomley <jejb@linux.ibm.com>; Yao, Jiewen
> <jiewen.yao@intel.com>;
> > > Tom Lendacky <thomas.lendacky@amd.com>
> > > Subject: [PATCH] OvmfPkg/OvmfPkgX64: Use different CcProbeLib when
> SMM is
> > > on or off
> > >
> > > CcProbeLib is designed to check the vm guest type. The OvmfPkg/CcProbeLib
> > > reads the OvmfWorkArea (0x80B000) to get the vm guest type which is
> > > written by each guest (SEV or TDX guest). But in SMM drivers the access
> > > to OvmfWorkArea is illegal. PiSmmCpuDxeSmm.inf is an example. It uses
> > > IoLib which in OvmfPkgX64 BaseIoLibIntrinsicSev.inf is included. The
> > > IoLib probes if the working guest is td guest by calling CcProbe().
> > >
> > > So CcProbeLibNull will be included when SMM_REQUIRE is set. Currently
> > > only TDVF uses CcProbe to check the guest type, and TDVF doesn't
> > > support SMM, so this fix has no side-effect.
> > >
> > > Cc: dann frazier <dann.frazier@canonical.com>
> > > Cc: Erdem Aktas <erdemaktas@google.com>
> > > Cc: James Bottomley <jejb@linux.ibm.com>
> > > Cc: Jiewen Yao <jiewen.yao@intel.com>
> > > Cc: Tom Lendacky <thomas.lendacky@amd.com>
> > > Signed-off-by: Min Xu <min.m.xu@intel.com>
> > > ---
> > >  OvmfPkg/OvmfPkgX64.dsc | 4 +++-
> > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
> > > index 71526bba31..db7f4def7a 100644
> > > --- a/OvmfPkg/OvmfPkgX64.dsc
> > > +++ b/OvmfPkg/OvmfPkgX64.dsc
> > > @@ -171,7 +171,6 @@
> > >    PciCapLib|OvmfPkg/Library/BasePciCapLib/BasePciCapLib.inf
> > >
> > >
> PciCapPciSegmentLib|OvmfPkg/Library/BasePciCapPciSegmentLib/BasePciCapP
> > > ciSegmentLib.inf
> > >    PciCapPciIoLib|OvmfPkg/Library/UefiPciCapPciIoLib/UefiPciCapPciIoLib.inf
> > > -  CcProbeLib|OvmfPkg/Library/CcProbeLib/CcProbeLib.inf
> > >    IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf
> > >
> > >
> OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/
> > > OemHookStatusCodeLibNull.inf
> > >    SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf
> > > @@ -198,6 +197,9 @@
> > >
> > >  !if $(SMM_REQUIRE) == FALSE
> > >    LockBoxLib|OvmfPkg/Library/LockBoxLib/LockBoxBaseLib.inf
> > > +  CcProbeLib|OvmfPkg/Library/CcProbeLib/CcProbeLib.inf
> > > +!else
> > > +  CcProbeLib|MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf
> > >  !endif
> > >
> > >
> CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/Customize
> > > dDisplayLib.inf
> > >
> > >
> FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLi
> > > b.inf
> >
> 
> 
> 
> 


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

end of thread, other threads:[~2022-05-17 15:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-17 12:43 [PATCH] OvmfPkg/OvmfPkgX64: Use different CcProbeLib when SMM is on or off Min Xu
2022-05-17 12:47 ` Yao, Jiewen
2022-05-17 15:22   ` dann frazier
2022-05-17 15:37     ` [edk2-devel] " Yao, Jiewen
2022-05-17 15:19 ` dann frazier

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