From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (NAM11-DM6-obe.outbound.protection.outlook.com [40.107.223.66]) by mx.groups.io with SMTP id smtpd.web12.5622.1595366556989802833 for ; Tue, 21 Jul 2020 14:22:37 -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=Y4D/fDP5; spf=none, err=SPF record not found (domain: amd.com, ip: 40.107.223.66, mailfrom: thomas.lendacky@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iaVb+BR/mvdYYBt06fQoyVm5WMqhSp4OeKw1TjFRHFro8G9BLwIUdTIbv/fU+iEJHiY0HxvTKTa8aBbWD1Co27O8sTL/LWdvxhgZe5pEKCR8uoII5Wt1GqlHvvHiXk8PB85xk7mnAl5vepdsEDaq9hE5lYg+bGpXxIIMfqX+l6lnqDoYq69ZQCaImq0Aj/1TJJ7coLubcwAuMncPRhNTANInr1BxGy1pK/dlMCarm44BKDnrsaLvVDqwFiYQANKSXCCnq2IZlxkdZZKOPiFGmksoNGS+F9m1+u3HE0Awr7a3xUcCIydxNimaO2PHGvMmCDsEH04Y38ipfSICxOhAnQ== 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=gM5hGms2Z8/bycPNfon5q6Q35qpXEowxwd5XhZ9Nq8qS01RTf5pFjWSsZqupsBjIZQaGSscP/N5tXKMksLf+Af8QGYtpBl0VZvM9eu2IAM5VMWq1/DZ2SDgTKUkBhOgryj+O5bcKBneh0mu3LaJSGyOV2hiOgiVA2xpkr0cseo9DlRpX++XrE19lwjsRqUrf56fzBQrpcuk8BwXCbm+OkkEMNuL7mw4PC51MSCROtnzZr1b7a1g8uZCgZXlrYlZlxsnBKygiMoqBf1XDJ3zvwCxqenmlqLp7c97DlZ6FFpMbNuDbIbRO1oUivs+36piuDfUgvO2G38f7n5kqSZO32Q== 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=Y4D/fDP5vQVQWcqQpoUBLLZGyjPYH0iqiv6pfo5CgmySa+DWSo6qWwMEq5UkmRZRJCdYol0JoEy4z5ysx0iLH6hE76F1xhAHHA5daFzmdRR90l7jmX1LkkcIShFLbxqqknhOzS6wo5zEZ6wEw9X8rBh5xHTxy/Deu73LTshb7ys= 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 CY4PR12MB1606.namprd12.prod.outlook.com (2603:10b6:910:10::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.23; Tue, 21 Jul 2020 21:22:35 +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.3216.020; Tue, 21 Jul 2020 21:22:35 +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 v11 21/46] OvmfPkg/VmgExitLib: Add support for INVD NAE events Date: Tue, 21 Jul 2020 16:18:58 -0500 Message-ID: <0c86b1e20e5850225a70e6ab265118accb7ccb58.1595366363.git.thomas.lendacky@amd.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-ClientProxiedBy: DM6PR07CA0041.namprd07.prod.outlook.com (2603:10b6:5:74::18) 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 DM6PR07CA0041.namprd07.prod.outlook.com (2603:10b6:5:74::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.20 via Frontend Transport; Tue, 21 Jul 2020 21:22:34 +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: e963a416-7f60-487b-03d7-08d82dbc2f96 X-MS-TrafficTypeDiagnostic: CY4PR12MB1606: 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: 0t/tj27hq2ii4Xwwz8h1WgKg8VcBAZwj1AuT6ZUDxyLsmBw2KDjtINrm0DpZdzhB5wjQxDT4qQ7NZzza3ocDJVCizI1kc82DodVtijuZKC6h7ljpF9RiTBkBcwxug6xSBLPnEcODzh+tZCMrYRwinOGaxJtT2XxZFNF2kob6TziDWuZuTZ7BIHUCgTUy7yRYFbWB0z6Me7cMlw/3a3U/N3OjyPI5IaBB7GVTn5J95XMuBK77NzF78yS9myGbv9JtSAvaM8TuFSlDqFHCOpF7lAUqtFEH0iqgVjOfYOpijhqdORXU8/jyMG++b/10lZLWVeR3w4psr1VIefUwDokdrAXbCmpC6XgO1hWz1Hnj3wCXOSCBReBcra/pN2cojwENReV2zZOI8yzGNgSIV7OfFr376IK10kLZg/RO7HiekZf2nBiBV0teqItq1EjSFeTFsm1T4kOy9mM8wwIAzgOvmQ== 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)(136003)(39860400002)(346002)(396003)(366004)(376002)(6916009)(54906003)(2616005)(956004)(316002)(6666004)(26005)(4326008)(186003)(66476007)(36756003)(16526019)(66556008)(66946007)(2906002)(6486002)(8676002)(52116002)(83380400001)(966005)(5660300002)(478600001)(86362001)(8936002)(7696005)(136400200001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: /dIGMoa8Q8z0rUT3PLU+gfR2i4S1gsbtd8vybn9IEfiLYt5btd4949MMwG8ekB06AyCGVOCyas1gpU44Rr0LDv1Mp5QhFgKMYW2VPDumWL+VapeBId50vQHUKJuQCEKIxDjQYlXrQl/kX4YypbSQaSSG7OoBQd2u4gH7YxfiVApn5QU37N6NSRvl6hbkM3yE0pjaDBQVD3LLb1TUoTK9Z8Wjzut41fSqcvG/tJy20CcTXmB8wJreJuMAd5eg+zBa/W9hh+aKWsxH5NUK5ES9uBc4zIuTkYOAx8hMGaq6RrajS5yvHpg+Qyd3rUaFdbVQyRusb3gnia7lZMn3euchbDDHqxUs+2WEJQSyu2vH1lMXvb+D7PHiKzh4tztW0KH7JyKXwLgoGizRWoXEQx5F763MZ6gdI3HhNe2Mb5CKpuI6bMiuogdit2rGl0f1M8oM7/+bhpNkSyFCJUlTxKTwA4OOVmuVFavI2Jag0szVJ0c= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: e963a416-7f60-487b-03d7-08d82dbc2f96 X-MS-Exchange-CrossTenant-AuthSource: CY4PR12MB1352.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2020 21:22:35.0266 (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: Bq5La0/oSSFWkCojlkJRKwZWW0PklaCQ2xEto2XbmItKS9lMspMxWNIeZEhwj6M8RT9/+XECc7Ol2JLtjw+bHg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1606 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