From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com []) by mx.groups.io with SMTP id smtpd.web12.1317.1585071732848065259 for ; Tue, 24 Mar 2020 10:42:13 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=xZrlbT1z; 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=mm7q3diyAnuIiyaJ3z4H3OXSTgr6J6/FAeeChvTKqmkvalrOSznH/IlK+gd0TKydx+yhD/Xv5SHMSowbhSXQ8zhKKM8aQlg+xgZrBRGIRGlUUiCZfYSLC9iv8G168JoZuJqOwgHvK7/jdJoGy19xj5q4Bakfq6Fsusd7cJuskTQUILxPq9gIwwq/ORtIRLVsYSY98HY3Q34cOEVSJsH/36zFhRgEuWnDrEWrVu8dltTEvonmDgrBzuQYAyvGekaBLjWO9WUMtm/wE2GDby5Iirc6H87ylsdpobs9qe4QHAbKnnUmFzAzK7h4iPHpdHM+KuubdH5zMQcagmlRoslH+g== 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=0hqs7g4JA8bRNE1UNv77i/GWxITqC2XLHCj8EoCKnFk=; b=DRdSSax5Ea0OiLalNQs/0pURDizDg8L1JfQWAcKZvYrWm5F6XzKxZ9PJfqHLDDsxydZSulYcQGoQfHz+VAR8O+mVZkXZKrS15NsOCX0op1VSvRdwBUO5E6N2yVB13MWb2wZa1fJKVEBbxioAF1/oMh5Ri5jk4ghRcIxC+mgx7BRwbPIbfMvq2X0hRq7GkaVrWbVZ2GcgCU9XocfvYd4igh3bijsvrqJL8mhvOV+o//mkGhOWuepwR6e089XhO8XJnJyhG3dKWitHn3jn8YOCCmQEyb7uvA1tIURECXwNC4x9xdqbe/x7xxdjww84nkyYd23FSA06SI4jEci6R7a+fQ== 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=0hqs7g4JA8bRNE1UNv77i/GWxITqC2XLHCj8EoCKnFk=; b=xZrlbT1znIP3bSWUE9BoGRLlG5IutsGLDSZAeBCzgUBHd7p9hFhlkq2nIicMbFqpf91gkW9inTR4/bFNcUptF1GcehjqIjU0xgP3I82J3TxsoU3Q41pNkaVAv4Q8dUnUCOLfDpyMpcZmPqd6oDM97WyAcsaDAk//JP7eo8JgLZg= 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 DM6PR12MB3915.namprd12.prod.outlook.com (2603:10b6:5:1c4::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2835.22; Tue, 24 Mar 2020 17:42:12 +0000 Received: from DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::f0f9:a88f:f840:2733]) by DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::f0f9:a88f:f840:2733%7]) with mapi id 15.20.2835.023; Tue, 24 Mar 2020 17:42:12 +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 v6 38/42] UefiCpuPkg/MpInitLib: Add CPU MP data flag to indicate if SEV-ES is enabled Date: Tue, 24 Mar 2020 12:40:52 -0500 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: DM5PR06CA0025.namprd06.prod.outlook.com (2603:10b6:3:5d::11) 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 DM5PR06CA0025.namprd06.prod.outlook.com (2603:10b6:3:5d::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2835.19 via Frontend Transport; Tue, 24 Mar 2020 17:41:45 +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: 56b09fcf-c545-439e-595a-08d7d01a9f4d X-MS-TrafficTypeDiagnostic: DM6PR12MB3915:|DM6PR12MB3915: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-Forefront-PRVS: 03524FBD26 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6029001)(4636009)(376002)(366004)(346002)(136003)(396003)(39860400002)(8676002)(8936002)(186003)(316002)(54906003)(16526019)(956004)(66476007)(36756003)(6486002)(66946007)(6916009)(66556008)(2616005)(26005)(4326008)(966005)(81156014)(478600001)(81166006)(5660300002)(2906002)(6666004)(7696005)(52116002)(86362001)(136400200001);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR12MB3915;H:DM6PR12MB3163.namprd12.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords; 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: XNlEJyBBd9uGHKvER/zHUW1PTFgSYXHr8qzHxZPu0ZojdFQ9die3rgsZdj+yYHhQ5AdUu4EforugQh6y7yYbY/dveyyqPkzwiK7cjAdEhojcGW47Shd+m+E0VUqZNHd6+GraMykX2kFUCOaf6cTo8jQhmF0wZjdf95Lod2Ftv7nDMijsE98qcG/ozkSUqCWbtzUL+57tPa1XKdPCiWfnbqJ0Y0jp1+e3eqKhWpMQqKUvCbtIWLEr4rKynm+Egh64SRBDGDJh1qE9xD53u8Z4lc+OqabAXT/vK60FF5OD4W/BumPp1pNxYIaZpgyP/G6g2Es0GQuS7SwcdaQDj1b6NTnCvPvCrrLYlc9ZxE5CBp0LO7dvdZKmATJP+9kgduu3i6Qxe6cjI/IPXUJWJU5Wd/qpq+3yWkbn755c9299mTV/nQABlO8/3GXNjWU9GX2sc8dYujt1WVrZw0oTQpB6G1b5BJTvytdOLjF1SjTMT+xMmJIRkvYkR1DQ8MHMxIxbdTGfXWc+q868vgZq2wf4IqorNPSr838kSpBu3SYzkvhZGWMY+/5e74Q2nq2OMqg0lViwx3e6HoB6vhkkEy5izQ== X-MS-Exchange-AntiSpam-MessageData: 0dt0RzIB7OzIqJDkL5g5ulpr5Glac0UoucxpdlHoLzdsOMtz90TEdoDDoatnsbnv9aMb26htTJ0jV3ZevBJdJu+OL0IVmyo29UVM5so0fPLwWqqeksi0pIcU0J62VQcixe32G/uz/wcQpVIl9HGcaA== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 56b09fcf-c545-439e-595a-08d7d01a9f4d X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Mar 2020 17:41:45.8606 (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: t4UVw9Tvq3WfzieP6kB6zFDRYHc/4rczkZT5l8mzH9Mgt0QypDb9+RZDJ//HU6/GvZuoYk+Db4pPcR0h6x0f+Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3915 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 45aaa179ff2e..8b0eb1df9594 100644 --- a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf +++ b/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf @@ -69,5 +69,6 @@ [Pcd] gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchRegionSize ## CONSUMES gUefiCpuPkgTokenSpaceGuid.PcdCpuApLoopMode ## CONSUMES gUefiCpuPkgTokenSpaceGuid.PcdCpuApTargetCstate ## SOMETIMES_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 0c89f8a6e732..edd936f06396 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