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 []) by mx.groups.io with SMTP id smtpd.web11.13460.1574280454277505127 for ; Wed, 20 Nov 2019 12:07:34 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=UKE1df0n; 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=a0CkYbs+yNl01vkwqRnOol2KEKJxjPRPBhS7q+yvxo4XIr6k3+5QG1KamOiN0wuzdf0talqOVKPhDLIK2SJDP77eTvkN+l9Ww6+GhMF3mgZD6P7K7oQRyWsioyimUhMrv3V5eR+BG2gFDjvbtdEvTxFG/iyYcGvH+XbubNZgEukBCug38P10uNMzUE0tffjKrbLdBK88gIjefkWj2JJ0L4BkM/+tFTDsUcSF8IojeETF6SsI+bNw6C41gF/yTY6GzDvUJNFHlmcWCV8hVZINzo/vTjDgbw3Dhr7IusgAN67m/2+UWEB8uH+fxQBIwF/JSDkZWw4aClbmTVPl84YnBQ== 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=tcYSqoVzSGtCnWVz24btADPy7zSA8UiSIA8Yyw6GwNM=; b=M3JFPnoNlJ+SbjMtsQN5fimR7mjNOMNHYY7HSsV3Kyxq1xpRQ75PuqKL2NPtnBUZcwxk8VNhAidJmoeTJzI9oDyz/xXioaHILAqunpi+3yHxwe9dHl3ULO/UEYESw5kNaMQZCvIZql5v4M4v+puDzU45+emwet8PCaHWdzeVd2m/qpJXI5efa8gAszbB6eiS0G1kfXKaaq6Pkk01/jntPR6ENoyC30zm54HlRR3LTu7G6rb0bLi6E6lx+YTYZ7SnXAhY/nMEefZ4DgCsw5I8AEf0a4eDTemdIuPQWkpOTyvP988v8FWZy0T7bh3slWyT14Ezwa2fdJt35bI1LNSMPw== 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=tcYSqoVzSGtCnWVz24btADPy7zSA8UiSIA8Yyw6GwNM=; b=UKE1df0nUKgrV8Hd29YCW8us9ibocNmPEM/A5re7zzasgslP88r14zQH/1ZrAAF7vTKj7T70YDonUy3eWCKvLRtMzOeSV7QNy5FaqfjN2hZJzEiOPPtL6dQpQWRXH1DfYwQHZ2Hkvank24Ygw+DgYuFIqG3NlRNsCSi321c+jEs= 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:34 +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:34 +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 17/43] UefiCpuPkg/CpuExceptionHandler: Add support for INVD NAE events Date: Wed, 20 Nov 2019 14:06:39 -0600 Message-Id: <2efa9329836e94ce9719db4fbed33953a2b8b68e.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: 0cb4fc89-887e-4e56-7a29-08d76df547e4 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)(1496009)(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: SLqkww+6fQQWb02aXNP2gjSJa1x2KmbAKeeHEV6n9l9K7dkqRgN/yJOFxH4cZdDvNBXnnhit1SM3vg3bgUBqkna5u52mtf35fmp0ulUUpUIgJx9P888CDj7+PVvP0+EtGeToAZE6KPt0cvhEdhm3tJlys+cE+4BwLupylEv+eh7U7u/0IdZYgLXNLM4PPq8ll11PxmyxEJO11sG5YfxYvDLsUSBJLYC859EFFEguCKosmjyUfRC+dzfROcVK3tE8SiUMFuKgAgJ9ryIhiD+bEhdeaQgwtVjRxVUBqRUoOg/5jqSPO71v2AswRsEjFJrwhBFn2fEBQXTY3wsAf5jJk7zIhuvxj9BLwDPfsMOmuBo0DqM1r3u2D8dEmcjuKRHzknGtWO7dVq5Zwpg/IyTJIg3PfOd+4h2pTaBGDuenQHzT+SbZ1qfmDpT76KQeZDk2KHxw7xK5JQJGYMUQxssRzlIztgTm85ltGIiq1V77tLs= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0cb4fc89-887e-4e56-7a29-08d76df547e4 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Nov 2019 20:07:33.8884 (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: HL1vEY+HbNWqx8YT/X0LsPRJeNcEzlb+mxKr2rMiSsnjsf7UEiDkfr0FgUJ+YrcWfFaIkJkLfeQ8jhdFAl7Yqw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3675 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 5fb3766ef138..a9dd98250c58 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/AMDSevVcCommon.c +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/AMDSevVcCommon.c @@ -856,6 +856,24 @@ IoioExit ( return 0; } +STATIC +UINTN +InvdExit ( + GHCB *Ghcb, + EFI_SYSTEM_CONTEXT_X64 *Regs, + SEV_ES_INSTRUCTION_DATA *InstructionData + ) +{ + UINTN Status; + + Status = VmgExit (Ghcb, SvmExitInvd, 0, 0); + if (Status) { + return Status; + } + + return 0; +} + STATIC UINTN CpuidExit ( @@ -978,6 +996,10 @@ DoVcCommon ( NaeExit = CpuidExit; break; + case SvmExitInvd: + NaeExit = InvdExit; + break; + case SvmExitIoioProt: NaeExit = IoioExit; break; -- 2.17.1