[edk2-devel] [PATCH V3 0/2] [PATCH V1 0/2] Refactor TDX MmioExit

Min Xu posted 2 patches 1 year, 3 months ago
Failed in applying to current master (apply log)
OvmfPkg/Library/CcExitLib/CcExitLib.inf     |   1 +
OvmfPkg/Library/CcExitLib/CcExitVcHandler.c | 697 +++-----------------
OvmfPkg/Library/CcExitLib/CcExitVeHandler.c | 546 ++++++++++-----
OvmfPkg/Library/CcExitLib/CcInstruction.c   | 454 +++++++++++++
OvmfPkg/Library/CcExitLib/CcInstruction.h   | 197 ++++++
OvmfPkg/Library/CcExitLib/SecCcExitLib.inf  |   1 +
6 files changed, 1117 insertions(+), 779 deletions(-)
create mode 100644 OvmfPkg/Library/CcExitLib/CcInstruction.c
create mode 100644 OvmfPkg/Library/CcExitLib/CcInstruction.h
[edk2-devel] [PATCH V3 0/2] [PATCH V1 0/2] Refactor TDX MmioExit
Posted by Min Xu 1 year, 3 months ago
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4169

The previous TDX MmioExit doesn't handle the Mmio instructions correctly
in some scenarios. This patch-set refactors the implementation to fix the
issues.

Before the refactoring, common X86 instruction codes in CcExitVcHandler.c
are moved to separate files (CcInstruction.h / CcInstruction.c) so that
these codes can be re-used in TDX.

Code: https://github.com/mxu9/edk2/tree/TdxMmioExit.v3

v3 changes:
 - Handle the error if an error is returned from TdxMmioReadWrite.
 - Add more check in ParseMmioExitInstructions.

v2 changes:
 - Add CpuDeadLoop () after each TDVMCALL(HALT) in VE handler. Because
   TDVMCALL(HALT) is not trusted.
 - Other minor changes such as deleting ASSERT in VE handler. Because
   any error in VE handler will trigger CpuDeadLoop (). So ASSERT is not
   needed any more.

Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Ryan Afranji <afranji@google.com>
Reported-by: Ryan Afranji <afranji@google.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>

Min M Xu (2):
  OvmfPkg/CcExitLib: Move common X86 instruction code to separate file
  OvmfPkg/CcExitLib: Refactor TDX MmioExit

 OvmfPkg/Library/CcExitLib/CcExitLib.inf     |   1 +
 OvmfPkg/Library/CcExitLib/CcExitVcHandler.c | 697 +++-----------------
 OvmfPkg/Library/CcExitLib/CcExitVeHandler.c | 546 ++++++++++-----
 OvmfPkg/Library/CcExitLib/CcInstruction.c   | 454 +++++++++++++
 OvmfPkg/Library/CcExitLib/CcInstruction.h   | 197 ++++++
 OvmfPkg/Library/CcExitLib/SecCcExitLib.inf  |   1 +
 6 files changed, 1117 insertions(+), 779 deletions(-)
 create mode 100644 OvmfPkg/Library/CcExitLib/CcInstruction.c
 create mode 100644 OvmfPkg/Library/CcExitLib/CcInstruction.h

-- 
2.29.2.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#98649): https://edk2.groups.io/g/devel/message/98649
Mute This Topic: https://groups.io/mt/96325923/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH V3 0/2] [PATCH V1 0/2] Refactor TDX MmioExit
Posted by Gerd Hoffmann 1 year, 3 months ago
On Tue, Jan 17, 2023 at 03:43:28PM +0800, Min Xu wrote:
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4169
> 
> The previous TDX MmioExit doesn't handle the Mmio instructions correctly
> in some scenarios. This patch-set refactors the implementation to fix the
> issues.
> 
> Before the refactoring, common X86 instruction codes in CcExitVcHandler.c
> are moved to separate files (CcInstruction.h / CcInstruction.c) so that
> these codes can be re-used in TDX.
> 
> Code: https://github.com/mxu9/edk2/tree/TdxMmioExit.v3
> 
> v3 changes:
>  - Handle the error if an error is returned from TdxMmioReadWrite.
>  - Add more check in ParseMmioExitInstructions.
> 
> v2 changes:
>  - Add CpuDeadLoop () after each TDVMCALL(HALT) in VE handler. Because
>    TDVMCALL(HALT) is not trusted.
>  - Other minor changes such as deleting ASSERT in VE handler. Because
>    any error in VE handler will trigger CpuDeadLoop (). So ASSERT is not
>    needed any more.

Series:
Acked-by: Gerd Hoffmann <kraxel@redhat.com>



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#98671): https://edk2.groups.io/g/devel/message/98671
Mute This Topic: https://groups.io/mt/96325923/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH V3 0/2] [PATCH V1 0/2] Refactor TDX MmioExit
Posted by Yao, Jiewen 1 year, 3 months ago
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>

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

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Gerd
> Hoffmann
> Sent: Tuesday, January 17, 2023 7:33 PM
> To: Xu, Min M <min.m.xu@intel.com>
> Cc: devel@edk2.groups.io; Aktas, Erdem <erdemaktas@google.com>; James
> Bottomley <jejb@linux.ibm.com>; Yao, Jiewen <jiewen.yao@intel.com>; Tom
> Lendacky <thomas.lendacky@amd.com>; Afranji, Ryan <afranji@google.com>
> Subject: Re: [edk2-devel] [PATCH V3 0/2] [PATCH V1 0/2] Refactor TDX
> MmioExit
> 
> On Tue, Jan 17, 2023 at 03:43:28PM +0800, Min Xu wrote:
> > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4169
> >
> > The previous TDX MmioExit doesn't handle the Mmio instructions correctly
> > in some scenarios. This patch-set refactors the implementation to fix the
> > issues.
> >
> > Before the refactoring, common X86 instruction codes in CcExitVcHandler.c
> > are moved to separate files (CcInstruction.h / CcInstruction.c) so that
> > these codes can be re-used in TDX.
> >
> > Code: https://github.com/mxu9/edk2/tree/TdxMmioExit.v3
> >
> > v3 changes:
> >  - Handle the error if an error is returned from TdxMmioReadWrite.
> >  - Add more check in ParseMmioExitInstructions.
> >
> > v2 changes:
> >  - Add CpuDeadLoop () after each TDVMCALL(HALT) in VE handler. Because
> >    TDVMCALL(HALT) is not trusted.
> >  - Other minor changes such as deleting ASSERT in VE handler. Because
> >    any error in VE handler will trigger CpuDeadLoop (). So ASSERT is not
> >    needed any more.
> 
> Series:
> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
> 
> 
> 
> 
> 



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