From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (NAM11-DM6-obe.outbound.protection.outlook.com [40.107.223.47]) by mx.groups.io with SMTP id smtpd.web12.4689.1594756247116778398 for ; Tue, 14 Jul 2020 12:50:47 -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=RrN0Xh0+; spf=none, err=SPF record not found (domain: amd.com, ip: 40.107.223.47, mailfrom: thomas.lendacky@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GCsDRxtc54jEPTX5/BePmiiruess+BGNJYkS9sQ1k19yZGnlXbs94NaFIqc0ewyo5c+LyFEUDAMiXrLUj/lLVxnpuDgImrgRs7bk6v8iIU5oixQtbaEFH/32+m5aCwx2jDyIqGL5ZiVb9/2Xei08kpg3YNo3aXKEt/MKTZrjENhiMXDtY9eJ7bgsxZwYMlwckh4doZWyopan0A5rw7Ap4DMk/WPDyAxW6f4yEGhc9CHIa/pvTErrZZvVom2ScbXtLO4IxW5ZMNO6B7+A45QT/NsXqgfqOv90Us7DUaPXJ/mTEKQUjKWGIAd4RCvXV5kmNb8ioTSnBHGmaPXrCtjxOg== 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=oUWaeELNSZrb79mTZeuM3jqogaWt+skecDpn/RWjoE2y8o897UhuTv2qyO1ZdJ4eMXe0OGT3FzbbKy2WCFIr8vtSoRhxwiHUW9PnN51h6SSZuUfqV1+nldbQZAhks50+URVVhplL+SIsflu3ycXykpFWpaQdBNKw8TCxiDKLHkVbwUwYvwQQf6N+vFEiMIVnsTa5FEZKw/hbonSrBEZr6fN4nSzm/I60e14Wm7JP8BeRrqmzRvTpeq767lkYPBLZ4qyCcbUPSspXy/im4ofMlvY7KIHhbpkxp8yvmuO57zcnJF2pUDkP1vzhKFm9XjwGeDGFYwdNqaeIpbkG/PWx8Q== 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=RrN0Xh0+pHO0OK1SVYVxxdtyooqqIaHjnQgfpsUaM4iXvhmca/JkPMtKVTMPctqiAR8Vy1juVOesihZPMiH0AWIwt++fr3qpGiIuoS9vt67HPw286HZ50puHEUAcNWYhNbGdDAqxSSZ+PkuMdDoIo3QtQBlaTDWjrgpvajqddK8= 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 DM5PR12MB1834.namprd12.prod.outlook.com (2603:10b6:3:10a::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.17; Tue, 14 Jul 2020 19:50:44 +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.3174.026; Tue, 14 Jul 2020 19:50:44 +0000 From: "Lendacky, Thomas" To: devel@edk2.groups.io Subject: [PATCH v10 41/46] UefiCpuPkg/MpInitLib: Add CPU MP data flag to indicate if SEV-ES is enabled Date: Tue, 14 Jul 2020 14:50:21 -0500 Message-ID: <2ff5bc297b876c8426b7c5515380450efad27203.1594736896.git.thomas.lendacky@amd.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-ClientProxiedBy: SN1PR12CA0085.namprd12.prod.outlook.com (2603:10b6:802:21::20) 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 SN1PR12CA0085.namprd12.prod.outlook.com (2603:10b6:802:21::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.17 via Frontend Transport; Tue, 14 Jul 2020 19:50:44 +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: cc168aa4-124a-4fc8-bbec-08d8282f3211 X-MS-TrafficTypeDiagnostic: DM5PR12MB1834: 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: HutvJVS/d/mdOr+Wrrmd39BEjcgH0nQyYtuDU6XTEczrHCnJTi3YvTYZqqa2cT3VsFM65Fdhfl14sShsW9KEh7folZ+g7neTCNrhsxED+H+FUzqhU8IWKafz3AbuAGO4gkmpv1o8srSqa/EEvs3egP5aMTD7++nzpkWssyCqALNPiOE99dHrsOMge4Ui/rX1rvtkUwKiTegnsJi9mznUKhb5qSDZ9caMgWRmmdrCmQWp8NjFgR00iDxOfKB4GEWngioLQJkjQrdQV900u7ZFJHk57DqyhwA9kB1CUXde9vFFebnx0Rm1OH1+hlR0pdiDEBZ9Fb5xo77fChT25cbyjg+bRzwSjtzqj9U78TfRwUyMymrGFM/+n9YnpgfOe1ougyChya7suSXqoKJdM0z+w7s0F5m8SOZXfEp7nFRcod9TqqQT+d8rcpDgl+Ihayhg2nIckcVUkFAtPE524pcsLA== 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;SFTY:;SFS:(6029001)(4636009)(346002)(136003)(396003)(376002)(39860400002)(366004)(478600001)(7696005)(8936002)(52116002)(2906002)(83380400001)(956004)(6666004)(36756003)(316002)(6486002)(26005)(66946007)(186003)(966005)(8676002)(16526019)(5660300002)(66476007)(6916009)(2616005)(66556008)(86362001)(136400200001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: ztdrmsqP41SUJj06N288L71d1K+A3bUCAj6SjT073v+fkHmf6/c+NadngR5TcJ+/4gtlUHuaVDk1SWw4YzwKC57ZajU8wkp/9ucoGGTm68JLq2lGwjJicucbkRAHZZ/+rbB1J7CW2eNA/FgnUobOgQWdKXzMfR2e2Q8tngvuyhX3Ng9V1UlNKUtQG1VJ7sbL5D1RpbdY7nkEsYUvj4ZaEv09+WMcOb+8KvTSp1aB8SsdgDBI2fLK6rFQAfxt9CvSArhLdrgg8ssuQSoQtUUsd8BL2NmA4LJEtsAARUBLGUDpLkZ8gvLOFv43ZB+rkD2ZaTwIKIT/gizccrPt1q5/+tI1K9SD3j1Mfh+F14GHXg6KNd91lUdqJCs/nsl7Fx0/AqUjGjwwVOrw/YaPaeiAtN6NOPFQvgu34BabL1ZyWQ0rg8l/zoeJFVPWwV12RdsgidmwpnfljPxOO8g1IXsgr8xUfUFFenfD38ZebWyNgfo= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: cc168aa4-124a-4fc8-bbec-08d8282f3211 X-MS-Exchange-CrossTenant-AuthSource: DM5PR12MB1355.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jul 2020 19:50:44.2901 (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: lBZdWsnM8mEGRctW2hLkRHgKuklj2gMD7A1QRw1NjXKkViBHHfubpmRIQt0VLek9I0b2qW0sJqGIdyo28I2WWA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1834 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