From nobody Tue Nov 26 22:13:11 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+46089+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1566301158310158.78253082525396; Tue, 20 Aug 2019 04:39:18 -0700 (PDT) Return-Path: X-Received: from NAM01-BY2-obe.outbound.protection.outlook.com (NAM01-BY2-obe.outbound.protection.outlook.com [40.107.81.85]) by groups.io with SMTP; Mon, 19 Aug 2019 14:36:22 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X2YrVuUf85x1lORuU4ikv/WgVqhz3N0zqMFJgFEsQUaVsPsy4iIa+FiR0I3nVDPjMcgpQKtmV56CqRv/jWKsShBQvX8LS0FRV1wYwr1AHnktGHGytx389xq9GHT9LuhcVBAli5YP+kNPFwiCc2YSclyPB4IzkPJkbKbCXKqE167f4N1RUAdX/wxkUjmLzHxeZEFVgmYOW+v0EGqEKR4uqes1zgwukrueQSaho8wtxVsJRvd3qQ/LhH8jF7IGlvQpXwIwjj46tbFVRD5iAQTudyttfEeQYVPHIxvVnTrOOQ12VYP8NwkhZLj+Ajwi/qhmb879Q1jf1+TKnD1lY5JiEQ== 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=CsA0iOy8EbOKZQWMclWZMQJXhhjCzFR+vgbc2Jz7Jr8=; b=jc6QDxbXUTv8cubejJvk8nH7I3WL6mZC9QuhuW3jhrSQEeV7P3G9R/25z6Ucjwn2OxLKjDZk4B+xTnUJDTK1qlhJZ6LBQnNnh0/7ujPGy97fgOE4rJ161WOJBduYp3cToWnbEFPtcGzKQdW/KfFTi9X4Tb0vpQhOJStF8wXfK7tzhwQWxEeLNMgkjPVTFDkX/4dJxS80xgUmlaqcK5umL0VYh4vBHObcefGGwOJSHR75Fr9z9SWjWbg4ryR0cecQ4dv1POAKZvWXz1HpqYnkOD3iJTlae6d7gmg/3B1KWZ+CtnFmrGcGDlzSE4/ba473xKoomBwb1JXyntdUmVA9vA== 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 X-Received: from BYAPR12MB3158.namprd12.prod.outlook.com (20.179.92.19) by BYAPR12MB3112.namprd12.prod.outlook.com (20.178.54.205) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2157.20; Mon, 19 Aug 2019 21:36:21 +0000 X-Received: from BYAPR12MB3158.namprd12.prod.outlook.com ([fe80::39b9:76bd:a491:1f27]) by BYAPR12MB3158.namprd12.prod.outlook.com ([fe80::39b9:76bd:a491:1f27%6]) with mapi id 15.20.2157.022; Mon, 19 Aug 2019 21:36:21 +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 , "Singh, Brijesh" Subject: [edk2-devel] [RFC PATCH 26/28] UefiCpuPkg/MpInitLib: Update CPU MP data with a flag to indicate if SEV-ES is active Thread-Topic: [RFC PATCH 26/28] UefiCpuPkg/MpInitLib: Update CPU MP data with a flag to indicate if SEV-ES is active Thread-Index: AQHVVtYk11osFhu0skeV1OETMrjKvA== Date: Mon, 19 Aug 2019 21:36:21 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SN2PR01CA0031.prod.exchangelabs.com (2603:10b6:804:2::41) To BYAPR12MB3158.namprd12.prod.outlook.com (2603:10b6:a03:132::19) x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [165.204.77.1] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b65f897f-1b6c-4f49-5e68-08d724ed46dd x-ms-office365-filtering-ht: Tenant x-ms-traffictypediagnostic: BYAPR12MB3112: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7219; Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+46089+1787277+3901457@groups.io; helo=web01.groups.io; received-spf: None (protection.outlook.com: amd.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: atVR3h0shtaDbPtywNZe16wKFrF2RhlyUvsRMGJC5lcOuc7keAVC4pV4jO8xOJunxDR3Ki/hWgF1qZRKCs/GG2wSPJUZY4sXE8saGAiCbCnpahc4iWYAg6M6PTTP0UwOABcr75si7qGORYokDHiT52Mo/oz6bxpwvT5oF91DuMXxI1ct8wZoTPGY9Q1d/tDBkfuXNlNaCWnyXYIXuEJDfY0pbPa4YGK9WjBSek+vLtucsHPDSH4AsbI7MzMdHeqQLRapWSyacvmCz2sX2g9igbRT1i9whB2BhnFpAmVMOGsZGb4ZighHv6675YRwIYrsciujyAVzUuMydRfhJgNvRnMendB8Ia30WSJgPLnglaK0hiSjZuM1G1Smx1gVjMwt/Z6NB3EnALbvLT/2fHpABvtBnkFPKCoxwN4xm3j9dwA= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: b65f897f-1b6c-4f49-5e68-08d724ed46dd X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Aug 2019 21:36:21.3524 (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: LBaYgzV71KyJKDZmiWdT0QC7epDELL9ahSfA673AWQbK8mroRXDELeeYuGwQ9S85B1IAcKIDs43hXVOk6Us7hA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB3112 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,thomas.lendacky@amd.com Content-Language: en-US Content-ID: Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1566301157; bh=HpJHb7I4fhs/gDZL1r0RdaxzuN/dIgZkVoueAowaWII=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=uzeavd6OoQE52V8VyTYWR2/KJpmpDT0z9Wjcct7Gl8TN5MAPN9TSo188gZqxZm68I92 yh1ZOyQKNhJthEy9vqa7R/2+yh6mpOGivayojUbnZk9Lacaszx8mNdGuDXkyhWsK0qr6D pCimrzraXFlTD6KiK8ta6jqMZRhEQor1L9U= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Tom Lendacky 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 active. This new field is set during MP library initialization with the PCD value PcdCpuSevEsActive. This flag can then be used to determine if SEV-ES is active. Signed-off-by: Tom Lendacky --- UefiCpuPkg/UefiCpuPkg.dec | 3 +++ UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf | 1 + UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf | 1 + UefiCpuPkg/Library/MpInitLib/MpLib.h | 2 ++ UefiCpuPkg/Library/MpInitLib/MpLib.c | 1 + 5 files changed, 8 insertions(+) diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec index 4d5a2593cf13..163146afb752 100644 --- a/UefiCpuPkg/UefiCpuPkg.dec +++ b/UefiCpuPkg/UefiCpuPkg.dec @@ -327,5 +327,8 @@ [PcdsDynamic, PcdsDynamicEx] gUefiCpuPkgTokenSpaceGuid.PcdGhcbBase|0x0|UINT64|0x60000016 gUefiCpuPkgTokenSpaceGuid.PcdGhcbSize|0x0|UINT64|0x60000017 =20 + ## Contains the SEV-ES active setting + gUefiCpuPkgTokenSpaceGuid.PcdCpuSevEsActive|0x0|UINT32|0x60000019 + [UserExtensions.TianoCore."ExtraFiles"] UefiCpuPkgExtra.uni diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf b/UefiCpuPkg/Lib= rary/MpInitLib/DxeMpInitLib.inf index 37b3f64e578a..1b7ac00ab361 100644 --- a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf +++ b/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf @@ -67,5 +67,6 @@ [Pcd] gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchRegionSize ## CONS= UMES gUefiCpuPkgTokenSpaceGuid.PcdCpuApLoopMode ## CONS= UMES gUefiCpuPkgTokenSpaceGuid.PcdCpuApTargetCstate ## SOME= TIMES_CONSUMES + gUefiCpuPkgTokenSpaceGuid.PcdCpuSevEsActive ## CONS= UMES gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard ## CONS= UMES =20 diff --git a/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf b/UefiCpuPkg/Lib= rary/MpInitLib/PeiMpInitLib.inf index 82b77b63ea87..bcdd2ca82612 100644 --- a/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf +++ b/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf @@ -59,6 +59,7 @@ [Pcd] gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchRegionSize ## CONS= UMES gUefiCpuPkgTokenSpaceGuid.PcdCpuApLoopMode ## CONS= UMES gUefiCpuPkgTokenSpaceGuid.PcdCpuApTargetCstate ## SOME= TIMES_CONSUMES + gUefiCpuPkgTokenSpaceGuid.PcdCpuSevEsActive ## CONS= UMES =20 [Guids] gEdkiiS3SmmInitDoneGuid diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h b/UefiCpuPkg/Library/MpIn= itLib/MpLib.h index f89037c59e13..2f75b82e8401 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.h +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h @@ -256,6 +256,8 @@ struct _CPU_MP_DATA { // driver. // BOOLEAN WakeUpByInitSipiSipi; + + UINT32 SevEsActive; }; =20 extern EFI_GUID mCpuInitMpLibHobGuid; diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpIn= itLib/MpLib.c index 6f51bc4ebfb9..74cfc513ec93 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c @@ -1639,6 +1639,7 @@ MpInitLibInitialize ( CpuMpData->MicrocodePatchAddress =3D (UINTN)MicrocodePatchInRam; } =20 + CpuMpData->SevEsActive =3D PcdGet32 (PcdCpuSevEsActive); InitializeSpinLock(&CpuMpData->MpLock); =20 // --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#46089): https://edk2.groups.io/g/devel/message/46089 Mute This Topic: https://groups.io/mt/32966262/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-