From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=cLxXGYen; spf=none, err=SPF record not found (domain: amd.com, ip: 40.107.92.40, mailfrom: thomas.lendacky@amd.com) 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 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=VWf8IlBLc5H2/zm6u8ihdDB1OPHPbvu83zMDyNap3VM=; b=cLxXGYendBOKIJ2dSNMaFteeVyoANT1vtzXEPtO0zPTbNZM3abrSe/JNoMb8adVPAzt2az5i0dNO0p1ghW4Im0zLlwxN4j2d5MP5zPwH2ADPkuSyHGD+1ho/Ch5m5o5CKjzLUZLn7oFYStFAD3LvzcWJV9ozKSeYw8oKNWvFKlU= Authentication-Results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=amd.com; 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 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: [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> X-Mailer: git-send-email 2.27.0 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) Return-Path: thomas.lendacky@amd.com MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 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-Mailer: git-send-email 2.27.0 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: BCL:0; X-Microsoft-Antispam-Message-Info: eW9PdbjL1cBP7mej2KI9ZM1Cz6pCO7vIv2CssspVNUoaWmJDTi3ukX07AkbudDAYgTFRlF89qQ7OfvSx6L9/xvMjgu6L1q2CtP7e7UTxfpFha0wrE0Rr2ldkPJJH0r/5DStktT5C08thOOJ1qS+RIVbeYgzPWs0KB4+HqUkJRnH4W0EtDAh5xsEdpnKwxivcqZeCkEbtpl30PD//VbsSUzy4Z/eK/0rlVU/bmDOX2Hj+8B9jonxL+7ZVU2Pq0I3xtowdBGhfbvCEJTOfNDmaew+6KhbA6FaIAu/RaWPmtc4sgYhoEDE+nu+1YvmV/1WVStDADsS0QaYGdaEqrf7ujcgz2kjZrjXZMeZHfMtB2dCx5Ia9K8FnozU38gG8hfzMSsHArJ16M5D13PjGYSGxz1YK9O+Flki02RopS6QaqOzRKa54MHnVygyDZpWcppOecrpePvBWFjqw/OUUKM1J0A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY4PR12MB1352.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(376002)(136003)(366004)(39860400002)(346002)(396003)(4326008)(66946007)(6486002)(2906002)(66556008)(66476007)(5660300002)(966005)(478600001)(8676002)(7696005)(26005)(8936002)(16526019)(186003)(86362001)(956004)(6916009)(36756003)(2616005)(6666004)(52116002)(316002)(54906003)(83380400001)(136400200001);DIR:OUT;SFP:1101; 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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