On 2/22/24 12:54, Gerd Hoffmann wrote:
> Create a separate control flow for TDX BSP.
> 
> TdxPostBuildPageTables will now only be called when running in TDX
> mode, so the TDX check in that function is not needed any more.
> 
> No functional change.
> 
> Signed-off-by: Gerd Hoffmann <kra...@redhat.com>
> ---
>  OvmfPkg/ResetVector/Ia32/IntelTdx.asm     |  4 ----
>  OvmfPkg/ResetVector/Ia32/PageTables64.asm | 15 ++++++++++-----
>  2 files changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/OvmfPkg/ResetVector/Ia32/IntelTdx.asm 
> b/OvmfPkg/ResetVector/Ia32/IntelTdx.asm
> index 06794baef81d..c6b86019dfb9 100644
> --- a/OvmfPkg/ResetVector/Ia32/IntelTdx.asm
> +++ b/OvmfPkg/ResetVector/Ia32/IntelTdx.asm
> @@ -197,11 +197,7 @@ NotTdx:
>  ; Set byte[TDX_WORK_AREA_PGTBL_READY] to 1
>  ;
>  TdxPostBuildPageTables:
> -    cmp     byte[WORK_AREA_GUEST_TYPE], VM_GUEST_TDX
> -    jne     ExitTdxPostBuildPageTables
>      mov     byte[TDX_WORK_AREA_PGTBL_READY], 1
> -
> -ExitTdxPostBuildPageTables:
>      OneTimeCallRet TdxPostBuildPageTables
>  
>  ;
> diff --git a/OvmfPkg/ResetVector/Ia32/PageTables64.asm 
> b/OvmfPkg/ResetVector/Ia32/PageTables64.asm
> index 14cc2c33aa3d..166e80293c89 100644
> --- a/OvmfPkg/ResetVector/Ia32/PageTables64.asm
> +++ b/OvmfPkg/ResetVector/Ia32/PageTables64.asm
> @@ -112,7 +112,7 @@ SetCr3ForPageTables64:
>      ; is set.
>      OneTimeCall   CheckTdxFeaturesBeforeBuildPagetables
>      cmp       eax, TDX_BSP
> -    je        ClearOvmfPageTables
> +    je        TdxBspInit
>      cmp       eax, TDX_AP
>      je        SetCr3
>  
> @@ -124,16 +124,21 @@ SetCr3ForPageTables64:
>      ; the page table build below.
>      OneTimeCall   GetSevCBitMaskAbove31
>  
> -ClearOvmfPageTables:
>      ClearOvmfPageTables
>      CreatePageTables4Level edx
>  
>      ; Clear the C-bit from the GHCB page if the SEV-ES is enabled.
>      OneTimeCall   SevClearPageEncMaskForGhcbPage
> +    jmp SetCr3
>  
> -    ; TDX will do some PostBuildPages task, such as setting
> -    ; byte[TDX_WORK_AREA_PGTBL_READY].
> -    OneTimeCall   TdxPostBuildPageTables
> +TdxBspInit:
> +    ;
> +    ; TDX BSP workflow
> +    ;
> +    ClearOvmfPageTables
> +    CreatePageTables4Level 0
> +    OneTimeCall TdxPostBuildPageTables
> +    jmp SetCr3
>  
>  SetCr3:
>      ;

Reviewed-by: Laszlo Ersek <ler...@redhat.com>



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116082): https://edk2.groups.io/g/devel/message/116082
Mute This Topic: https://groups.io/mt/104506797/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to