From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (NAM11-BN8-obe.outbound.protection.outlook.com []) by mx.groups.io with SMTP id smtpd.web11.13894.1597335903506943915 for ; Thu, 13 Aug 2020 09:25:04 -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=TWum3ZlS; 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=W6+0E1Z18O6sA0f+J1lPytMLO6+r0eoCeUfDpM+fBq/YpPpDRq2WmDMUTtPfbFk+xGJ56onVtIma98rx+SdLZLbv8uvXmM0iKTUWt7tksOn0O9uM6ixSsDK+Q+fUG4suWzv75BAkKf+XXXRy+wV0354YMJjZBfffq/7aEmlTIkxSzJldEuUBm11KR7c3dGLvFt5AgKFyELU2zVQUPFPQNayx+TPPI4HKhbqtj0qFj1BKnVPB5wQWs3AERHmzBw4jtOlS3oDKK5pzcI5Cf7HUgOqhegZrxNVLus2dd4wTyp1eGaw7+YxrzM+7LlvI6eI0zbND7PlPshEMpSFEXkFvdg== 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=s3rhl0wOKus268K1SIIF4QkpJfaxpWuKdTYJtQfTPN8=; b=XijAmlePZQz6F23HikZHQWPMAcGey9yIgEmWi1A3HrD5UgpvNtoUZ2/kczz/vmGUuU9Hi1bN70K0ntIlhWArvnJSA+qlGLQPWKFGALCmsNGTStXg+WgDKvmaYOUyJJ/levYjOwwduB/l++N8keltJVxJY2zdZ0J7ihg6t5WH3vgDZQFgduwO6mBPka335SkUtD9/U4Z3ASH6l9yBY0f016ulSiO6ILSubtOsai65UcDBgF+svHtvzCm7LukX9cjuh4Iv4yrq/3M0NdMLMo4b1WO9TNJwcOnc/IVJEPvXOnRFDFxwvu4o+cCxMO4d7J9qZhtGILNWeISZydAs9dQvig== 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=s3rhl0wOKus268K1SIIF4QkpJfaxpWuKdTYJtQfTPN8=; b=TWum3ZlSeOawvd5LuBnU/1ufsXpovQ6RNAJiY16JP4i5E6gewAANsrGahsMbyOG993GUxLwt25XiXG/GtFWKmaiCPvfJKe1u+1UzB7lasB29AEsSx+DTKBKXQf1M6vs5smfCGmCjNaTie19w0Fr6RLk/9jN6KJ+lAR/VRiU+Vws= 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 DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) by DM6PR12MB4297.namprd12.prod.outlook.com (2603:10b6:5:211::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.16; Thu, 13 Aug 2020 16:25:02 +0000 Received: from DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::25ec:e6ba:197c:4eb0]) by DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::25ec:e6ba:197c:4eb0%8]) with mapi id 15.20.3261.025; Thu, 13 Aug 2020 16:25:02 +0000 From: "Lendacky, Thomas" To: devel@edk2.groups.io Subject: [PATCH v15 41/46] UefiCpuPkg/MpInitLib: Add CPU MP data flag to indicate if SEV-ES is enabled Date: Thu, 13 Aug 2020 11:24:40 -0500 Message-ID: X-Mailer: git-send-email 2.28.0 In-Reply-To: References: X-ClientProxiedBy: DM5PR20CA0011.namprd20.prod.outlook.com (2603:10b6:3:93::21) To DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) 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 DM5PR20CA0011.namprd20.prod.outlook.com (2603:10b6:3:93::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.16 via Frontend Transport; Thu, 13 Aug 2020 16:25:02 +0000 X-Mailer: git-send-email 2.28.0 X-Originating-IP: [165.204.77.1] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: a27b4202-b559-4dde-6738-08d83fa56e47 X-MS-TrafficTypeDiagnostic: DM6PR12MB4297: 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: v1pBIFqmrzmXPPqjYk/Szmb1msOrEf9dVhzg0DXSN2TNKjz0wvdrn4i01jJqtOHNeCbDZ/4viOoNHK94+aZp63KwiJQjjjMWH/Du/TzTQC/ezbB79JHPQAqs7GzW1ICeHPev3U+x2NYWColefOXTouVigiJnZHupceEewF8vfWFdI/cmVo1MIvqhTRWXq6T9Aj8NXeSErBfwGMF4tlJ4dhlbQj87PwNPtNkk1s59D+Hf3btV0JfCHuzN/N+rodo6V7mRAEB8NMGN/jmES7vSarqdX4dpGZhESZv4C+SRwiDk/MSkCRYzIkYOjnWEtqyXBkOI+f2YucNsyeRXXKR+s7fjMN76mZqiPFYwosaJtSeSZFcgCR+dRQNWANmtiSr9kATwBVRCRLxz3xqqjuXb5vx31mFAwxa9PtpWXDLNarJxcz7OMuIdkLruViLkEyCxWgbyuJCG/TS9caUy069hHQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR12MB1355.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(6029001)(4636009)(39860400002)(366004)(136003)(376002)(396003)(346002)(6486002)(478600001)(6666004)(16526019)(26005)(86362001)(36756003)(186003)(966005)(52116002)(83380400001)(7696005)(956004)(2616005)(316002)(6916009)(66946007)(66556008)(8676002)(5660300002)(8936002)(66476007)(2906002)(136400200001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: hhoHTM396wam1fy1ytBkv0I61wDtYLxKL60BN0wt9TPbhlJde56wBwnXKHI7yhdjWypzr3kGS659q9t+bm1Qfu5av/3SfV0N5WlTNLs6IB3cwrSHLJ4R7B1U8b7DnqFcgXPaOwj6gg+v8jf0QmvEkQGB7J7Nm4e/qy9iomIIcEyZCKpsSSD+kjjnHVBtbuadQpIhmqn6zJ3qQOGF69kxEEhXHxIbLfiyla0DgahB5dODQbtPEpnxTH2WwBm6+GMsee8d0kutPYd1sYeB7GrkY/73C4+zN8qx9Dv0LKwn1SnGpglA+lfET2LTtDLzNxj1v2Lh7vl6WWwuTds9EHyOUUHQIxR/tfqbUu5weyP8r6RVuQUdgCK1fxLSvIRZxAudX4vU55a2h+M7zH/iW3QPOveeuEWXLjGO8Jh9dbdWbVeldvuaAMJNUAITmTsMaGIAQ5buXkQpcqZ1r5BTUYxd/QHOZpEGwxYNG/4C780ayf5u6ZhoWzbb8uXk4QV02S0X/JBr/ad30DPTEGDm3/InrrsZY+W6Wu/9+s5SddBfIA0IB5Z4B3MFbi/VT+Sl4cTTG/kwStSt81jD89SvWNbXShVYK8Q2DH8aHe4WCCCGsNoqcBDvp6sBW3MMlNADVxP5B7VJVEUadapibfHtSvtIKA== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: a27b4202-b559-4dde-6738-08d83fa56e47 X-MS-Exchange-CrossTenant-AuthSource: DM5PR12MB1355.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2020 16:25:02.6861 (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: 0vH/toPwnFuCe8sAG+kt4khqeOM6X1yQAF91pOes9y4CouJqzc4RxbVcYNtIe5gtJIEU4H8D/YmLCyqk/u2LDw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4297 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.28.0