From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.24; helo=mga09.intel.com; envelope-from=ray.ni@intel.com; receiver=edk2-devel@lists.01.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 281E3211E82FB for ; Tue, 2 Apr 2019 00:15:58 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Apr 2019 00:15:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,298,1549958400"; d="scan'208";a="332914470" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga006.fm.intel.com with ESMTP; 02 Apr 2019 00:15:58 -0700 Received: from fmsmsx113.amr.corp.intel.com (10.18.116.7) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 2 Apr 2019 00:15:58 -0700 Received: from shsmsx153.ccr.corp.intel.com (10.239.6.53) by FMSMSX113.amr.corp.intel.com (10.18.116.7) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 2 Apr 2019 00:15:57 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.92]) by SHSMSX153.ccr.corp.intel.com ([169.254.12.139]) with mapi id 14.03.0415.000; Tue, 2 Apr 2019 15:15:55 +0800 From: "Ni, Ray" To: "Dong, Eric" , "edk2-devel@lists.01.org" Thread-Topic: [edk2] [Patch v2 2/4] UefiCpuPkg/RegisterCpuFeaturesLib: Optimize PCD PcdCpuFeaturesUserConfiguration. Thread-Index: AQHUz/FQlLkvFAaU/0idi6qrmqQeH6YopuKg Date: Tue, 2 Apr 2019 07:15:55 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C0C2865@SHSMSX104.ccr.corp.intel.com> References: <20190301053957.3572-1-eric.dong@intel.com> <20190301053957.3572-3-eric.dong@intel.com> In-Reply-To: <20190301053957.3572-3-eric.dong@intel.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch v2 2/4] UefiCpuPkg/RegisterCpuFeaturesLib: Optimize PCD PcdCpuFeaturesUserConfiguration. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Apr 2019 07:15:59 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Minor comments: 1. Please add "CONST" before AndFeatureBitMask to declare that it won't be = changed in the routine. SupportedMaskAnd ( IN UINT8 *SupportedFeatureMask, IN CONST UINT8 *AndFeatureBitMask ) 2. Please update the year in the copyright. With these comments addressed, Reviewed-by: Ray Ni > -----Original Message----- > From: edk2-devel On Behalf Of Eric Dong > Sent: Friday, March 1, 2019 1:40 PM > To: edk2-devel@lists.01.org > Subject: [edk2] [Patch v2 2/4] UefiCpuPkg/RegisterCpuFeaturesLib: Optimiz= e > PCD PcdCpuFeaturesUserConfiguration. >=20 > Merge PcdCpuFeaturesUserConfiguration into PcdCpuFeaturesSetting. > Use PcdCpuFeaturesSetting as input for the user input feature setting Use > PcdCpuFeaturesSetting as output for the final CPU feature setting >=20 > BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=3D1375 >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Eric Dong > --- > .../RegisterCpuFeaturesLib/CpuFeaturesInitialize.c | 71 +++++-----------= ------ > .../DxeRegisterCpuFeaturesLib.inf | 3 +- > .../PeiRegisterCpuFeaturesLib.inf | 3 +- > .../RegisterCpuFeaturesLib/RegisterCpuFeatures.h | 1 - > UefiCpuPkg/UefiCpuPkg.dec | 9 +-- > 5 files changed, 21 insertions(+), 66 deletions(-) >=20 > diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitial= ize.c > b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c > index bae92b89a6..d877caff74 100644 > --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c > +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c > @@ -21,16 +21,21 @@ CHAR16 *mRegisterTypeStr[] =3D {L"MSR", L"CR", > L"MMIO", L"CACHE", L"SEMAP", L"INVA > Worker function to save PcdCpuFeaturesCapability. >=20 > @param[in] SupportedFeatureMask The pointer to CPU feature bits mask > buffer > + @param[in] FeatureMaskSize CPU feature bits mask buffer size. > + > **/ > VOID > SetCapabilityPcd ( > - IN UINT8 *SupportedFeatureMask > + IN UINT8 *SupportedFeatureMask, > + IN UINT32 FeatureMaskSize > ) > { > EFI_STATUS Status; > UINTN BitMaskSize; >=20 > BitMaskSize =3D PcdGetSize (PcdCpuFeaturesCapability); > + ASSERT (FeatureMaskSize =3D=3D BitMaskSize); > + > Status =3D PcdSetPtrS (PcdCpuFeaturesCapability, &BitMaskSize, > SupportedFeatureMask); > ASSERT_EFI_ERROR (Status); > } > @@ -53,48 +58,6 @@ SetSettingPcd ( > ASSERT_EFI_ERROR (Status); > } >=20 > -/** > - Worker function to get PcdCpuFeaturesSupport. > - > - @return The pointer to CPU feature bits mask buffer. > -**/ > -UINT8 * > -GetSupportPcd ( > - VOID > - ) > -{ > - UINT8 *SupportBitMask; > - > - SupportBitMask =3D AllocateCopyPool ( > - PcdGetSize (PcdCpuFeaturesSupport), > - PcdGetPtr (PcdCpuFeaturesSupport) > - ); > - ASSERT (SupportBitMask !=3D NULL); > - > - return SupportBitMask; > -} > - > -/** > - Worker function to get PcdCpuFeaturesUserConfiguration. > - > - @return The pointer to CPU feature bits mask buffer. > -**/ > -UINT8 * > -GetConfigurationPcd ( > - VOID > - ) > -{ > - UINT8 *SupportBitMask; > - > - SupportBitMask =3D AllocateCopyPool ( > - PcdGetSize (PcdCpuFeaturesUserConfiguration), > - PcdGetPtr (PcdCpuFeaturesUserConfiguration) > - ); > - ASSERT (SupportBitMask !=3D NULL); > - > - return SupportBitMask; > -} > - > /** > Collects CPU type and feature information. >=20 > @@ -287,7 +250,6 @@ CpuInitDataInitialize ( > // Get support and configuration PCDs > // > CpuFeaturesData->SupportPcd =3D GetSupportPcd (); > - CpuFeaturesData->ConfigurationPcd =3D GetConfigurationPcd (); } >=20 > /** > @@ -610,16 +572,9 @@ AnalysisProcessorFeatures ( > // > // Calculate the last setting > // > - > CpuFeaturesData->SettingPcd =3D AllocateCopyPool (CpuFeaturesData- > >BitMaskSize, CpuFeaturesData->CapabilityPcd); > ASSERT (CpuFeaturesData->SettingPcd !=3D NULL); > - SupportedMaskAnd (CpuFeaturesData->SettingPcd, CpuFeaturesData- > >ConfigurationPcd); > - > - // > - // Save PCDs and display CPU PCDs > - // > - SetCapabilityPcd (CpuFeaturesData->CapabilityPcd); > - SetSettingPcd (CpuFeaturesData->SettingPcd); > + SupportedMaskAnd (CpuFeaturesData->SettingPcd, PcdGetPtr > + (PcdCpuFeaturesSetting)); >=20 > // > // Dump the last CPU feature list > @@ -643,14 +598,20 @@ AnalysisProcessorFeatures ( > } > DEBUG ((DEBUG_INFO, "PcdCpuFeaturesSupport:\n")); > DumpCpuFeatureMask (CpuFeaturesData->SupportPcd); > - DEBUG ((DEBUG_INFO, "PcdCpuFeaturesUserConfiguration:\n")); > - DumpCpuFeatureMask (CpuFeaturesData->ConfigurationPcd); > DEBUG ((DEBUG_INFO, "PcdCpuFeaturesCapability:\n")); > DumpCpuFeatureMask (CpuFeaturesData->CapabilityPcd); > - DEBUG ((DEBUG_INFO, "PcdCpuFeaturesSetting:\n")); > + DEBUG ((DEBUG_INFO, "Origin PcdCpuFeaturesSetting:\n")); > + DumpCpuFeatureMask (PcdGetPtr (PcdCpuFeaturesSetting)); > + DEBUG ((DEBUG_INFO, "Final PcdCpuFeaturesSetting:\n")); > DumpCpuFeatureMask (CpuFeaturesData->SettingPcd); > ); >=20 > + // > + // Save PCDs and display CPU PCDs > + // > + SetCapabilityPcd (CpuFeaturesData->CapabilityPcd, > + CpuFeaturesData->BitMaskSize); SetSettingPcd > + (CpuFeaturesData->SettingPcd); > + > for (ProcessorNumber =3D 0; ProcessorNumber < NumberOfCpus; > ProcessorNumber++) { > CpuInitOrder =3D &CpuFeaturesData->InitOrder[ProcessorNumber]; > Entry =3D GetFirstNode (&CpuFeaturesData->FeatureList); diff --git > a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.inf > b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.inf > index 362e0c6cd1..957ca87ff1 100644 > --- > a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.inf > +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLi > +++ b.inf > @@ -56,9 +56,8 @@ > [Pcd] > gUefiCpuPkgTokenSpaceGuid.PcdCpuS3DataAddress #= # > CONSUMES > gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSupport #= # > CONSUMES > - gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesUserConfiguration #= # > CONSUMES > gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesCapability #= # > PRODUCES > - gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSetting #= # > PRODUCES > + gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSetting #= # > PRODUCES ## CONSUMES >=20 > [Depex] > gEfiMpServiceProtocolGuid AND gEdkiiCpuFeaturesSetDoneGuid diff --git > a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.inf > b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.inf > index f3907e25d3..659aa9eaaf 100644 > --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib= .inf > +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLi > +++ b.inf > @@ -57,9 +57,8 @@ > [Pcd] > gUefiCpuPkgTokenSpaceGuid.PcdCpuS3DataAddress #= # > CONSUMES > gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSupport #= # > CONSUMES > - gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesUserConfiguration #= # > CONSUMES > gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesCapability #= # > PRODUCES > - gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSetting #= # > PRODUCES > + gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSetting #= # > CONSUMES ## PRODUCES >=20 > [Depex] > gEfiPeiMpServicesPpiGuid AND gEdkiiCpuFeaturesSetDoneGuid diff --git > a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h > b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h > index 21dd5773a6..3e0a342fd1 100644 > --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h > +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h > @@ -83,7 +83,6 @@ typedef struct { > CPU_FEATURES_INIT_ORDER *InitOrder; > UINT8 *SupportPcd; > UINT8 *CapabilityPcd; > - UINT8 *ConfigurationPcd; > UINT8 *SettingPcd; >=20 > UINT32 NumberOfCpus; > diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec index > cb05fa2660..cd9b2d1b03 100644 > --- a/UefiCpuPkg/UefiCpuPkg.dec > +++ b/UefiCpuPkg/UefiCpuPkg.dec > @@ -261,10 +261,6 @@ > # @Prompt SMM CPU Synchronization Method. >=20 > gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmSyncMode|0x00|UINT8|0x60000014 >=20 > - ## Specifies user's desired settings for enabling/disabling processor = features. > - # @Prompt User settings for enabling/disabling processor features. > - gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesUserConfiguration|{0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}|VOID*|0x00000017 > - > ## Specifies the On-demand clock modulation duty cycle when ACPI featu= re is > enabled. > # @Prompt The encoded values for target duty cycle modulation. > # @ValidRange 0x80000001 | 0 - 15 > @@ -292,8 +288,9 @@ > # @ValidList 0x80000001 | 0 > gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesCapability|{0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00}|VOID*|0x00000018 >=20 > - ## Specifies actual settings for processor features, each bit correspo= nding to a > specific feature. > - # @Prompt Actual processor feature settings. > + ## As input, specifies user's desired settings for enabling/disabling = processor > features. > + ## As output, specifies actual settings for processor features, each b= it > corresponding to a specific feature. > + # @Prompt As input, specifies user's desired processor feature setting= s. As > output, specifies actual processor feature settings. > # @ValidList 0x80000001 | 0 > gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSetting|{0x00, 0x00, 0x00, 0x0= 0, > 0x00, 0x00, 0x00, 0x00}|VOID*|0x00000019 >=20 > -- > 2.15.0.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel