From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web10.53060.1600055202386457795 for ; Sun, 13 Sep 2020 20:46:42 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=DgMfCKJK; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: ray.ni@intel.com) IronPort-SDR: 7Si9ocRJe42+xx/326bSPVa4Mcp7BDDqTzO3H6It/e1sseOLYiCN2WhYPazYtNXKkDlSucb+sw ctSe2g9QDr+g== X-IronPort-AV: E=McAfee;i="6000,8403,9743"; a="159057511" X-IronPort-AV: E=Sophos;i="5.76,424,1592895600"; d="scan'208";a="159057511" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Sep 2020 20:46:41 -0700 IronPort-SDR: VxSwgn4+ys4X0/yMrF06bLQPdKS3KL6Aid57UXbAJdOkQaz6/ZG49Q86I3gYvMYDcUpT7+OD17 O2cWaTwZ70TQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,424,1592895600"; d="scan'208";a="335163501" Received: from orsmsx606.amr.corp.intel.com ([10.22.229.19]) by orsmga008.jf.intel.com with ESMTP; 13 Sep 2020 20:46:41 -0700 Received: from orsmsx606.amr.corp.intel.com (10.22.229.19) by ORSMSX606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Sun, 13 Sep 2020 20:46:41 -0700 Received: from orsmsx151.amr.corp.intel.com (10.22.226.38) by orsmsx606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Sun, 13 Sep 2020 20:46:41 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by ORSMSX151.amr.corp.intel.com (10.22.226.38) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 13 Sep 2020 20:46:41 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.175) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Sun, 13 Sep 2020 20:46:40 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QGODU+qqHdlMGmZlaRANXQiIB6esGg5Sep5PD0snTPgWgdNr14r/vPjzZOIbvz/O4To1UCYphSVyHtAAjgFvdBgcfqmQaPquHrgqH94YvBtQ1tI4HTni3g5C9+z15/zy/6Bi1oNeEM+FQDw8skaB5VwYmCyNOMcscUOnjmXg3BGT4z7x+OL8n31pnr/ZpJt/+nE6kNLXFtg0V3UvYmpATtcOq1VnmHrm+a/wPX4/RNlBz1fEY3TdFfxJRqJKVJMWjqI8QuCzWIJJuPGZi2egWehsSvejXW+4Spq5ZV6alVzg1f/2NWnOUU4i4LnAvTndjAyWklyVzpSW3mmZCJSymw== 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=S+aQ1G3a2WilzPKwRhU909G+vLRWjcbV7oxe7211AK0=; b=FUy/LMkOwftVcRnL+v4WesFeR8hZbW/dgra/DgFrzOovX2kI1eLhFSx1PRYNxc+kTiwgDRyjZjLbtOlmQR+V+QcffIN+S4fe8XQn3VTlAOVl4Ttsf+NuDHwBiLzCfkQ/kw+beaPy0gSlgmXlxfNAl+ktAbItQ909IdzieAFjPXBChyVf6hL57/maf4H4dXIHUZ9CrflZbn9jG57d3eTqiRT31bblJdpPmmX5+F823A3ist700AAUNN8KRqRIpBdXeniiOQWZvAVTIxnvzvkl6Eg6hRWKunzyguwEWIAWRCeVO8ahqjFwWlfXS7YWvOv80u3b76tJAYbRSgzo3JUtOA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=S+aQ1G3a2WilzPKwRhU909G+vLRWjcbV7oxe7211AK0=; b=DgMfCKJKRrFGS0iI49CD/rLmRuVIq+zYxvhYMneS+Ua11f/deuWRTraEyPVfH1XZehT5MDMkq4QBlALUGb/VHv+rklL0dHc9FfBNSI4sfIHeaf3bMnXgpM4Em5CScUKMWnU6cr4SAWPp+vhkgHmxsjCXYqAhLvnUoRoodPgBuns= Received: from BY5PR11MB4007.namprd11.prod.outlook.com (2603:10b6:a03:189::28) by BYAPR11MB2677.namprd11.prod.outlook.com (2603:10b6:a02:cd::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.18; Mon, 14 Sep 2020 03:46:38 +0000 Received: from BY5PR11MB4007.namprd11.prod.outlook.com ([fe80::1533:4053:1c45:3596]) by BY5PR11MB4007.namprd11.prod.outlook.com ([fe80::1533:4053:1c45:3596%6]) with mapi id 15.20.3370.018; Mon, 14 Sep 2020 03:46:38 +0000 From: "Ni, Ray" To: "Chiu, Chasel" , "devel@edk2.groups.io" CC: "Chiu, Chasel" , "Dong, Eric" , Laszlo Ersek , "Kumar, Rahul1" , "Desimone, Nathaniel L" Subject: Re: [PATCH v2] UefiCpuPkg/RegisterCpuFeaturesLib: Support MpServices2 only case. Thread-Topic: [PATCH v2] UefiCpuPkg/RegisterCpuFeaturesLib: Support MpServices2 only case. Thread-Index: AQHWijkrdt+0rOCIZE+mGkChGoNbxqlnfjlw Date: Mon, 14 Sep 2020 03:46:29 +0000 Deferred-Delivery: Mon, 14 Sep 2020 03:45:00 +0000 Message-ID: References: <20200914014827.14476-1-chasel.chiu@intel.com> In-Reply-To: <20200914014827.14476-1-chasel.chiu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.198.147.194] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 19038325-67f8-4896-cbc2-08d85860c933 x-ms-traffictypediagnostic: BYAPR11MB2677: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:873; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 8PM0qBeICJUVrRZtM54sMYgqvMZeHuyqZO0MYXCZdun87mNVwSMl7JCqPVk7g5w6Inl8krDnSJAzFEqWCTgcgQ2DYYW5SiOpU/chIRL1LIVySiOcyZdgAdHXo/1/WC2noOqYvoA5CMWuOO1tku0mNMkY1sUkcmm6eoxc/g6dgaZRNt7lW5jdwHogwCaFiHdw+rYq7k8htSF60SXOFNUDIOJfTdcUhwyRKypuZsR/k2UoBCtMuDeZV9gam4Gj4bVhxS48E7lqDvuBFyTCQEW7ax4hIdMtJOj/n7puBPD8Ev51ERh9DAKxSk5kzUU5anOo0WQzdmafAzXysu+l2bRYMAt6vjLyvmuSGMKmG4tLMiyg3kFP4AfqN3WF5eAWrHjK6AHTmGA2H+QvM3jbMjKjl0QwMYgzu4DrN/QvrCoFwNkSxVZzHxSZqUVFoarGMXo65rNLiei62Y97Z+E4rDhrgw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR11MB4007.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(6029001)(4636009)(39860400002)(346002)(396003)(136003)(376002)(366004)(316002)(64756008)(76116006)(4326008)(66946007)(66446008)(66556008)(66476007)(107886003)(9686003)(55016002)(8676002)(86362001)(7696005)(478600001)(6506007)(19627235002)(53546011)(8936002)(71200400001)(6666004)(110136005)(966005)(186003)(83380400001)(54906003)(33656002)(26005)(2906002)(5660300002)(52536014);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: teFM/ry/dX9YeOF73JHMCz/ghNyZhvXcIrYiacrZYqpkYMmwIA8Fvm8lv7SEunuG9Kuzl0cwitChbPW7y1efUnSUncf5W0EMvZw/z846t6IXvMHFH3DCHQfpyrGyq/vTOgr5vrbAQSK3XPeaLzPN3ui3y2c/oJWV08KT+Y/aPll5BGUbz45MRosTV9/5Qa9ra2QsliiddPsMWGuksW2/EON0sK2bQn5Dt/MnngC7uVT9PGrnIISSjltGouLxGsQovIdmDtxWNP+Lxe8TBbJiTvYTtx1BN7deFN2gS1L47g6WF/iPhsc8aU8CE2q5bOqtLskBgk647aDfN3AJeUIr1cFy2/HfCYvxVSHGIEdJ583lTj+SrHnKaUTc5hmCuSn0qcrySD/Bc3ZivpRUvzLPK1mHMV60SW4WR70wlcX1xoMng6fkUyG6mGniwi45qy0cjgMMtR0oYOdb08miRloKQvCyOF7bA0jmtyKHjalVVb9UFRe+V01PsGhSaz+gBgs7U2PIzwC1G7g5kVn+eG7nONMPu6r0bHkGUzXHH8GoiBZLuaPT1VO5AtmG5zmdtglL87hoIbanj9+VoH3dDvX+UGjhQbnL2knIMviylbm/8F8i3ST+edtbY/hrmcjYoB8pPgPvGQ/fUHGdBxlL/6wcug== MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BY5PR11MB4007.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 19038325-67f8-4896-cbc2-08d85860c933 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Sep 2020 03:46:38.6026 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: hI52N8Gh0uSiOR9/ciWxsVhjPQUCVycF8cKjg+8v6MdMtI8eUFtcydqyzW+HQrPFWSYqzEDUBPqSxjZmxsOidg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2677 Return-Path: ray.ni@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ray Ni > -----Original Message----- > From: Chasel Chiu > Sent: Monday, September 14, 2020 9:48 AM > To: devel@edk2.groups.io > Cc: Chiu, Chasel ; Dong, Eric ; > Ni, Ray ; Laszlo Ersek ; Kumar, Rahu= l1 > ; Desimone, Nathaniel L > > Subject: [PATCH v2] UefiCpuPkg/RegisterCpuFeaturesLib: Support MpServices= 2 > only case. >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2883 >=20 > MpServices Ppi can be replaced by MpServices2 Ppi and MpServices2 > Ppi is mandatory for RegisterCpuFeaturesLib functionality, > basing on this we can drop MpServices Ppi usage from the library > and the constraint that both Ppis must be installed. >=20 > Cc: Eric Dong > Cc: Ray Ni > Cc: Laszlo Ersek > Cc: Rahul Kumar > Cc: Nate DeSimone > Signed-off-by: Chasel Chiu > --- > UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.c = | > 61 +++++++++++++++++++++++-------------------------------------- > UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.inf = | 5 > ++--- > UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h = | 6 > +++--- > 3 files changed, 28 insertions(+), 44 deletions(-) >=20 > diff --git > a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.c > b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.c > index 64768f7a74..4e558e9fee 100644 > --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib= .c > +++ > b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.c > @@ -1,7 +1,7 @@ > /** @file > CPU Register Table Library functions. >=20 > - Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.
> + Copyright (c) 2016 - 2020, Intel Corporation. All rights reserved.
> SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > **/ > @@ -11,7 +11,6 @@ > #include > #include > #include > -#include > #include >=20 > #include "RegisterCpuFeatures.h" > @@ -75,10 +74,10 @@ GetMpService ( > MP_SERVICES MpService; >=20 > // > - // Get MP Services Protocol > + // Get MP Services2 Ppi > // > Status =3D PeiServicesLocatePpi ( > - &gEfiPeiMpServicesPpiGuid, > + &gEdkiiPeiMpServices2PpiGuid, > 0, > NULL, > (VOID **)&MpService.Ppi > @@ -100,17 +99,17 @@ GetProcessorIndex ( > ) > { > EFI_STATUS Status; > - EFI_PEI_MP_SERVICES_PPI *CpuMpPpi; > + EDKII_PEI_MP_SERVICES2_PPI *CpuMp2Ppi; > UINTN ProcessorIndex; >=20 > - CpuMpPpi =3D CpuFeaturesData->MpService.Ppi; > + CpuMp2Ppi =3D CpuFeaturesData->MpService.Ppi; >=20 > // > // For two reasons which use NULL for WhoAmI: > // 1. This function will be called by APs and AP should not use PeiSer= vices > Table > // 2. Check WhoAmI implementation, this parameter will not be used. > // > - Status =3D CpuMpPpi->WhoAmI(NULL, CpuMpPpi, &ProcessorIndex); > + Status =3D CpuMp2Ppi->WhoAmI (CpuMp2Ppi, &ProcessorIndex); > ASSERT_EFI_ERROR (Status); > return ProcessorIndex; > } > @@ -131,16 +130,15 @@ GetProcessorInformation ( > OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer > ) > { > - EFI_PEI_MP_SERVICES_PPI *CpuMpPpi; > + EDKII_PEI_MP_SERVICES2_PPI *CpuMp2Ppi; > EFI_STATUS Status; > CPU_FEATURES_DATA *CpuFeaturesData; >=20 > CpuFeaturesData =3D GetCpuFeaturesData (); > - CpuMpPpi =3D CpuFeaturesData->MpService.Ppi; > + CpuMp2Ppi =3D CpuFeaturesData->MpService.Ppi; >=20 > - Status =3D CpuMpPpi->GetProcessorInfo ( > - GetPeiServicesTablePointer(), > - CpuMpPpi, > + Status =3D CpuMp2Ppi->GetProcessorInfo ( > + CpuMp2Ppi, > ProcessorNumber, > ProcessorInfoBuffer > ); > @@ -162,18 +160,17 @@ StartupAllAPsWorker ( > ) > { > EFI_STATUS Status; > - EFI_PEI_MP_SERVICES_PPI *CpuMpPpi; > + EDKII_PEI_MP_SERVICES2_PPI *CpuMp2Ppi; > CPU_FEATURES_DATA *CpuFeaturesData; >=20 > CpuFeaturesData =3D GetCpuFeaturesData (); > - CpuMpPpi =3D CpuFeaturesData->MpService.Ppi; > + CpuMp2Ppi =3D CpuFeaturesData->MpService.Ppi; >=20 > // > // Wakeup all APs for data collection. > // > - Status =3D CpuMpPpi->StartupAllAPs ( > - GetPeiServicesTablePointer (), > - CpuMpPpi, > + Status =3D CpuMp2Ppi->StartupAllAPs ( > + CpuMp2Ppi, > Procedure, > FALSE, > 0, > @@ -203,17 +200,7 @@ StartupAllCPUsWorker ( > // > // Get MP Services2 Ppi > // > - Status =3D PeiServicesLocatePpi ( > - &gEdkiiPeiMpServices2PpiGuid, > - 0, > - NULL, > - (VOID **)&CpuMp2Ppi > - ); > - ASSERT_EFI_ERROR (Status); > - > - // > - // Wakeup all APs for data collection. > - // > + CpuMp2Ppi =3D CpuFeaturesData->MpService.Ppi; > Status =3D CpuMp2Ppi->StartupAllCPUs ( > CpuMp2Ppi, > Procedure, > @@ -234,18 +221,17 @@ SwitchNewBsp ( > ) > { > EFI_STATUS Status; > - EFI_PEI_MP_SERVICES_PPI *CpuMpPpi; > + EDKII_PEI_MP_SERVICES2_PPI *CpuMp2Ppi; > CPU_FEATURES_DATA *CpuFeaturesData; >=20 > CpuFeaturesData =3D GetCpuFeaturesData (); > - CpuMpPpi =3D CpuFeaturesData->MpService.Ppi; > + CpuMp2Ppi =3D CpuFeaturesData->MpService.Ppi; >=20 > // > // Wakeup all APs for data collection. > // > - Status =3D CpuMpPpi->SwitchBSP ( > - GetPeiServicesTablePointer (), > - CpuMpPpi, > + Status =3D CpuMp2Ppi->SwitchBSP ( > + CpuMp2Ppi, > ProcessorNumber, > TRUE > ); > @@ -269,18 +255,17 @@ GetNumberOfProcessor ( > ) > { > EFI_STATUS Status; > - EFI_PEI_MP_SERVICES_PPI *CpuMpPpi; > + EDKII_PEI_MP_SERVICES2_PPI *CpuMp2Ppi; > CPU_FEATURES_DATA *CpuFeaturesData; >=20 > CpuFeaturesData =3D GetCpuFeaturesData (); > - CpuMpPpi =3D CpuFeaturesData->MpService.Ppi; > + CpuMp2Ppi =3D CpuFeaturesData->MpService.Ppi; >=20 > // > // Get the number of CPUs > // > - Status =3D CpuMpPpi->GetNumberOfProcessors ( > - GetPeiServicesTablePointer (), > - CpuMpPpi, > + Status =3D CpuMp2Ppi->GetNumberOfProcessors ( > + CpuMp2Ppi, > NumberOfCpus, > NumberOfEnabledProcessors > ); > diff --git > a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.inf > b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.inf > index 61f922bf63..196c72eb85 100644 > --- > a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.inf > +++ > b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.inf > @@ -1,7 +1,7 @@ > ## @file > # Register CPU Features Library PEI instance. > # > -# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved. > +# Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved. > # SPDX-License-Identifier: BSD-2-Clause-Patent > # > ## > @@ -45,7 +45,6 @@ > IoLib >=20 > [Ppis] > - gEfiPeiMpServicesPpiGuid #= # CONSUMES > gEdkiiPeiMpServices2PpiGuid #= # CONSUMES >=20 > [Pcd] > @@ -55,4 +54,4 @@ > gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSetting #= # > CONSUMES ## PRODUCES >=20 > [Depex] > - gEfiPeiMpServicesPpiGuid AND gEdkiiCpuFeaturesSetDoneGuid > + gEdkiiPeiMpServices2PpiGuid AND gEdkiiCpuFeaturesSetDoneGuid > diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeature= s.h > b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h > index 53cb340b4c..e8a4aa644d 100644 > --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h > +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h > @@ -10,7 +10,7 @@ > #define _REGISTER_CPU_FEATURES_H_ > #include > #include > -#include > +#include > #include >=20 > #include > @@ -64,8 +64,8 @@ typedef struct { > } PROGRAM_CPU_REGISTER_FLAGS; >=20 > typedef union { > - EFI_MP_SERVICES_PROTOCOL *Protocol; > - EFI_PEI_MP_SERVICES_PPI *Ppi; > + EFI_MP_SERVICES_PROTOCOL *Protocol; > + EDKII_PEI_MP_SERVICES2_PPI *Ppi; > } MP_SERVICES; >=20 > typedef struct { > -- > 2.13.3.windows.1