From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (NAM04-DM6-obe.outbound.protection.outlook.com [40.107.102.77]) by mx.groups.io with SMTP id smtpd.web10.9815.1597325167090392977 for ; Thu, 13 Aug 2020 06:26:07 -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=EiBVBgSi; spf=none, err=SPF record not found (domain: amd.com, ip: 40.107.102.77, mailfrom: thomas.lendacky@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W0xv9tsJ6w0zdjp1wsYNGIzd03fu6PEFAQDYUddD8e0uET97H4URCXz96q4mr97G1gVLwX1LDZYoxCu1n+awzNZWj3WHyMpwqok3/HQqQGxOuJ+tR5HCp4Z4IIKMnHw+q9jQtMfyEY4nMJZlesUJGbRCwLXe9HKdAzS0N1whgJfa4hRJ1HDh8yXkoaIJTGWbouI33Z5FAfyxBO7FllPg0ulnpVxPNtJjpMpY5vH1JhX7D/2Gh7pbCLDGQ/2d8gZp7rG82MBp6ejKaZLn7dPTXlzl4QQLE5Gpez9/WIj7B6r3hzyFiCjAeSVIwbDVSwA7J8rDxqTLTneOywItbxVEZQ== 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=gZ7nH1rjo2zr/vLgvURZrmuu7+MoTWbvaLXerbI76iM=; b=nGtqft2rYBZ0dyo1VI+sD/ERDCNRpQFx9GwwirgXTZ6Q6c9Xzr548hvNwO4nFN0ZcT/IsqWKqqhosmdUmGneAZ1vJHZrltyAbOOP4w4NwFQDF8FLR9r6m0rMIwbvU6+8GZiyv2OHPcaJqakNmxSzIRMVV9D5afXfl+G7xTizkc6YlHvJkaIdHaFk7YaN4opP/vFVPCKjJCAMYdQFx7uCGXUvircwjOEff3FMTKSgaQeqon2tLq7Va/6EdQGrJIaVR3Mj27GpR8bGJTSo3FX+oiTtMkIGsdxFL/SCmXdhTKzMDnTsDpIfWjLf/ULqO7Nwws6cTzRMk0Wrq1GsfgFWbg== 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=gZ7nH1rjo2zr/vLgvURZrmuu7+MoTWbvaLXerbI76iM=; b=EiBVBgSi5riiEbsrq+A+SvmNPVKzLCvyA7862h5QNFryJroMyxCSSiEc4aThQMO0YlQV8EVnFqY0YV6lydgTmb/std3lXMMk5/es3a3kR14yjs5IPMcwgUZ/ZCONmvs6c4HWRj++ang4V9jpaA0fRi0U8he/M/iY64UhV9bcJjM= 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 DM6PR12MB4220.namprd12.prod.outlook.com (2603:10b6:5:21d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.15; Thu, 13 Aug 2020 13:26:05 +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.3261.025; Thu, 13 Aug 2020 13:26:05 +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 v15 18/46] OvmfPkg/VmgExitLib: Add support for WBINVD NAE events Date: Thu, 13 Aug 2020 08:23:05 -0500 Message-ID: X-Mailer: git-send-email 2.28.0 In-Reply-To: References: X-ClientProxiedBy: DM6PR08CA0041.namprd08.prod.outlook.com (2603:10b6:5:1e0::15) 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 DM6PR08CA0041.namprd08.prod.outlook.com (2603:10b6:5:1e0::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.15 via Frontend Transport; Thu, 13 Aug 2020 13:26:05 +0000 X-Mailer: git-send-email 2.28.0 X-Originating-IP: [165.204.77.1] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 06311a2d-5909-4b3a-2b27-08d83f8c6e8b X-MS-TrafficTypeDiagnostic: DM6PR12MB4220: 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: 1A6lp3ObZZ5K6LZZurmqOc7KCWz8yQhOCUnoCIVor8dDjwpff8fYRqcXduwKKOYiXpB04GjcfSptoOit7VpNp6RPXtlkPeXkzAwoMsG/iK4x8oBEyVmKlCGbo/xGs//KMKKVerufQ3fQVbQFykKTady1IbTean0qcvn9bP/91u65oH87s9fJ6dwM7OePkF+Vb9vHf2wXVIShgl/jrblrMCD3Z02uxcqXCP2naqkHWiylO3BXbDtBjPr4FV+lFRJcMUk8RA4UK0DBSdoZprg3qFQGIyamLUKzizfYYuj2dx1wORXro/eoL720Muam8WdFdMEchCZalKNCpjFmtTe+UHjYhzLJPSJz+6RhKQ0rkUoQ5e2j9tXBGqzhFtwfxGGfv565h9NKG6GyaeOIjtobzTjEn2rX9jfCxG9wWL3yccq9aDXV+8pquKrHls1RwZ28ktSGVvXVhPtHF1+7Oz+bbA== 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;SFS:(4636009)(366004)(136003)(396003)(346002)(39860400002)(376002)(2906002)(956004)(36756003)(66556008)(54906003)(86362001)(966005)(2616005)(6916009)(478600001)(8676002)(66476007)(316002)(83380400001)(52116002)(6486002)(7696005)(8936002)(66946007)(5660300002)(186003)(4326008)(16526019)(26005)(136400200001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: g7r1LRH1Y/eMX3hJ47mhd1BGzz1r2zwJ4xObuSNJZl4NWxh3x2KkSGtUYNanmv4XBpn0/2flMQk/f5K1Q8kglqxlUqey/blUSXMdFJrVk7f6I1lM7FhMiLGxqzwmPuRv2is11i1UjWzLpMhH7r3widCoG9Wt9Gna5m//pf43IpqM3R0M9UtY91B7dFAhRNQNIp4jWoB7NLXbMszEgLFjxBnJYocAhyGkkKjzbozJOWWiH8bX7hBpMasejHGKHnT2AXHsIS89LW9nwejQ0dBP6mHJdq7EnrnWyg73pDuy4xDxefOciBBU/1OfULJbmAS6yMAMUlgsUmTy1Zo167a0Ly8oB+ZATBdTM5i1drqHn14kByrFqwfqmfnprf/ED6p2iLSrKiDSCHgDzTI8QekBE55PTY9Jv0SKhnpIKC+RiLTe9PJS18V4GnYOiBMT0+qfUPb1egM9HF9rsH4Zklbeonmcl2svf5nbsdA8kXQSWN/eyT5PgHs3mrgW8vfg15sv9nPvkwatqf2Fnt76UJa05hAqfdOKmpveDAB+OPXP+bDecoP8s1uMu9rrWeF7kmgmGwgej8mD78TwJXT1FTAv462Tvuh8L9ZvXU8LWTDQZxTlcQ3cz+YWtSvKPQ+GZPK2qqkmI4CrCJnNFRGxtmLomQ== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 06311a2d-5909-4b3a-2b27-08d83f8c6e8b X-MS-Exchange-CrossTenant-AuthSource: DM5PR12MB1355.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2020 13:26:05.7829 (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: saiJ21UhtPrFil30/9F6dbm1i1NBe2hp13R8VERo+zNKNvWUgJBjfPuRv1bjX8VfeKDWMCGEVWlnqI4IJRqxKw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4220 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 WBINVD 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 03fa9f6f7f46..2070c943de93 100644 --- a/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c +++ b/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c @@ -858,6 +858,31 @@ MmioExit ( return Status; } =20 +/** + Handle a WBINVD event. + + Use the VMGEXIT instruction to handle a WBINVD 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 +WbinvdExit ( + IN OUT GHCB *Ghcb, + IN OUT EFI_SYSTEM_CONTEXT_X64 *Regs, + IN SEV_ES_INSTRUCTION_DATA *InstructionData + ) +{ + return VmgExit (Ghcb, SVM_EXIT_WBINVD, 0, 0); +} + /** Handle an MSR event. =20 @@ -1254,6 +1279,10 @@ VmgExitHandleVc ( NaeExit =3D MsrExit; break; =20 + case SVM_EXIT_WBINVD: + NaeExit =3D WbinvdExit; + break; + case SVM_EXIT_NPF: NaeExit =3D MmioExit; break; --=20 2.28.0