From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=1WUYpr4N; spf=none, err=SPF record not found (domain: amd.com, ip: , mailfrom: thomas.lendacky@amd.com) Received: from NAM01-BN3-obe.outbound.protection.outlook.com (NAM01-BN3-obe.outbound.protection.outlook.com []) by groups.io with SMTP; Mon, 19 Aug 2019 14:36:10 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Vr9kz7AVtU485wBR03YhW9vCSsMz2HaoJcu1P43H8O7fnYN7bHQ3PL/BHZgbQJbqajwbW5aWMJGLlgKRDnjxghdW5v9xcqTEjnKQWkuRxnMetPWiTLZFEMVuLxdnaaWAoeCkOujWdv5UbrJAgVWMsDmjtt0Gj5J7/JJtpdq70yEdPM6LTKMMCHNDyIeQL9M6auA37xBw26m/cJ3H6gaf5XloF5RTtscXNscczXjDbNdqka1fNIadU/zUp+2VReKyTHwb8rjZHG2LKjPQgtoi+l//1Dh/KA2Q6KXWVTl+h4WH4EZK9sKNbkJAvzqI+GrVJhTyTQOKkL4Cd9BqXgjYXg== 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=J4xVN23NnNf0XeqvdiCNOwY+ITjQpjuPrHRuICyH3YM=; b=YAB0HtMKTBffMucmmlsKmjw7/fwDvIP9rU5Y1kwNJDittFOixwhB4x+y7G+7fQSLeqpORenqLqbjXuC2nYy57qZsocejU+u2DIBS2jtfpd2gwZG5ebHsFII+/haQoa68X9vl5lI+DqGSjeiUED2BcNCVawjEPsL+uOV0O3m4pPRVW16SWZPGs4o3JF+Cd6T95iKJr03aLMI+Y/b2z6ECrmNs9vAX8De85yGL4PRL7ShauHC/WG302wUuwuv5Zv1YwFXqQTqI8JtFEZI1HVCC2nIC9svzQcm60rpJWdotD9tILGFw0Q8QfohVMtxxd9jPgAKL5n8D5vDau/ENZ4bR9A== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=J4xVN23NnNf0XeqvdiCNOwY+ITjQpjuPrHRuICyH3YM=; b=1WUYpr4Nq1zP/ftS2gKCHnBKdv5YgW5mciaACklSxGbSdAGX0jGwEsbnrXN+Uc6x2/yD3gnMdYtozj4O4S/UpsW5AVLX4qxKE+T9xun3gTxgAat5EDqvoX0xpQSwFTGOD24/ZA9gvNQXz62N0oWkZqM9dP/CyQvjS5fPfduSV10= Received: from BYAPR12MB3158.namprd12.prod.outlook.com (20.179.92.19) by BYAPR12MB2965.namprd12.prod.outlook.com (20.178.52.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2178.18; Mon, 19 Aug 2019 21:36:08 +0000 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:08 +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: [RFC PATCH 16/28] UefiCpuPkg/CpuExceptionHandler: Add support for WBINVD NAE events Thread-Topic: [RFC PATCH 16/28] UefiCpuPkg/CpuExceptionHandler: Add support for WBINVD NAE events Thread-Index: AQHVVtYcJunHfVyetU28kilgnKC20A== Date: Mon, 19 Aug 2019 21:36:08 +0000 Message-ID: <814eac8c6cb0fe86b3b7e867042497bcc5db8f60.1566250534.git.thomas.lendacky@amd.com> References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.17.1 x-clientproxiedby: SN2PR01CA0031.prod.exchangelabs.com (2603:10b6:804:2::41) To BYAPR12MB3158.namprd12.prod.outlook.com (2603:10b6:a03:132::19) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Thomas.Lendacky@amd.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [165.204.77.1] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 339dc723-95e3-4f5d-3fc4-08d724ed3f30 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020);SRVR:BYAPR12MB2965; x-ms-traffictypediagnostic: BYAPR12MB2965: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2000; x-forefront-prvs: 0134AD334F x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(346002)(366004)(376002)(396003)(136003)(39860400002)(189003)(199004)(50226002)(53936002)(316002)(5660300002)(2351001)(52116002)(76176011)(36756003)(6436002)(71200400001)(19627235002)(6512007)(7736002)(256004)(86362001)(14454004)(478600001)(305945005)(2906002)(71190400001)(2501003)(64756008)(186003)(118296001)(4326008)(26005)(6486002)(99286004)(1730700003)(386003)(6506007)(66066001)(66476007)(66556008)(8676002)(102836004)(81166006)(25786009)(66446008)(6916009)(54906003)(3846002)(6116002)(486006)(5640700003)(476003)(2616005)(11346002)(446003)(81156014)(66946007)(8936002);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR12MB2965;H:BYAPR12MB3158.namprd12.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: amd.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: utTOVmGYwc4UBQXS03hxmTMqVhIy1a1458VDpLYkakzinEUnslOGik26ciLrV7ctlQHQgPeOISPEJjOOZadqifqy3fMtcsOZiosn7CStXCdHjWU9a2QApJCtxCa3sMqEB0Awo/3g6s72WrSi06L8B076loXyjWvOZS4WR35NOdlxa1ML/J0clljn1396Ga8m/vr+qnW/bfbY9eAGudvYkdEyNyCteFe5YvsW0eSc01Mjbvlp6PiRtY9xaMHh4qO6qjEIZ3q0uq7Qpp4OXk5tc3uBUIdetRlxpP7yhKUof7C5GnQJlrWIIJU+WlWMHbXReXfmgHS3bUk/Wf6enqCGNvtZlZxPZW5a9xC4lkqjpmN9AODuaO3SyRV27uBd3WKpFO4Mq1bIKDK+RHVWpq3rwPhH+KLQFDZcdQXSUCzKVP4= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 339dc723-95e3-4f5d-3fc4-08d724ed3f30 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Aug 2019 21:36:08.4998 (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: C60RdVsm3jBkCFOo1dJn/NMCG4Ddauco0mpJvTBLj2nyATvIBAdN2KZcBGs5lgbJ1vTzDe62XtFdCMdCbyGOBg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB2965 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-ID: <32194FBBC3C6054285346FE690304D5B@namprd12.prod.outlook.com> Content-Transfer-Encoding: quoted-printable From: Tom Lendacky Under SEV-ES, a WBINVD intercept generates a #VC exception. VMGEXIT must be used to allow the hypervisor to handle this intercept. Signed-off-by: Tom Lendacky --- .../X64/AMDSevVcCommon.c | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/AMDSevVcCommon.c= b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/AMDSevVcCommon.c index 5b2df92acf72..78d9b315c446 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/AMDSevVcCommon.c +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/AMDSevVcCommon.c @@ -528,6 +528,24 @@ UnsupportedExit ( return Status; } =20 +STATIC +UINTN +WbinvdExit ( + GHCB *Ghcb, + EFI_SYSTEM_CONTEXT_X64 *Regs, + SEV_ES_INSTRUCTION_DATA *InstructionData + ) +{ + UINTN Status; + + Status =3D VmgExit (Ghcb, SvmExitWbinvd, 0, 0); + if (Status) { + return Status; + } + + return 0; +} + STATIC UINTN MsrExit ( @@ -867,6 +885,10 @@ DoVcCommon ( NaeExit =3D MsrExit; break; =20 + case SvmExitWbinvd: + NaeExit =3D WbinvdExit; + break; + case SvmExitNpf: NaeExit =3D MmioExit; break; --=20 2.17.1