From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (NAM12-DM6-obe.outbound.protection.outlook.com []) by mx.groups.io with SMTP id smtpd.web11.1226.1585071686106387436 for ; Tue, 24 Mar 2020 10:41:26 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=EntE59eP; spf=none, err=SPF record not found (domain: amd.com, ip: , mailfrom: thomas.lendacky@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PhFtyx1LBjqWUrDZMSg7ZRROB6zns0IJmOTpqthWYOTrDlAnv530LsEVa9itxuSglQmODWEfk8G3yixyQlbWusRUpH1NL/nnZDODFjO4POfwYXsRjah7fb/EniuP6El3Gm5OACKw05w5X7CKVVjvVdKDxYcUYqnIsY+D3iL6IWZpT+gPqNBQ+j7VUck56zDnZeD2uNCxf2Aj0QBZ8qK0RNNNXErC9/varOXbUBib6ZPhnoRKRNwA5c27JffUqeQw610vQdWzk4VXyu2YzI2fvKB28F+BxvpIh9bLxL8b/DhULXvC7T/fahf21tPQvQ+DlA0IuyFLxW8O8mxTkMe8JQ== 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=tzIa4tHCmusjOcVu5cI8FflsP+RWUpeZDKtjDNzz+po=; b=AkyMuZVQ8iGAR6502yMWplpRIy8aLbGgdM10/1oRTb9RgKaGXnefTWixVSGqzePbqubmk1HD0taw3l3q/CvNNYUSjXJGd+bIGVZJsFQ0fxfZgUwR1HR7eNjl4fQ5LsaVL0Lb/6sdBbQ6lcHCVtC5AORmyy5Wsv73VT05PiVx1QQh43j+rTzFJp3R4DBEpkuHCOMOSYlmSVkETYaSBYENIvI3dtbKMiLlaiBufiroijbj696vhQLfvBYB28GE7UFaq+f0yQ4dmExwUABV2oHWKeA8ZBXoEwuDjvNJgh+OYxTVAT78te8fU5i3PDT1is6eMaXLBpEwNBbO0IE+KlgICQ== 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=tzIa4tHCmusjOcVu5cI8FflsP+RWUpeZDKtjDNzz+po=; b=EntE59ePkN0Z2sPwaDS2atu3FVE2EdbyUIBlcRkjpBzqlS7283fuHDMqia3nelRBTlBoMUxJ5q2RdU7i1EGLGHZ9CB0Mvx9spFil6hwvyQU1WN+3YPYlu+tL0fo7CZm4EHGjuNZffhnLF7oOrRfyQEMw9mD0xilOwEJ4g1B35Fg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Thomas.Lendacky@amd.com; Received: from DM6PR12MB3163.namprd12.prod.outlook.com (2603:10b6:5:15e::26) by DM6PR12MB3915.namprd12.prod.outlook.com (2603:10b6:5:1c4::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2835.22; Tue, 24 Mar 2020 17:41:25 +0000 Received: from DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::f0f9:a88f:f840:2733]) by DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::f0f9:a88f:f840:2733%7]) with mapi id 15.20.2835.023; Tue, 24 Mar 2020 17:41:25 +0000 From: "Lendacky, Thomas" To: devel@edk2.groups.io Cc: Jordan Justen , Laszlo Ersek , Ard Biesheuvel , Michael D Kinney , Liming Gao , Eric Dong , Ray Ni , Brijesh Singh Subject: [PATCH v6 16/42] UefiCpuPkg/CpuExceptionHandler: Add support for WBINVD NAE events Date: Tue, 24 Mar 2020 12:40:30 -0500 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: DM5PR06CA0025.namprd06.prod.outlook.com (2603:10b6:3:5d::11) To DM6PR12MB3163.namprd12.prod.outlook.com (2603:10b6:5:15e::26) 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 DM5PR06CA0025.namprd06.prod.outlook.com (2603:10b6:3:5d::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2835.19 via Frontend Transport; Tue, 24 Mar 2020 17:41:24 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [165.204.77.1] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: b3db1333-1a07-43aa-0511-08d7d01a92e9 X-MS-TrafficTypeDiagnostic: DM6PR12MB3915:|DM6PR12MB3915: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2000; X-Forefront-PRVS: 03524FBD26 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4636009)(376002)(366004)(346002)(136003)(396003)(39860400002)(8676002)(8936002)(186003)(316002)(54906003)(16526019)(956004)(66476007)(36756003)(6486002)(19627235002)(66946007)(6916009)(66556008)(2616005)(26005)(4326008)(966005)(81156014)(478600001)(81166006)(5660300002)(2906002)(6666004)(7696005)(52116002)(86362001)(136400200001);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR12MB3915;H:DM6PR12MB3163.namprd12.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Nv+M9noKGi6h+5k6b8n5oIsxwWyyPRdX19jD5T2NHYRfxtwPUnoC0FctfHe7BJMHRdLozzHt0LjTGQTDTTGP1dm9V2VFY18mG3tOSgqjKcZQH+9y0VugdA/YCTSeQ56Bgl6Goq+PHv5XluBRcBPvDtpliQpxZsB13zEeQacKpsqLvX+OLsR4rGFjP0JK/XZB+9Vk8JvvYOn3cGS+iE4tCT24Fw4waRMyuqrtzeJ07xwxjAgTlqXQXj4x8hyLZ2pdFHAhkxy4xcVuZu0DD+PjPbr/rRZLBQBpkmBwgAZ9TAtIAafXCkyP7ZedWF+NiRrJ+VUbxEAK+ZDkmYmN+2wFXMJjPChF+MkLjJ9vRWKUJr5ZzTMokvsyT7na4abKqfT/MHM+jhtD9jbocIU6NVJoMPdGucRAPt/O6lJa/li6xroTtVt2o49u3z2d27IsYfTh74K1TzNfMI8t0voHjQdjvYwtfSMK5LlyQFS9WvGAI6thoAWe/Hr+s14LE4UsnLBzYoyDzbw9c2TSy5DqVx9isNVi0TLmH3C0vPYWnLQd3VmBd+05huMGJ9jJPdVPHwDbaBrToW3UGvbaMHnFw1dTQg== X-MS-Exchange-AntiSpam-MessageData: sjwnFYYglOCthbPp3b8acvmV2zq3Bs8JTO7AICKaUsw1v436R6fGXnzQ1880OVhRJTS3cTz4kTvn8yy5Sj9FA5qw+mzoBg2pKxF8ndnwEb8qA8ByxAvmJ5c4OnMzhAJUc9LlWfEjikklOhVe0U0tiw== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: b3db1333-1a07-43aa-0511-08d7d01a92e9 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Mar 2020 17:41:25.0685 (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: sDAOJPbrchjQ4CFWh2Pnumt3YeXjXyA7Te4kWgnkOxbdn56JCNJ2BlKWWYsLUW7Wlgmg738tGuqGwILEyAPVZw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3915 Content-Type: text/plain BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2198 Under SEV-ES, a WBINVD intercept generates a #VC exception. VMGEXIT must be used to allow the hypervisor to handle this intercept. Cc: Eric Dong Cc: Ray Ni Cc: Laszlo Ersek Signed-off-by: Tom Lendacky --- .../X64/ArchAMDSevVcHandler.c | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchAMDSevVcHandler.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchAMDSevVcHandler.c index 3cac613c8889..55e18c47921e 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchAMDSevVcHandler.c +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchAMDSevVcHandler.c @@ -591,6 +591,24 @@ MmioExit ( return Status; } +STATIC +UINT64 +WbinvdExit ( + GHCB *Ghcb, + EFI_SYSTEM_CONTEXT_X64 *Regs, + SEV_ES_INSTRUCTION_DATA *InstructionData + ) +{ + UINT64 Status; + + Status = VmgExit (Ghcb, SvmExitWbinvd, 0, 0); + if (Status) { + return Status; + } + + return 0; +} + STATIC UINT64 MsrExit ( @@ -904,6 +922,10 @@ DoVcCommon ( NaeExit = MsrExit; break; + case SvmExitWbinvd: + NaeExit = WbinvdExit; + break; + case SvmExitNpf: NaeExit = MmioExit; break; -- 2.17.1