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.65]) by mx.groups.io with SMTP id smtpd.web11.21105.1594737146786174466 for ; Tue, 14 Jul 2020 07:32:26 -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=StO14Ga5; spf=none, err=SPF record not found (domain: amd.com, ip: 40.107.93.65, mailfrom: thomas.lendacky@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fEjEeR9FK8AJJP5QJuUnYkSPLnE0mbDp54s2iorzkcBnPRgEwq/w0mLc2k5yWzPZYYB/iHfKBwYL/GJzXjdau1XfxowWvaMFj5Icvuv3b5xhyrpMUpNVODniRiQKpi3tBSCwsWNY2LiqSP8G0OrCe7gIF37jW1MrUzNjhThmX/dFzx9nEUM7IcuWhWDQIRk3nQMoaG16SOTq9yJ77BC4iLguzHZ88Smgm7OZXva2yD0JFs0o2H/YPDpTE+1pSvLcctLBxjLknj5lwN/BUB5IRoiIA7DS8YZUrKTOTgZaLfY3SMF6W+0kJkr4mW4Y9skka9nJ/cLvOEKUfGKwtOO8Cg== 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=crbmyZ65afRC34Vt1/yjGXXSEbQgatvY+leMn0es1AI=; b=j/I5pi7FrD44MCVqVtJBZVCRtR5yIwuIGmg8Bx9u2b5gDCl8O1HbZ5zu73fdMd0VeqWmQcOWgah/rfBFpP5ePpI0YzLJITA+bXqCmmfODcTZfsFt6qsGauLqH+YbvRbN5PhcCCVS70KLsbEiYMGPU8sPO3iTwN7Yydc/7CefspXike9EWkjJGjaNW3GlkyILOR49iI1PPdht9MWBDzOkdNCnRh9osaZl/IZ6Z2i8/ix+YrS6Yxsif3S/m7m+owWSk7B6JjcO1uvwktb3xxebFRjMmJmw55Z8FHfWY3MRMLTdOumnsubDsOBPEbpKCbWhLPtY86Bp/pfejdFES86Mlw== 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=crbmyZ65afRC34Vt1/yjGXXSEbQgatvY+leMn0es1AI=; b=StO14Ga5EM+E0QCzX82j69XeOXMrLmi7EccDML54V1xOUxXMQxndmUBCAuUtN6C+K6TLp+2pikOcblciDmmBUiie8RxwxQbCy9dbLt+XS4RGz2SY9BGo3DZBfgsmeLxfxVXTtwxfUv8K+Xp7VQOm9AqXYJo3Fv4wBSDXvWpnruQ= 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:32:25 +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:32:25 +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 18/46] OvmfPkg/VmgExitLib: Add support for WBINVD NAE events Date: Tue, 14 Jul 2020 09:27:49 -0500 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-ClientProxiedBy: DM5PR2001CA0012.namprd20.prod.outlook.com (2603:10b6:4:16::22) 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 DM5PR2001CA0012.namprd20.prod.outlook.com (2603:10b6:4:16::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.17 via Frontend Transport; Tue, 14 Jul 2020 14:32:24 +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: 83643a29-6b3d-43bd-829b-08d82802ba21 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: Il0+yUJJeQvHOuku384pu6QjjOhDosbw+RrdVqfHDAmRqvGkTGT5nHKy8txpcPi5bmbviFQV74v02h3+sVbG2IUqXML/nlOUQuibtwDoHy++9swiVEAmXqy2tCCGh8kqR9gZu/IvrHPZPbmIbJkem/2sLzWi/5wEpEuPwarRIjI7+94t3wwADe2/7CGGKrMbnP1NSilAIAKkAulOe1nYYy3ECoyC+PpcTx/fpIKuEVh5/CSsCQWmX36YDq9Z1JChlrxPNKG+GPMOartGadP+8rmAFINoQ2ifxUTsipvWc1W0wI5MnvOVgJNcAfI66b9afQ2nM130jUuzPVueDAr+xRsld+NEhoiTfvO3KHqomaFjOJk1D4Qym+DUZ1pQUECteezMKUu7aHmUfEPkmS5tjzL53xBsyq5bwZvuojg7RavOIbJJPXQ3Vntk/wM97eoDyqLu6LaEnyUo3VeVXIJ5cw== 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: CyUuUnROCY1rF7X51n6L2fcm+/EuldIVDHE88Vo+2fWetP44Cg73g+/Z4Gq6zN5AfSXd/D2Y4y7SJFDVsyPQbHmVQCV3PxL+sVyMqt0IvY61ojPgJ/eIns4NVmbbwsN+7JgzEvWqKQb2Yoqmbxb3FjR2+2x2u9lT1EHYEgvpr9Me4nLVWzqt0UPoP6/uHyUHEn7xKS0hgP4zR46Qruzgzbls3fBgKQW/eFG1AHVxLv9oEA98knY014qskPMZD6Hxb7O+qmiUNHk8BDrOmr/j6kqfm8u01CbZcZ5j32f5HOFqL9R7ELE0V/T5/bwVk9Jk30lE05KejMAHA6UqW9NNK1C1QC0kTZySH97pylAR1K+404mcgcx7tzxyg78M+hohKul0c5pK51DWWMe8vM0wiNvU3dxc5Jat1Nqk0indOun3mZbK6Bl18S1E92BnovfXLrzhsNpvHSMFXnInAh9pMQoeN1W3CoS/FhL7qYmPmhA= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 83643a29-6b3d-43bd-829b-08d82802ba21 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:32:25.3078 (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: xCuH91VnvuwP1u3kmSTrr5JPN4H1/bxL7i8qJXx4sxVc90eh2ut5F7PxHSpgIfnXyUzsAiZ4mFNxlQjVTPFcBw== 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 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 0e502ac14819..bf07f960e380 100644 --- a/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c +++ b/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c @@ -856,6 +856,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 @@ -1252,6 +1277,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.27.0