From: "Ni, Ray" <ray.ni@intel.com>
To: Gerd Hoffmann <kraxel@redhat.com>,
"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: Oliver Steffen <osteffen@redhat.com>,
Laszlo Ersek <lersek@redhat.com>,
"Kumar, Rahul R" <rahul.r.kumar@intel.com>
Subject: Re: [edk2-devel] [PATCH 2/5] UefiCpuPkg/MpInitLib: Add support for multiple HOBs to GetBspNumber()
Date: Mon, 19 Feb 2024 02:41:16 +0000 [thread overview]
Message-ID: <MN6PR11MB8244A8CC3C051584859140F58C512@MN6PR11MB8244.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20240215093149.251319-3-kraxel@redhat.com>
Since MpHandOff HOBs are created by the PEI instance of MpInitLib, I am ok that the consumer (DXE instance)
assumes the HOB instances are created in the order of ProcessorIndex.
Please update the patch accordingly with the change of GetMpHandOffHob() I commented to patch #1.
Thanks,
Ray
> -----Original Message-----
> From: Gerd Hoffmann <kraxel@redhat.com>
> Sent: Thursday, February 15, 2024 5:32 PM
> To: devel@edk2.groups.io
> Cc: Oliver Steffen <osteffen@redhat.com>; Ni, Ray <ray.ni@intel.com>; Laszlo
> Ersek <lersek@redhat.com>; Kumar, Rahul R <rahul.r.kumar@intel.com>;
> Gerd Hoffmann <kraxel@redhat.com>
> Subject: [PATCH 2/5] UefiCpuPkg/MpInitLib: Add support for multiple HOBs to
> GetBspNumber()
>
> Remove the MpHandOff parameter. This is not useful in case multiple
> HOBs are present in the system. The function will use GetMpHandOffHob()
> to loop over all HOBs instead.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
> UefiCpuPkg/Library/MpInitLib/MpLib.c | 26 ++++++++++++++++----------
> 1 file changed, 16 insertions(+), 10 deletions(-)
>
> diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> index e0a2366073a7..8e6cf50ed171 100644
> --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> @@ -1894,26 +1894,32 @@ CheckAllAPs (
> /**
> This function Get BspNumber.
>
> - @param[in] MpHandOff Pointer to MpHandOff
> @return BspNumber
> **/
> UINT32
> GetBspNumber (
> - IN CONST MP_HAND_OFF *MpHandOff
> + VOID
> )
> {
> - UINT32 ApicId;
> - UINT32 BspNumber;
> - UINT32 Index;
> + UINT32 ApicId;
> + UINT32 BspNumber;
> + UINT32 Index;
> + MP_HAND_OFF *MpHandOff;
>
> //
> // Get the processor number for the BSP
> //
> BspNumber = MAX_UINT32;
> ApicId = GetInitialApicId ();
> - for (Index = 0; Index < MpHandOff->CpuCount; Index++) {
> - if (MpHandOff->Info[Index].ApicId == ApicId) {
> - BspNumber = Index;
> +
> + for (MpHandOff = GetMpHandOffHob (0);
> + MpHandOff != NULL;
> + MpHandOff = GetMpHandOffHob (MpHandOff->ProcessorIndex +
> MpHandOff->CpuCount))
> + {
> + for (Index = 0; Index < MpHandOff->CpuCount; Index++) {
> + if (MpHandOff->Info[Index].ApicId == ApicId) {
> + BspNumber = MpHandOff->ProcessorIndex + Index;
> + }
> }
> }
>
> @@ -1941,7 +1947,7 @@ SwitchApContext (
> UINTN Index;
> UINT32 BspNumber;
>
> - BspNumber = GetBspNumber (MpHandOff);
> + BspNumber = GetBspNumber ();
>
> for (Index = 0; Index < MpHandOff->CpuCount; Index++) {
> if (Index != BspNumber) {
> @@ -2191,7 +2197,7 @@ MpInitLibInitialize (
> }
>
> CpuMpData->CpuCount = MpHandOff->CpuCount;
> - CpuMpData->BspNumber = GetBspNumber (MpHandOff);
> + CpuMpData->BspNumber = GetBspNumber ();
> CpuInfoInHob = (CPU_INFO_IN_HOB
> *)(UINTN)CpuMpData->CpuInfoInHob;
> for (Index = 0; Index < CpuMpData->CpuCount; Index++) {
> InitializeSpinLock (&CpuMpData->CpuData[Index].ApLock);
> --
> 2.43.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115577): https://edk2.groups.io/g/devel/message/115577
Mute This Topic: https://groups.io/mt/104369845/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
next prev parent reply other threads:[~2024-02-19 2:41 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-15 9:31 [edk2-devel] [PATCH 0/5] UefiCpuPkg/MpInitLib: Add support for multiple MP_HAND_OFF HOBs Gerd Hoffmann
2024-02-15 9:31 ` [edk2-devel] [PATCH 1/5] UefiCpuPkg/MpInitLib: Add ProcessorIndex argument to GetMpHandOffHob() Gerd Hoffmann
2024-02-19 2:34 ` Ni, Ray
2024-02-19 9:51 ` Gerd Hoffmann
2024-02-20 3:42 ` Ni, Ray
2024-02-19 11:18 ` Laszlo Ersek
2024-02-15 9:31 ` [edk2-devel] [PATCH 2/5] UefiCpuPkg/MpInitLib: Add support for multiple HOBs to GetBspNumber() Gerd Hoffmann
2024-02-19 2:41 ` Ni, Ray [this message]
2024-02-19 11:18 ` Laszlo Ersek
2024-02-19 11:37 ` Gerd Hoffmann
2024-02-19 20:02 ` Laszlo Ersek
2024-02-15 9:31 ` [edk2-devel] [PATCH 3/5] UefiCpuPkg/MpInitLib: Add support for multiple HOBs to SwitchApContext() Gerd Hoffmann
2024-02-19 2:43 ` Ni, Ray
2024-02-19 11:25 ` Laszlo Ersek
2024-02-15 9:31 ` [edk2-devel] [PATCH 4/5] UefiCpuPkg/MpInitLib: Add support for multiple HOBs to MpInitLibInitialize Gerd Hoffmann
2024-02-19 2:57 ` Ni, Ray
2024-02-19 11:56 ` Laszlo Ersek
2024-02-15 9:31 ` [edk2-devel] [PATCH 5/5] UefiCpuPkg/MpInitLib: Add support for multiple HOBs to SaveCpuMpData() Gerd Hoffmann
2024-02-19 3:02 ` Ni, Ray
2024-02-19 12:50 ` Laszlo Ersek
2024-02-20 7:35 ` Ni, Ray
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=MN6PR11MB8244A8CC3C051584859140F58C512@MN6PR11MB8244.namprd11.prod.outlook.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox