From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (NAM10-DM6-obe.outbound.protection.outlook.com [40.107.93.75]) by mx.groups.io with SMTP id smtpd.web10.21137.1594737182003850058 for ; Tue, 14 Jul 2020 07:33:02 -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=fbhutDG6; spf=none, err=SPF record not found (domain: amd.com, ip: 40.107.93.75, mailfrom: thomas.lendacky@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gwAKJV9okKJ/s4cgWDaRrTU3j884fDHjj9oq4olGEjoTR1+rSCjFja9or69pC28cGC1KCA0ZbI+CaiK7nqBNvcBt+Z1Bb42QAXmxnVbEGIjkSWQ6iW8ZYxQi+yArDlKLyjYXtoyLZn7lEHovz41/ReQDDeDKPLyfhSrtH4b/OvWQzQzn9snvwrJIFmyFnKIfp+KKSGOPZVMKY+8tHLZtRPJAHR+bxdY4HC7I3V+x6pRiOWhML/9JRxwnt8TfdZxZGmwUdo+bJVe3KnR1+xsVfnutva9H9DPpFf5kW8W1OiHbB0dUIzvstuQxo4eMqeC2l+wgKLL+7yZTXcC+3q+mkg== 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=ii/cER8J1TzGPiy9lBlRq+GW9kijPmqm/bvWAoE3XcAKSNYEcUqgu+fZO9H8ooaJP0Xu9HvKpd27+SrLkxbEaWFQ96opVIMPuVDX8cROUZoCTZ4MLzhxnulHx6X9xLSou+gSrRuzSJtw610B2L01JUiGZzgti4oU8kGgDiVPdX13qOrjfCW4G8S4ttkPjl9cqhjJBdsPRmXkZRhjRkeLd3I47WzxazMm32AjtWnXWuNvCsUsW8MpoPvSArs5nb+V0qVbEEZBoWNC6sJ8L0ukTn13xzZhL1qMs3YRxtx5HMpb2FqIMyV0x9VpYr2URgvT5Z00tYcOmlN3obi2lYGBkw== 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=fbhutDG6lvCGHZ54lWOePLqaqXTZoLEa3JaqEuay7Kh6zWwAuslhAfhilAGBkyn8ayrCvea9rYbMx15zZ39jb+SS5QtMfWk4OTWzhJ/c22fO4fkfr3X8ILVnX0XCzeWV6MQddRTzPIGiyly6UxiSk8D3f7hyGRJXZSIjB+Jc6F8= 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 DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) by DM6PR12MB3177.namprd12.prod.outlook.com (2603:10b6:5:187::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3174.22; Tue, 14 Jul 2020 14:33:00 +0000 Received: from DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::25ec:e6ba:197c:4eb0]) by DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::25ec:e6ba:197c:4eb0%8]) with mapi id 15.20.3174.026; Tue, 14 Jul 2020 14:33:00 +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 v10 21/46] OvmfPkg/VmgExitLib: Add support for INVD NAE events Date: Tue, 14 Jul 2020 09:27:52 -0500 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-ClientProxiedBy: DM5PR12CA0058.namprd12.prod.outlook.com (2603:10b6:3:103::20) To DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) 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 DM5PR12CA0058.namprd12.prod.outlook.com (2603:10b6:3:103::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3174.22 via Frontend Transport; Tue, 14 Jul 2020 14:32:59 +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: 84bfefac-001d-44e9-8842-08d82802cf25 X-MS-TrafficTypeDiagnostic: DM6PR12MB3177: 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: 7CYykr31WbGvLqBDq/L3iOP/lv6xZuWrLWcDcIwp5eJGnQu9gA3/r9KeUaykAILooXf4TeQ4Z4KkEOoZow9IQCUUcqNPc9dr0hYP1O/B94qqQPxaTmzninGjrtxpqqwa/5TQrmZz0KnbQuCEiCZYc5fjzyTrKTVEu/KnB+vQ8KezCBM3sfDC02EOm6Yfz+04y1Hs090XAZo78FpjxsaUzf+2WJWTF8PcNmulFCKAo9TLpIICmGTBKN2uSAc+evZU+zCgx0lAKCTaZSsRpPtPJVNc5u/QTvNWE1W6qQ7SRzqe9Pf00mSrw/DqSSHRwO6e2ECL0TFB4S6qoQZDpYLXNgzcSE8MHpr2omKmDcQyPq566eKcGvegjmIii4MyLN/utxipKCHXGy2AaOWs6qHX5DSEm+XglKoU7yV2ZVmJKimYuCOAqf8iWQbTMcS8KEG20s0UFi+ZSmeBGw4r7RBEcA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR12MB1355.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(396003)(39860400002)(136003)(346002)(366004)(376002)(86362001)(478600001)(8676002)(54906003)(6916009)(2906002)(8936002)(956004)(6486002)(2616005)(52116002)(966005)(7696005)(66946007)(4326008)(6666004)(66476007)(186003)(66556008)(16526019)(26005)(83380400001)(5660300002)(316002)(36756003)(136400200001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: RflvKV0B1p7H2/XO4oRJarWkqLtJ7f9vUj6Rigukfxg/2BkIHACLJERhm8BhW5hgqLe8HdHD08Xv+AInT8toPn0yjzJL1uioBDikcH93j3zqaR7S3YopSPmRKzExWp7k7Sx1cvrzICCip1DGTF2Jwj2j3KXuGiUX9aoX6at27w5lOYlr9AsI50yODhMVgTH/WvgSfSb1UwpiNkY9nFzr/fI29abnFK0bs9cpPCBxphfs51XrF+xYVk6JgZ8lu4qoe6clLFwT4YXioaSNzXHzHMyIJ8EZ0i7nb3LHQGbg0yyVXcCrYaRb/VVR/5d4olkzmuztFowEpr+UBdnZ9jFhBjuJEcaZxL/RSysWSD+VOUv8e4gAhRCwukDYQRTmZuOuYHEzp+l7SEJH6S/o59FA8W81lgCq2YtUCZOzX3bhZNIosS+wDH2BdzfAcb7DP/Qf9/YbDq3CKvREEes6ihGKQfDcScswQKkyWarnkVbFG6s= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 84bfefac-001d-44e9-8842-08d82802cf25 X-MS-Exchange-CrossTenant-AuthSource: DM5PR12MB1355.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jul 2020 14:33:00.6262 (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: rH5goYlrpvO4y16JyZ4PpP+xBeYljobPABm+SUHRs5iB+qWd3iQYV5+jweb2l8OFLHh0wfdNGS81KRBZU5iIDw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3177 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