From nobody Tue Nov 26 22:21:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+46088+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1566301158036806.802026982107; Tue, 20 Aug 2019 04:39:18 -0700 (PDT) Return-Path: X-Received: from NAM05-CO1-obe.outbound.protection.outlook.com (NAM05-CO1-obe.outbound.protection.outlook.com [40.107.72.71]) by groups.io with SMTP; Mon, 19 Aug 2019 14:36:21 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=agSevMj6uXss8Zgdwn+IVntxHJ2kBovTHOi2RHJ18w0ThPKs2FlVgwwIn2Z2VlVkWwdBw1FjnNE26AnDugiPsCxwn7oFcFthO4+UqivtYU6Hulph+1pP/es9Yjta0onkAOtzlIBPlACifVZvJqtBs9woHNlCicrrkzVrlvqBMk2luCkuRmIulCr00xTRXCJOJ/dJshVAUX1AhFfWyUU9Wmah4XpvrM5SABfBhiJpgiw8g+Dxemwb+ijOnRnqvDVMjrtg4EmddPIiAd5YFdNQ4tTZSKB+i8vMM7jee6L6EqE2XFBaGGmetbV71gO0rpJAR0Z/DS/MgZNk6F4fn04qBg== 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=5uo2NIeT3t+OIZdNsRoclB7WcOuLB0bkF84hOKVwsOk=; b=dDBfu284Mz2SCT6RCSeGxICChmIbV2w+3uBNHUVMyF+cpLKvTmA1GdeFBUAWrdo3b11P+4jEoio39QCYWNReOJZsKA5TGnZj5y9QSWWzodvcTzdOFWv39K5/mAvsEzTohyFMBrI0cEDokD9FVN0xwWWs16js4Qz7lHey/DDryAfjXgr/QuXiZSZCu+9ferR6TGDrVaRFkhVMWGS/on5gbTOU0ct3tB4ofcxfu9Yw9DN28jTvGYdyFU0pdgJO9H+3UU85+f4YQN0TYBAtJaq1dtfU0HGsP7+AMOushTQKLATwwR2aoq80+it3+ReiJXpqEHRxptvJwoJdpqf3tU7SDA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none X-Received: from BYAPR12MB3158.namprd12.prod.outlook.com (20.179.92.19) by BYAPR12MB3112.namprd12.prod.outlook.com (20.178.54.205) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2157.20; Mon, 19 Aug 2019 21:36:20 +0000 X-Received: from BYAPR12MB3158.namprd12.prod.outlook.com ([fe80::39b9:76bd:a491:1f27]) by BYAPR12MB3158.namprd12.prod.outlook.com ([fe80::39b9:76bd:a491:1f27%6]) with mapi id 15.20.2157.022; Mon, 19 Aug 2019 21:36:20 +0000 From: "Lendacky, Thomas" To: "devel@edk2.groups.io" CC: Jordan Justen , Laszlo Ersek , Ard Biesheuvel , Michael D Kinney , Liming Gao , Eric Dong , Ray Ni , "Singh, Brijesh" Subject: [edk2-devel] [RFC PATCH 25/28] UefiCpuPkg/CpuExceptionHandler: Add base #VC exception handling support for Pei/Dxe phases Thread-Topic: [RFC PATCH 25/28] UefiCpuPkg/CpuExceptionHandler: Add base #VC exception handling support for Pei/Dxe phases Thread-Index: AQHVVtYj7zAeBlOOmkuuflpAWR8bsA== Date: Mon, 19 Aug 2019 21:36:20 +0000 Message-ID: <7f0123ecbec9862f141c3e07e3032552f8777bea.1566250534.git.thomas.lendacky@amd.com> References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SN2PR01CA0031.prod.exchangelabs.com (2603:10b6:804:2::41) To BYAPR12MB3158.namprd12.prod.outlook.com (2603:10b6:a03:132::19) x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [165.204.77.1] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 1a80f8e8-6e91-4fce-8697-08d724ed4614 x-ms-office365-filtering-ht: Tenant x-ms-traffictypediagnostic: BYAPR12MB3112: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:935; Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+46088+1787277+3901457@groups.io; helo=web01.groups.io; received-spf: None (protection.outlook.com: amd.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: gRmcijXeKuIHEWm1Atfi61+5d1NBOvgiwqTUUW44wA6NdF3tSLKswO+PAH/QZlTEVTxUFCNcI4xV00KLaWMP7jsiI6X0CQu+Wgj7I+Ej/015i9u7vJsxbwyB3NyOLCN5TLxwv/8YXJJwVdTk2FC1tYUwYitlhfcyYz8bHgBqVKDoAiHVlACZD2ntqm7Be/DXgaF4+GTvY8ZoWU7CP6VQwwRzUgxiOHfa8fxv2tPWDolwE4D3QAOq35UdLSf64WSp85MjAh2Pgu/hpqG1WXE09/PwN8S+xbJNytjVQv/t3ESmM9nHEOg6nXALS0JYWZK5ed1Ui53P4vWVmfoXToCt44hBG9i+E0oDsxNwjhzS4t99nadosfDPLP5ipb9uXtP+2zQK0ceFIW2FyGhrCGjJgyzP3mjl22JA35jIHCiszSI= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1a80f8e8-6e91-4fce-8697-08d724ed4614 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Aug 2019 21:36:20.1052 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: SVqv/7a4UySN7K2rsbbf0Cm+eXoQAcWJMumCJ73SVNzxaYo8mcYA+1MWnzLfRAn/Z49HhRVQAvTZE9ZU3rCJ0w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB3112 Precedence: Bulk List-Unsubscribe: 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,thomas.lendacky@amd.com Content-Language: en-US Content-ID: <865EC779E36BC94E9B5921DF5A381B83@namprd12.prod.outlook.com> Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1566301157; bh=iRqBpuNZczLlzlcV5acLwHj0BdUXSV+AOSdJX9Jg+8Y=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=bk7JxUc4hNMVnofO19YLElKWRkvzpYBv2FfnU6EurV2+CBbZ+HsEoe2cZDvSOwPsQj3 ykURMNXvy6PgOFI6AAZkHsvsIjnvWbvr7QvJz4EOOGL5xWD819+fYMroBYAARxyIaVjMR GwJROil5euXnWN4L3z3AaB1RRV2MThSROQQ= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Tom Lendacky An SEV-ES guest will generate a #VC exception when it encounters a non-automatic exit (NAE) event. It is expected that the #VC exception handler will communicate with the hypervisor using the GHCB to handle the NAE event. Update the Pei and Dxe exception handling support to recognize the #VC exception and call a common #VC handler. Signed-off-by: Tom Lendacky --- .../DxeCpuExceptionHandlerLib.inf | 2 ++ .../PeiCpuExceptionHandlerLib.inf | 2 ++ .../PeiDxeAMDSevVcHandler.c | 15 +++++++++++++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandl= erLib.inf b/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandle= rLib.inf index 331ae7334c45..75fafd346add 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.i= nf +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.i= nf @@ -26,11 +26,13 @@ [Sources.Ia32] Ia32/ExceptionTssEntryAsm.nasm Ia32/ArchExceptionHandler.c Ia32/ArchInterruptDefs.h + Ia32/AMDSevVcCommon.c =20 [Sources.X64] X64/ExceptionHandlerAsm.nasm X64/ArchExceptionHandler.c X64/ArchInterruptDefs.h + X64/AMDSevVcCommon.c =20 [Sources.common] CpuExceptionCommon.h diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandl= erLib.inf b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandle= rLib.inf index 89b5d496e56f..50124b598509 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.i= nf +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.i= nf @@ -26,11 +26,13 @@ [Sources.Ia32] Ia32/ExceptionTssEntryAsm.nasm Ia32/ArchExceptionHandler.c Ia32/ArchInterruptDefs.h + Ia32/AMDSevVcCommon.c =20 [Sources.X64] X64/ExceptionHandlerAsm.nasm X64/ArchExceptionHandler.c X64/ArchInterruptDefs.h + X64/AMDSevVcCommon.c =20 [Sources.common] CpuExceptionCommon.h diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeAMDSevVcHandle= r.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeAMDSevVcHandler.c index 1e027b3f2964..d32de9efb09e 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeAMDSevVcHandler.c +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeAMDSevVcHandler.c @@ -1,11 +1,22 @@ =20 +#include +#include +#include #include "CpuExceptionCommon.h" #include "AMDSevVcCommon.h" =20 UINTN -DoVcException( +DoVcException ( EFI_SYSTEM_CONTEXT Context ) { - return 0; + MSR_SEV_ES_GHCB_REGISTER Msr; + GHCB *Ghcb; + + Msr.GhcbPhysicalAddress =3D AsmReadMsr64 (MSR_SEV_ES_GHCB); + ASSERT(!Msr.Bits.GhcbNegotiateBit); + + Ghcb =3D Msr.Ghcb; + + return DoVcCommon (Ghcb, Context); } --=20 2.17.1 -=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 (#46088): https://edk2.groups.io/g/devel/message/46088 Mute This Topic: https://groups.io/mt/32966261/1787277 Mute #vc: https://groups.io/mk?hashtag=3Dvc&subid=3D3901457 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-