From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (NAM10-BN7-obe.outbound.protection.outlook.com []) by mx.groups.io with SMTP id smtpd.web11.1675.1580857385855360254 for ; Tue, 04 Feb 2020 15:03:09 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=xeUTq0ef; 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=LjSJpgMlk8w/cNzq4lDMaHWlkOUbYzb40DV8FRye2sBDnt+R4pkecJIV56tKJon+DYCnnLLHiQvclKsgER4H/Y7RTR8AIMhKUz2Wn82+qbEbishGeEQEvR5sKaNY3pulOLCWfpYVoUlaVvXgGm301EJGux7CHaJlkZ8MxvNHrMhQMexb/0Y/WvFZFPPvjUlnhOP6g9k6RgqZcrmOXGOibzGL82yCqTWrLK8JuTmTYX/GnyiE3tVBS4xYveUJAcCOK+mseEzvyBM7+AGG07Ng0arltMgMgfryoDt2kttchBOELhIVTIaCSr+UX29u2F/vRFFUZ7PBvL/+9L6pYTBBxQ== 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=cbUCObaKXeUU2VJZ8sPh0LzUsOUKTLMglMOP2GkVL4Q=; b=cbw/loy+8h7NBesAQ+aNcHvfMrG1aKFPgYS3AOZh1MmbfTo3U47hiOjwD/CNr93TfvVRoTnMg8xt3IZEZW6IlbrcO0pSWqIp5sb8a4ZoaltluBCanbbaLUi4Ml7i67RH4YmnMzPQzZlQHgwpb/Vtkar1cV6UyeZTY9tAjx7cH1VbNehtihRgz3qIbX2z1OYtOuou2TT0qJPH8Kp2cm1C/5kMxXdXQ07YLLMhcVqULCZ8BtiDmS9Cq/Qvf/YqD6MJXLktnwfgIwJtLstnSLDxR5t3qi7nWyoVHh76sq5e8RVIEzGEURpqUc+nac7vx+TtquqeAx3qNEfjzuWFoKVPcQ== 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=cbUCObaKXeUU2VJZ8sPh0LzUsOUKTLMglMOP2GkVL4Q=; b=xeUTq0efR4ZHGeUYzaa9G58cb/g3Iu3G/O0Wsz2IdbxyqOCnGXl/zjuqLZNU08oQ5HlF2cnz01hcLqWx5mVOU6WWgNhYtmEfTuiLhhd+/mzwKy1jImiUaG/qgDKGYNBaFOijtDX6jtlFvQdG80KCFL30qCl8yqrpN7cRDNn4wHE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Thomas.Lendacky@amd.com; Received: from DM6PR12MB3163.namprd12.prod.outlook.com (20.179.71.154) by DM6PR12MB3930.namprd12.prod.outlook.com (10.255.174.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2686.29; Tue, 4 Feb 2020 23:03:07 +0000 Received: from DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::a0cd:463:f444:c270]) by DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::a0cd:463:f444:c270%7]) with mapi id 15.20.2707.020; Tue, 4 Feb 2020 23:03:07 +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 v4 36/40] UefiCpuPkg/MpInitLib: Add a CPU MP data flag to indicate if SEV-ES is enabled Date: Tue, 4 Feb 2020 17:01:40 -0600 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: SN6PR16CA0062.namprd16.prod.outlook.com (2603:10b6:805:ca::39) To DM6PR12MB3163.namprd12.prod.outlook.com (2603:10b6:5:15e::26) Return-Path: thomas.lendacky@amd.com MIME-Version: 1.0 Received: from tlendack-t1.amd.com (165.204.77.1) by SN6PR16CA0062.namprd16.prod.outlook.com (2603:10b6:805:ca::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2686.32 via Frontend Transport; Tue, 4 Feb 2020 23:02:40 +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: 817b2a4d-0ff2-48a2-1881-08d7a9c6560d X-MS-TrafficTypeDiagnostic: DM6PR12MB3930:|DM6PR12MB3930: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-Forefront-PRVS: 03030B9493 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6029001)(4636009)(39860400002)(366004)(376002)(136003)(396003)(346002)(199004)(189003)(4326008)(478600001)(6916009)(81156014)(2616005)(956004)(81166006)(8676002)(966005)(316002)(54906003)(19627235002)(2906002)(6486002)(66476007)(66556008)(52116002)(7696005)(186003)(26005)(16526019)(5660300002)(86362001)(36756003)(66946007)(8936002);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR12MB3930;H:DM6PR12MB3163.namprd12.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; 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: s4KqAPBxvtaFM7k3KXybh1Y9dFpCbq9O0bBIrr6i07mmW/Sd6ukpXPuXNp+JTGcJxuF/A1g+jsCQqX4tBR01uRvnOdKM8zzrJEPPtb33HtonQC+3fiplQDXJCrfnpXGZasWc9M893SU+BZfdIdDbWLyfsG102do72pQAU63kdlFS67N4dOfrgIOSOqFJsQXw8HA0cVcO9Bh3y5PX+xYs80kTwwNucxeDH2HiiYEB1A/NjvCdoy3c+e0ny268bys3XtLOb/yMK39ZYom77Uz+tpMAiu9Twp1y4oHvmZzuDktgS/GZhkcTaioWLVkz5mnCELiK4Yx41m3VG4czXA29trSFgWytdPPKRyg/DENjbXga3ERjUGW3MGOXAzpA0RVdp9qn+Im7YLEbmcWjQ9Gb8Ty5jatvwHXdvGTmjoRAHvVXRlJukhlAfnCVretjaaYZxazS/JURL0rZCqRmwY5jChoB9nOeVudeJEoBXnKfkAP4Ekr0qKOwlDBU4QeYNQaTYTYHu7JHPakE+dR2gVMtxA== X-MS-Exchange-AntiSpam-MessageData: QLHXarbNdyIclodmA8d2/KM2f4dBMKkBRmCuKKx7Cj0gKA/giVgB5I2r8OplQGmoV3VbYtLSgHKGz5kB8jFBpB6CI1wXsUK6bvKAJbyRnwiNU5yvCiFfkcR1Tnj0p7wAsDBGgTfZA61dMCsRTBHGTQ== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 817b2a4d-0ff2-48a2-1881-08d7a9c6560d X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Feb 2020 23:02:41.0530 (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: MEn2h17DOjluDYIilwQ0W1cNCIRCOxczp/Lzbo7O46cJaJ8MFtMH98eqGnOb9Na1T9cqW5Sm5KqzPyYhliib4A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3930 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 bf5d18d521e9..2c26f20c1972 100644 --- a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf +++ b/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf @@ -69,5 +69,6 @@ [Pcd] gUefiCpuPkgTokenSpaceGuid.PcdCpuApLoopMode ## CONSUMES gUefiCpuPkgTokenSpaceGuid.PcdCpuApTargetCstate ## SOMETIMES_CONSUMES gUefiCpuPkgTokenSpaceGuid.PcdCpuShadowMicrocodeByFit ## CONSUMES + gUefiCpuPkgTokenSpaceGuid.PcdSevEsIsEnabled ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard ## CONSUMES diff --git a/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf b/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf index 555125a7c575..66b2acfe98e7 100644 --- a/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf +++ b/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf @@ -61,6 +61,7 @@ [Pcd] gUefiCpuPkgTokenSpaceGuid.PcdCpuApLoopMode ## CONSUMES gUefiCpuPkgTokenSpaceGuid.PcdCpuApTargetCstate ## SOMETIMES_CONSUMES gUefiCpuPkgTokenSpaceGuid.PcdCpuShadowMicrocodeByFit ## CONSUMES + gUefiCpuPkgTokenSpaceGuid.PcdSevEsIsEnabled ## CONSUMES [Guids] gEdkiiS3SmmInitDoneGuid diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h b/UefiCpuPkg/Library/MpInitLib/MpLib.h index 7c62d75accfb..864b16872010 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.h +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h @@ -273,6 +273,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 855d37ba3ed8..5e3183c2493b 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c @@ -1687,6 +1687,7 @@ MpInitLibInitialize ( CpuMpData->MicrocodePatchAddress = OldCpuMpData->MicrocodePatchAddress; } InitializeSpinLock(&CpuMpData->MpLock); + CpuMpData->SevEsIsEnabled = PcdGetBool (PcdSevEsIsEnabled); // // Make sure no memory usage outside of the allocated buffer. -- 2.17.1