From nobody Fri Feb 6 15:35:47 2026 Delivered-To: importer@patchew.org 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+43622+1787277+3901457@groups.io; helo=web01.groups.io; 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+43622+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1562896405; cv=none; d=zoho.com; s=zohoarc; b=l61jeC6UPEOHXY+fSUfIdb3T0Rf9xcFTJmaXy6SjZzkLeA5xClqjiaE5GpKfpMgURcxkqXrFOi55C0x/O6Emw3iq/sU9nLMFI7V+ytoT8EI4D+TycAyk6rFwmBXJjf7WbNQeKFWjWdZIGt65LihiH6Y2IE12Jl3DGy6vLmWlWrE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562896405; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=M7cpwu521LC1e82dHcw2cbapfFUFCa2AZu2L+XfKVD4=; b=jJQOpad8TfK793u7tDWcmVqmqRBPwa25jACFI8Gc1/40qTo9bsfICdtmY8R8jEE3BILXAvDO5r90lkth319dNqEJqlUJSdjtY/Er/+RhKzAsGTbkWkHsBG3UFTWysu8ZfI26bVzEmf4Qq2RpUWPfNvSCNFtnOnaH5NJFZmVKD7o= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+43622+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1562896405729832.1450499037048; Thu, 11 Jul 2019 18:53:25 -0700 (PDT) Return-Path: X-Received: from mga01.intel.com (mga01.intel.com []) by groups.io with SMTP; Thu, 11 Jul 2019 18:53:24 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Jul 2019 18:53:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,480,1557212400"; d="scan'208";a="249985067" X-Received: from ydong10-win10.ccr.corp.intel.com ([10.239.158.133]) by orsmga001.jf.intel.com with ESMTP; 11 Jul 2019 18:53:22 -0700 From: "Dong, Eric" To: devel@edk2.groups.io Cc: Ray Ni , Laszlo Ersek , Chandana Kumar , Star Zeng Subject: [edk2-devel] [Patch 1/2] UefiCpuPkg/RegisterCpuFeaturesLib: Avoid AP calls gBS service. Date: Fri, 12 Jul 2019 09:53:07 +0800 Message-Id: <20190712015308.26492-2-eric.dong@intel.com> In-Reply-To: <20190712015308.26492-1-eric.dong@intel.com> References: <20190712015308.26492-1-eric.dong@intel.com> MIME-Version: 1.0 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,eric.dong@intel.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1562896405; bh=EkM00xoEyp9d+QdOprUyXEY/nD5YVTQa3B3yFPjTJz4=; h=Cc:Date:From:Reply-To:Subject:To; b=ZHIZ92y8tYeJBhTcW2egzpHvvLyjdOzZ6hVqzNMfwRVuwLg3HqvTH4qvma7tbdQ4eHz 5eNLiCO6XhhnlREUV5REbcf4mjpDj8Sb4B5c3Ic0VD/1CJiE+/2BSlJsfXXahUIujC42y CnOKk1ohuYWKrIhaMIQudUWDxcdABqonmjw= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1972 AP calls CollectProcessorData() to collect processor info. CollectProcessorData function finally calls PcdGetSize function to get DynamicPCD PcdCpuFeaturesSetting value. PcdGetSize will use gBS which caused below assert info: Processor Info: Package: 1, MaxCore : 4, MaxThread: 1 Package: 0, Valid Core : 4 ASSERT [CpuFeaturesPei] c:\projects\jsl\jsl_v1193\Edk2\MdePkg\Library \PeiServicesTablePointerLibIdt\PeiServicesTablePointer.c(48): PeiServices !=3D ((void *) 0) This change uses saved global pcd size instead of calls PcdGetSize to fix this issue. Cc: Ray Ni Cc: Laszlo Ersek Cc: Chandana Kumar Cc: Star Zeng Signed-off-by: Eric Dong Reviewed-by: Ray Ni --- .../RegisterCpuFeaturesLib/CpuFeaturesInitialize.c | 13 ++++++++----- .../RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c | 5 +++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitializ= e.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c index aff7ad600c..87bfc64250 100644 --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c @@ -246,19 +246,20 @@ CpuInitDataInitialize ( =20 @param[in] SupportedFeatureMask The pointer to CPU feature bits mask b= uffer @param[in] OrFeatureBitMask The feature bit mask to do OR operation + @param[in] BitMaskSize The CPU feature bits mask buffer size. + **/ VOID SupportedMaskOr ( IN UINT8 *SupportedFeatureMask, - IN UINT8 *OrFeatureBitMask + IN UINT8 *OrFeatureBitMask, + IN UINT32 BitMaskSize ) { UINTN Index; - UINTN BitMaskSize; UINT8 *Data1; UINT8 *Data2; =20 - BitMaskSize =3D PcdGetSize (PcdCpuFeaturesSetting); Data1 =3D SupportedFeatureMask; Data2 =3D OrFeatureBitMask; for (Index =3D 0; Index < BitMaskSize; Index++) { @@ -384,12 +385,14 @@ CollectProcessorData ( // SupportedMaskOr ( CpuFeaturesData->InitOrder[ProcessorNumber].FeaturesSupportedMask, - CpuFeature->FeatureMask + CpuFeature->FeatureMask, + CpuFeaturesData->BitMaskSize ); } else if (CpuFeature->SupportFunc (ProcessorNumber, CpuInfo, CpuFeatu= re->ConfigData)) { SupportedMaskOr ( CpuFeaturesData->InitOrder[ProcessorNumber].FeaturesSupportedMask, - CpuFeature->FeatureMask + CpuFeature->FeatureMask, + CpuFeaturesData->BitMaskSize ); } Entry =3D Entry->ForwardLink; diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesL= ib.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c index fa0f0b41e2..36aabd7267 100644 --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c @@ -658,6 +658,11 @@ RegisterCpuFeatureWorker ( InitializeListHead (&CpuFeaturesData->FeatureList); InitializeSpinLock (&CpuFeaturesData->CpuFlags.MemoryMappedLock); InitializeSpinLock (&CpuFeaturesData->CpuFlags.ConsoleLogLock); + // + // Driver has assumption that these three PCD should has same buffer s= ize. + // + ASSERT (PcdGetSize (PcdCpuFeaturesSetting) =3D=3D PcdGetSize (PcdCpuFe= aturesCapability)); + ASSERT (PcdGetSize (PcdCpuFeaturesSetting) =3D=3D PcdGetSize (PcdCpuFe= aturesSupport)); CpuFeaturesData->BitMaskSize =3D (UINT32) BitMaskSize; } ASSERT (CpuFeaturesData->BitMaskSize =3D=3D BitMaskSize); --=20 2.21.0.windows.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 (#43622): https://edk2.groups.io/g/devel/message/43622 Mute This Topic: https://groups.io/mt/32437607/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-