From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=bXZ62Mno; spf=none, err=SPF record not found (domain: amd.com, ip: 40.107.68.61, mailfrom: thomas.lendacky@amd.com) 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 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=2xL2RAVEP5XW/LxYrRr+kHwaYvf60goYc3Dt2uOHhXI=; b=bXZ62Mnopprspw3/19fn1gwoNOzDOJUxrKTEt0tPkld2nlAfGLe41EcMTnvR7zY51ihIXGWi6cu+SAeQP+7VP4TYz5gYTolEkF6H5nyGhrk6Qez9cOeTKJRH/QEKouAZiCy4fZYxGiePEgYnbmJ397AXMxVP+c44N9s4eV/8Dmw= Authentication-Results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=amd.com; 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 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: [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> X-Mailer: git-send-email 2.27.0 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) 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 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-Mailer: git-send-email 2.27.0 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: BCL:0; X-Microsoft-Antispam-Message-Info: VK5IyK0RubHX/1zTXmjjJ1sWL8sBGQX/hpClJbc9NelsP8BhbaZcSuW3avhn3fQBM+stdCsDFOlAm1QJeayyDXXL5vl6pwazWq8rcqLOT8HyGGxxJipkfKmsm7GPqkNU0ugJYvAuPvmfypmsYquJaDZ09HbSyE9RfjwpOTqxXQqlgCp7zIo+YovGGT6HIK6GX30eYdxA6PeE5aCV0Lz6WH6qoRnL+k9jx885SztI3T/nXCiOJ6xkv6JVV/MgeB1cT5zNDAKF04i0ZWuNjlbs1VefnNhvSWSW5HrnHRdeu+TdaUm4IQ/V5TaB0RIUu6V1CDXPsxaeD8EZcCoKY+mBlWKzEk6WD/ddIlfbjCxZ2+i2qCNZCF7i/VtNsRbJUqGrteAruLRRjjjFzsFBk2e63PKrQPHZEFTmvQyV89TJJZcGg0jrJV4K2ewZ3AjZy5VToHGM4ylvWJlC3tXd79x6mQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY4PR12MB1352.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(6029001)(4636009)(136003)(346002)(366004)(396003)(376002)(39860400002)(26005)(478600001)(966005)(86362001)(16526019)(36756003)(6486002)(2906002)(6666004)(186003)(6916009)(7696005)(52116002)(8936002)(8676002)(316002)(66476007)(5660300002)(66556008)(66946007)(956004)(2616005)(83380400001)(136400200001);DIR:OUT;SFP:1101; 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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