From nobody Tue Nov 26 00:50:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+63863+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+63863+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 1596829357363907.8832878783809; Fri, 7 Aug 2020 12:42:37 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id VkHrYY1788612xwzPQFhRnui; Fri, 07 Aug 2020 12:42:37 -0700 X-Received: from NAM10-BN7-obe.outbound.protection.outlook.com (NAM10-BN7-obe.outbound.protection.outlook.com [40.107.92.40]) by mx.groups.io with SMTP id smtpd.web10.4187.1596829356407846566 for ; Fri, 07 Aug 2020 12:42:36 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JqCEyQrDXi6w610sWtBMxf0/XiHYSjLhnSdAKaw4Hh5sb1EpypyL2QcWmHL5dhR9ODCQNqJzmODuHO9Jh0ieJMXQcnjABDviElYqg5bgIiFoOb6At5U9cW0iPRn7glDvitcwnj850MGPz6RFX9HZakYNzaKBR+6okrZzgD0yRciVqfDYfyumrrRBDPmu4k+foPUvXgj5HeHRE0xp7Atpq+vb15b1+xaHvJDcqWztVevoSQauI4QkoWVizt/TJGjco0y2sRn0t1+f0UT2265RZg0C1HC30ttUpjhdnZHoBwxKV1136darfUGBYDf4XQ5bDDYoS7KwbAIWIAbKu3qMew== 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=VWf8IlBLc5H2/zm6u8ihdDB1OPHPbvu83zMDyNap3VM=; b=Cd2D60jER+Bejfi2+iLP5vJrI9yP3XcdIL6yA2/juUahciA9m4nU0R2Gd1r/NRlWswz/MwiYBsLrBanwHfYB5Crft7o4ktDwzXEzvylf2CIMEQR/T4qsFaGtVZq3f38cjA2fg/v2hx9f73HDC1PuLD1KY41dpPz8Tz1hA9X2dqFqfkK2CyQ55/9640js6QLcZ/WYqnFMuDG8pB2146V/JLiiD+bzhzLTcYkk7OIeAghySGRYLr2iCcSh0YyFmlFXliSExTIVxL/h9GMlFTZ2Db0efKKkApuE+MhU5L//T7DRG9o7zv0cL2Ou6aHEXrTcLOJsDLKRIA2q6X//pqF8kw== 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 CY4PR12MB1352.namprd12.prod.outlook.com (2603:10b6:903:3a::13) by CY4PR12MB1798.namprd12.prod.outlook.com (2603:10b6:903:11a::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.19; Fri, 7 Aug 2020 19:42:34 +0000 X-Received: from CY4PR12MB1352.namprd12.prod.outlook.com ([fe80::9181:78bf:bf0:702b]) by CY4PR12MB1352.namprd12.prod.outlook.com ([fe80::9181:78bf:bf0:702b%5]) with mapi id 15.20.3239.024; Fri, 7 Aug 2020 19:42:34 +0000 From: "Lendacky, Thomas" To: devel@edk2.groups.io CC: Brijesh Singh , Ard Biesheuvel , Eric Dong , Jordan Justen , Laszlo Ersek , Liming Gao , Michael D Kinney , Ray Ni Subject: [edk2-devel] [PATCH v14 21/46] OvmfPkg/VmgExitLib: Add support for INVD NAE events Date: Fri, 7 Aug 2020 14:39:06 -0500 Message-ID: <0e27a2b00a0f5acdcf941ee03c63e1c88aed1c8a.1596829170.git.thomas.lendacky@amd.com> In-Reply-To: References: X-ClientProxiedBy: DM5PR10CA0022.namprd10.prod.outlook.com (2603:10b6:4:2::32) To CY4PR12MB1352.namprd12.prod.outlook.com (2603:10b6:903:3a::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-Received: from tlendack-t1.amd.com (165.204.77.1) by DM5PR10CA0022.namprd10.prod.outlook.com (2603:10b6:4:2::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.19 via Frontend Transport; Fri, 7 Aug 2020 19:42:33 +0000 X-Originating-IP: [165.204.77.1] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 96362415-566a-45cb-fd7d-08d83b0a07d4 X-MS-TrafficTypeDiagnostic: CY4PR12MB1798: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: eW9PdbjL1cBP7mej2KI9ZM1Cz6pCO7vIv2CssspVNUoaWmJDTi3ukX07AkbudDAYgTFRlF89qQ7OfvSx6L9/xvMjgu6L1q2CtP7e7UTxfpFha0wrE0Rr2ldkPJJH0r/5DStktT5C08thOOJ1qS+RIVbeYgzPWs0KB4+HqUkJRnH4W0EtDAh5xsEdpnKwxivcqZeCkEbtpl30PD//VbsSUzy4Z/eK/0rlVU/bmDOX2Hj+8B9jonxL+7ZVU2Pq0I3xtowdBGhfbvCEJTOfNDmaew+6KhbA6FaIAu/RaWPmtc4sgYhoEDE+nu+1YvmV/1WVStDADsS0QaYGdaEqrf7ujcgz2kjZrjXZMeZHfMtB2dCx5Ia9K8FnozU38gG8hfzMSsHArJ16M5D13PjGYSGxz1YK9O+Flki02RopS6QaqOzRKa54MHnVygyDZpWcppOecrpePvBWFjqw/OUUKM1J0A== X-MS-Exchange-AntiSpam-MessageData: U5+CDQRzOKaWJ1MwVOhZwh/39vnxFfewdDzHVMZzvdgeMELcxyGXX3nCi5Ydl2T8nIW4LqeKyYcoEsuKGV9qw1f7X6OBy8OXIA5I0j6eegs/24AQpXFdZfkZ87lvneu3cZkswz2sANX+vLWk7cZf5Sds49POwtpSYfft7n63OMe8XVp+y68Er2GE9FS5t7O5C2wlCPRuUR8WUx8quNGUhOlUreD95lml+dGRqGH5DM9hpuVFlE/EFrhkUnpvDv1WKYFPX7oDnQjh0efToJOVeancomD4ztZdSAsqqbQiA2j6KSwJKbHndtv3jFXtnFTYyRSsDTzPUAICorNvX4imEBOWQe/tK9xhIaKPkVFHze+UdFyfi0QvSV3stWjukpHK+CDrN/Ip4g020TgNKfZ1XIMTFfCcrkZ7XJ50dFGmgkwbzrKNHBxJj4xJNhmzLx5PvqZhsDY8ukgVWYZLfcaX9CnmG69+w0Il9bfhRewzQlf+ffw9I/lTQ2HZkFCBrfbwdpi/YozgZs0W6hy36ye+9hiE0z0m+BVkZpjwQQ+X3d3V8m6DJX3l8/Nb4EbYu9R51HR7k/UYkRDlr4iIwsgWMLiclaV5Q0s2WfQyDXsEZTVawLhxKT1cz06xO3E4qegEG5kM4i1sXxpxvA2jpLY0vg== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 96362415-566a-45cb-fd7d-08d83b0a07d4 X-MS-Exchange-CrossTenant-AuthSource: CY4PR12MB1352.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2020 19:42:34.2344 (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: /KdaqK71utv+QMBoaTAFIn1+01ESdTJrr6pPUEc2yuC8yiARvuiD5zfqF6ywsIYopeIaw+0Ay9yhMEi9nTERSA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1798 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 X-Gm-Message-State: E5vqSy5KvB6vJXFnJgsgzB5Bx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1596829357; bh=XnV06cCKiitkYlzePtlIxV8REMYo0lQS5zZM4AGZVlU=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=IcQjeGQiIhY9RnHEdaZxt35ZAyciT6bHn/ONNZO3sXmeLzX8XdI8k1uvLMgRAVO4op5 hR24IUhJBo8oV2TPpa3TeVZDYYhWuPZNuupfPOXQUxtRaf4ImJtOITs0BeyrVXIMmwXvs gcGgn25PK9QoDqH/ZKs7KccJ78Rbfn7tKCQ= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Tom Lendacky BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2198 Under SEV-ES, a INVD intercept generates a #VC exception. VMGEXIT must be used to allow the hypervisor to handle this intercept. Cc: Jordan Justen Cc: Laszlo Ersek Cc: Ard Biesheuvel Acked-by: Laszlo Ersek Signed-off-by: Tom Lendacky --- OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c b/OvmfPkg/Librar= y/VmgExitLib/VmgExitVcHandler.c index b19bd3ee8906..af5264095b98 100644 --- a/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c +++ b/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c @@ -1166,6 +1166,31 @@ IoioExit ( return 0; } =20 +/** + Handle a INVD event. + + Use the VMGEXIT instruction to handle a INVD event. + + @param[in, out] Ghcb Pointer to the Guest-Hypervisor Communi= cation + Block + @param[in, out] Regs x64 processor context + @param[in] InstructionData Instruction parsing context + + @retval 0 Event handled successfully + @return New exception value to propagate + +**/ +STATIC +UINT64 +InvdExit ( + IN OUT GHCB *Ghcb, + IN OUT EFI_SYSTEM_CONTEXT_X64 *Regs, + IN SEV_ES_INSTRUCTION_DATA *InstructionData + ) +{ + return VmgExit (Ghcb, SVM_EXIT_INVD, 0, 0); +} + /** Handle a CPUID event. =20 @@ -1358,6 +1383,10 @@ VmgExitHandleVc ( NaeExit =3D CpuidExit; break; =20 + case SVM_EXIT_INVD: + NaeExit =3D InvdExit; + break; + case SVM_EXIT_IOIO_PROT: NaeExit =3D IoioExit; break; --=20 2.27.0 -=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 (#63863): https://edk2.groups.io/g/devel/message/63863 Mute This Topic: https://groups.io/mt/76056534/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-