From: "Ni, Ray" <ray.ni@intel.com>
To: "Wu, Jiaxin" <jiaxin.wu@intel.com>,
"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: Laszlo Ersek <lersek@redhat.com>,
"Dong, Eric" <eric.dong@intel.com>,
"Zeng, Star" <star.zeng@intel.com>,
Gerd Hoffmann <kraxel@redhat.com>,
"Kumar, Rahul R" <rahul.r.kumar@intel.com>
Subject: Re: [edk2-devel] [PATCH v2 3/6] UefiCpuPkg/PiSmmCpuDxeSmm: Check SMM Debug Agent support or not
Date: Tue, 26 Dec 2023 02:18:49 +0000 [thread overview]
Message-ID: <MN6PR11MB82440929D3C1C2B58BBB80FC8C98A@MN6PR11MB8244.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20231225162034.2052-4-jiaxin.wu@intel.com>
Reviewed-by: Ray Ni <ray.ni@Intel.com>
Thanks,
Ray
> -----Original Message-----
> From: Wu, Jiaxin <jiaxin.wu@intel.com>
> Sent: Tuesday, December 26, 2023 12:21 AM
> To: devel@edk2.groups.io
> Cc: Laszlo Ersek <lersek@redhat.com>; Dong, Eric <eric.dong@intel.com>; Ni,
> Ray <ray.ni@intel.com>; Zeng, Star <star.zeng@intel.com>; Gerd Hoffmann
> <kraxel@redhat.com>; Kumar, Rahul R <rahul.r.kumar@intel.com>
> Subject: [PATCH v2 3/6] UefiCpuPkg/PiSmmCpuDxeSmm: Check SMM Debug
> Agent support or not
>
> This patch is to check SMM Debug Agent support or not before
> InitializeDebugAgent.
>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Zeng Star <star.zeng@intel.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Rahul Kumar <rahul1.kumar@intel.com>
> Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
> ---
> UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c | 4 +++-
> UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c | 22 +++++++++++++--------
> -
> UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c | 7 ++++++-
> UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h | 1 +
> 4 files changed, 23 insertions(+), 11 deletions(-)
>
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
> b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
> index 0bae0e33f1..b14c289a27 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
> @@ -835,11 +835,13 @@ SmmRestoreCpu (
> ASSERT_EFI_ERROR (Status);
>
> //
> // Initialize Debug Agent to support source level debug
> //
> - InitializeDebugAgent (DEBUG_AGENT_INIT_THUNK_PEI_IA32TOX64, (VOID
> *)&Ia32Idtr, NULL);
> + if (mSmmDebugAgentSupport) {
> + InitializeDebugAgent (DEBUG_AGENT_INIT_THUNK_PEI_IA32TOX64,
> (VOID *)&Ia32Idtr, NULL);
> + }
> }
>
> mBspApicId = GetApicId ();
> //
> // Skip AP initialization if mAcpiCpuData is not valid
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> index 4fbb0bba87..324e85d6b5 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> @@ -474,14 +474,16 @@ BSPHandler (
> //
> // Flag BSP's presence
> //
> *mSmmMpSyncData->InsideSmm = TRUE;
>
> - //
> - // Initialize Debug Agent to start source level debug in BSP handler
> - //
> - InitializeDebugAgent (DEBUG_AGENT_INIT_ENTER_SMI, NULL, NULL);
> + if (mSmmDebugAgentSupport) {
> + //
> + // Initialize Debug Agent to start source level debug in BSP handler
> + //
> + InitializeDebugAgent (DEBUG_AGENT_INIT_ENTER_SMI, NULL, NULL);
> + }
>
> //
> // Mark this processor's presence
> //
> *(mSmmMpSyncData->CpuData[CpuIndex].Present) = TRUE;
> @@ -646,15 +648,17 @@ BSPHandler (
> // Wait for all APs to complete MTRR programming
> //
> SmmCpuSyncWaitForAPs (mSmmMpSyncData->SyncContext, ApCount,
> CpuIndex);
> }
>
> - //
> - // Stop source level debug in BSP handler, the code below will not be
> - // debugged.
> - //
> - InitializeDebugAgent (DEBUG_AGENT_INIT_EXIT_SMI, NULL, NULL);
> + if (mSmmDebugAgentSupport) {
> + //
> + // Stop source level debug in BSP handler, the code below will not be
> + // debugged.
> + //
> + InitializeDebugAgent (DEBUG_AGENT_INIT_EXIT_SMI, NULL, NULL);
> + }
>
> //
> // Signal APs to Reset states/semaphore for this processor
> //
> ReleaseAllAPs ();
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
> b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
> index 209a2e4810..9b230772cb 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
> @@ -110,10 +110,15 @@ BOOLEAN mSmmReadyToLock = FALSE;
> //
> // Global used to cache PCD for SMM Code Access Check enable
> //
> BOOLEAN mSmmCodeAccessCheckEnable = FALSE;
>
> +//
> +// Global used to cache SMM Debug Agent Supported ot not
> +//
> +BOOLEAN mSmmDebugAgentSupport = FALSE;
> +
> //
> // Global copy of the PcdPteMemoryEncryptionAddressOrMask
> //
> UINT64 mAddressEncMask = 0;
>
> @@ -895,11 +900,11 @@ PiCpuSmmEntry (
> PiSmmCpuSmiEntryFixupAddress ();
>
> //
> // Initialize Debug Agent to support source level debug in SMM code
> //
> - InitializeDebugAgent (DEBUG_AGENT_INIT_SMM, NULL, NULL);
> + InitializeDebugAgent (DEBUG_AGENT_INIT_SMM,
> &mSmmDebugAgentSupport, NULL);
>
> //
> // Report the start of CPU SMM initialization.
> //
> REPORT_STATUS_CODE (
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
> b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
> index a2fa4f6734..7f244ea803 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
> @@ -481,10 +481,11 @@ extern UINTN mSemaphoreSize;
> extern SPIN_LOCK *mPFLock;
> extern SPIN_LOCK *mConfigSmmCodeAccessCheckLock;
> extern EFI_SMRAM_DESCRIPTOR *mSmmCpuSmramRanges;
> extern UINTN mSmmCpuSmramRangeCount;
> extern UINT8 mPhysicalAddressBits;
> +extern BOOLEAN mSmmDebugAgentSupport;
>
> //
> // Copy of the PcdPteMemoryEncryptionAddressOrMask
> //
> extern UINT64 mAddressEncMask;
> --
> 2.16.2.windows.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112901): https://edk2.groups.io/g/devel/message/112901
Mute This Topic: https://groups.io/mt/103360804/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/1913456212/xyzzy [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
next prev parent reply other threads:[~2023-12-26 2:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-25 16:20 [edk2-devel] [PATCH v2 0/6] Reduce one round BSP & AP sync Wu, Jiaxin
2023-12-25 16:20 ` [edk2-devel] [PATCH v2 1/6] SourceLevelDebugPkg/Library: Indicate SMM Debug Agent support or not Wu, Jiaxin
2023-12-26 2:17 ` Ni, Ray
2023-12-25 16:20 ` [edk2-devel] [PATCH v2 2/6] MdeModulePkg/DebugAgentLibNull: " Wu, Jiaxin
2023-12-26 2:18 ` Ni, Ray
2023-12-25 16:20 ` [edk2-devel] [PATCH v2 3/6] UefiCpuPkg/PiSmmCpuDxeSmm: Check " Wu, Jiaxin
2023-12-26 2:18 ` Ni, Ray [this message]
2023-12-25 16:20 ` [edk2-devel] [PATCH v2 4/6] UefiCpuPkg/PiSmmCpuDxeSmm: Align BSP and AP sync logic for SMI exit Wu, Jiaxin
2023-12-26 2:19 ` Ni, Ray
2023-12-25 16:20 ` [edk2-devel] [PATCH v2 5/6] UefiCpuPkg/PiSmmCpuDxeSmm: Invert ReleaseAllAPs & InitializeDebugAgent Wu, Jiaxin
2023-12-26 2:21 ` Ni, Ray
2023-12-25 16:20 ` [edk2-devel] [PATCH v2 6/6] UefiCpuPkg/PiSmmCpuDxeSmm: Reduce one round BSP & AP sync Wu, Jiaxin
2023-12-26 5:02 ` 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=MN6PR11MB82440929D3C1C2B58BBB80FC8C98A@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