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.web12.504.1587577397852627360 for ; Wed, 22 Apr 2020 10:43:22 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=W3y+AOxm; 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=bs0P4nEs5pFdS1+ahhl95rVkxOZzy2U+LcHg/ShJlmKwBaOsNau90nZolM8s5xaQ3KzO58zINLOfmzPTGPlsiLVfEDqpsDYF/FgEcyt0PzVA6ejqpg+4pMnrR5+BcTvJDnK1Jf6BqFrm4ZXmLM8LFcnI6r6/tgegR+8KKuaIHXTY8WOfMCKmS2jUIY88Cn2sPOg4rVXQlRbxh7S9QPyxgf7V14j226iKOf67mbR7HPZbO152r+dFz0j+gl5VmFz/b8zmgAcHrUBH4aGPNK1rr+Nd0F0/xs3grWop8J9SV9sWSm4E9CX7Gtk/c5vwnOkzqgNT8G9Hup2dgNb2RkorBA== 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=dHgldUUddmJeDG86msPtm4cVgUutB2Ttv/dw+thuBoE=; b=CDhfgvLQnyGSSmkxS8v74QLpLVmuMIhFMYLSC1vK2qaMIwPWuefhmsMME4tu/F1MSmeHj5rSXZVl9ecZnk9J4xNRfNoYMcteIFVYCYmxoH5MqjA77TFv9msyqLiE3uy8DlizbzYx716CfJfWKCMMJcpeVPiWvILah6DVZHNmYoCOHi3mNjz5rqpYHtn8PIMMvf2cPvnCr+atxc/yOxCIe96kUxFPfHqvZ+Vz42BzpkoqgsqO0jYHYrmoQaObCflpUZMtTk5LkrY4gOAMLDk3e7Eer7mHMvnlOJ5P72iOaracTiONbN4nF8n+El1p7CzvrwIvTiYwYGsKRrAq2bugTQ== 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=dHgldUUddmJeDG86msPtm4cVgUutB2Ttv/dw+thuBoE=; b=W3y+AOxmpUGnGBI6nPikxIubc4V4vC5188aYFmiLlRywZdzT9FS/3AOORBv0gaFnYfRcMcKBB6nAepKMUyo4KnJf5LT75N0zlYr1ZqKbP9fLhohnndFHr8SpqnsbWp8wYzsLRYO6tpl2bSkC220U97cwhoFDAOlbzbo5Nd/amSo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Thomas.Lendacky@amd.com; Received: from DM6PR12MB3163.namprd12.prod.outlook.com (2603:10b6:5:15e::26) by DM6PR12MB3673.namprd12.prod.outlook.com (2603:10b6:5:1c5::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2921.29; Wed, 22 Apr 2020 17:43:19 +0000 Received: from DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::9ae:cb95:c925:d5bf]) by DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::9ae:cb95:c925:d5bf%4]) with mapi id 15.20.2921.030; Wed, 22 Apr 2020 17:43:19 +0000 From: "Lendacky, Thomas" To: devel@edk2.groups.io Cc: Jordan Justen , Laszlo Ersek , Ard Biesheuvel , Michael D Kinney , Liming Gao , Eric Dong , Ray Ni , Brijesh Singh Subject: [PATCH v7 39/43] UefiCpuPkg/MpInitLib: Add CPU MP data flag to indicate if SEV-ES is enabled Date: Wed, 22 Apr 2020 12:41:54 -0500 Message-Id: <6d577f1b7a691805785ea2ac2c09a2c456ca86f7.1587577317.git.thomas.lendacky@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: DM5PR04CA0060.namprd04.prod.outlook.com (2603:10b6:3:ef::22) To DM6PR12MB3163.namprd12.prod.outlook.com (2603:10b6:5:15e::26) 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 DM5PR04CA0060.namprd04.prod.outlook.com (2603:10b6:3:ef::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.13 via Frontend Transport; Wed, 22 Apr 2020 17:42:53 +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: e567225a-26cc-43ad-2031-08d7e6e495f4 X-MS-TrafficTypeDiagnostic: DM6PR12MB3673:|DM6PR12MB3673: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-Forefront-PRVS: 03818C953D X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR12MB3163.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(10009020)(6029001)(4636009)(346002)(136003)(396003)(366004)(39860400002)(376002)(16526019)(186003)(8936002)(8676002)(956004)(4326008)(316002)(6916009)(86362001)(2616005)(36756003)(26005)(52116002)(7696005)(5660300002)(2906002)(478600001)(81156014)(966005)(66556008)(66946007)(66476007)(6486002)(54906003)(136400200001);DIR:OUT;SFP:1101; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: m1iS3P5KXmAsjYa9EL+MCxeaiAHqG557q6HO+YXE0Iue05kbmKasD9KnesnhhBJgg/4lyBJ4pHvbQKkmYopzCo4cA8ToD098freP+N3c1mM/slNnH6lqT/h8Nuf3/jEHeL6TpmG4c7JV7Lq6oP6BuP87XIWLZEDRQzGyd2rWuceG/0oc9jIc1Bo+3UkVruKDI2Vo8hqoC7K6pvaLKj7K2Td8sidkaUVTtW6QD9ktaFkeHLUyv7A2KCfzOYQ3us/VmX7o94G39GZaSiO6TQ9xmq2B9pYK+Zid03ab1z1oXKAslqO/D1Mx/MGW0C6Fm71F5UZJRHNcgdicKqZ1sztldeXYM+WWCSVaCdpAF4Q09kll/Fr54tAP63UxJEqbbHCmQEPI7NTD0WwUxy8DkXGcjl+PbtoGbRuoybfU7nkPnrLPhfNzINhR6LTx1wNq2NtR8ZbxqFHT+QEHWEJa06bnsrm8EOPjSGW4XAD3xdlFdU2NrBFO07CpCbDT0tIsiDfcnamNCW6qy7RRZZyKv1dN6x+02TfnqdIikTDgu/m+cb2dzxX5sCwsBoIfNlyi/mVgDQxnPVLu+AvllC5DbYEaKw== X-MS-Exchange-AntiSpam-MessageData: d38dRr8FroUZXHGyfu+NkPCz32prheiUGdsdbu4jioiipsRACdWiVP846c61l5iGqDR/DfWWAf9f4uIjwiFiXAUre/kJ/WE1x0j48bc0Ly3OzMP2rN5BzP75VINSKlhtKY/muenAWG/7DZEFc2rEww== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: e567225a-26cc-43ad-2031-08d7e6e495f4 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Apr 2020 17:42:54.0399 (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: anLEBXhZDS8O0AuBxCdvQjnubVQAy6+7GeGQx3V8oNFAroqxWIzhhgF6wubgCtpFJAQnFt0vo+xuHrh0o2VRvw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3673 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 a51a9ec1d28b..4ea94848dc11 100644 --- a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf +++ b/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf @@ -70,4 +70,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 d78d328b4252..b4dc7e69d829 100644 --- a/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf +++ b/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf @@ -60,6 +60,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 74e919dae077..c320ad8334bb 100755 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.h +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h @@ -275,6 +275,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 64a4c3546e22..81c5b1a5b701 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c @@ -1714,6 +1714,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