From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 271D59411BE for ; Tue, 5 Dec 2023 05:49:19 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=/khxhjOL4H9HXZxDlaxWdr7x+CGbgJvespO0BhpqzlA=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1701755358; v=1; b=h1iUfr+yLszYXTpwRxPimcmfjQ6qNxnETV4oXz0i4b4xjlQHc+SkmC1bsRysOGutOjmFut2l ilf7h4C4hz1CnINYQYsvixG89ZTbTKhFsleTCeWPRudUQm9Lbz51/kyNYewlDhKfg3oE6JffxoS OmyMXGunV2jgges8Abd83HM0= X-Received: by 127.0.0.2 with SMTP id Xd08YY7687511xeHMM0OkDAz; Mon, 04 Dec 2023 21:49:18 -0800 X-Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web11.93095.1701755355027796431 for ; Mon, 04 Dec 2023 21:49:18 -0800 X-IronPort-AV: E=McAfee;i="6600,9927,10914"; a="378875426" X-IronPort-AV: E=Sophos;i="6.04,251,1695711600"; d="scan'208";a="378875426" X-Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2023 21:49:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10914"; a="720580527" X-IronPort-AV: E=Sophos;i="6.04,251,1695711600"; d="scan'208";a="720580527" X-Received: from shwdeopenlab702.ccr.corp.intel.com ([10.239.55.43]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2023 21:49:16 -0800 From: "duntan" To: devel@edk2.groups.io Cc: Eric Dong , Ray Ni , Rahul Kumar , Gerd Hoffmann Subject: [edk2-devel] [PATCH 1/6] UefiCpuPkg: Create gMpInformationHobGuid2 in UefiCpuPkg Date: Tue, 5 Dec 2023 13:48:55 +0800 Message-Id: <20231205054900.926-2-dun.tan@intel.com> In-Reply-To: <20231205054900.926-1-dun.tan@intel.com> References: <20231205054900.926-1-dun.tan@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: 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,dun.tan@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: ISsorI9r78SUrDGgMeunJiECx7686176AA= Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=h1iUfr+y; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Create gMpInformationHobGuid2 in UefiCpuPkg. Currently, there is a gMpInformationHobGuid defined, created and consumed only in StandaloneMmPkg. The HOB contains the EFI_PROCESSOR_INFORMATION structure for each CPU and the number of processors. This is the same as the information that PiSmmCpuDxeSmm uses MpService Protocol to get. This new gMpInformationHobGuid2 also contains the NumberOfProcessors and the EFI_PROCESSOR_INFORMATION for each CPU. Also the HOB is extended to support the case that the maximum HOB length is not enough for all CPU. So there might be more than one HOB instance in the HOB list. Each HOB describes the corresponding CPU index range. The plan is to create gMpInformationHob2Guid in CpuMpPei module(implemented in next commit). Then PiSmmCpuDxeSmm and other MM_STANDALONE modules can consume the hob. This can avoid calling MpService Protocol in PiSmmCpuDxeSmm. Also the issue that one gMpInformationHobGuid might be not enough when CPU number is 1~2000 or bigger can be solved. Signed-off-by: Dun Tan Cc: Eric Dong Cc: Ray Ni Cc: Rahul Kumar Cc: Gerd Hoffmann --- UefiCpuPkg/Include/Guid/MpInformation2.h | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ UefiCpuPkg/UefiCpuPkg.dec | 3 +++ 2 files changed, 59 insertions(+) diff --git a/UefiCpuPkg/Include/Guid/MpInformation2.h b/UefiCpuPkg/Include/Guid/MpInformation2.h new file mode 100644 index 0000000000..4164ce1c30 --- /dev/null +++ b/UefiCpuPkg/Include/Guid/MpInformation2.h @@ -0,0 +1,56 @@ +/** @file + EFI MP information protocol provides a lightweight MP_SERVICES_PROTOCOL. + + MP information protocol only provides static information of MP processor. + + If SwitchBSP or Enable/DisableAP in MP service is called between the HOB + production and HOB consumption, EFI_PROCESSOR_INFORMATION.StatusFlag and + NumberOfEnabledProcessors fields in this HOB may be invalidated. + + Copyright (c) 2023, Intel Corporation. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef MP_INFORMATION2_H_ +#define MP_INFORMATION2_H_ + +#include +#include +#include + +#define MP_INFORMATION2_HOB_REVISION 1 + +#define MP_INFORMATION2_GUID \ + { \ + 0x417a7f64, 0xf4e9, 0x4b32, {0x84, 0x6a, 0x5c, 0xc4, 0xd8, 0x62, 0x18, 0x79} \ + } + +typedef struct { + EFI_PROCESSOR_INFORMATION ProcessorInfo; + // + // Add more fields in future + // +} MP_INFORMATION2_ENTRY; + +typedef struct { + UINT16 NumberOfProcessors; + UINT16 EntrySize; + UINT8 Version; + UINT8 Reserved[3]; + UINT64 ProcessorIndex; + MP_INFORMATION2_ENTRY MpInformation[0]; +} MP_INFORMATION2_HOB_DATA; + +// +// Producer of MP_INFORMATION2_HOB_DATA should assign sizeof (MP_INFORMATION2_ENTRY) to MP_INFORMATION2_HOB_DATA.EntrySize +// Consumer of MP_INFORMATION2_HOB_DATA should use below macro or similar logic to get the individual entry +// as the entry structure might be updated to include more information. +// +#define GET_MP_INFORMATION_ENTRY(MpInfoHobData, Index) \ + (MP_INFORMATION2_ENTRY *)((UINTN)&((MP_INFORMATION2_HOB_DATA *)(MpInfoHobData))->MpInformation + (MpInfoHobData)->EntrySize * Index) + +extern EFI_GUID gMpInformationHobGuid2; + +#endif diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec index 0b5431dbf7..61bd34ef17 100644 --- a/UefiCpuPkg/UefiCpuPkg.dec +++ b/UefiCpuPkg/UefiCpuPkg.dec @@ -85,6 +85,9 @@ ## Include/Guid/SmmBaseHob.h gSmmBaseHobGuid = { 0xc2217ba7, 0x03bb, 0x4f63, {0xa6, 0x47, 0x7c, 0x25, 0xc5, 0xfc, 0x9d, 0x73 }} + ## Include/Guid/MpInformation2.h + gMpInformationHobGuid2 = { 0x417a7f64, 0xf4e9, 0x4b32, {0x84, 0x6a, 0x5c, 0xc4, 0xd8, 0x62, 0x18, 0x79 }} + [Protocols] ## Include/Protocol/SmmCpuService.h gEfiSmmCpuServiceProtocolGuid = { 0x1d202cab, 0xc8ab, 0x4d5c, { 0x94, 0xf7, 0x3c, 0xfc, 0xc0, 0xd3, 0xd3, 0x35 }} -- 2.31.1.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#112063): https://edk2.groups.io/g/devel/message/112063 Mute This Topic: https://groups.io/mt/102987137/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-