* [PATCH v2 1/1] UefiCpuPkg: Reset a parameter when BSP Exit in CPU relaxed mode.
@ 2022-10-08 5:57 Li, Zhihao
2022-10-08 6:33 ` Ni, Ray
0 siblings, 1 reply; 2+ messages in thread
From: Li, Zhihao @ 2022-10-08 5:57 UTC (permalink / raw)
To: devel; +Cc: Eric Dong, Ray Ni
From: Zhihao Li <zhihao.li@intel.com>
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4083
In CPU relaxed mode, it doesn't reset the value of
mSmmMpSyncData->AllApArrivedWithException when BSP exit smm mode.
So this patch will reset this variable. Modified the flow of
SmmCpuRendezvous to avoid enter SmmWaitForApArrival repeatedly.
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Zhihao Li <zhihao.li@intel.com>
---
UefiCpuPkg/PiSmmCpuDxeSmm/CpuService.c | 17 ++++++++++++-----
UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c | 5 +++--
2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuService.c b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuService.c
index 2ebf4543c3ed..368bacd29ea1 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuService.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuService.c
@@ -421,11 +421,18 @@ SmmCpuRendezvous (
goto ON_EXIT;
}
- //
- // There are some APs outside SMM, Wait for all avaiable APs to arrive.
- //
- SmmWaitForApArrival ();
- Status = mSmmMpSyncData->AllApArrivedWithException ? EFI_SUCCESS : EFI_TIMEOUT;
+ if ((mSmmMpSyncData->EffectiveSyncMode != SmmCpuSyncModeTradition) && !SmmCpuFeaturesNeedConfigureMtrrs ()) {
+ //
+ // There are some APs outside SMM, Wait for all avaiable APs to arrive.
+ //
+ SmmWaitForApArrival ();
+ Status = mSmmMpSyncData->AllApArrivedWithException ? EFI_SUCCESS : EFI_TIMEOUT;
+ } else {
+ //
+ // BSP has already waitted for APs to arrive SMM if SmmCpuSyncMode selected or need config MTRR.
+ //
+ Status = EFI_TIMEOUT;
+ }
ON_EXIT:
if (!mSmmMpSyncData->AllApArrivedWithException) {
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
index 13c2cb8da4c3..c79da418e37c 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
@@ -696,8 +696,9 @@ BSPHandler (
//
// Allow APs to check in from this point on
//
- *mSmmMpSyncData->Counter = 0;
- *mSmmMpSyncData->AllCpusInSync = FALSE;
+ *mSmmMpSyncData->Counter = 0;
+ *mSmmMpSyncData->AllCpusInSync = FALSE;
+ mSmmMpSyncData->AllApArrivedWithException = FALSE;
}
/**
--
2.26.2.windows.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2 1/1] UefiCpuPkg: Reset a parameter when BSP Exit in CPU relaxed mode.
2022-10-08 5:57 [PATCH v2 1/1] UefiCpuPkg: Reset a parameter when BSP Exit in CPU relaxed mode Li, Zhihao
@ 2022-10-08 6:33 ` Ni, Ray
0 siblings, 0 replies; 2+ messages in thread
From: Ni, Ray @ 2022-10-08 6:33 UTC (permalink / raw)
To: Li, Zhihao, devel@edk2.groups.io; +Cc: Dong, Eric
Can you please split the patch to 2 patches?
> -----Original Message-----
> From: Li, Zhihao <zhihao.li@intel.com>
> Sent: Saturday, October 8, 2022 1:58 PM
> To: devel@edk2.groups.io
> Cc: Dong, Eric <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com>
> Subject: [PATCH v2 1/1] UefiCpuPkg: Reset a parameter when BSP Exit in
> CPU relaxed mode.
>
> From: Zhihao Li <zhihao.li@intel.com>
>
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4083
>
> In CPU relaxed mode, it doesn't reset the value of
> mSmmMpSyncData->AllApArrivedWithException when BSP exit smm mode.
> So this patch will reset this variable. Modified the flow of
> SmmCpuRendezvous to avoid enter SmmWaitForApArrival repeatedly.
>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
>
> Signed-off-by: Zhihao Li <zhihao.li@intel.com>
> ---
> UefiCpuPkg/PiSmmCpuDxeSmm/CpuService.c | 17 ++++++++++++-----
> UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c | 5 +++--
> 2 files changed, 15 insertions(+), 7 deletions(-)
>
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuService.c
> b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuService.c
> index 2ebf4543c3ed..368bacd29ea1 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuService.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuService.c
> @@ -421,11 +421,18 @@ SmmCpuRendezvous (
> goto ON_EXIT;
>
> }
>
>
>
> - //
>
> - // There are some APs outside SMM, Wait for all avaiable APs to arrive.
>
> - //
>
> - SmmWaitForApArrival ();
>
> - Status = mSmmMpSyncData->AllApArrivedWithException ? EFI_SUCCESS :
> EFI_TIMEOUT;
>
> + if ((mSmmMpSyncData->EffectiveSyncMode !=
> SmmCpuSyncModeTradition) && !SmmCpuFeaturesNeedConfigureMtrrs ())
> {
>
> + //
>
> + // There are some APs outside SMM, Wait for all avaiable APs to arrive.
>
> + //
>
> + SmmWaitForApArrival ();
>
> + Status = mSmmMpSyncData->AllApArrivedWithException ? EFI_SUCCESS :
> EFI_TIMEOUT;
>
> + } else {
>
> + //
>
> + // BSP has already waitted for APs to arrive SMM if SmmCpuSyncMode
> selected or need config MTRR.
>
> + //
>
> + Status = EFI_TIMEOUT;
>
> + }
>
>
>
> ON_EXIT:
>
> if (!mSmmMpSyncData->AllApArrivedWithException) {
>
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> index 13c2cb8da4c3..c79da418e37c 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> @@ -696,8 +696,9 @@ BSPHandler (
> //
>
> // Allow APs to check in from this point on
>
> //
>
> - *mSmmMpSyncData->Counter = 0;
>
> - *mSmmMpSyncData->AllCpusInSync = FALSE;
>
> + *mSmmMpSyncData->Counter = 0;
>
> + *mSmmMpSyncData->AllCpusInSync = FALSE;
>
> + mSmmMpSyncData->AllApArrivedWithException = FALSE;
>
> }
>
>
>
> /**
>
> --
> 2.26.2.windows.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-10-08 6:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-08 5:57 [PATCH v2 1/1] UefiCpuPkg: Reset a parameter when BSP Exit in CPU relaxed mode Li, Zhihao
2022-10-08 6:33 ` Ni, Ray
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox