public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Yuanhao Xie" <yuanhao.xie@intel.com>
To: devel@edk2.groups.io
Cc: Guo Dong <guo.dong@intel.com>, Ray Ni <ray.ni@intel.com>,
	Sean Rhodes <sean@starlabs.systems>,
	James Lu <james.lu@intel.com>, Gua Guo <gua.guo@intel.com>
Subject: [Patch V4 7/8] UefiCpuPkg: Rename AsmRelocateApLoopStart.
Date: Wed,  1 Mar 2023 14:09:53 +0800	[thread overview]
Message-ID: <20230301060954.1464-8-yuanhao.xie@intel.com> (raw)
In-Reply-To: <20230301060954.1464-1-yuanhao.xie@intel.com>

Rename AsmRelocateApLoopStart to AsmRelocateApLoopStartAmdSev

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Cc: James Lu <james.lu@intel.com>
Cc: Gua Guo <gua.guo@intel.com>
Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com>
---
 UefiCpuPkg/Library/MpInitLib/DxeMpLib.c       |  4 ++--
 UefiCpuPkg/Library/MpInitLib/MpEqu.inc        |  4 ++--
 UefiCpuPkg/Library/MpInitLib/MpLib.h          |  8 ++++----
 UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm | 40 ++++++++++++++++++++--------------------
 4 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
