From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM02-CY1-obe.outbound.protection.outlook.com (NAM02-CY1-obe.outbound.protection.outlook.com [40.107.76.71]) by mx.groups.io with SMTP id smtpd.web11.13458.1574280452112074134 for ; Wed, 20 Nov 2019 12:07:32 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=yGUNbLnE; spf=none, err=SPF record not found (domain: amd.com, ip: 40.107.76.71, mailfrom: thomas.lendacky@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gBR1d826FdptqQ3uzoaaGnjV+IS1L9fhnTutqPZh+xT4XwGj7eGGPOvU5CDahb9Cyre+hJCIW74suUrCbS42KamXD3DVFN4gTpQzvRpU1iRe28VzgmxAZiOJMYoldmGH/SFab/cdK2/nU0lHjaJxrivmJ7sWCNLpyrbbgE4OzVhJGurL/tm7hr+ewvA5VIV4wGHaTCABFusoBIgZDhSafN2Y/+SFmT0wDa+fdQP5PFASn6SRVyAp/C4dSzNEzlBH+DTvUyIM3L7Cf6H4ouNH2adb+GI8EjKieWY7N6u+7SQglugg1PXceCSSaNRMiS0L5dTEvx+O1J0iL/bVn9BJdQ== 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=Wi9OCLcFiJXN3fMVWy87RQsfmzGP2QZK3TEYx+8kUuY=; b=UT2FotN4WqZYi5gtGzqTVkNZiss2GaZj7p+UOTDY3ZVYDusadDFrppuFrr0HQj2hczGqEdrVdMQAej2gxou8HwmV9sxyN+BS+2bW4b+ydug3+me++nFhhEDiC7PMWGSrWgNC47SoCl6EYUpRbmX3A7XHeucpBNKszOZikSJ7Iu2zR3DOeYwK3c/BxcC7D6ZhxeL7acZnrIKYkLMafXorsonPx0joy2whG55cGX6dtwoUTTQ/4Xsixq051K+go2PFfqvpQB7F/+EUwodtRDmPCVY+ivXDdwsWiw8MHpxzJ69XdMJkeRaxEoELOyMRfH54/bAuSnyH/XQB0wqVTvi/EA== 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=Wi9OCLcFiJXN3fMVWy87RQsfmzGP2QZK3TEYx+8kUuY=; b=yGUNbLnEtzFMfZpLZGeU2NKFw7SCkrZad2fU9GlYozNcFMhSdoxZIeEYX6B0hizwlqR2kZ5WxVmYk4Lv6hB2ZG5fV8KLovbKwxRto3Zn6Qm4F5/1m3QyNJ7Z8mn8KbIyHkFkZ5NgenIRf7HHjLmq6BXg1BZYX7EbZgUJNL2I9vQ= 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 DM6PR12MB3675.namprd12.prod.outlook.com (10.255.76.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2451.28; Wed, 20 Nov 2019 20:07:31 +0000 Received: from DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::dd0c:8e53:4913:8ef4]) by DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::dd0c:8e53:4913:8ef4%5]) with mapi id 15.20.2451.031; Wed, 20 Nov 2019 20:07:31 +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: [RFC PATCH v3 14/43] UefiCpuPkg/CpuExceptionHandler: Add support for WBINVD NAE events Date: Wed, 20 Nov 2019 14:06:36 -0600 Message-Id: <8d9ce3a53eaa6c576e08d1f182c583d39498e3d7.1574280425.git.thomas.lendacky@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: DM3PR12CA0087.namprd12.prod.outlook.com (2603:10b6:0:57::31) To DM6PR12MB3163.namprd12.prod.outlook.com (2603:10b6:5:15e::26) Return-Path: thomas.lendacky@amd.com MIME-Version: 1.0 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: cfd570f6-cd10-4ca2-9072-08d76df54626 X-MS-TrafficTypeDiagnostic: DM6PR12MB3675: X-MS-Exchange-PUrlCount: 1 X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2000; X-Forefront-PRVS: 02272225C5 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4636009)(376002)(346002)(396003)(39860400002)(366004)(136003)(189003)(199004)(2361001)(50226002)(81156014)(81166006)(8676002)(2906002)(6486002)(99286004)(66476007)(486006)(47776003)(66556008)(25786009)(2616005)(476003)(54906003)(11346002)(118296001)(8936002)(316002)(2351001)(7736002)(305945005)(66066001)(6916009)(86362001)(16586007)(3846002)(6116002)(48376002)(14454004)(478600001)(966005)(5660300002)(66946007)(446003)(76176011)(36756003)(51416003)(6506007)(386003)(50466002)(52116002)(4326008)(6436002)(6306002)(6512007)(19627235002)(26005)(186003);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR12MB3675;H:DM6PR12MB3163.namprd12.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A: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: TUgJm4xYa4i/idsOnufqrIIyOhys9SNfQ4cIUDC54woGOS8zStLpMPkF8CFSH1F+CucjxSdmYQ+OaqLHL13GS8wKfsFs9kad1AGTh+nWlPsnR4cXHgU3tDFpNnv4oC+TvExvpU/Wkye/Q5MzOt8S7ixtKVCTYBvI1LlbbIs5LJCaCFT3VepIeyRdr3Nlh1qssr8wNgDyjHhQPZzSZ3RQP1o6/eZ2Wk+cXsaD/12Nyg8jjS0qTMXBzs/nhx7H7zqQn8fL29FF4exUUI8wZlZ6q3E+HDYRrgLkGuK+RhKyj3qZ8aU0s7YE2Oj3/2anSb0ts0hyyxvz6X/04CqDX0kL1xANR2NWTzKgCbQn5KH+P96D0sXmOLM9or1d8aMvOlYKafDCenZYiaxGCOMreyueUyr0qLtUWmXB5m4uv+CqWw2qpmmQV88elkZrbyyuV0V8up9QSbmM+rqPR8CU/p7+Lqc4oT8uuT/ETWAp2VhLnHI= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: cfd570f6-cd10-4ca2-9072-08d76df54626 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Nov 2019 20:07:30.9301 (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: suM5i6gEEpARFtl+A+HanICPDP+2LSGcJeINtkrjC2uB+KZSsG+KwBnxjizruvG8H6wqw7lN+2DvQ5CNYBTosw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3675 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 d82121c3fa1c..697d50338da0 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/AMDSevVcCommon.c +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/AMDSevVcCommon.c @@ -585,6 +585,24 @@ UnsupportedExit ( return Status; } +STATIC +UINTN +WbinvdExit ( + GHCB *Ghcb, + EFI_SYSTEM_CONTEXT_X64 *Regs, + SEV_ES_INSTRUCTION_DATA *InstructionData + ) +{ + UINTN Status; + + Status = VmgExit (Ghcb, SvmExitWbinvd, 0, 0); + if (Status) { + return Status; + } + + return 0; +} + STATIC UINTN MsrExit ( @@ -905,6 +923,10 @@ DoVcCommon ( NaeExit = MsrExit; break; + case SvmExitWbinvd: + NaeExit = WbinvdExit; + break; + case SvmExitNpf: NaeExit = MmioExit; break; -- 2.17.1