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.75]) by mx.groups.io with SMTP id smtpd.web11.5523.1595366532480900793 for ; Tue, 21 Jul 2020 14:22:12 -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=LEHahHDt; spf=none, err=SPF record not found (domain: amd.com, ip: 40.107.223.75, mailfrom: thomas.lendacky@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZuOLQGe5nVUP9IRAkq+cfaabuLeFCNfnhOiIB9hnFYg1Gq4E9rBJ/NUZrgnN35GZrJZ+3ooBFWHN0r2lT7cXE8zaZ32BRW8CJ2J9tCcg3D5+m+M+VEi47beo4cjTqdZaZ2EwLQWLkOWVCDTloP+6oJIThaMYjq0gfWmxb75BZYN2PWuSFwWl9t6jbs9NkSwJ8N9xcpba33CbHWG3vAdE+Qe4hN71RGsnHKfZrbkOrCizL+ALYy9o/8kYIOk11mdfJB6U83oZNJSq+xoc4T+xJfwydkjR3UDkQonGSN4SEuuUwqs5hqhbnTedMzRD8tK8x7mkOT11LPALG833glAqFg== 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=XYin4P81GIO7cJ7+hpLoaSOukmDnnkqU26/XXz/37PHnpO/emY1v9Ip9/x0iB3qI5MEcmVmE2uRI2RnPsF7s/a68hkVyVH6Sh6lVLI2UKKAe2Bb3LFfDW3e1xupz59oqW4f7n+jofQWherSnxH67k4PQXTEGhK4zyrG8AsZgbbPL5XwvVYW8Dt6TQ89o3KDpCYGAgMRUijKHdaZvXLn23p2WQwBZXeyN5/nZI8LVXPxRA2uGyAlYB32r3LlvQVMZ66nsrSi7P8NYqxsSIgGurV4ALYv+FHkuIY0FGvJz14VdrNp7CZIGWQ0+01YbDMC2dMngWTJZVvsJ4naVAK49oQ== 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=LEHahHDt92SOwUx30aNIz6gbtS63R+1Oyswon/TrSaxi7V2/+1FCxkYR1KwPLFGf4DigwXrOae4jajCnJppOWNrnqvE4TTVMpDeChGpjDROiIikXgELdyjBa/3VbDIUjLR94b8lUgJAxoNeTBFRvBZY/ax5WGhLJ88cvcDdgYoQ= 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:10 +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:10 +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 18/46] OvmfPkg/VmgExitLib: Add support for WBINVD NAE events Date: Tue, 21 Jul 2020 16:18:55 -0500 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-ClientProxiedBy: SN4PR0201CA0054.namprd02.prod.outlook.com (2603:10b6:803:20::16) 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 SN4PR0201CA0054.namprd02.prod.outlook.com (2603:10b6:803:20::16) 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:09 +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: d322c3ab-a7f2-439d-59a2-08d82dbc20b9 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: YmVDAs+5Il/P4yxMJB85iPTGUOoU8AVoXSvjDEudxXQgeoZRs1uUZjaD2pZqVveOygDSVVeRjtC/L+rsBfUrACq1qF/+UMmQQzxt15t81xSzN3YL5VEdEFiW0jGMNsOWk7mUIwfkTdPRWUYhTrSuySuKJW5hcMqhumtT9CESPdbYygQpTYYA0uEwIRdD7ZN47tlFSOiWpdij7jz0/WiG1MC5yEoGQkrCX1BZ+kH2NDyQGS/V1Ro9hgIUhYGIt3wq+PtH5usH4AO/heeXZ0Djw7Q15q93IyvW1P2cvHf1fLdjfOafmVw6QPpYBpc+l6/3AR15OFgdHx337oqb4QeknTMKUJtMUZxXB4FpAeqf+dWV2naSxIOCCO5Wvv/J8p+XW0nfDXUPAStNB1QZfMXHwMPKnoxJxKke8HK9M5nwEpYO4wBADzsGPVndWl7UIZc2Uj3B0WtGeILqMKSwNuIsKg== 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: 9RxA9XdwjcRaiNvQ5MNy7jz1IVfLjVG7V5WO0ESfEaLlbdvKsEgGdLpmRHSPbgROATts4w7VFCSnrhtg4Hggd6K0jBITW/LJcjjslOdA47e4UMBr8ZNJ/EGPYqEgJjz3aNaRKrD62xIjeZZ24pRb6xWmkoT/X9ZAhrF0RPCVHCGY70nQ7hudKxmwAyL2CSfJY9HYQ9VeA89b8t8RnL6m23lUslzQqQhulEeZjubkwOiiMGch2sat3ZnOH7J8blnZG8YO9NsVpr7makZL0VRdZp5XXDM4wg+98YSK5QNXHXMdoCUbuTLU8iiRaPugwI53pRCQegSNKzbkpOo4G49tZkdUSqC6qtwg7jKS65rhaEF0Wz7+myIElaxkAGhhmB0PKDR2vZzzgd3yT26ag+DbieMPUL9Lg8oLXnI2WkSjqmowysswIZ+b2NxaNkWg067GHbEqpBQgkqofTU2qeRCbkFFlPr6uYFaihG1QRcGwqJc= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: d322c3ab-a7f2-439d-59a2-08d82dbc20b9 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:10.1113 (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: 09ee8Cut7VjkDpmHBtU9wAopaGUbtsg94NTqt8dDPQj+aivka9DbX6/fpSJBnYx02+Lta2t2YlJHx+0ivEo/Yg== 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 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