From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=RLiaoG4V; spf=none, err=SPF record not found (domain: amd.com, ip: 40.107.73.53, mailfrom: thomas.lendacky@amd.com) Received: from NAM05-DM3-obe.outbound.protection.outlook.com (NAM05-DM3-obe.outbound.protection.outlook.com [40.107.73.53]) by groups.io with SMTP; Thu, 19 Sep 2019 12:53:33 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mXAhDWeg4FppfNQ6iuzxrNZAnyuZ+kfmFUquINrfenjQ6R7+xnFg9Qktm34BoLRKKHWD8EsHaA1id7ZUFux90TUUl/JYkYN6BGFLSaJoItG1vh8f5D1pc5MH7f2Y52+6CoDpCcxWpe+Kjaa8ZB8OxfAxcDmbpbKtFKZBphn0oKpNfED1kf9lls0Y7F/IugRoRoGlPEVnkcEr6nnmXtRwc3CPLT16cnuo3i0hAHRpmkgIlgvVfmPzcMz1Ze4EEL92X2s/12TQ6OGX0br1TZxBoYOwuX7vtbZAZMzZA1PrIIyme2KfAFc4wrV1NBpYZ3W/oD6Spl/HuJ3pR5dsizKSzQ== 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=Aya8guyxdUIOxxdwaEDcLy/dIdIRjxQBqt8b41zn4b8=; b=mheVrrJFPksEgExiG4lAtLYFNIG0wxLgUh31vCPqFZyhCkF7lpG0gB272EhyAXDRmXmZQOOun1ExibYyleF6q+NwhBhYxRSsomxe1x/Q+3e8zSAolyK7bNokgKIyDb4kk/SN+dFCoYuKujYiPE2B1l6Wm+E/WG4BegxVDZnxz5x4QYTqc7hQyEL0EJ9XTqFhfsdMlHUVp7XEVFNhRxAsYFTlE7j20C7Q++HrpF2ErP6lAEkhDoTKl+3TTVPHCYWwuHl2GmXQpuI6/IMK68VHc1FmXz7FDSvyGgcJWDQyfkuW24w8tEdQ1+VkLsfNTtAne4sY13hwYPVWQCdzOUV/RA== 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=Aya8guyxdUIOxxdwaEDcLy/dIdIRjxQBqt8b41zn4b8=; b=RLiaoG4Vrml+wPhoUWaD4hOHBAGPZWZSTAhiGtxKofNiROk7gF0CwMBuHXA5cksUU30871vdm04h/FTJQogkkVb7Dw6Vhtr2EHiye7nYneomay15KoL8tHGNK/5kKCHp29jj8RkuQ30zotM9smjQPVMVnu0plQpaxdSc+Bt8iPA= Received: from DM6PR12MB3163.namprd12.prod.outlook.com (20.179.104.150) by DM6PR12MB3372.namprd12.prod.outlook.com (20.178.198.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2263.22; Thu, 19 Sep 2019 19:53:31 +0000 Received: from DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::400e:f0c3:7ca:2fcc]) by DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::400e:f0c3:7ca:2fcc%6]) with mapi id 15.20.2284.009; Thu, 19 Sep 2019 19:53:31 +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: [RFC PATCH v2 34/44] UefiCpuPkg/MpInitLib: Update CPU MP data with a flag to indicate if SEV-ES is active Thread-Topic: [RFC PATCH v2 34/44] UefiCpuPkg/MpInitLib: Update CPU MP data with a flag to indicate if SEV-ES is active Thread-Index: AQHVbyPYDo8W7uu+LES7nsMcHaZ0ig== Date: Thu, 19 Sep 2019 19:53:02 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.17.1 x-clientproxiedby: SN4PR0501CA0146.namprd05.prod.outlook.com (2603:10b6:803:2c::24) To DM6PR12MB3163.namprd12.prod.outlook.com (2603:10b6:5:182::22) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Thomas.Lendacky@amd.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [165.204.78.1] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 7fc5a8ce-018d-4939-e0bb-08d73d3afb14 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600167)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020);SRVR:DM6PR12MB3372; x-ms-traffictypediagnostic: DM6PR12MB3372: x-ms-exchange-purlcount: 1 x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-forefront-prvs: 016572D96D x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(6029001)(4636009)(396003)(39860400002)(376002)(366004)(136003)(346002)(199004)(189003)(386003)(71200400001)(52116002)(14444005)(86362001)(14454004)(256004)(76176011)(99286004)(966005)(66446008)(64756008)(478600001)(19627235002)(66556008)(6666004)(118296001)(66946007)(66476007)(71190400001)(66066001)(5660300002)(6306002)(6512007)(5640700003)(476003)(2616005)(36756003)(11346002)(446003)(8676002)(6506007)(8936002)(1730700003)(81166006)(81156014)(2501003)(26005)(186003)(102836004)(50226002)(54906003)(486006)(6436002)(6486002)(2351001)(316002)(6116002)(3846002)(7736002)(305945005)(25786009)(2906002)(6916009)(4326008);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR12MB3372;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-message-info: S1IoaWOIugmtQ/reTeBaq5YvqxjAfgvQuV5rL45J0CNcGrHnwHvtoQWI+MNvUvVaEIeHL6BwCxZgLdYkYslDelKEqFrAjP8uVGVGDk91h2r6cA2WHx0O7+aGRlwqJzjc6seae7EcVOtKRrY+h/YnWSElqzIlwIEjNFRZ88Sno27ImCL0gpJlG6etI2aJynIuoVd2oFp74lMaqAGBVX67dEvz1VcTXiMqmzLB6vcYfYDYxONnqEF39CRKwNHinKfjRy2aY8RBHD3IBYxKvdhrGybohk37x/LRCtB4QalIdYbpJuSeTqj6Mqz7clLkzNhvM3yinDNn5J/68htzmeAUQxXbDWwDNdUodbQK6Nah5dy3C3OBWezoDeZpYykVlvm6G4sQKTVO3e7uxCI9dZDk3h30jNkvOt1hwyEraFjfIFk= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7fc5a8ce-018d-4939-e0bb-08d73d3afb14 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Sep 2019 19:53:02.7890 (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: 31rlw5JKZkKgLgx+Wg/mL3Jk/VpDCl3VYiiCNc21XE0jTxGO7GQQAo4sdheQcjF+HeZEWzXvv6wDVfDpYbTlhw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3372 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-ID: <95AB333D2576334CAAB7CB14D749A432@namprd12.prod.outlook.com> Content-Transfer-Encoding: quoted-printable From: Tom Lendacky BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2198 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 PcdSevEsActive. This flag can then be used to determine if SEV-ES is active. 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/Lib= rary/MpInitLib/DxeMpInitLib.inf index 37b3f64e578a..557507e9a466 100644 --- a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf +++ b/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf @@ -68,4 +68,5 @@ [Pcd] gUefiCpuPkgTokenSpaceGuid.PcdCpuApLoopMode ## CONS= UMES gUefiCpuPkgTokenSpaceGuid.PcdCpuApTargetCstate ## SOME= TIMES_CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard ## CONS= UMES + gEfiMdeModulePkgTokenSpaceGuid.PcdSevEsActive ## CONS= UMES =20 diff --git a/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf b/UefiCpuPkg/Lib= rary/MpInitLib/PeiMpInitLib.inf index 82b77b63ea87..f26ffd5a2ef5 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 + gEfiMdeModulePkgTokenSpaceGuid.PcdSevEsActive ## CONS= UMES =20 [Guids] gEdkiiS3SmmInitDoneGuid diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h b/UefiCpuPkg/Library/MpIn= itLib/MpLib.h index 107872b3679c..1dfe9a9cd756 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.h +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h @@ -260,6 +260,8 @@ struct _CPU_MP_DATA { // driver. // BOOLEAN WakeUpByInitSipiSipi; + + BOOLEAN SevEsActive; }; =20 extern EFI_GUID mCpuInitMpLibHobGuid; diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpIn= itLib/MpLib.c index d6f84c6f45c0..3e20900ec7bc 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c @@ -1657,6 +1657,7 @@ MpInitLibInitialize ( CpuMpData->MicrocodePatchAddress =3D OldCpuMpData->MicrocodePatchAd= dress; } InitializeSpinLock(&CpuMpData->MpLock); + CpuMpData->SevEsActive =3D PcdGetBool (PcdSevEsActive); =20 // // Make sure no memory usage outside of the allocated buffer. --=20 2.17.1