From nobody Thu May 2 18:36:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+68544+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+68544+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1607513291; cv=none; d=zohomail.com; s=zohoarc; b=Ga8TOb+jMcxHRlAxVEvWHoV/CqZvu0F5Yo18Pc+bdydpHAoYtXhxIyDs8v/w7WEo7kTfAO0xrcgXaH6e8w7lPyJ1iivz+/Wte6sNxOyOTgtVnNSLfHpXnRqtJ/AK4CNzj3AAnh9YUXQsAkSePsIwS2JLJ/E1ZDKxOsi7sSg22As= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607513291; h=Content-Transfer-Encoding:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=BsSwMoAcH91k+W2Lpb0RHKMtDQIPb5S+24381v20ZHY=; b=eb8bGZSBWa4k/+5CqzmD54aLZUtAFJt+9Ylynwp+cyVETyb0eKLyQ6VGzkAgqVfmikd9XAd7zmA+5dZ3loF7oTphBvAuOmU6yJ0Qbn3Llxe93Kmivlo/D/FLmcpUIaeoGawHK2EmaE2ZVgLWC5HfP0cA/HgpqwAV5Hkr4f1GCbI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+68544+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 160751329162615.256314871551467; Wed, 9 Dec 2020 03:28:11 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id vwiWYY1788612xEbaYzOlkyA; Wed, 09 Dec 2020 03:28:11 -0800 X-Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web11.5127.1607513289296397056 for ; Wed, 09 Dec 2020 03:28:10 -0800 IronPort-SDR: AsqzVB5OrJj6I0UM0EOfrmwXc+Ma+2FuzhHgsgZtRi9XCDH+UF/faIsbIFAmoZwaySqMCcB7E/ pKHNy2KJh7eg== X-IronPort-AV: E=McAfee;i="6000,8403,9829"; a="235658425" X-IronPort-AV: E=Sophos;i="5.78,405,1599548400"; d="scan'208";a="235658425" X-Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Dec 2020 03:28:08 -0800 IronPort-SDR: dGkVUnRRU8hKoNB3JXKAcmTgsPK5nyDvEbM0Q+caLkFKLvC8BmR3I3DI218b/+p4zBIa+K7Pdc tGAUseYY+mfA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,405,1599548400"; d="scan'208";a="368150104" X-Received: from shwdeopenpsi068.ccr.corp.intel.com ([10.239.158.37]) by fmsmga004.fm.intel.com with ESMTP; 09 Dec 2020 03:28:06 -0800 From: "Zeng, Star" To: devel@edk2.groups.io Cc: Star Zeng , Ray Ni , Eric Dong , Laszlo Ersek Subject: [edk2-devel] [PATCH] UefiCpuPkg RegisterCpuFeaturesLib: Use AllocatePages() for InitOrder Date: Wed, 9 Dec 2020 19:27:57 +0800 Message-Id: <20201209112757.34196-1-star.zeng@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,star.zeng@intel.com X-Gm-Message-State: GIXH0uGpilz2LakplnJJF9l4x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1607513291; bh=nzlpmqN94Xtee22uPfVCNIKEmddEo+LKkcdFc9EfA4U=; h=Cc:Date:From:Reply-To:Subject:To; b=Wki+rp1Ed1T1y1gvAUYQ/l8ufksc8VqN4tVNwg4HXKalFogw9fzzF9z/KmlyyPX4wT6 8iuScpUnjGp9joX7KATH2zDQgVACWcgufEadmpnYInLVetoAqlz7fb0GVakPR1GqgLeKH UqHpiU6XNkl9gxJ/zhNoH7vNZS3vOn8bJQc= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" The required buffer size for InitOrder will be 96K when NumberOfCpus=3D1024. sizeof (CPU_FEATURES_INIT_ORDER) =3D 96 NumberOfCpus =3D 1024 =3D 1K sizeof (CPU_FEATURES_INIT_ORDER) * NumberOfCpus =3D 96K AllocateZeroPool() will call to PeiServicesAllocatePool() which will use EFI_HOB_MEMORY_POOL to management memory pool. EFI_HOB_MEMORY_POOL.Header.HobLength is UINT16 type, so there is no way for AllocateZeroPool() to allocate > 64K memory. So AllocateZeroPool() could not be used anymore for the case above or even bigger required buffer size. This patch updates the code to use AllocatePages() instead of AllocateZeroPool() to allocate buffer for InitOrder. Signed-off-by: Star Zeng Cc: Ray Ni Cc: Eric Dong Cc: Laszlo Ersek Reviewed-by: Ray Ni --- .../Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitializ= e.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c index d4a576385f0f..ba052732a86c 100644 --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c @@ -126,8 +126,9 @@ CpuInitDataInitialize ( =20 GetNumberOfProcessor (&NumberOfCpus, &NumberOfEnabledProcessors); =20 - CpuFeaturesData->InitOrder =3D AllocateZeroPool (sizeof (CPU_FEATURES_IN= IT_ORDER) * NumberOfCpus); + CpuFeaturesData->InitOrder =3D AllocatePages (EFI_SIZE_TO_PAGES (sizeof = (CPU_FEATURES_INIT_ORDER) * NumberOfCpus)); ASSERT (CpuFeaturesData->InitOrder !=3D NULL); + ZeroMem (CpuFeaturesData->InitOrder, sizeof (CPU_FEATURES_INIT_ORDER) * = NumberOfCpus); =20 // // Collect CPU Features information --=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 (#68544): https://edk2.groups.io/g/devel/message/68544 Mute This Topic: https://groups.io/mt/78826783/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-