From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (NAM11-CO1-obe.outbound.protection.outlook.com [40.107.220.74]) by mx.groups.io with SMTP id smtpd.web11.1414.1589993812441821053 for ; Wed, 20 May 2020 09:56:52 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=0H46HTvE; spf=none, err=SPF record not found (domain: amd.com, ip: 40.107.220.74, mailfrom: thomas.lendacky@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YJxDP8r5lHRWJC4Lp+OMUdvh0n8LNKAiYn3pwFOu8jP6xSGuT335WhI3gg+GDyntawvWEDJYMKX3u/HpdyqEvaNE91/Lo0ffPUV2WwRRuVdK/10TS5J55CA1gzG2jcFHW4bQsaOpYp3HP1JXKOJxn6mQ3GWDh7kbjv4bZQ7Wsp+zFCCj8Xp28iOhXhbkNNoWgbOH8H8RFrSZWJQS8VgtnvqrDkwpqt9dKTFiewqrUBIKbcOi2muCqthC6ZjHgtKREVzWUKUZ+sbeuU4t5DoBvp0pHM039NBV3EFeEnj/VzKzUpZJSNCNPzntX4YdjRbP41D4ckPBOVqGfnFJDTsROw== 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=VORA6Rcit0Cs6Q5RnlvCED550RUltaOpv/GoZ+imiIY=; b=GKn6MYJPsxRBg2EIGrWGw4eWZZMv/fFrrJvTJA/g2uGm4AEPf6s7HsBtINu52DMiykym5mQikqv8QBmmBdcrLApxBew/0lPE3nHqRTfaH0vKz3Xlg8apFAV+rVVr8wBVQsvps1ADdTRL3Gh1k7t89Z3Lsdjl3JKiNHU3lNDZd/BWKcZu7Sys40FWbpinC/hgbk6xtK9J0uWOsjncKrBeC2tnX60ZzXMzvtClSBT/VRMjuXoPRZ2a/Mq11qM0/2TSj8d/uZeQZYoi3nsDRfvhpkOPs7JC+jZolddehO1OBDJcwr8Pem6l1pC2A7vo/LJlnhRxnq0XZKNMeRGCPx7oWA== 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=VORA6Rcit0Cs6Q5RnlvCED550RUltaOpv/GoZ+imiIY=; b=0H46HTvE7L9cKWvbUIDjAubO/VIawCNbeMAMTJlYlCwMOuONUmmWXhrqWL93xeXn4/evfxl3G7n12rOKMAyKtb7GZEGNA72ITNH59PtYuKIMBmKvyW+ugevfzjTQPmie/xbsOSXAYcXzu6PYlKA7X4qEFPaiNmxW+MvjvMi4JQ0= 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 DM5PR12MB1578.namprd12.prod.outlook.com (2603:10b6:4:e::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.25; Wed, 20 May 2020 16:56:51 +0000 Received: from DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::4ce1:9947:9681:c8b1]) by DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::4ce1:9947:9681:c8b1%10]) with mapi id 15.20.3000.034; Wed, 20 May 2020 16:56:51 +0000 From: "Lendacky, Thomas" To: devel@edk2.groups.io Subject: [PATCH v8 41/46] UefiCpuPkg/MpInitLib: Add CPU MP data flag to indicate if SEV-ES is enabled Date: Wed, 20 May 2020 11:56:34 -0500 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: DM6PR08CA0026.namprd08.prod.outlook.com (2603:10b6:5:80::39) 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 DM6PR08CA0026.namprd08.prod.outlook.com (2603:10b6:5:80::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Wed, 20 May 2020 16:56:50 +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: 5c3ee4d8-4c5d-4e10-f8f3-08d7fcdeca9c X-MS-TrafficTypeDiagnostic: DM5PR12MB1578: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-Forefront-PRVS: 04097B7F7F X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bHiUC7uQAAGp1ICosWa8sy4ccmVnpKFk075fppLPcXkSFL91pt2anPkxNO+tOo6XLDWKPXwjtwSJNL++SWMbU38JqugeXNL8fl/x3iukEQ6xA2VqCJJwPv3U4ydgc6xHJZ8iDYaE2DfRFHwexkDpA0LBEj7oMiGWAyU4pgsa01LZnqGlXEVKQlMTR8zIdJtmBd1OJJoM0gGUpPar1RQaCeYuZv+r+GvCaQ7Yo655lSCBeeBpPlsJ43n5IcdzhwDbX1VRPCmGGuN3hwn11nFKCIIVC8hMyFyXB/qWji/11G2WM2kucaComqfYzn32Lta9XC+2cThC79rEEGUsfEXhsDBZ7F0RfYSqELeYInqswgFwQ9vA2y8zRRPkHHSLhexSm5xyeKC8XJt1yDLsRo5BdlOIvB2rNtpWNeVM08l4uRVZki5chCR7lIFydb8sPecJjtgNKikbJcyjGl3Y+sI78SKO9K553orUXBFwOr5a27OcRvt+G0/pGM2ApdNVOQc2K/ZSNnDi48W2IPzeNH2BxZCQ/6Pe1rwOITtdWWndMwhhsWmid00bW9M+8icjsu1v9a0Sj0ECe5/ES/0xvNALAw== 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)(136003)(366004)(39860400002)(396003)(346002)(376002)(5660300002)(2906002)(956004)(66476007)(6916009)(6666004)(66556008)(66946007)(966005)(8676002)(8936002)(316002)(36756003)(7696005)(52116002)(2616005)(26005)(186003)(478600001)(6486002)(16526019)(86362001)(136400200001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: W0SLEcdLpYg3xt/anssUFS/NyFtzTjj9bSmoJRgFziEZkJmyQ/75GkhRPdcA0d4erWd85Ap4WO3UtGGs4lg5+uxtXJAqqncK68bLdRomq5iFdenqb3Ry7Q85EuFaemCINm01g6VE8FRYRob20g2hOwjgeilYy3MMPdHhNiblEeYSSAUIR9TndROSB6fZVgJVh2X25d3kFBIOIVIB8N+w//9k9CEVN0GiuOqaES1q5qlLDfzL6tcc1RHurVMYPpWhz8CIy7DF/PhWX5ffmQcHxtKcju3nCcBGSccBJS0l2Aq2J1fSoPAaOFfGziYCwnFHwe/ELBVIyQEwTaLDJur7l3BSn7FUOTp/DF24+fWXSFycL1vwemMENGoEJJYWkc2TQjXdXR8AqdzHKgQV7AQs7fNKV3HapqrJ7Q9bXbB4KxMwFPsxtOF44OKu6fSBjCF/dNzfAACYeBT9Zo1bD0x7yTsoRSdt25Jal8Y10YGSTzg= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5c3ee4d8-4c5d-4e10-f8f3-08d7fcdeca9c X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 May 2020 16:56:51.0207 (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: Brgl6Z895K9m7iaPxuVEVRH0F7xOhMKH08rsHvBgPOQMbGiBgUnsZ7TBWnxW/Rg8Z+GDZKlGzXQB2dvoqzPX/g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1578 Content-Type: text/plain BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2198 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 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/Library/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/Library/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 ## CONSUMES gUefiCpuPkgTokenSpaceGuid.PcdCpuApLoopMode ## CONSUMES gUefiCpuPkgTokenSpaceGuid.PcdCpuApTargetCstate ## SOMETIMES_CONSUMES + gUefiCpuPkgTokenSpaceGuid.PcdSevEsIsEnabled ## CONSUMES [Ppis] gEdkiiPeiShadowMicrocodePpiGuid ## SOMETIMES_CONSUMES diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h b/UefiCpuPkg/Library/MpInitLib/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; }; extern EFI_GUID mCpuInitMpLibHobGuid; diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c index ab7a8ed6633a..a8b605f569bf 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c @@ -1727,6 +1727,7 @@ MpInitLibInitialize ( CpuMpData->CpuData = (CPU_AP_DATA *) (CpuMpData + 1); CpuMpData->CpuInfoInHob = (UINT64) (UINTN) (CpuMpData->CpuData + MaxLogicalProcessorNumber); InitializeSpinLock(&CpuMpData->MpLock); + CpuMpData->SevEsIsEnabled = PcdGetBool (PcdSevEsIsEnabled); // // Make sure no memory usage outside of the allocated buffer. -- 2.17.1