From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web12.10294.1604478017137067937 for ; Wed, 04 Nov 2020 00:20:17 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=hRJoi3+Y; spf=pass (domain: intel.com, ip: 134.134.136.20, mailfrom: eric.dong@intel.com) IronPort-SDR: 9YHTJxeP+cfGM6Zg9IZ3xH2oOE9gxEsGlnSlV7OdSgEMS3Q0S8xaO54GjcKwWZlfTbBtx7FQR/ vNe9IgOV5Iaw== X-IronPort-AV: E=McAfee;i="6000,8403,9794"; a="156172879" X-IronPort-AV: E=Sophos;i="5.77,450,1596524400"; d="scan'208";a="156172879" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Nov 2020 00:20:16 -0800 IronPort-SDR: NthqCW8yTGBCddKHQfg5GwPVIfhQUIG5K50iAcDA0xbQPi5bRfR0L4b765/WXbo5a45A8WH3MF QeYbdgqKJQTg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,450,1596524400"; d="scan'208";a="538825088" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga005.jf.intel.com with ESMTP; 04 Nov 2020 00:20:15 -0800 Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 4 Nov 2020 00:20:15 -0800 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Wed, 4 Nov 2020 00:20:15 -0800 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.102) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Wed, 4 Nov 2020 00:20:12 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VJ4wFMNPl/nLw9IZONgkHVkuWQ6+Bi+xtDh/aXwbDAj4S5K4U89WeW/qJhqKvm++7lqaiZPvFvCMYFZGl0sqm6Y1Kqmm/m3PsWoEHR8RyXHi1o6gO+KPq3vBXNIx8zXlw8OSCFDQ8p3mXpQmX0ST+UFx1a7IwT7TwHVGoQ5T6mOlXZZLJMh89pkFuoRnXagkmf5+7t/sZ/aXUEL57g8oZjvRld+kidr4gQPU3nn96rx0j9QhXb0AZIWFVFCWXQSIW+tuZeyiaFGhKzJ1zLQ61Sad8Tw18ROPZG3CKGrOcigIDfqSsiYA7549yc8YThkVGnlAOKWsCHJaMyVVFaR3Rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SX4ZsjC7vjNNcD02MGHx7syC1E4V192m8T39OruKoro=; b=hxVPEKnr0qYCzhsJo+whvGSeL+cZkY/K/7kiH4F6eZKCTbtgVDhH4f+bDKu4aBiiGfmh84Yozg0FQqD2YY6s/RJBRldUz/k/X9DUHqYHnDjFNX8n2hqf0IIuc2QmjZjUiTcPDPX/H0YLUDoQwiteQ8KzU1n5Z90S5SopCl91ZiP+l1TijL3GJxqcemGqztbMOCL+HxYtZYN7tXLLLfiFEwvN9Y/bF+8mhUOlRhSWSb+BLbAZLYvWMmAKjyWP1UyQmebE1MgZW6CHgRBBxtHOH+yLuPM8rSoyEmrrRSs0GKzuV6xmyqOuM2KxA2cbAKAyTbW1GCHJLk09vcqwq5wUIw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SX4ZsjC7vjNNcD02MGHx7syC1E4V192m8T39OruKoro=; b=hRJoi3+YywyjZQkFDgf5zfqLBcuNXu6fbKMcdRF7i9KBmpy5S5AKx2wJfMNNzfEQn8jUzQBE9APhoU36Z4leFBm94MXzX/TJo6WuS1wlnZhVN05737+cyWsU9mr1F7mAuFq/9wBKzaTL1XlPfGEAkEGzBoGpEUbiBW9dHqGIal4= Received: from CY4PR11MB1272.namprd11.prod.outlook.com (2603:10b6:903:29::9) by CY4PR11MB2055.namprd11.prod.outlook.com (2603:10b6:903:23::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.28; Wed, 4 Nov 2020 08:20:09 +0000 Received: from CY4PR11MB1272.namprd11.prod.outlook.com ([fe80::5cb2:9510:d640:fa56]) by CY4PR11MB1272.namprd11.prod.outlook.com ([fe80::5cb2:9510:d640:fa56%4]) with mapi id 15.20.3499.032; Wed, 4 Nov 2020 08:20:09 +0000 From: "Dong, Eric" To: "devel@edk2.groups.io" , "thomas.lendacky@amd.com" CC: Brijesh Singh , "Ni, Ray" , Laszlo Ersek , "Kumar, Rahul1" , "Justen, Jordan L" , Ard Biesheuvel Subject: Re: [edk2-devel] [PATCH v3 10/11] UefiCpuPkg, OvmfPkg: Disable interrupts when using the GHCB Thread-Topic: [edk2-devel] [PATCH v3 10/11] UefiCpuPkg, OvmfPkg: Disable interrupts when using the GHCB Thread-Index: AQHWrf6T/h5ZciSJNUOEOdjvENopaam3qoyw Date: Wed, 4 Nov 2020 08:20:09 +0000 Message-ID: References: <0f3f11bec870bc4f10843beb53c6a919ac549ef4.1603981082.git.thomas.lendacky@amd.com> In-Reply-To: <0f3f11bec870bc4f10843beb53c6a919ac549ef4.1603981082.git.thomas.lendacky@amd.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.5.1.3 dlp-product: dlpe-windows dlp-reaction: no-action authentication-results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.198.147.202] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 62f8fd01-8eab-4d93-e0b7-08d8809a71e4 x-ms-traffictypediagnostic: CY4PR11MB2055: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: XkeiNQe/ySaxROV0BiNBjHbVzmWmhjzXt1tJdhDeItQgwew4WzIDVgIpowbTs7KjRwdSQHKbh7c65mf6Lv5OiasDBFzleK9yWXoHu/k0E3JLAP1UqDInUntAYXpgT0F8zwvmgcTp4H+lK/8Wl3SH+mxTpW2Hu2rm58sHKrTp6XRK8mdbZqmGkzEO0Xd4zjHqXlLVDGrH6KpuWjNty89fIEs10OhU/C2hNZ0/4nkZtT5CeImRn6ShSFYQP0JpgDKY+PXqEM+4O6uXv0yPlg4rokDN25yNOjcLHplATSFT0jEODqpYpT/Xf1wg6jt7CJr4AEWt0wwYVI3xbue2S5szPn91sLLHWwJXYG6m1UTdqwpa0KCrW/KZDen4bm+Xl65vBLLHqpV8ORDmmzNTMo+gUA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY4PR11MB1272.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(346002)(396003)(39860400002)(376002)(136003)(366004)(5660300002)(76116006)(83380400001)(52536014)(66946007)(66556008)(66476007)(33656002)(86362001)(478600001)(966005)(66446008)(186003)(53546011)(26005)(9686003)(6506007)(316002)(4326008)(7696005)(8936002)(2906002)(8676002)(71200400001)(19627235002)(55016002)(110136005)(64756008)(54906003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: W38ybnaWfP/0L759/QuP2pqtS6ElahzmSPTDT+cBM2A2dwPiPhk8tHr225yUAN0bFME5b5i6SUKcYt23h14e7t3/3RFqbq9Yjoz9z/uOd++i8ozzyjeOq6OFVc3LxmX8Qcfuwl2cf5Zk0SfNlw1SEhs4P4Xc6sGRFIIO6GG2YraF1bTGJtxHVrHit14Z/iIoSGJdJdvhd9++YS7EO4wpCD8UqPneY1ivYeuUQeeWYcerOQR9pAoOfJJXoNlVPOEXqrHPGtXZMsGd1h2YWgZ5ZzVc4lfO1HYf+vLgaSGDIbjmBrDjn8ZFi/uESYJv2ViktI2FpBW2G8R9VsgTjsNMGYyhh1UPWwEd+M9DWX4f/oCewa/OONgGi2G/Hd08Ei780C+pfZnFlg4QqOVAERlRemNGjl7wPk8SR08WBziZsAtHR/+A+G/AB7/8B/YBvFVmjggTqKLqHK7rI7QtYZoRvqcC+eIBIgSVfmPcRjT4NGEcua+xL/KYEdsQJJ3WxjWs7PcbJWWQ+5lnHcr7CaHmf+N0j+QKglrqNf6R8YMXQGweF3gNfVi66RTV2EJi3RD0f/mw7gfxUli1Cl/AdrvF3Wd2i6kBGnbdfdZR9gpcxgVn1CbBPdjcLv3msFU7dojVB4yC/ErosZIsoR/eHYV/uA== MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CY4PR11MB1272.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 62f8fd01-8eab-4d93-e0b7-08d8809a71e4 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Nov 2020 08:20:09.5889 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 4yVpa2yXKYYP25xlw5nlj4nYyIAY1GX2mQABA5xV8044j6Z7BReQSn2MQj/QsiUIy18DIcPEeUvR4D8ZD1sCDQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR11MB2055 Return-Path: eric.dong@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Acked-by: Eric Dong -----Original Message----- From: devel@edk2.groups.io On Behalf Of Lendacky, T= homas Sent: Thursday, October 29, 2020 10:18 PM To: devel@edk2.groups.io Cc: Brijesh Singh ; Dong, Eric ; Ni, Ray ; Laszlo Ersek ; Kumar, Rah= ul1 ; Justen, Jordan L ;= Ard Biesheuvel Subject: [edk2-devel] [PATCH v3 10/11] UefiCpuPkg, OvmfPkg: Disable interr= upts when using the GHCB From: Tom Lendacky BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3008 The QemuFlashPtrWrite() flash services runtime uses the GHCB and VmgExit()= directly to perform the flash write when running as an SEV-ES guest. If an= interrupt arrives between VmgInit() and VmgExit(), the Dr7 read in the int= errupt handler will generate a #VC, which can overwrite information in the = GHCB that QemuFlashPtrWrite() has set. This has been seen with the timer in= terrupt firing and the CpuExceptionHandlerLib library code, UefiCpuPkg/Libr= ary/CpuExceptionHandlerLib/X64/ Xcode5ExceptionHandlerAsm.nasm and ExceptionHandlerAsm.nasm reading the Dr7 register while QemuFlashPtrWrite() is using the GHCB. In g= eneral, it is necessary to protect the GHCB whenever it is used, not just i= n QemuFlashPtrWrite(). Disable interrupts around the usage of the GHCB by modifying the VmgInit()= and VmgDone() interfaces: - VmgInit() will take an extra parameter that is a pointer to a BOOLEAN that will hold the interrupt state at the time of invocation. VmgInit() will get and save this interrupt state before updating the GHCB. - VmgDone() will take an extra parameter that is used to indicate whether interrupts are to be (re)enabled. Before exiting, VmgDone() will enable interrupts if that is requested. Fixes: 437eb3f7a8db7681afe0e6064d3a8edb12abb766 Cc: Eric Dong Cc: Ray Ni Cc: Laszlo Ersek Cc: Rahul Kumar Cc: Jordan Justen Cc: Ard Biesheuvel Cc: Tom Lendacky Cc: Brijesh Singh Reviewed-by: Laszlo Ersek Signed-off-by: Tom Lendacky --- UefiCpuPkg/Include/Library/VmgExitLib.h | 14 ++++++++--- OvmfPkg/Library/VmgExitLib/VmgExitLib.c | 26 ++++++++++++++= +++--- OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c | 5 ++-- OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashDxe.c | 5 ++-- UefiCpuPkg/Library/MpInitLib/DxeMpLib.c | 5 ++-- UefiCpuPkg/Library/MpInitLib/MpLib.c | 7 +++--- UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.c | 18 ++++++++------ 7 files changed, 55 insertions(+), 25 deletions(-) diff --git a/UefiCpuPkg/Include/Library/VmgExitLib.h b/UefiCpuPkg/Include/= Library/VmgExitLib.h index 07e8af6450b9..061948cf840d 100644 --- a/UefiCpuPkg/Include/Library/VmgExitLib.h +++ b/UefiCpuPkg/Include/Library/VmgExitLib.h @@ -50,13 +50,16 @@ VmgExit ( Performs the necessary steps in preparation for invoking VMGEXIT. Must = be called before setting any fields within the GHCB. =20 - @param[in, out] Ghcb A pointer to the GHCB + @param[in, out] Ghcb A pointer to the GHCB + @param[in, out] InterruptState A pointer to hold the current interrup= t + state, used for restoring in VmgDone= =20 + () =20 **/ VOID EFIAPI VmgInit ( - IN OUT GHCB *Ghcb + IN OUT GHCB *Ghcb, + IN OUT BOOLEAN *InterruptState ); =20 /** @@ -65,13 +68,16 @@ VmgInit ( Performs the necessary steps to cleanup after invoking VMGEXIT. Must be called after obtaining needed fields within the GHCB. =20 - @param[in, out] Ghcb A pointer to the GHCB + @param[in, out] Ghcb A pointer to the GHCB + @param[in] InterruptState An indicator to conditionally (re)enab= le + interrupts =20 **/ VOID EFIAPI VmgDone ( - IN OUT GHCB *Ghcb + IN OUT GHCB *Ghcb, + IN BOOLEAN InterruptState ); =20 /** diff --git a/OvmfPkg/Library/VmgExitLib/VmgExitLib.c b/OvmfPkg/Library/Vmg= ExitLib/VmgExitLib.c index 0540df8a04d4..bc5cd61d751f 100644 --- a/OvmfPkg/Library/VmgExitLib/VmgExitLib.c +++ b/OvmfPkg/Library/VmgExitLib/VmgExitLib.c @@ -132,15 +132,27 @@ VmgExit ( Performs the necessary steps in preparation for invoking VMGEXIT. Must = be called before setting any fields within the GHCB. =20 - @param[in, out] Ghcb A pointer to the GHCB + @param[in, out] Ghcb A pointer to the GHCB + @param[in, out] InterruptState A pointer to hold the current interrup= t + state, used for restoring in VmgDone= =20 + () =20 **/ VOID EFIAPI VmgInit ( - IN OUT GHCB *Ghcb + IN OUT GHCB *Ghcb, + IN OUT BOOLEAN *InterruptState ) { + // + // Be sure that an interrupt can't cause a #VC while the GHCB is //=20 + being used. + // + *InterruptState =3D GetInterruptState (); if (*InterruptState) { + DisableInterrupts (); + } + SetMem (&Ghcb->SaveArea, sizeof (Ghcb->SaveArea), 0); } =20 @@ -150,15 +162,21 @@ VmgInit ( Performs the necessary steps to cleanup after invoking VMGEXIT. Must be called after obtaining needed fields within the GHCB. =20 - @param[in, out] Ghcb A pointer to the GHCB + @param[in, out] Ghcb A pointer to the GHCB + @param[in] InterruptState An indicator to conditionally (re)enab= le + interrupts =20 **/ VOID EFIAPI VmgDone ( - IN OUT GHCB *Ghcb + IN OUT GHCB *Ghcb, + IN BOOLEAN InterruptState ) { + if (InterruptState) { + EnableInterrupts (); + } } =20 /** diff --git a/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c b/OvmfPkg/Libra= ry/VmgExitLib/VmgExitVcHandler.c index 9bf9d160179c..1671db3a01b1 100644 --- a/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c +++ b/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c @@ -1568,6 +1568,7 @@ VmgExitHandleVc ( SEV_ES_INSTRUCTION_DATA InstructionData; UINT64 ExitCode, Status; EFI_STATUS VcRet; + BOOLEAN InterruptState; =20 VcRet =3D EFI_SUCCESS; =20 @@ -1578,7 +1579,7 @@ VmgExitHandleVc ( Regs =3D SystemContext.SystemContextX64; Ghcb =3D Msr.Ghcb; =20 - VmgInit (Ghcb); + VmgInit (Ghcb, &InterruptState); =20 ExitCode =3D Regs->ExceptionData; switch (ExitCode) { @@ -1662,7 +1663,7 @@ VmgExitHandleVc ( VcRet =3D EFI_PROTOCOL_ERROR; } =20 - VmgDone (Ghcb); + VmgDone (Ghcb, InterruptState); =20 return VcRet; } diff --git a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashDxe.c b/OvmfP= kg/QemuFlashFvbServicesRuntimeDxe/QemuFlashDxe.c index f9b21b54137d..1b0742967f71 100644 --- a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashDxe.c +++ b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashDxe.c @@ -52,6 +52,7 @@ QemuFlashPtrWrite ( if (MemEncryptSevEsIsEnabled ()) { MSR_SEV_ES_GHCB_REGISTER Msr; GHCB *Ghcb; + BOOLEAN InterruptState; =20 Msr.GhcbPhysicalAddress =3D AsmReadMsr64 (MSR_SEV_ES_GHCB); Ghcb =3D Msr.Ghcb; @@ -63,12 +64,12 @@ QemuFlashPtrWrite ( // #VC exception. Instead, use the the VMGEXIT MMIO write support dir= ectly // to perform the update. // - VmgInit (Ghcb); + VmgInit (Ghcb, &InterruptState); Ghcb->SharedBuffer[0] =3D Value; Ghcb->SaveArea.SwScratch =3D (UINT64) (UINTN) Ghcb->SharedBuffer; VmgSetOffsetValid (Ghcb, GhcbSwScratch); VmgExit (Ghcb, SVM_EXIT_MMIO_WRITE, (UINT64) (UINTN) Ptr, 1); - VmgDone (Ghcb); + VmgDone (Ghcb, InterruptState); } else { *Ptr =3D Value; } diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c b/UefiCpuPkg/Library/= MpInitLib/DxeMpLib.c index 2c00d72ddefe..7839c249760e 100644 --- a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c @@ -171,6 +171,7 @@ GetSevEsAPMemory ( EFI_PHYSICAL_ADDRESS StartAddress; MSR_SEV_ES_GHCB_REGISTER Msr; GHCB *Ghcb; + BOOLEAN InterruptState; =20 // // Allocate 1 page for AP jump table page @@ -192,9 +193,9 @@ GetSevEsA= PMemory ( Msr.GhcbPhysicalAddress =3D AsmReadMsr64 (MSR_SEV_ES_GHCB); Ghcb =3D Msr.Ghcb; =20 - VmgInit (Ghcb); + VmgInit (Ghcb, &InterruptState); VmgExit (Ghcb, SVM_EXIT_AP_JUMP_TABLE, 0, (UINT64) (UINTN) StartAddress= ); - VmgDone (Ghcb); + VmgDone (Ghcb, InterruptState); =20 return (UINTN) StartAddress; } diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpI= nitLib/MpLib.c index 6d977d45bcdd..1f47ff3f73b5 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c @@ -884,6 +884,7 @@ ApWakeupFunction ( GHCB *Ghcb; UINT64 Status; BOOLEAN DoDecrement; + BOOLEAN InterruptState; =20 DoDecrement =3D (BOOLEAN) (CpuMpData->InitFlag =3D=3D ApInitCon= fig); =20 @@ -891,7 +892,7 @@ ApWakeupFunction ( Msr.GhcbPhysicalAddress =3D AsmReadMsr64 (MSR_SEV_ES_GHCB); Ghcb =3D Msr.Ghcb; =20 - VmgInit (Ghcb); + VmgInit (Ghcb, &InterruptState); =20 if (DoDecrement) { DoDecrement =3D FALSE; @@ -905,11 +906,11 @@ ApWakeupFunction ( =20 Status =3D VmgExit (Ghcb, SVM_EXIT_AP_RESET_HOLD, 0, 0); if ((Status =3D=3D 0) && (Ghcb->SaveArea.SwExitInfo2 !=3D 0))= { - VmgDone (Ghcb); + VmgDone (Ghcb, InterruptState); break; } =20 - VmgDone (Ghcb); + VmgDone (Ghcb, InterruptState); } =20 // diff --git a/UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.c b/UefiCpuP= kg/Library/VmgExitLibNull/VmgExitLibNull.c index b47e282aff82..89b065cb3ff3 100644 --- a/UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.c +++ b/UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.c @@ -57,15 +57,16 @@ VmgExit ( Performs the necessary steps in preparation for invoking VMGEXIT. Must = be called before setting any fields within the GHCB. =20 - The base library function does nothing. - - @param[in, out] Ghcb A pointer to the GHCB + @param[in, out] Ghcb A pointer to the GHCB + @param[in, out] InterruptState A pointer to hold the current interrup= t + state, used for restoring in VmgDone= =20 + () =20 **/ VOID EFIAPI VmgInit ( - IN OUT GHCB *Ghcb + IN OUT GHCB *Ghcb, + IN OUT BOOLEAN *InterruptState ) { } @@ -76,15 +77,16 @@ VmgInit ( Performs the necessary steps to cleanup after invoking VMGEXIT. Must be called after obtaining needed fields within the GHCB. =20 - The base library function does nothing. - - @param[in, out] Ghcb A pointer to the GHCB + @param[in, out] Ghcb A pointer to the GHCB + @param[in] InterruptState An indicator to conditionally (re)enab= le + interrupts =20 **/ VOID EFIAPI VmgDone ( - IN OUT GHCB *Ghcb + IN OUT GHCB *Ghcb, + IN BOOLEAN InterruptState ) { } -- 2.28.0