From nobody Mon Feb 9 11:46:39 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+96058+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+96058+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1667870103; cv=none; d=zohomail.com; s=zohoarc; b=Y8GEUUA+FPZDjPqAqZu3wSgIvp+upRgFST7H0379fvpXlvsopYe785j6hn3CLdXTFidlcYKp60ZmSw1HBKDQmxa+9kAKg1X6GjWIqxaIxGuYrlTuUdfDHJw09Gw4O4gWUfv73RDujUUid0M5FTnauOqBTxA/2p1S68G6U9uAQzc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1667870103; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=rkvJqhJy+TzXlbeEllNz18XOeO0fJK5pYeAiljFcotw=; b=JG1Q9ca3qZ3Os0nDqjmh0xDAkSN5JreL3zLXayZOYZi9WhMpw6scu7okU+NNw+ICLDdg2arZMv5kXa3NxymvTJc8GznE+xAYD4k1NBrNMFesGePm3DCLLaa5sRKxsezXSJXPqCmvfxwCDFIF836RpyRqQt4U2tSqzYXobl4CE1A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+96058+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 166787010332240.720490663202895; Mon, 7 Nov 2022 17:15:03 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 5t7yYY1788612xD4U1eTNYwn; Mon, 07 Nov 2022 17:15:03 -0800 X-Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web11.2875.1667870096464222463 for ; Mon, 07 Nov 2022 17:15:02 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="308191291" X-IronPort-AV: E=Sophos;i="5.96,145,1665471600"; d="scan'208";a="308191291" X-Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2022 17:15:02 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="761306419" X-IronPort-AV: E=Sophos;i="5.96,145,1665471600"; d="scan'208";a="761306419" X-Received: from mxu9-mobl1.ccr.corp.intel.com ([10.238.0.61]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2022 17:14:59 -0800 From: "Min Xu" To: devel@edk2.groups.io Cc: Min M Xu , Eric Dong , Ray Ni , Brijesh Singh , Erdem Aktas , Gerd Hoffmann , James Bottomley , Jiewen Yao , Tom Lendacky Subject: [edk2-devel] [PATCH V4 2/3] OvmfPkg/UefiCpuPkg: Add CcExit prefix to the APIs of CcExitLib Date: Tue, 8 Nov 2022 09:14:39 +0800 Message-Id: <20221108011440.1750-3-min.m.xu@intel.com> In-Reply-To: <20221108011440.1750-1-min.m.xu@intel.com> References: <20221108011440.1750-1-min.m.xu@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,min.m.xu@intel.com X-Gm-Message-State: BFk2RRbrpGwtzt7xyhO5E71Yx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1667870103; bh=xnLBVUmGu6lxF6shsBOBA9KLdt1QUKfAsiSEV7KxQMo=; h=Cc:Date:From:Reply-To:Subject:To; b=rnfEvIRnPmZWqsxMfPxtZFool7ah8pHBlO0Q8kokcCQucPv9P75I8E1dQfEfJUJuuVt GnU29eGzESqFUiov0w6IeZloy+9UpMiz63jRyGRI5xNrO7DxJnDKGPxNVBBEatzKjpeEI 9+lObROPH6/m4yVKa4f2C1zTbh0/ZwCIO4M= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1667870103971100002 Content-Type: text/plain; charset="utf-8" From: Min M Xu BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4123 APIs which are defined in CcExitLib.h are added with the CcExit prefix. This is to make the APIs' name more meaningful. This change impacts OvmfPkg/UefiCpuPkg. Cc: Eric Dong Cc: Ray Ni Cc: Brijesh Singh Cc: Erdem Aktas Cc: Gerd Hoffmann Cc: James Bottomley Cc: Jiewen Yao Cc: Tom Lendacky Signed-off-by: Min Xu --- .../X64/SnpPageStateChangeInternal.c | 8 +- OvmfPkg/Library/CcExitLib/CcExitLib.c | 18 +-- OvmfPkg/Library/CcExitLib/CcExitVcHandler.c | 124 +++++++++--------- OvmfPkg/Library/CcExitLib/CcExitVeHandler.c | 2 +- .../Library/CcExitLib/PeiDxeCcExitVcHandler.c | 2 +- .../Library/CcExitLib/SecCcExitVcHandler.c | 2 +- OvmfPkg/PlatformPei/AmdSev.c | 8 +- .../QemuFlashDxe.c | 8 +- UefiCpuPkg/Include/Library/CcExitLib.h | 16 +-- .../Library/CcExitLibNull/CcExitLibNull.c | 16 +-- .../PeiDxeSmmCpuException.c | 4 +- .../SecPeiCpuException.c | 4 +- UefiCpuPkg/Library/MpInitLib/AmdSev.c | 8 +- UefiCpuPkg/Library/MpInitLib/DxeMpLib.c | 6 +- UefiCpuPkg/Library/MpInitLib/X64/AmdSev.c | 8 +- 15 files changed, 117 insertions(+), 117 deletions(-) diff --git a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInt= ernal.c b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeIntern= al.c index 73698a7b9d8c..4d684964d838 100644 --- a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c +++ b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c @@ -193,9 +193,9 @@ PageStateChangeVmgExit ( // while (Info->Header.CurrentEntry <=3D Info->Header.EndEntry) { Ghcb->SaveArea.SwScratch =3D (UINT64)Ghcb->SharedBuffer; - VmgSetOffsetValid (Ghcb, GhcbSwScratch); + CcExitVmgSetOffsetValid (Ghcb, GhcbSwScratch); =20 - Status =3D VmgExit (Ghcb, SVM_EXIT_SNP_PAGE_STATE_CHANGE, 0, 0); + Status =3D CcExitVmgExit (Ghcb, SVM_EXIT_SNP_PAGE_STATE_CHANGE, 0, 0); =20 // // The Page State Change VMGEXIT can pass the failure through the @@ -251,7 +251,7 @@ InternalSetPageState ( // // Initialize the GHCB // - VmgInit (Ghcb, &InterruptState); + CcExitVmgInit (Ghcb, &InterruptState); =20 // // Build the page state structure @@ -293,7 +293,7 @@ InternalSetPageState ( PvalidateRange (Info, CurrentEntry, EndEntry, TRUE); } =20 - VmgDone (Ghcb, InterruptState); + CcExitVmgDone (Ghcb, InterruptState); =20 BaseAddress =3D NextAddress; } diff --git a/OvmfPkg/Library/CcExitLib/CcExitLib.c b/OvmfPkg/Library/CcExit= Lib/CcExitLib.c index 477064cde2bb..e256000fb283 100644 --- a/OvmfPkg/Library/CcExitLib/CcExitLib.c +++ b/OvmfPkg/Library/CcExitLib/CcExitLib.c @@ -103,7 +103,7 @@ VmgExitErrorCheck ( **/ UINT64 EFIAPI -VmgExit ( +CcExitVmgExit ( IN OUT GHCB *Ghcb, IN UINT64 ExitCode, IN UINT64 ExitInfo1, @@ -114,9 +114,9 @@ VmgExit ( Ghcb->SaveArea.SwExitInfo1 =3D ExitInfo1; Ghcb->SaveArea.SwExitInfo2 =3D ExitInfo2; =20 - VmgSetOffsetValid (Ghcb, GhcbSwExitCode); - VmgSetOffsetValid (Ghcb, GhcbSwExitInfo1); - VmgSetOffsetValid (Ghcb, GhcbSwExitInfo2); + CcExitVmgSetOffsetValid (Ghcb, GhcbSwExitCode); + CcExitVmgSetOffsetValid (Ghcb, GhcbSwExitInfo1); + CcExitVmgSetOffsetValid (Ghcb, GhcbSwExitInfo2); =20 // // Guest memory is used for the guest-hypervisor communication, so fence @@ -138,12 +138,12 @@ VmgExit ( =20 @param[in, out] Ghcb A pointer to the GHCB @param[in, out] InterruptState A pointer to hold the current interrupt - state, used for restoring in VmgDone () + state, used for restoring in CcExitVmgD= one () =20 **/ VOID EFIAPI -VmgInit ( +CcExitVmgInit ( IN OUT GHCB *Ghcb, IN OUT BOOLEAN *InterruptState ) @@ -173,7 +173,7 @@ VmgInit ( **/ VOID EFIAPI -VmgDone ( +CcExitVmgDone ( IN OUT GHCB *Ghcb, IN BOOLEAN InterruptState ) @@ -195,7 +195,7 @@ VmgDone ( **/ VOID EFIAPI -VmgSetOffsetValid ( +CcExitVmgSetOffsetValid ( IN OUT GHCB *Ghcb, IN GHCB_REGISTER Offset ) @@ -224,7 +224,7 @@ VmgSetOffsetValid ( **/ BOOLEAN EFIAPI -VmgIsOffsetValid ( +CcExitVmgIsOffsetValid ( IN GHCB *Ghcb, IN GHCB_REGISTER Offset ) diff --git a/OvmfPkg/Library/CcExitLib/CcExitVcHandler.c b/OvmfPkg/Library/= CcExitLib/CcExitVcHandler.c index ad2a922c9f43..985e5479775c 100644 --- a/OvmfPkg/Library/CcExitLib/CcExitVcHandler.c +++ b/OvmfPkg/Library/CcExitLib/CcExitVcHandler.c @@ -611,7 +611,7 @@ UnsupportedExit ( { UINT64 Status; =20 - Status =3D VmgExit (Ghcb, SVM_EXIT_UNSUPPORTED, Regs->ExceptionData, 0); + Status =3D CcExitVmgExit (Ghcb, SVM_EXIT_UNSUPPORTED, Regs->ExceptionDat= a, 0); if (Status =3D=3D 0) { GHCB_EVENT_INJECTION Event; =20 @@ -755,8 +755,8 @@ MmioExit ( CopyMem (Ghcb->SharedBuffer, &InstructionData->Ext.RegData, Bytes); =20 Ghcb->SaveArea.SwScratch =3D (UINT64)Ghcb->SharedBuffer; - VmgSetOffsetValid (Ghcb, GhcbSwScratch); - Status =3D VmgExit (Ghcb, SVM_EXIT_MMIO_WRITE, ExitInfo1, ExitInfo2); + CcExitVmgSetOffsetValid (Ghcb, GhcbSwScratch); + Status =3D CcExitVmgExit (Ghcb, SVM_EXIT_MMIO_WRITE, ExitInfo1, Exit= Info2); if (Status !=3D 0) { return Status; } @@ -807,8 +807,8 @@ MmioExit ( CopyMem (Ghcb->SharedBuffer, &Regs->Rax, Bytes); =20 Ghcb->SaveArea.SwScratch =3D (UINT64)Ghcb->SharedBuffer; - VmgSetOffsetValid (Ghcb, GhcbSwScratch); - Status =3D VmgExit (Ghcb, SVM_EXIT_MMIO_WRITE, ExitInfo1, ExitInfo2); + CcExitVmgSetOffsetValid (Ghcb, GhcbSwScratch); + Status =3D CcExitVmgExit (Ghcb, SVM_EXIT_MMIO_WRITE, ExitInfo1, Exit= Info2); if (Status !=3D 0) { return Status; } @@ -843,8 +843,8 @@ MmioExit ( CopyMem (Ghcb->SharedBuffer, InstructionData->Immediate, Bytes); =20 Ghcb->SaveArea.SwScratch =3D (UINT64)Ghcb->SharedBuffer; - VmgSetOffsetValid (Ghcb, GhcbSwScratch); - Status =3D VmgExit (Ghcb, SVM_EXIT_MMIO_WRITE, ExitInfo1, ExitInfo2); + CcExitVmgSetOffsetValid (Ghcb, GhcbSwScratch); + Status =3D CcExitVmgExit (Ghcb, SVM_EXIT_MMIO_WRITE, ExitInfo1, Exit= Info2); if (Status !=3D 0) { return Status; } @@ -882,8 +882,8 @@ MmioExit ( ExitInfo2 =3D Bytes; =20 Ghcb->SaveArea.SwScratch =3D (UINT64)Ghcb->SharedBuffer; - VmgSetOffsetValid (Ghcb, GhcbSwScratch); - Status =3D VmgExit (Ghcb, SVM_EXIT_MMIO_READ, ExitInfo1, ExitInfo2); + CcExitVmgSetOffsetValid (Ghcb, GhcbSwScratch); + Status =3D CcExitVmgExit (Ghcb, SVM_EXIT_MMIO_READ, ExitInfo1, ExitI= nfo2); if (Status !=3D 0) { return Status; } @@ -942,8 +942,8 @@ MmioExit ( ExitInfo2 =3D Bytes; =20 Ghcb->SaveArea.SwScratch =3D (UINT64)Ghcb->SharedBuffer; - VmgSetOffsetValid (Ghcb, GhcbSwScratch); - Status =3D VmgExit (Ghcb, SVM_EXIT_MMIO_READ, ExitInfo1, ExitInfo2); + CcExitVmgSetOffsetValid (Ghcb, GhcbSwScratch); + Status =3D CcExitVmgExit (Ghcb, SVM_EXIT_MMIO_READ, ExitInfo1, ExitI= nfo2); if (Status !=3D 0) { return Status; } @@ -979,8 +979,8 @@ MmioExit ( ExitInfo2 =3D Bytes; =20 Ghcb->SaveArea.SwScratch =3D (UINT64)Ghcb->SharedBuffer; - VmgSetOffsetValid (Ghcb, GhcbSwScratch); - Status =3D VmgExit (Ghcb, SVM_EXIT_MMIO_READ, ExitInfo1, ExitInfo2); + CcExitVmgSetOffsetValid (Ghcb, GhcbSwScratch); + Status =3D CcExitVmgExit (Ghcb, SVM_EXIT_MMIO_READ, ExitInfo1, ExitI= nfo2); if (Status !=3D 0) { return Status; } @@ -1011,8 +1011,8 @@ MmioExit ( ExitInfo2 =3D Bytes; =20 Ghcb->SaveArea.SwScratch =3D (UINT64)Ghcb->SharedBuffer; - VmgSetOffsetValid (Ghcb, GhcbSwScratch); - Status =3D VmgExit (Ghcb, SVM_EXIT_MMIO_READ, ExitInfo1, ExitInfo2); + CcExitVmgSetOffsetValid (Ghcb, GhcbSwScratch); + Status =3D CcExitVmgExit (Ghcb, SVM_EXIT_MMIO_READ, ExitInfo1, ExitI= nfo2); if (Status !=3D 0) { return Status; } @@ -1068,11 +1068,11 @@ MwaitExit ( DecodeModRm (Regs, InstructionData); =20 Ghcb->SaveArea.Rax =3D Regs->Rax; - VmgSetOffsetValid (Ghcb, GhcbRax); + CcExitVmgSetOffsetValid (Ghcb, GhcbRax); Ghcb->SaveArea.Rcx =3D Regs->Rcx; - VmgSetOffsetValid (Ghcb, GhcbRcx); + CcExitVmgSetOffsetValid (Ghcb, GhcbRcx); =20 - return VmgExit (Ghcb, SVM_EXIT_MWAIT, 0, 0); + return CcExitVmgExit (Ghcb, SVM_EXIT_MWAIT, 0, 0); } =20 /** @@ -1100,13 +1100,13 @@ MonitorExit ( DecodeModRm (Regs, InstructionData); =20 Ghcb->SaveArea.Rax =3D Regs->Rax; // Identity mapped, so VA =3D PA - VmgSetOffsetValid (Ghcb, GhcbRax); + CcExitVmgSetOffsetValid (Ghcb, GhcbRax); Ghcb->SaveArea.Rcx =3D Regs->Rcx; - VmgSetOffsetValid (Ghcb, GhcbRcx); + CcExitVmgSetOffsetValid (Ghcb, GhcbRcx); Ghcb->SaveArea.Rdx =3D Regs->Rdx; - VmgSetOffsetValid (Ghcb, GhcbRdx); + CcExitVmgSetOffsetValid (Ghcb, GhcbRdx); =20 - return VmgExit (Ghcb, SVM_EXIT_MONITOR, 0, 0); + return CcExitVmgExit (Ghcb, SVM_EXIT_MONITOR, 0, 0); } =20 /** @@ -1131,7 +1131,7 @@ WbinvdExit ( IN SEV_ES_INSTRUCTION_DATA *InstructionData ) { - return VmgExit (Ghcb, SVM_EXIT_WBINVD, 0, 0); + return CcExitVmgExit (Ghcb, SVM_EXIT_WBINVD, 0, 0); } =20 /** @@ -1160,14 +1160,14 @@ RdtscpExit ( =20 DecodeModRm (Regs, InstructionData); =20 - Status =3D VmgExit (Ghcb, SVM_EXIT_RDTSCP, 0, 0); + Status =3D CcExitVmgExit (Ghcb, SVM_EXIT_RDTSCP, 0, 0); if (Status !=3D 0) { return Status; } =20 - if (!VmgIsOffsetValid (Ghcb, GhcbRax) || - !VmgIsOffsetValid (Ghcb, GhcbRcx) || - !VmgIsOffsetValid (Ghcb, GhcbRdx)) + if (!CcExitVmgIsOffsetValid (Ghcb, GhcbRax) || + !CcExitVmgIsOffsetValid (Ghcb, GhcbRcx) || + !CcExitVmgIsOffsetValid (Ghcb, GhcbRdx)) { return UnsupportedExit (Ghcb, Regs, InstructionData); } @@ -1206,16 +1206,16 @@ VmmCallExit ( DecodeModRm (Regs, InstructionData); =20 Ghcb->SaveArea.Rax =3D Regs->Rax; - VmgSetOffsetValid (Ghcb, GhcbRax); + CcExitVmgSetOffsetValid (Ghcb, GhcbRax); Ghcb->SaveArea.Cpl =3D (UINT8)(Regs->Cs & 0x3); - VmgSetOffsetValid (Ghcb, GhcbCpl); + CcExitVmgSetOffsetValid (Ghcb, GhcbCpl); =20 - Status =3D VmgExit (Ghcb, SVM_EXIT_VMMCALL, 0, 0); + Status =3D CcExitVmgExit (Ghcb, SVM_EXIT_VMMCALL, 0, 0); if (Status !=3D 0) { return Status; } =20 - if (!VmgIsOffsetValid (Ghcb, GhcbRax)) { + if (!CcExitVmgIsOffsetValid (Ghcb, GhcbRax)) { return UnsupportedExit (Ghcb, Regs, InstructionData); } =20 @@ -1254,28 +1254,28 @@ MsrExit ( case 0x30: // WRMSR ExitInfo1 =3D 1; Ghcb->SaveArea.Rax =3D Regs->Rax; - VmgSetOffsetValid (Ghcb, GhcbRax); + CcExitVmgSetOffsetValid (Ghcb, GhcbRax); Ghcb->SaveArea.Rdx =3D Regs->Rdx; - VmgSetOffsetValid (Ghcb, GhcbRdx); + CcExitVmgSetOffsetValid (Ghcb, GhcbRdx); // // fall through // case 0x32: // RDMSR Ghcb->SaveArea.Rcx =3D Regs->Rcx; - VmgSetOffsetValid (Ghcb, GhcbRcx); + CcExitVmgSetOffsetValid (Ghcb, GhcbRcx); break; default: return UnsupportedExit (Ghcb, Regs, InstructionData); } =20 - Status =3D VmgExit (Ghcb, SVM_EXIT_MSR, ExitInfo1, 0); + Status =3D CcExitVmgExit (Ghcb, SVM_EXIT_MSR, ExitInfo1, 0); if (Status !=3D 0) { return Status; } =20 if (ExitInfo1 =3D=3D 0) { - if (!VmgIsOffsetValid (Ghcb, GhcbRax) || - !VmgIsOffsetValid (Ghcb, GhcbRdx)) + if (!CcExitVmgIsOffsetValid (Ghcb, GhcbRax) || + !CcExitVmgIsOffsetValid (Ghcb, GhcbRdx)) { return UnsupportedExit (Ghcb, Regs, InstructionData); } @@ -1471,8 +1471,8 @@ IoioExit ( } =20 Ghcb->SaveArea.SwScratch =3D (UINT64)Ghcb->SharedBuffer; - VmgSetOffsetValid (Ghcb, GhcbSwScratch); - Status =3D VmgExit (Ghcb, SVM_EXIT_IOIO_PROT, ExitInfo1, ExitInfo2); + CcExitVmgSetOffsetValid (Ghcb, GhcbSwScratch); + Status =3D CcExitVmgExit (Ghcb, SVM_EXIT_IOIO_PROT, ExitInfo1, ExitI= nfo2); if (Status !=3D 0) { return Status; } @@ -1495,15 +1495,15 @@ IoioExit ( CopyMem (&Ghcb->SaveArea.Rax, &Regs->Rax, IOIO_DATA_BYTES (ExitInfo1= )); } =20 - VmgSetOffsetValid (Ghcb, GhcbRax); + CcExitVmgSetOffsetValid (Ghcb, GhcbRax); =20 - Status =3D VmgExit (Ghcb, SVM_EXIT_IOIO_PROT, ExitInfo1, 0); + Status =3D CcExitVmgExit (Ghcb, SVM_EXIT_IOIO_PROT, ExitInfo1, 0); if (Status !=3D 0) { return Status; } =20 if ((ExitInfo1 & IOIO_TYPE_IN) !=3D 0) { - if (!VmgIsOffsetValid (Ghcb, GhcbRax)) { + if (!CcExitVmgIsOffsetValid (Ghcb, GhcbRax)) { return UnsupportedExit (Ghcb, Regs, InstructionData); } =20 @@ -1536,7 +1536,7 @@ InvdExit ( IN SEV_ES_INSTRUCTION_DATA *InstructionData ) { - return VmgExit (Ghcb, SVM_EXIT_INVD, 0, 0); + return CcExitVmgExit (Ghcb, SVM_EXIT_INVD, 0, 0); } =20 /** @@ -1581,23 +1581,23 @@ GetCpuidHyp ( { *UnsupportedExit =3D FALSE; Ghcb->SaveArea.Rax =3D EaxIn; - VmgSetOffsetValid (Ghcb, GhcbRax); + CcExitVmgSetOffsetValid (Ghcb, GhcbRax); Ghcb->SaveArea.Rcx =3D EcxIn; - VmgSetOffsetValid (Ghcb, GhcbRcx); + CcExitVmgSetOffsetValid (Ghcb, GhcbRcx); if (EaxIn =3D=3D CPUID_EXTENDED_STATE) { Ghcb->SaveArea.XCr0 =3D XCr0; - VmgSetOffsetValid (Ghcb, GhcbXCr0); + CcExitVmgSetOffsetValid (Ghcb, GhcbXCr0); } =20 - *Status =3D VmgExit (Ghcb, SVM_EXIT_CPUID, 0, 0); + *Status =3D CcExitVmgExit (Ghcb, SVM_EXIT_CPUID, 0, 0); if (*Status !=3D 0) { return FALSE; } =20 - if (!VmgIsOffsetValid (Ghcb, GhcbRax) || - !VmgIsOffsetValid (Ghcb, GhcbRbx) || - !VmgIsOffsetValid (Ghcb, GhcbRcx) || - !VmgIsOffsetValid (Ghcb, GhcbRdx)) + if (!CcExitVmgIsOffsetValid (Ghcb, GhcbRax) || + !CcExitVmgIsOffsetValid (Ghcb, GhcbRbx) || + !CcExitVmgIsOffsetValid (Ghcb, GhcbRcx) || + !CcExitVmgIsOffsetValid (Ghcb, GhcbRdx)) { *UnsupportedExit =3D TRUE; return FALSE; @@ -2049,15 +2049,15 @@ RdpmcExit ( UINT64 Status; =20 Ghcb->SaveArea.Rcx =3D Regs->Rcx; - VmgSetOffsetValid (Ghcb, GhcbRcx); + CcExitVmgSetOffsetValid (Ghcb, GhcbRcx); =20 - Status =3D VmgExit (Ghcb, SVM_EXIT_RDPMC, 0, 0); + Status =3D CcExitVmgExit (Ghcb, SVM_EXIT_RDPMC, 0, 0); if (Status !=3D 0) { return Status; } =20 - if (!VmgIsOffsetValid (Ghcb, GhcbRax) || - !VmgIsOffsetValid (Ghcb, GhcbRdx)) + if (!CcExitVmgIsOffsetValid (Ghcb, GhcbRax) || + !CcExitVmgIsOffsetValid (Ghcb, GhcbRdx)) { return UnsupportedExit (Ghcb, Regs, InstructionData); } @@ -2092,13 +2092,13 @@ RdtscExit ( { UINT64 Status; =20 - Status =3D VmgExit (Ghcb, SVM_EXIT_RDTSC, 0, 0); + Status =3D CcExitVmgExit (Ghcb, SVM_EXIT_RDTSC, 0, 0); if (Status !=3D 0) { return Status; } =20 - if (!VmgIsOffsetValid (Ghcb, GhcbRax) || - !VmgIsOffsetValid (Ghcb, GhcbRdx)) + if (!CcExitVmgIsOffsetValid (Ghcb, GhcbRax) || + !CcExitVmgIsOffsetValid (Ghcb, GhcbRdx)) { return UnsupportedExit (Ghcb, Regs, InstructionData); } @@ -2150,9 +2150,9 @@ Dr7WriteExit ( // Using a value of 0 for ExitInfo1 means RAX holds the value // Ghcb->SaveArea.Rax =3D *Register; - VmgSetOffsetValid (Ghcb, GhcbRax); + CcExitVmgSetOffsetValid (Ghcb, GhcbRax); =20 - Status =3D VmgExit (Ghcb, SVM_EXIT_DR7_WRITE, 0, 0); + Status =3D CcExitVmgExit (Ghcb, SVM_EXIT_DR7_WRITE, 0, 0); if (Status !=3D 0) { return Status; } @@ -2243,7 +2243,7 @@ InternalVmgExitHandleVc ( =20 Regs =3D SystemContext.SystemContextX64; =20 - VmgInit (Ghcb, &InterruptState); + CcExitVmgInit (Ghcb, &InterruptState); =20 ExitCode =3D Regs->ExceptionData; switch (ExitCode) { @@ -2327,7 +2327,7 @@ InternalVmgExitHandleVc ( VcRet =3D EFI_PROTOCOL_ERROR; } =20 - VmgDone (Ghcb, InterruptState); + CcExitVmgDone (Ghcb, InterruptState); =20 return VcRet; } diff --git a/OvmfPkg/Library/CcExitLib/CcExitVeHandler.c b/OvmfPkg/Library/= CcExitLib/CcExitVeHandler.c index 08e92c66ce74..081af7e12aa5 100644 --- a/OvmfPkg/Library/CcExitLib/CcExitVeHandler.c +++ b/OvmfPkg/Library/CcExitLib/CcExitVeHandler.c @@ -464,7 +464,7 @@ MmioExit ( **/ EFI_STATUS EFIAPI -VmTdExitHandleVe ( +CcExitHandleVe ( IN OUT EFI_EXCEPTION_TYPE *ExceptionType, IN OUT EFI_SYSTEM_CONTEXT SystemContext ) diff --git a/OvmfPkg/Library/CcExitLib/PeiDxeCcExitVcHandler.c b/OvmfPkg/Li= brary/CcExitLib/PeiDxeCcExitVcHandler.c index bb718161f588..522f747f08c1 100644 --- a/OvmfPkg/Library/CcExitLib/PeiDxeCcExitVcHandler.c +++ b/OvmfPkg/Library/CcExitLib/PeiDxeCcExitVcHandler.c @@ -33,7 +33,7 @@ **/ EFI_STATUS EFIAPI -VmgExitHandleVc ( +CcExitHandleVc ( IN OUT EFI_EXCEPTION_TYPE *ExceptionType, IN OUT EFI_SYSTEM_CONTEXT SystemContext ) diff --git a/OvmfPkg/Library/CcExitLib/SecCcExitVcHandler.c b/OvmfPkg/Libra= ry/CcExitLib/SecCcExitVcHandler.c index 769e0b5b7417..da70581af8d8 100644 --- a/OvmfPkg/Library/CcExitLib/SecCcExitVcHandler.c +++ b/OvmfPkg/Library/CcExitLib/SecCcExitVcHandler.c @@ -33,7 +33,7 @@ **/ EFI_STATUS EFIAPI -VmgExitHandleVc ( +CcExitHandleVc ( IN OUT EFI_EXCEPTION_TYPE *ExceptionType, IN OUT EFI_SYSTEM_CONTEXT SystemContext ) diff --git a/OvmfPkg/PlatformPei/AmdSev.c b/OvmfPkg/PlatformPei/AmdSev.c index 80a1194ffcb9..e1b9fd9b7f68 100644 --- a/OvmfPkg/PlatformPei/AmdSev.c +++ b/OvmfPkg/PlatformPei/AmdSev.c @@ -50,7 +50,7 @@ AmdSevSnpInitialize ( } =20 // - // Query the hypervisor feature using the VmgExit and set the value in t= he + // Query the hypervisor feature using the CcExitVmgExit and set the valu= e in the // hypervisor features PCD. // HvFeatures =3D GetHypervisorFeature (); @@ -129,19 +129,19 @@ GetHypervisorFeature ( // // Initialize the GHCB // - VmgInit (Ghcb, &InterruptState); + CcExitVmgInit (Ghcb, &InterruptState); =20 // // Query the Hypervisor Features. // - Status =3D VmgExit (Ghcb, SVM_EXIT_HYPERVISOR_FEATURES, 0, 0); + Status =3D CcExitVmgExit (Ghcb, SVM_EXIT_HYPERVISOR_FEATURES, 0, 0); if ((Status !=3D 0)) { SevEsProtocolFailure (GHCB_TERMINATE_GHCB_GENERAL); } =20 Features =3D Ghcb->SaveArea.SwExitInfo2; =20 - VmgDone (Ghcb, InterruptState); + CcExitVmgDone (Ghcb, InterruptState); =20 return Features; } diff --git a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashDxe.c b/OvmfPk= g/QemuFlashFvbServicesRuntimeDxe/QemuFlashDxe.c index 58bcad825d57..d57f7ca25ccf 100644 --- a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashDxe.c +++ b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashDxe.c @@ -82,12 +82,12 @@ QemuFlashPtrWrite ( // #VC exception. Instead, use the VMGEXIT MMIO write support directly // to perform the update. // - VmgInit (Ghcb, &InterruptState); + CcExitVmgInit (Ghcb, &InterruptState); Ghcb->SharedBuffer[0] =3D Value; Ghcb->SaveArea.SwScratch =3D (UINT64)(UINTN)Ghcb->SharedBuffer; - VmgSetOffsetValid (Ghcb, GhcbSwScratch); - VmgExit (Ghcb, SVM_EXIT_MMIO_WRITE, PhysAddr, 1); - VmgDone (Ghcb, InterruptState); + CcExitVmgSetOffsetValid (Ghcb, GhcbSwScratch); + CcExitVmgExit (Ghcb, SVM_EXIT_MMIO_WRITE, PhysAddr, 1); + CcExitVmgDone (Ghcb, InterruptState); } else { *Ptr =3D Value; } diff --git a/UefiCpuPkg/Include/Library/CcExitLib.h b/UefiCpuPkg/Include/Li= brary/CcExitLib.h index 1ae618c19b9e..3381d583691f 100644 --- a/UefiCpuPkg/Include/Library/CcExitLib.h +++ b/UefiCpuPkg/Include/Library/CcExitLib.h @@ -41,7 +41,7 @@ **/ UINT64 EFIAPI -VmgExit ( +CcExitVmgExit ( IN OUT GHCB *Ghcb, IN UINT64 ExitCode, IN UINT64 ExitInfo1, @@ -56,12 +56,12 @@ VmgExit ( =20 @param[in, out] Ghcb A pointer to the GHCB @param[in, out] InterruptState A pointer to hold the current interrupt - state, used for restoring in VmgDone () + state, used for restoring in CcExitVmgD= one () =20 **/ VOID EFIAPI -VmgInit ( +CcExitVmgInit ( IN OUT GHCB *Ghcb, IN OUT BOOLEAN *InterruptState ); @@ -79,7 +79,7 @@ VmgInit ( **/ VOID EFIAPI -VmgDone ( +CcExitVmgDone ( IN OUT GHCB *Ghcb, IN BOOLEAN InterruptState ); @@ -96,7 +96,7 @@ VmgDone ( **/ VOID EFIAPI -VmgSetOffsetValid ( +CcExitVmgSetOffsetValid ( IN OUT GHCB *Ghcb, IN GHCB_REGISTER Offset ); @@ -116,7 +116,7 @@ VmgSetOffsetValid ( **/ BOOLEAN EFIAPI -VmgIsOffsetValid ( +CcExitVmgIsOffsetValid ( IN GHCB *Ghcb, IN GHCB_REGISTER Offset ); @@ -142,7 +142,7 @@ VmgIsOffsetValid ( **/ EFI_STATUS EFIAPI -VmgExitHandleVc ( +CcExitHandleVc ( IN OUT EFI_EXCEPTION_TYPE *ExceptionType, IN OUT EFI_SYSTEM_CONTEXT SystemContext ); @@ -168,7 +168,7 @@ VmgExitHandleVc ( **/ EFI_STATUS EFIAPI -VmTdExitHandleVe ( +CcExitHandleVe ( IN OUT EFI_EXCEPTION_TYPE *ExceptionType, IN OUT EFI_SYSTEM_CONTEXT SystemContext ); diff --git a/UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.c b/UefiCpuPkg/= Library/CcExitLibNull/CcExitLibNull.c index 79eca74e138f..230e50705b4a 100644 --- a/UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.c +++ b/UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.c @@ -35,7 +35,7 @@ **/ UINT64 EFIAPI -VmgExit ( +CcExitVmgExit ( IN OUT GHCB *Ghcb, IN UINT64 ExitCode, IN UINT64 ExitInfo1, @@ -60,12 +60,12 @@ VmgExit ( =20 @param[in, out] Ghcb A pointer to the GHCB @param[in, out] InterruptState A pointer to hold the current interrupt - state, used for restoring in VmgDone () + state, used for restoring in CcExitVmgD= one () =20 **/ VOID EFIAPI -VmgInit ( +CcExitVmgInit ( IN OUT GHCB *Ghcb, IN OUT BOOLEAN *InterruptState ) @@ -85,7 +85,7 @@ VmgInit ( **/ VOID EFIAPI -VmgDone ( +CcExitVmgDone ( IN OUT GHCB *Ghcb, IN BOOLEAN InterruptState ) @@ -104,7 +104,7 @@ VmgDone ( **/ VOID EFIAPI -VmgSetOffsetValid ( +CcExitVmgSetOffsetValid ( IN OUT GHCB *Ghcb, IN GHCB_REGISTER Offset ) @@ -126,7 +126,7 @@ VmgSetOffsetValid ( **/ BOOLEAN EFIAPI -VmgIsOffsetValid ( +CcExitVmgIsOffsetValid ( IN GHCB *Ghcb, IN GHCB_REGISTER Offset ) @@ -155,7 +155,7 @@ VmgIsOffsetValid ( **/ EFI_STATUS EFIAPI -VmgExitHandleVc ( +CcExitHandleVc ( IN OUT EFI_EXCEPTION_TYPE *ExceptionType, IN OUT EFI_SYSTEM_CONTEXT SystemContext ) @@ -183,7 +183,7 @@ VmgExitHandleVc ( **/ EFI_STATUS EFIAPI -VmTdExitHandleVe ( +CcExitHandleVe ( IN OUT EFI_EXCEPTION_TYPE *ExceptionType, IN OUT EFI_SYSTEM_CONTEXT SystemContext ) diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuExceptio= n.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c index 2b6d9da5c713..748cf8d3bfc6 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c @@ -40,7 +40,7 @@ CommonExceptionHandlerWorker ( // On other - ExceptionType contains (possibly new) exception // value // - Status =3D VmgExitHandleVc (&ExceptionType, SystemContext); + Status =3D CcExitHandleVc (&ExceptionType, SystemContext); if (!EFI_ERROR (Status)) { return; } @@ -57,7 +57,7 @@ CommonExceptionHandlerWorker ( // On other - ExceptionType contains (possibly new) exception // value // - Status =3D VmTdExitHandleVe (&ExceptionType, SystemContext); + Status =3D CcExitHandleVe (&ExceptionType, SystemContext); if (!EFI_ERROR (Status)) { return; } diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException.c= b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException.c index 0a9ea79f52dc..497cd1649930 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException.c +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException.c @@ -39,7 +39,7 @@ CommonExceptionHandler ( // On other - ExceptionType contains (possibly new) exception // value // - Status =3D VmgExitHandleVc (&ExceptionType, SystemContext); + Status =3D CcExitHandleVc (&ExceptionType, SystemContext); if (!EFI_ERROR (Status)) { return; } @@ -57,7 +57,7 @@ CommonExceptionHandler ( // On other - ExceptionType contains (possibly new) exception // value // - Status =3D VmTdExitHandleVe (&ExceptionType, SystemContext); + Status =3D CcExitHandleVe (&ExceptionType, SystemContext); if (!EFI_ERROR (Status)) { return; } diff --git a/UefiCpuPkg/Library/MpInitLib/AmdSev.c b/UefiCpuPkg/Library/MpI= nitLib/AmdSev.c index 2dd8f4d74621..ca9bfed7f3b1 100644 --- a/UefiCpuPkg/Library/MpInitLib/AmdSev.c +++ b/UefiCpuPkg/Library/MpInitLib/AmdSev.c @@ -209,7 +209,7 @@ SevEsPlaceApHlt ( Msr.GhcbPhysicalAddress =3D AsmReadMsr64 (MSR_SEV_ES_GHCB); Ghcb =3D Msr.Ghcb; =20 - VmgInit (Ghcb, &InterruptState); + CcExitVmgInit (Ghcb, &InterruptState); =20 if (DoDecrement) { DoDecrement =3D FALSE; @@ -221,13 +221,13 @@ SevEsPlaceApHlt ( InterlockedDecrement ((UINT32 *)&CpuMpData->MpCpuExchangeInfo->NumAp= sExecuting); } =20 - Status =3D VmgExit (Ghcb, SVM_EXIT_AP_RESET_HOLD, 0, 0); + Status =3D CcExitVmgExit (Ghcb, SVM_EXIT_AP_RESET_HOLD, 0, 0); if ((Status =3D=3D 0) && (Ghcb->SaveArea.SwExitInfo2 !=3D 0)) { - VmgDone (Ghcb, InterruptState); + CcExitVmgDone (Ghcb, InterruptState); break; } =20 - VmgDone (Ghcb, InterruptState); + CcExitVmgDone (Ghcb, InterruptState); } =20 // diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c b/UefiCpuPkg/Library/M= pInitLib/DxeMpLib.c index ef56af1f738b..a84e9e33bafa 100644 --- a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c @@ -222,9 +222,9 @@ GetSevEsAPMemory ( Msr.GhcbPhysicalAddress =3D AsmReadMsr64 (MSR_SEV_ES_GHCB); Ghcb =3D Msr.Ghcb; =20 - VmgInit (Ghcb, &InterruptState); - VmgExit (Ghcb, SVM_EXIT_AP_JUMP_TABLE, 0, (UINT64)(UINTN)StartAddress); - VmgDone (Ghcb, InterruptState); + CcExitVmgInit (Ghcb, &InterruptState); + CcExitVmgExit (Ghcb, SVM_EXIT_AP_JUMP_TABLE, 0, (UINT64)(UINTN)StartAddr= ess); + CcExitVmgDone (Ghcb, InterruptState); =20 return (UINTN)StartAddress; } diff --git a/UefiCpuPkg/Library/MpInitLib/X64/AmdSev.c b/UefiCpuPkg/Library= /MpInitLib/X64/AmdSev.c index 4c4f81af7c22..bfda1e19030d 100644 --- a/UefiCpuPkg/Library/MpInitLib/X64/AmdSev.c +++ b/UefiCpuPkg/Library/MpInitLib/X64/AmdSev.c @@ -150,16 +150,16 @@ SevSnpCreateSaveArea ( Msr.GhcbPhysicalAddress =3D AsmReadMsr64 (MSR_SEV_ES_GHCB); Ghcb =3D Msr.Ghcb; =20 - VmgInit (Ghcb, &InterruptState); + CcExitVmgInit (Ghcb, &InterruptState); Ghcb->SaveArea.Rax =3D SaveArea->SevFeatures; - VmgSetOffsetValid (Ghcb, GhcbRax); - VmgExitStatus =3D VmgExit ( + CcExitVmgSetOffsetValid (Ghcb, GhcbRax); + VmgExitStatus =3D CcExitVmgExit ( Ghcb, SVM_EXIT_SNP_AP_CREATION, ExitInfo1, ExitInfo2 ); - VmgDone (Ghcb, InterruptState); + CcExitVmgDone (Ghcb, InterruptState); =20 ASSERT (VmgExitStatus =3D=3D 0); if (VmgExitStatus !=3D 0) { --=20 2.29.2.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#96058): https://edk2.groups.io/g/devel/message/96058 Mute This Topic: https://groups.io/mt/94881762/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-