From nobody Tue Nov 26 01:34:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+63883+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+63883+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 15968372654951005.5193269691971; Fri, 7 Aug 2020 14:54:25 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id QGDmYY1788612xozILNw9IGq; Fri, 07 Aug 2020 14:54:25 -0700 X-Received: from NAM04-BN3-obe.outbound.protection.outlook.com (NAM04-BN3-obe.outbound.protection.outlook.com [40.107.68.61]) by mx.groups.io with SMTP id smtpd.web10.6574.1596837264504456901 for ; Fri, 07 Aug 2020 14:54:24 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aD5qYDYaYfJo324l0jHoZ1hCRyuTF00EexoUTX0FVtT2GBZ6Da9fEoAfePkOg/EIhpLibDXNogTNTmWxNCa4AxiEiXge4UHk6Ta/VL3LyUZGQ2DgYmpSllCVngM3geUmvgkTd/DKm+Ob3aqQsjG0gYwXPpv07D2VM16dtBuKcVfbYI2pnNjP3P3fY6bjO27YTcXlFpoLIE5nMkUMEjB2yRq2Haf8OZxyYmmSJ/BALCIlRE/EizlrC69UwzqdQLvo1H18ePNr6NDGYxH+YsxvIsrAfLFPfCufW4DoABbKBeYx9YiUGs31dTZsZynZmFFWGauxzEjKNvyb4tdEOaKCcw== 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=2xL2RAVEP5XW/LxYrRr+kHwaYvf60goYc3Dt2uOHhXI=; b=Gpqh2BRFlNP1VgtgukPxjrzZdS8eJL51PxrvaWYusxYcFG4vDH5v3yyMzGqjZpG0jvlhSWNiK/semBGrY02KuyECSuLggp/6+o6kdUuYWjmn0L83lwURLXdZ/vWIW8jiYRMfhAfrGL4y3sGUh8+psRl5QOLejBwHLezz7irORMbZZ3hSz/gHWBF84P8m4RiSlesH/3xkfBkDiVqTEjYH2uB9WLz4Bq6pRSt1H1helwvvxGQchor4j3OyoyQ4cvf/3FlaSj97c0Ejv4fdie/yaiVG9Y39gg1K8PhY9MMlgiqlpM/XFwFAy+c2AasphIq6MoYaBCVC71iL2WOHXQYnQA== 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 X-Received: from CY4PR12MB1352.namprd12.prod.outlook.com (2603:10b6:903:3a::13) by CY4PR12MB1717.namprd12.prod.outlook.com (2603:10b6:903:11f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.20; Fri, 7 Aug 2020 21:54:17 +0000 X-Received: from CY4PR12MB1352.namprd12.prod.outlook.com ([fe80::9181:78bf:bf0:702b]) by CY4PR12MB1352.namprd12.prod.outlook.com ([fe80::9181:78bf:bf0:702b%5]) with mapi id 15.20.3239.024; Fri, 7 Aug 2020 21:54:17 +0000 From: "Lendacky, Thomas" To: devel@edk2.groups.io Subject: [edk2-devel] [PATCH v14 41/46] UefiCpuPkg/MpInitLib: Add CPU MP data flag to indicate if SEV-ES is enabled Date: Fri, 7 Aug 2020 16:53:54 -0500 Message-ID: <9bca729d71e7283a1d117a79baa77fa4009b2808.1596829170.git.thomas.lendacky@amd.com> In-Reply-To: References: X-ClientProxiedBy: DM6PR13CA0061.namprd13.prod.outlook.com (2603:10b6:5:134::38) To CY4PR12MB1352.namprd12.prod.outlook.com (2603:10b6:903:3a::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-Received: from tlendack-t1.amd.com (165.204.77.1) by DM6PR13CA0061.namprd13.prod.outlook.com (2603:10b6:5:134::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.10 via Frontend Transport; Fri, 7 Aug 2020 21:54:17 +0000 X-Originating-IP: [165.204.77.1] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: e41bd368-33c6-435a-b9eb-08d83b1c6ead X-MS-TrafficTypeDiagnostic: CY4PR12MB1717: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: VK5IyK0RubHX/1zTXmjjJ1sWL8sBGQX/hpClJbc9NelsP8BhbaZcSuW3avhn3fQBM+stdCsDFOlAm1QJeayyDXXL5vl6pwazWq8rcqLOT8HyGGxxJipkfKmsm7GPqkNU0ugJYvAuPvmfypmsYquJaDZ09HbSyE9RfjwpOTqxXQqlgCp7zIo+YovGGT6HIK6GX30eYdxA6PeE5aCV0Lz6WH6qoRnL+k9jx885SztI3T/nXCiOJ6xkv6JVV/MgeB1cT5zNDAKF04i0ZWuNjlbs1VefnNhvSWSW5HrnHRdeu+TdaUm4IQ/V5TaB0RIUu6V1CDXPsxaeD8EZcCoKY+mBlWKzEk6WD/ddIlfbjCxZ2+i2qCNZCF7i/VtNsRbJUqGrteAruLRRjjjFzsFBk2e63PKrQPHZEFTmvQyV89TJJZcGg0jrJV4K2ewZ3AjZy5VToHGM4ylvWJlC3tXd79x6mQ== X-MS-Exchange-AntiSpam-MessageData: UXd1iXrJLSzD8zWq1ulbkwS+Ffw/igIGUjTFXqKTOxxO+PmUR8uLbH6UYzoC/qrZr7GA1vjYp04Kp7yMkTS+e0IAzt7JmmM/6nIEbXFPdr/AyQ47ebBEpyEZVND3wKMnlwpfWFC+kkdQ25PwtAqf9WWwk16GY+ib/118TCnAU0s47+koCZ1NshMvEe0SVvnG/ls+HQYF1bR68kUML0lm8ol3oTLmtn/3ePE6iJ3zhHVd+UBjaGdel0p8jmHLY22TAkwNS9ztxKHZdoHf+NobXDRgSEZdn582APJaDi769TypeFHGWYD9e/dKKAqav0lvzE4vNrEw9CDtg/M7qGuRubdKMGhEfciv+BlpOTtbMPHz2aK08ivK7y2DCRMDVcPGl57YSdUaWV2xxIjZvoW6Ck4kgYL1t8lqaYnJZ/FEdhVwI9ETYe1D06bgPNDcCbDnsF2ZrUpjFULQV2WKp7DrO/zx55JZ8uGUgZdlbn+c8DA7xFOGiCHmgADaeUCWLhygkWwz4takk1xiEdEJZru4RC+oeWVbuMMfOrdUph2conQf2DBWHNKNYLrmyPWLMkTT6ljpAo95mFtlSXr1Jg+2U1sQBILmNXwucPmeIYkHDUy/Tbav4vxlUJZEX/sY9cfUoWpcHpxgEYhnmADGFTRyvA== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: e41bd368-33c6-435a-b9eb-08d83b1c6ead X-MS-Exchange-CrossTenant-AuthSource: CY4PR12MB1352.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2020 21:54:17.6646 (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: W16vLrKTk0SylgW2fslszcQYz5PBpQKiCcKEpXwN3YdusJ8//tlkudEkKGkie6i7QOu0AKieb68XKNSguACjQw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1717 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,thomas.lendacky@amd.com X-Gm-Message-State: TdwWxIp1VDtIGwGEPtoo9nJpx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1596837265; bh=aKa1Qu3W/ROgcnbiAIQIu4mE3YoBhrwg5tL1cFj+Wgo=; h=Content-Type:Date:From:Reply-To:Subject:To; b=SxHLpsJq56KJe9w1Dp5olWuibkahdvPgKXrf+1hETMRj4UBqHD0q1NSBr6ZojJUQw36 UOPbN5thVcgHBl9ZNYWqiIWx4iRtjJg3Rrh0oYAnfFMtoo4rUMd2jCEsQ4k0LLp7tqYad JwRveSQyhIXAlbnuzcIHHUaPx+gMG2U27SM= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Tom Lendacky BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2198 When starting APs in an SMP configuration, the AP needs to know if it is running as an SEV-ES guest in order to assign a GHCB page. Add a field to the CPU_MP_DATA structure that will indicate if SEV-ES is enabled. This new field is set during MP library initialization with the PCD value PcdSevEsIsEnabled. This flag can then be used to determine if SEV-ES is enabled. Cc: Eric Dong Cc: Ray Ni Cc: Laszlo Ersek Reviewed-by: Eric Dong Signed-off-by: Tom Lendacky --- UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf | 1 + UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf | 1 + UefiCpuPkg/Library/MpInitLib/MpLib.h | 2 ++ UefiCpuPkg/Library/MpInitLib/MpLib.c | 1 + 4 files changed, 5 insertions(+) diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf b/UefiCpuPkg/Lib= rary/MpInitLib/DxeMpInitLib.inf index 9907f4157b09..583276595619 100644 --- a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf +++ b/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf @@ -71,4 +71,5 @@ [Pcd] gUefiCpuPkgTokenSpaceGuid.PcdCpuApLoopMode ## = CONSUMES gUefiCpuPkgTokenSpaceGuid.PcdCpuApTargetCstate ## = SOMETIMES_CONSUMES gUefiCpuPkgTokenSpaceGuid.PcdCpuApStatusCheckIntervalInMicroSeconds ## = CONSUMES + gUefiCpuPkgTokenSpaceGuid.PcdSevEsIsEnabled ## = CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard ## = CONSUMES diff --git a/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf b/UefiCpuPkg/Lib= rary/MpInitLib/PeiMpInitLib.inf index 89ee9a79d8c5..4b3d39fbf36c 100644 --- a/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf +++ b/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf @@ -61,6 +61,7 @@ [Pcd] gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchRegionSize ## CONS= UMES gUefiCpuPkgTokenSpaceGuid.PcdCpuApLoopMode ## CONS= UMES gUefiCpuPkgTokenSpaceGuid.PcdCpuApTargetCstate ## SOME= TIMES_CONSUMES + gUefiCpuPkgTokenSpaceGuid.PcdSevEsIsEnabled ## CONS= UMES =20 [Ppis] gEdkiiPeiShadowMicrocodePpiGuid ## SOMETIMES_CONSUMES diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h b/UefiCpuPkg/Library/MpIn= itLib/MpLib.h index a8ca03efb8e3..5b46c295b6b2 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.h +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h @@ -276,6 +276,8 @@ struct _CPU_MP_DATA { // driver. // BOOLEAN WakeUpByInitSipiSipi; + + BOOLEAN SevEsIsEnabled; }; =20 extern EFI_GUID mCpuInitMpLibHobGuid; diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpIn= itLib/MpLib.c index 9b0660a5d4ea..2a3fbeef35f7 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c @@ -1704,6 +1704,7 @@ MpInitLibInitialize ( CpuMpData->CpuData =3D (CPU_AP_DATA *) (CpuMpData + 1); CpuMpData->CpuInfoInHob =3D (UINT64) (UINTN) (CpuMpData->CpuData + M= axLogicalProcessorNumber); InitializeSpinLock(&CpuMpData->MpLock); + CpuMpData->SevEsIsEnabled =3D PcdGetBool (PcdSevEsIsEnabled); =20 // // Make sure no memory usage outside of the allocated buffer. --=20 2.27.0 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#63883): https://edk2.groups.io/g/devel/message/63883 Mute This Topic: https://groups.io/mt/76058838/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-