From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (NAM10-BN7-obe.outbound.protection.outlook.com []) by mx.groups.io with SMTP id smtpd.web09.1692.1580857338005546073 for ; Tue, 04 Feb 2020 15:02:18 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=B1jkJNlD; 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=oLKMoDqMydiIoF0ooBcYG3lVS/mq6gKIu3kLY+C6Kh3DeR6jJ2QlLHy3wD5uW2O+6SG2L5YhKaJZN6yQLCiJWbFqQNLZz0s6DEe/o7I1lE841d+L6Xfwhj9FctDTbMC7kCVWlInMcaS1cQvVOJbmfOu8A30mu7Mww82SYyBLnD0Iueq3JDS/OkRWtjFETmU6j2OF9nvnIWJbQOCxIb0cnkRBGV8ookbIFX1UHaM1QeQLppDcDymXujE6t2k3EKGH2XyTauTUkH6eLHhOKh66fDqcYooGXakyPH0s4WC2nNLObOnXFsbrTgk1JymzqBMp5xGCbV2JkFCotES/gx3B4Q== 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=8L/gPVBo+QltpzO1k0JSPJXWxH7djOktRRZazDChnqk=; b=U2CiPjsjStow8a3foVLGFZYkHQipzpSeZyOtxjHD5YQxftIUJzSUis69mDflUv2lOwTjqLM/3Hd9VG2UBd8DkL0bs9FB6c0KjzHfs5J9hVhTr5JGe9blfO2M0RyLjRziSZNwbBtqVHhTS7aEBpq9pp+5hbhC3ViZLakyR4OX6EltEmyh8FSLKKz2uFExYwj5pWVcW3ETienA2C3ExRCAqm42ivK9C+fo5vchCU+0+1W9+xPIHGtyXYlMi1RRYRtPGSEZGp8hnEg9rXR5tKEYIiw9dm/zxtfGHtERw9qmqCnjDzJ12ZPogy2KVbzNlCvgqKa5fU7iOK6aSQQYb9VEEg== 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=8L/gPVBo+QltpzO1k0JSPJXWxH7djOktRRZazDChnqk=; b=B1jkJNlD6SRYpWgRobOXeGUa4/r1q4Qm/HlxxnXGtb3XQxIW+mUy18URSgUASCFLD1+O1UCYAkybinNQBr6uFCGXNQGiFU+m1IfIDrVVkHPkbGTtnuoB3BwVy+KNiuRgnVi3BtJkTMMvXEn4XdFJ7TfordtVE6b4taYM3Y47Dd0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Thomas.Lendacky@amd.com; Received: from DM6PR12MB3163.namprd12.prod.outlook.com (20.179.71.154) by DM6PR12MB3930.namprd12.prod.outlook.com (10.255.174.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2686.29; Tue, 4 Feb 2020 23:02:16 +0000 Received: from DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::a0cd:463:f444:c270]) by DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::a0cd:463:f444:c270%7]) with mapi id 15.20.2707.020; Tue, 4 Feb 2020 23:02:16 +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 v4 14/40] UefiCpuPkg/CpuExceptionHandler: Add support for WBINVD NAE events Date: Tue, 4 Feb 2020 17:01:18 -0600 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: SN6PR16CA0062.namprd16.prod.outlook.com (2603:10b6:805:ca::39) To DM6PR12MB3163.namprd12.prod.outlook.com (2603:10b6:5:15e::26) Return-Path: thomas.lendacky@amd.com MIME-Version: 1.0 Received: from tlendack-t1.amd.com (165.204.77.1) by SN6PR16CA0062.namprd16.prod.outlook.com (2603:10b6:805:ca::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2686.32 via Frontend Transport; Tue, 4 Feb 2020 23:02:14 +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: 6f20e838-d7cd-43d1-27ac-08d7a9c646f9 X-MS-TrafficTypeDiagnostic: DM6PR12MB3930:|DM6PR12MB3930: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2000; X-Forefront-PRVS: 03030B9493 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4636009)(39860400002)(366004)(376002)(136003)(396003)(346002)(199004)(189003)(4326008)(478600001)(6916009)(81156014)(2616005)(956004)(81166006)(8676002)(966005)(316002)(54906003)(19627235002)(2906002)(6486002)(66476007)(66556008)(52116002)(7696005)(186003)(26005)(16526019)(5660300002)(86362001)(36756003)(66946007)(8936002);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR12MB3930;H:DM6PR12MB3163.namprd12.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; 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: vPP8w3vzl0TWQgwW3a5/myk/BrrvCwpmjPY6mOwcyDTsjRii0UpIkqPDL1TeWDEwDfuYXEGE4XklGso+UiGP30fmcl52wZcGGHp7QZoEce0pS9b6HhuYtPe9E42VOUrXFiTKUSuxBnH2HJEBhccEwfe3asHG9AV4WfOPAxkQzY+qF62njuFZHvIl6QkK8/TrLWVtsr+i5hd0sWFeI+HkUbgZPkAxWWPgApmP17/YsUNDYmz20MijlojyYX1H78QWK4in57KTG5Hf3+1ju5FzlBZn0TxeuzC7qB3sHdTFQQu5elw6a72M4a3dFc/ukcAVfU8hmlMtQqKnz+D/WZQw8R72D8zkFa+kzHZyD5++rsiey0PlfDJJPGeumdkk6Q6N7abd0wlqEsab6tQHbozR9kEE8AzOusrSFWf+ljOaIiI7B3JOhkXSQWhUUS1v/iPmWunJ6C5tNuXwE5Wtsxcc6cjdbVUVx5AGJhbdm2ZQHsZxb024ps246V8m4YI3b+3eQbGxR2cpwXlnf/oxBWo/uw== X-MS-Exchange-AntiSpam-MessageData: cMZZL3PWjNppKIxmsnBAAxRaPafn3bCdRfNB8fUGo5Hf0/7kAP4+HaagtDUCYADWqSKG39JwQWoGYimuaJy6xERWO894ic+Yw0nqthDzCg9F1KiSN3OP1k8AVjMGw0OxxU7esioBo61fTAj5eI3DUw== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6f20e838-d7cd-43d1-27ac-08d7a9c646f9 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Feb 2020 23:02:15.9035 (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: BFtAUt3zWY4n7AhDea6IY4wSLP1uyn6nF1XeVQyU9pu9uLN6+sxHJAgei7WL6M2WT6uALEYxHEpl8vp/KmYang== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3930 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/AMDSevVcCommon.c | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/AMDSevVcCommon.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/AMDSevVcCommon.c index c68aeb5d2c10..03003e9113fa 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/AMDSevVcCommon.c +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/AMDSevVcCommon.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