From: "Laszlo Ersek" <lersek@redhat.com>
To: devel@edk2.groups.io, kraxel@redhat.com
Cc: Oliver Steffen <osteffen@redhat.com>,
Rahul Kumar <rahul1.kumar@intel.com>, Ray Ni <ray.ni@intel.com>
Subject: Re: [edk2-devel] [PATCH v2 3/5] UefiCpuPkg/MpInitLib: Add support for multiple HOBs to SwitchApContext()
Date: Thu, 22 Feb 2024 01:44:45 +0100 [thread overview]
Message-ID: <3e3c9c39-76c1-4a80-4cfa-830b52ecd831@redhat.com> (raw)
In-Reply-To: <20240220174939.1288689-4-kraxel@redhat.com>
On 2/20/24 18:49, Gerd Hoffmann wrote:
> Rename the MpHandOff parameter to FirstMpHandOff. Add loops so the
> function inspects all HOBs present in the system.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
> UefiCpuPkg/Library/MpInitLib/MpLib.h | 2 +-
> UefiCpuPkg/Library/MpInitLib/MpLib.c | 35 ++++++++++++++++++----------
> 2 files changed, 24 insertions(+), 13 deletions(-)
>
> diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h b/UefiCpuPkg/Library/MpInitLib/MpLib.h
> index bc2a0232291d..b5214b904b41 100644
> --- a/UefiCpuPkg/Library/MpInitLib/MpLib.h
> +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h
> @@ -482,7 +482,7 @@ GetWakeupBuffer (
> **/
> VOID
> SwitchApContext (
> - IN MP_HAND_OFF *MpHandOff
> + IN CONST MP_HAND_OFF *FirstMpHandOff
> );
>
> /**
> diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> index 8f198ff6d817..c13de34e5769 100644
> --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> @@ -1938,31 +1938,42 @@ GetBspNumber (
> This procedure allows the AP to switch to another section of
> memory and continue its loop there.
>
> - @param[in] MpHandOff Pointer to MP hand-off data structure.
> + @param[in] FirstMpHandOff Pointer to first MP hand-off HOB.
comment should say sth like "Pointer to first MP hand-off HOB body".
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
> **/
> VOID
> SwitchApContext (
> - IN MP_HAND_OFF *MpHandOff
> + IN CONST MP_HAND_OFF *FirstMpHandOff
> )
> {
> - UINTN Index;
> - UINT32 BspNumber;
> + UINTN Index;
> + UINT32 BspNumber;
> + CONST MP_HAND_OFF *MpHandOff;
>
> - BspNumber = GetBspNumber (MpHandOff);
> + BspNumber = GetBspNumber (FirstMpHandOff);
>
> - for (Index = 0; Index < MpHandOff->CpuCount; Index++) {
> - if (Index != BspNumber) {
> - *(UINTN *)(UINTN)MpHandOff->Info[Index].StartupProcedureAddress = (UINTN)SwitchContextPerAp;
> - *(UINT32 *)(UINTN)MpHandOff->Info[Index].StartupSignalAddress = MpHandOff->StartupSignalValue;
> + for (MpHandOff = FirstMpHandOff;
> + MpHandOff != NULL;
> + MpHandOff = GetNextMpHandOffHob (MpHandOff))
> + {
> + for (Index = 0; Index < MpHandOff->CpuCount; Index++) {
> + if (MpHandOff->ProcessorIndex + Index != BspNumber) {
> + *(UINTN *)(UINTN)MpHandOff->Info[Index].StartupProcedureAddress = (UINTN)SwitchContextPerAp;
> + *(UINT32 *)(UINTN)MpHandOff->Info[Index].StartupSignalAddress = MpHandOff->StartupSignalValue;
> + }
> }
> }
>
> //
> // Wait all APs waken up if this is not the 1st broadcast of SIPI
> //
> - for (Index = 0; Index < MpHandOff->CpuCount; Index++) {
> - if (Index != BspNumber) {
> - WaitApWakeup ((UINT32 *)(UINTN)(MpHandOff->Info[Index].StartupSignalAddress));
> + for (MpHandOff = FirstMpHandOff;
> + MpHandOff != NULL;
> + MpHandOff = GetNextMpHandOffHob (MpHandOff))
> + {
> + for (Index = 0; Index < MpHandOff->CpuCount; Index++) {
> + if (MpHandOff->ProcessorIndex + Index != BspNumber) {
> + WaitApWakeup ((UINT32 *)(UINTN)(MpHandOff->Info[Index].StartupSignalAddress));
> + }
> }
> }
> }
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115764): https://edk2.groups.io/g/devel/message/115764
Mute This Topic: https://groups.io/mt/104472306/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-22 0:44 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-20 17:49 [edk2-devel] [PATCH v2 0/5] UefiCpuPkg/MpInitLib: Add support for multiple MP_HAND_OFF HOBs Gerd Hoffmann
2024-02-20 17:49 ` [edk2-devel] [PATCH v2 1/5] UefiCpuPkg/MpInitLib: Add support for multiple HOBs to GetMpHandOffHob Gerd Hoffmann
2024-02-21 3:35 ` Ni, Ray
2024-02-22 0:30 ` Laszlo Ersek
2024-02-20 17:49 ` [edk2-devel] [PATCH v2 2/5] UefiCpuPkg/MpInitLib: Add support for multiple HOBs to GetBspNumber() Gerd Hoffmann
2024-02-21 3:36 ` Ni, Ray
2024-02-21 3:36 ` Ni, Ray
2024-02-22 0:37 ` Laszlo Ersek
2024-02-22 0:38 ` Laszlo Ersek
2024-02-22 10:24 ` Ni, Ray
2024-02-20 17:49 ` [edk2-devel] [PATCH v2 3/5] UefiCpuPkg/MpInitLib: Add support for multiple HOBs to SwitchApContext() Gerd Hoffmann
2024-02-21 5:47 ` Ni, Ray
2024-02-22 0:44 ` Laszlo Ersek [this message]
2024-02-20 17:49 ` [edk2-devel] [PATCH v2 4/5] UefiCpuPkg/MpInitLib: Add support for multiple HOBs to MpInitLibInitialize Gerd Hoffmann
2024-02-21 3:37 ` Ni, Ray
2024-02-22 1:11 ` Laszlo Ersek
2024-02-22 12:28 ` Gerd Hoffmann
2024-02-23 0:23 ` Ni, Ray
2024-02-25 12:54 ` Laszlo Ersek
2024-02-20 17:49 ` [edk2-devel] [PATCH v2 5/5] UefiCpuPkg/MpInitLib: Add support for multiple HOBs to SaveCpuMpData() Gerd Hoffmann
2024-02-21 3:48 ` Ni, Ray
2024-02-21 10:24 ` Gerd Hoffmann
2024-02-22 1:34 ` Laszlo Ersek
2024-02-22 1:49 ` Laszlo Ersek
2024-02-22 2:17 ` Laszlo Ersek
2024-02-22 2:03 ` Laszlo Ersek
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=3e3c9c39-76c1-4a80-4cfa-830b52ecd831@redhat.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