index d292277d10..330676b700 100644
--- a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
@@ -547,8 +547,8 @@ InitMpGlobalData (
     // 64-bit AMD processors with SEV-ES
     //
     Address        = BASE_4GB - 1;
-    ApLoopFunc     = AddressMap->RelocateApLoopFuncAddress;
-    ApLoopFuncSize = AddressMap->RelocateApLoopFuncSize;
+    ApLoopFunc     = AddressMap->RelocateApLoopFuncAddressAmdSev;
+    ApLoopFuncSize = AddressMap->RelocateApLoopFuncSizeAmdSev;
   } else {
     //
     // Intel processors (32-bit or 64-bit), 32-bit AMD processors, or 64-bit AMD processors without SEV-ES
diff --git a/UefiCpuPkg/Library/MpInitLib/MpEqu.inc b/UefiCpuPkg/Library/MpInitLib/MpEqu.inc
index 09c1817426..72af196513 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpEqu.inc
+++ b/UefiCpuPkg/Library/MpInitLib/MpEqu.inc
@@ -26,8 +26,8 @@ struc MP_ASSEMBLY_ADDRESS_MAP
   .RendezvousFunnelSize               CTYPE_UINTN 1
   .RelocateApLoopFuncAddressGeneric   CTYPE_UINTN 1
   .RelocateApLoopFuncSizeGeneric      CTYPE_UINTN 1
-  .RelocateApLoopFuncAddress          CTYPE_UINTN 1
-  .RelocateApLoopFuncSize             CTYPE_UINTN 1
+  .RelocateApLoopFuncAddressAmdSev    CTYPE_UINTN 1
+  .RelocateApLoopFuncSizeAmdSev       CTYPE_UINTN 1
   .ModeTransitionOffset               CTYPE_UINTN 1
   .SwitchToRealNoNxOffset             CTYPE_UINTN 1
   .SwitchToRealPM16ModeOffset         CTYPE_UINTN 1
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h b/UefiCpuPkg/Library/MpInitLib/MpLib.h
index e137545fc6..6f235dcf6d 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.h
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h
@@ -179,8 +179,8 @@ typedef struct {
   UINTN    RendezvousFunnelSize;
   UINT8    *RelocateApLoopFuncAddressGeneric;
   UINTN    RelocateApLoopFuncSizeGeneric;
-  UINT8    *RelocateApLoopFuncAddress;
-  UINTN    RelocateApLoopFuncSize;
+  UINT8    *RelocateApLoopFuncAddressAmdSev;
+  UINTN    RelocateApLoopFuncSizeAmdSev;
   UINTN    ModeTransitionOffset;
   UINTN    SwitchToRealNoNxOffset;
   UINTN    SwitchToRealPM16ModeOffset;
@@ -388,7 +388,7 @@ typedef
 **/
 typedef
   VOID
-(EFIAPI *ASM_RELOCATE_AP_LOOP)(
+(EFIAPI *ASM_RELOCATE_AP_LOOP_AMDSEV)(
   IN BOOLEAN                 MwaitSupport,
   IN UINTN                   ApTargetCState,
   IN UINTN                   PmCodeSegment,
@@ -429,7 +429,7 @@ AsmExchangeRole (
 
 typedef union {
   VOID                            *Data;
-  ASM_RELOCATE_AP_LOOP            AmdSevEntry;  // 64-bit AMD Sev processors
+  ASM_RELOCATE_AP_LOOP_AMDSEV     AmdSevEntry;  // 64-bit AMD Sev processors
   ASM_RELOCATE_AP_LOOP_GENERIC    GenericEntry; // Intel processors (32-bit or 64-bit), 32-bit AMD processors, or AMD non-Sev processors
 } RELOCATE_AP_LOOP_ENTRY;
 
diff --git a/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm b/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm
index c0d7355c6b..1a64d5681f 100644
--- a/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm
+++ b/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm
@@ -277,14 +277,14 @@ CProcedureInvoke:
 %include "AmdSev.nasm"
 
 RendezvousFunnelProcEnd:
-
 ;-------------------------------------------------------------------------------------
-;  AsmRelocateApLoop (MwaitSupport, ApTargetCState, PmCodeSegment, TopOfApStack, CountTofinish, Pm16CodeSegment, SevEsAPJumpTable, WakeupBuffer);
+;  AsmRelocateApLoopAmdSev (MwaitSupport, ApTargetCState, PmCodeSegment, TopOfApStack, CountTofinish, Pm16CodeSegment, SevEsAPJumpTable, WakeupBuffer);
 ;-------------------------------------------------------------------------------------
-AsmRelocateApLoopStart:
+
+AsmRelocateApLoopAmdSevStart:
 BITS 64
     cmp        qword [rsp + 56], 0  ; SevEsAPJumpTable
-    je         NoSevEs
+    je         NoSevEsAmdSev
 
     ;
     ; Perform some SEV-ES related setup before leaving 64-bit mode
@@ -329,7 +329,7 @@ BITS 64
     pop        rdx
     pop        rcx
 
-NoSevEs:
+NoSevEsAmdSev:
     cli                          ; Disable interrupt before switching to 32-bit mode
     mov        rax, [rsp + 40]   ; CountTofinish
     lock dec   dword [rax]       ; (*CountTofinish)--
@@ -345,7 +345,7 @@ NoSevEs:
     push       rcx               ; Save MwaitSupport
     push       rdx               ; Save ApTargetCState
 
-    lea        rax, [PmEntry]    ; rax <- The start address of transition code
+    lea        rax, [PmEntryAmdSev]    ; rax <- The start address of transition code
 
     push       r8
     push       rax
@@ -365,10 +365,10 @@ NoSevEs:
     ;
     ; Far return into 32-bit mode
     ;
-    retfq
+o64 retf
 
 BITS 32
-PmEntry:
+PmEntryAmdSev:
     mov        eax, cr0
     btr        eax, 31           ; Clear CR0.PG
     mov        cr0, eax          ; Disable paging and caches
@@ -386,11 +386,11 @@ PmEntry:
     pop        ecx,
     add        esp, 4
 
-MwaitCheck:
+MwaitCheckAmdSev:
     cmp        cl, 1              ; Check mwait-monitor support
-    jnz        HltLoop
+    jnz        HltLoopAmdSev
     mov        ebx, edx           ; Save C-State to ebx
-MwaitLoop:
+MwaitLoopAmdSev:
     cli
     mov        eax, esp           ; Set Monitor Address
     xor        ecx, ecx           ; ecx = 0
@@ -399,9 +399,9 @@ MwaitLoop:
     mov        eax, ebx           ; Mwait Cx, Target C-State per eax[7:4]
     shl        eax, 4
     mwait
-    jmp        MwaitLoop
+    jmp        MwaitLoopAmdSev
 
-HltLoop:
+HltLoopAmdSev:
     pop        edx                ; PM16CodeSegment
     add        esp, 4
     pop        ebx                ; WakeupBuffer
@@ -409,7 +409,7 @@ HltLoop:
     pop        eax                ; SevEsAPJumpTable
     add        esp, 4
     cmp        eax, 0             ; Check for SEV-ES
-    je         DoHlt
+    je         DoHltAmdSev
 
     cli
     ;
@@ -439,13 +439,13 @@ BITS 32
 
     retf
 
-DoHlt:
+DoHltAmdSev:
     cli
     hlt
-    jmp        DoHlt
+    jmp        DoHltAmdSev
 
 BITS 64
-AsmRelocateApLoopEnd:
+AsmRelocateApLoopAmdSevEnd:
 
 ;-------------------------------------------------------------------------------------
 ;  AsmRelocateApLoop (MwaitSupport, ApTargetCState, TopOfApStack, CountTofinish, Cr3);
@@ -511,9 +511,9 @@ ASM_PFX(AsmGetAddressMap):
 lea        rax, [AsmRelocateApLoopGenericStart]
     mov        qword [rcx + MP_ASSEMBLY_ADDRESS_MAP.RelocateApLoopFuncAddressGeneric], rax
     mov        qword [rcx + MP_ASSEMBLY_ADDRESS_MAP.RelocateApLoopFuncSizeGeneric], AsmRelocateApLoopGenericEnd - AsmRelocateApLoopGenericStart
-    lea        rax, [AsmRelocateApLoopStart]
-    mov        qword [rcx + MP_ASSEMBLY_ADDRESS_MAP.RelocateApLoopFuncAddress], rax
-    mov        qword [rcx + MP_ASSEMBLY_ADDRESS_MAP.RelocateApLoopFuncSize], AsmRelocateApLoopEnd - AsmRelocateApLoopStart
+    lea        rax, [AsmRelocateApLoopAmdSevStart]
+    mov        qword [rcx + MP_ASSEMBLY_ADDRESS_MAP.RelocateApLoopFuncAddressAmdSev], rax
+    mov        qword [rcx + MP_ASSEMBLY_ADDRESS_MAP.RelocateApLoopFuncSizeAmdSev], AsmRelocateApLoopAmdSevEnd - AsmRelocateApLoopAmdSevStart
     mov        qword [rcx + MP_ASSEMBLY_ADDRESS_MAP.ModeTransitionOffset], Flat32Start - RendezvousFunnelProcStart
     mov        qword [rcx + MP_ASSEMBLY_ADDRESS_MAP.SwitchToRealNoNxOffset], SwitchToRealProcStart - Flat32Start
     mov        qword [rcx + MP_ASSEMBLY_ADDRESS_MAP.SwitchToRealPM16ModeOffset], PM16Mode - RendezvousFunnelProcStart
-- 
2.36.1.windows.1


  parent reply	other threads:[~2023-03-01  6:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-01  6:09 [Patch V4 0/8] Put APs in 64 bit mode before handoff to OS Yuanhao Xie
2023-03-01  6:09 ` [Patch V4 1/8] UefiCpuPkg: Check AP_SAFE_STACK_SIZE during build time Yuanhao Xie
2023-03-01  6:09 ` [Patch V4 2/8] UefiCpuPkg: Split the path in RelocateApLoop into two Yuanhao Xie
2023-03-01  6:09 ` [Patch V4 3/8] UefiCpuPkg: Allocate contiguous memory for stacks and APs loop Yuanhao Xie
2023-03-01  6:09 ` [Patch V4 4/8] OvmfPkg: Add CpuPageTableLib required by MpInitLib Yuanhao Xie
2023-03-01  6:09 ` [Patch V4 5/8] UefiPayloadPkg: " Yuanhao Xie
2023-03-01  6:09 ` [Patch V4 6/8] UefiCpuPkg: Put APs in 64 bit mode before handoff to OS Yuanhao Xie
2023-03-01  6:09 ` Yuanhao Xie [this message]
2023-03-01  6:09 ` [Patch V4 8/8] UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm Yuanhao Xie
2023-03-01  6:40 ` [edk2-devel] [Patch V4 0/8] Put APs in 64 bit mode before handoff to OS Gerd Hoffmann
2023-03-07  7:00 ` Ni, Ray

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230301060954.1464-8-yuanhao.xie@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox