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:20 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=YiTdRGt5; 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=PxCvWyh/D6deu7vhsQTMJPt0lFKEAfecH1aNb63PNb7mntlpTof3LwjCc+yAyZhaREHoUb0Vwf8CHodlcVveHQhaVNUyqXBr8Inb9qtXaceJwgHUWbvswMRhVyESqlzpuPLfUDnGhG1Z5m28YOboheZB/ylzMtZyN0Zi020k5bZpzyr+DLDeLR7StOxYRTjP1k74UYT3Dp7zYoC1xX0d0gMQijv9hoAF/usdE00Hg93eWUhDY5iDb7r5dFqylVy0LSCA4eNr244+PTlhp5wNfQKU9dJr7pPEvyAuPowhdJ3mFYHMvWdBrlLSoJY9ioxgoXPCLvUZrdv0ariD/VBpyQ== 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=4rl6/NudVtsF2p87pB1OVDhzK2Mqe9kbkCPupa5sdqs=; b=Nmk03A7qBCGEhd2bCsRo3p0AYe9Wgd68lqtaIhj2SZ29uuHQtKe1S72QVc433dRDSb/u8l0ZLLpaoZ0Sc1JPVY/OqU04lQfgHQeEVbLZRJlmg1PWbFbXskvb+tZ0ISKCMoGDclBYY5tnNWLusLbIjeb5BHCZK3DacEO1jL/rpBhL9SZHOWPF/xlmyqVgAF4mV6a0eWFN9Oq/PxNrU/3an4Ry9HcFjTuApege3rha6J/saVheucVyRJuHfyjRHPsHHpFGZkiolWCl22SW5Dd6cR8foeO4Uv4W1REVLzyDBu+szCtzsM3RhpM+6Nk2jyhsWAcvf9RLXWk8AHFeT2JiLg== 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=4rl6/NudVtsF2p87pB1OVDhzK2Mqe9kbkCPupa5sdqs=; b=YiTdRGt51MDfRAe2oVh3H+TXR1HJq9v8fFSv0Ml/Ere0jfoIVQxvvZC+EQKDR8nTgnQKCfRUhdldsrAjiI8TzE3Am53pkZcNLetHYcd6XB8j7vsHHJJD1j1hGqL/ctu9OZpkWTxc5HlwQnU27QZLXEZTtQwNkfysI0rdAC5CYEU= 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:19 +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:19 +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 17/40] UefiCpuPkg/CpuExceptionHandler: Add support for INVD NAE events Date: Tue, 4 Feb 2020 17:01:21 -0600 Message-Id: <6df3201439cc932d8cfe91054eccca27921c9573.1580857303.git.thomas.lendacky@amd.com> 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:18 +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: 70e2828d-c3d5-4813-6783-08d7a9c648f9 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)(6666004)(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: e0TRYDz3qynt+klX0zbMX6NnNmDCFxIxYyCXAx1ZemRoxWLWDDi6+1Sif5JB4Q7t0q3crWQXFxS2DqSeZjkDk8+CmO/oT9jeqts19diMwzSXQzCuirzWA8Uws0lzgylztG9vCVnr48Wy8IhWjNtpI3W/7tIy5WzTWvFHCHDeyIaAQGxUo0EaR9Y4aMQ7XmKUlzvu6WlSVjAOO+MCks9GIkBUP7OTKpBfjlx6MMeg2tJGX3zcZ3L8EPB+EIUiw4ek9MYGRXY37KrpRbiiTfk8KY3lAzfAXoRkjCmae2lU8y7ySuBPMKuaQrIBcY6mzEQ6MR4L+YBMN+T9SS728VAGT/je7+WzacbMwUSZ04LogoGseXZ1iKB1h928wNjl0+IKLfPtatF/MH5UdTdJ00+tUV7vJ9s0eKYXBu1GJKLUWP9BZH2EGUYTfa2szfgE+MuWWLl4/qtezEUWtovb38bdXKZSNmA87XKjkz2AVBuQXY5LMQQJSdXh/QtuV3BXsk17FGZaouw9dV7X9mXb9WFZ0w== X-MS-Exchange-AntiSpam-MessageData: 9Xertu3/bJLlnWOSt9xh/WkWTYmURFpNGYQlXkJasDsDdvdgSX1ZoDYp+onowJfl46BjX/4Zh4LbzQSXeU8ZvH5dLCmBp2OmxbEIem2O+sTpiLhRFnkTOtNsj30YKetRPGbeHmJkTKiAD/QpLRW2yA== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 70e2828d-c3d5-4813-6783-08d7a9c648f9 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Feb 2020 23:02:19.1706 (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: iI2BPLJZgwkIdprN3c8EmSneJoIENcPB5f76322F8b6yN9w5a2skDENPjGG6J+AWCYQqn1R9L985wPnMGxYGAw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3930 Content-Type: text/plain BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2198 Under SEV-ES, a INVD 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 c2bc213e602c..a47bba5ac1c1 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/AMDSevVcCommon.c +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/AMDSevVcCommon.c @@ -856,6 +856,24 @@ IoioExit ( return 0; } +STATIC +UINT64 +InvdExit ( + GHCB *Ghcb, + EFI_SYSTEM_CONTEXT_X64 *Regs, + SEV_ES_INSTRUCTION_DATA *InstructionData + ) +{ + UINT64 Status; + + Status = VmgExit (Ghcb, SvmExitInvd, 0, 0); + if (Status) { + return Status; + } + + return 0; +} + STATIC UINT64 CpuidExit ( @@ -975,6 +993,10 @@ DoVcCommon ( NaeExit = CpuidExit; break; + case SvmExitInvd: + NaeExit = InvdExit; + break; + case SvmExitIoioProt: NaeExit = IoioExit; break; -- 2.17.1