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 [40.107.243.89]) by mx.groups.io with SMTP id smtpd.web12.1293.1585071689459662899 for ; Tue, 24 Mar 2020 10:41:29 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=Z57IXRVB; spf=none, err=SPF record not found (domain: amd.com, ip: 40.107.243.89, mailfrom: thomas.lendacky@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CNalWC3FfKIA6PZV8CvEep/k+wpOyTKseXtf3DlnlB4AYNxN6yqgEsacmMGHT2v0iC5RJox92VKN4i56HDcCCJLqsLZVxgKAIWccTpcA8aapsRxokZ8jbb0bd6/jVQSuyCjteO3/Kp7J9OyT8ixNA4T4Asnv1tEF+yHrHWSDXSQgZ49XbY4dvYQns4wZsKSaw3FjcCQxSpva8V4vmAEQ9aIYd0Kn6p6nJZCbfp6srO/20ppAj3Jsw/v2P9Rv1uib1woa+wPOOZLCwLEJBadGTzeT+Twrt8WeMsrsVJFa5xZrj9DIumH6caY3eDbLyFYY6GqqaEXobJufF30UEs7lKg== 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=JN9pD4iwfBpnQ+fRKN4uWn7wyklEAllS4Cz8tMXfPv8=; b=OmU6Drs6rkE2a+96H3bhNCHTROcRo0COQpEC7eXUJbuE2CWD0k6/cZK3mfm1X7phcQyrSPibhPOiC1015gU4EL2HyqxUt8wFI9buNdOfbcgy6maLq+XqzrrVTwVU7fyARJ4mV5B0wvX5EvXsQ7K1L7/hWQgDu6yctZYT4kZz6S2rFzuNcw1qgygNj3CpsJ9XF/y6+3ka6UUmgMb3P9Ltu+/mm66odF7cSbd+S+gmjtAaki8emkdA8s6c8eHL7RrTtI+qLJa/GjZovA6q6h7Mg1Ctn6dUnPhZy53Ae/pxrQ6mKDb62W7VLH34dVoIPp86bCc2zU6MfnLMLuoOqiG4JA== 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=JN9pD4iwfBpnQ+fRKN4uWn7wyklEAllS4Cz8tMXfPv8=; b=Z57IXRVBTX3A0pNy0oSVcK7ZnGb0t7LlD2fQaeat2bMLnC982qD08rREX8I+k/JMm6mkzTTm17bsRmbyc+vt1cWY61fvqlhLcHIgRh41wB2CHezqznFB2vWqclojk9ADXFpDL9qHoiBsBwaMe9GuuygONBz/Bh5OKBKvLAgQi2M= 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:28 +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:28 +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 19/42] UefiCpuPkg/CpuExceptionHandler: Add support for INVD NAE events Date: Tue, 24 Mar 2020 12:40:33 -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:27 +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: 8884d0a1-0d7e-48ca-f3fc-08d7d01a949b 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: 5G7aN2FEb/IHC2uUdyZaRXVeduCCfV2ZVgvhXPNTVlNdXmzMPnE3eGG0vtOoXGpbZodT/QCG9YiaF35Cr8axiafZdTTeu4yovLpHabC93A+uqTUm+Xl1NoPl6yNwEK7k/yJsAlIYsrf4EY5XaAPNSiV4QPgLEtFkK87vUMCmChWd8n07LIpSWE1RfOSPsZurznINabmTGQUvOREaJnEpjbZ6qJ/vBdT3yU3Lhiij0ijAeH4Tvd2Prbm9lTn5USI2MnZ/SlFLaEJKGbYxXx5S8DTAzT0DGfcS3WFYZS6tAZU3Q5tSsSeb0Z+/ixT2jRpvgD6MdyKVsL6bAL02DitE897725fzNbmcV2yI3HqWoEpBneZ9L5bzPTgp46tOEomw9XA6QcXEW1ELgQPem6WbcIyxygO2SI4t2pH4zjLQTUJI7ZZquw989Zlt20+kAJFAd8rviBxDkUNRMI2CeDOqUDs9iOZAXmgjG6qDH5n9lD1YnoTPGai/5U1GASXVETw+zn75UchFqVihg+Bjl+W2QbaHYK/19i+FqGzYL0CIX0TJL790eq1DjmTMspdIwwCtBFQV6N8x40Xg79AvnU8Zkg== X-MS-Exchange-AntiSpam-MessageData: EeScs/CgfwsCeehKDDXwHtd+GJNsbE+duyhKlGIWrr+Slyc0t3hgwf/mjadNKzKUO/yo01H0EUFawes65uSG0vx6jQ2633qs7KXRcpN7mHTaNHOXczsgfVBZqrCOeXVnPDygUJ4je5PoYA0Moet1ew== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8884d0a1-0d7e-48ca-f3fc-08d7d01a949b X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Mar 2020 17:41:28.0658 (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: HFz0tPxp1wcnwCqhlzm2r9G3Cs93K4h/NlHOm1ITyqVJO7/dtPIDLKbjSLqCGp9j71Xb8vDgRpYTYCqelvY6Xw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3915 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/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 ea67648d12ff..acba14d995cb 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchAMDSevVcHandler.c +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchAMDSevVcHandler.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