On 2/22/24 12:54, Gerd Hoffmann wrote: > Removes the GetSevCBitMaskAbove31 OneTimeCall because we need that twice > (for 4-level and 5-level paging). Open code the single instruction left > in that function instead. > > Signed-off-by: Gerd Hoffmann <kra...@redhat.com> > --- > OvmfPkg/ResetVector/Ia32/AmdSev.asm | 8 -------- > OvmfPkg/ResetVector/Ia32/PageTables64.asm | 14 +++++++++++++- > 2 files changed, 13 insertions(+), 9 deletions(-) > > diff --git a/OvmfPkg/ResetVector/Ia32/AmdSev.asm > b/OvmfPkg/ResetVector/Ia32/AmdSev.asm > index 9063ce1080d3..d1e5e8dfae71 100644 > --- a/OvmfPkg/ResetVector/Ia32/AmdSev.asm > +++ b/OvmfPkg/ResetVector/Ia32/AmdSev.asm > @@ -191,14 +191,6 @@ pageTableEntries4kLoop: > SevClearPageEncMaskForGhcbPageExit: > OneTimeCallRet SevClearPageEncMaskForGhcbPage > > -; Get the C-bit mask above 31. > -; Modified: EDX > -; > -; The value is returned in the EDX > -GetSevCBitMaskAbove31: > - mov edx, dword[SEV_ES_WORK_AREA_ENC_MASK + 4] > - OneTimeCallRet GetSevCBitMaskAbove31 > - > %endif > > ; Check if Secure Encrypted Virtualization (SEV) features are enabled. > diff --git a/OvmfPkg/ResetVector/Ia32/PageTables64.asm > b/OvmfPkg/ResetVector/Ia32/PageTables64.asm > index 6e2063430802..55664fa64f62 100644 > --- a/OvmfPkg/ResetVector/Ia32/PageTables64.asm > +++ b/OvmfPkg/ResetVector/Ia32/PageTables64.asm > @@ -243,11 +243,23 @@ SevInit: > ; SEV workflow > ; > ClearOvmfPageTables > +%if PG_5_LEVEL > + Check5LevelPaging Sev4Level > ; If SEV is enabled, the C-bit position is always above 31. > ; The mask will be saved in the EDX and applied during the > ; the page table build below. > - OneTimeCall GetSevCBitMaskAbove31 > + mov edx, dword[SEV_ES_WORK_AREA_ENC_MASK + 4] > + CreatePageTables5Level edx > + Enable5LevelPaging > + jmp SevCommon > +Sev4Level: > +%endif > + ; If SEV is enabled, the C-bit position is always above 31. > + ; The mask will be saved in the EDX and applied during the > + ; the page table build below. > + mov edx, dword[SEV_ES_WORK_AREA_ENC_MASK + 4] > CreatePageTables4Level edx > +SevCommon: > ; Clear the C-bit from the GHCB page if the SEV-ES is enabled. > OneTimeCall SevClearPageEncMaskForGhcbPage > OneTimeCall SevClearVcHandlerAndStack
This patch looks fine to me (especially the SevCommon label), but can you please reimplement GetSevCBitMaskAbove31 as a macro, rather than open-coding the mov edx, dword[SEV_ES_WORK_AREA_ENC_MASK + 4] instruction? Thanks! Laszlo -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116088): https://edk2.groups.io/g/devel/message/116088 Mute This Topic: https://groups.io/mt/104506802/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-