From: "Fan, Jeff" <jeff.fan@intel.com>
To: "Kinney, Michael D" <michael.d.kinney@intel.com>,
"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Tian, Feng" <feng.tian@intel.com>
Subject: Re: [PATCH 2/2] MdeModulePkg/PiSmmCpuDxeSmm: Check RegisterCpuInterruptHandler status
Date: Thu, 17 Nov 2016 02:54:13 +0000 [thread overview]
Message-ID: <542CF652F8836A4AB8DBFAAD40ED192A4A2E0088@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <E92EE9817A31E24EB0585FDF735412F564853CC5@ORSMSX113.amr.corp.intel.com>
Mike,
I think it's not necessary to move ASSERT() to SmmRegisterExceptionHandler() implementation.
Because PiSmmCpuDxeSmm will invoke SmmRegisterExceptionHandler() at module entry point function as my patch showed, it could make sure PiSmmCpuDxeSmm choose the correct instance.
Other module invoke may check SmmRegisterExceptionHandler the return status for other choice per design.
For example:
@retval EFI_ALREADY_STARTED InterruptHandler is not NULL, and a handler for InterruptType was previously installed.
Thanks!
Jeff
-----Original Message-----
From: Kinney, Michael D
Sent: Thursday, November 17, 2016 12:29 AM
To: Fan, Jeff; edk2-devel@lists.01.org; Kinney, Michael D
Cc: Tian, Feng
Subject: RE: [PATCH 2/2] MdeModulePkg/PiSmmCpuDxeSmm: Check RegisterCpuInterruptHandler status
Jeff,
Shouldn't this ASSERT() be moved into the implementation of SmmRegisterExceptionHandler()? This will make sure the PiSmmCpuDxeSmm driver uses the right lib instance for exceptions that module registers and for exceptions other SMM modules register through the EFI_SMM_CPU_SERVICE_PROTOCOL.
Mike
> -----Original Message-----
> From: Fan, Jeff
> Sent: Wednesday, November 16, 2016 6:34 AM
> To: edk2-devel@lists.01.org
> Cc: Tian, Feng <feng.tian@intel.com>; Kinney, Michael D
> <michael.d.kinney@intel.com>
> Subject: [PATCH 2/2] MdeModulePkg/PiSmmCpuDxeSmm: Check
> RegisterCpuInterruptHandler status
>
> Once platform selects the incorrect instance, the caller could know it
> from return status and ASSERT().
>
> Cc: Feng Tian <feng.tian@intel.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jeff Fan <jeff.fan@intel.com>
> ---
> UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c | 4 +++-
> UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c | 5 ++++-
> UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c | 4 +++-
> 3 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
> b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
> index a871bef..f2e2ceb 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
> @@ -27,6 +27,7 @@ SmmInitPageTable (
> {
> UINTN PageFaultHandlerHookAddress;
> IA32_IDT_GATE_DESCRIPTOR *IdtEntry;
> + EFI_STATUS Status;
>
> //
> // Initialize spin lock
> @@ -49,7 +50,8 @@ SmmInitPageTable (
> //
> // Register SMM Page Fault Handler
> //
> - SmmRegisterExceptionHandler (&mSmmCpuService, EXCEPT_IA32_PAGE_FAULT,
> SmiPFHandler);
> + Status = SmmRegisterExceptionHandler (&mSmmCpuService,
> + EXCEPT_IA32_PAGE_FAULT,
> SmiPFHandler);
> + ASSERT_EFI_ERROR (Status);
> }
>
> //
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c
> b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c
> index 329574e..350a6a2 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c
> @@ -1384,5 +1384,8 @@ InitIdtr (
> VOID
> )
> {
> - SmmRegisterExceptionHandler (&mSmmCpuService, EXCEPT_IA32_DEBUG,
> DebugExceptionHandler);
> + EFI_STATUS Status;
> +
> + Status = SmmRegisterExceptionHandler (&mSmmCpuService,
> + EXCEPT_IA32_DEBUG,
> DebugExceptionHandler);
> + ASSERT_EFI_ERROR (Status);
> }
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
> b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
> index 9cee784..c49fb26 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
> @@ -102,6 +102,7 @@ SmmInitPageTable (
> UINTN Index;
> UINTN PageFaultHandlerHookAddress;
> IA32_IDT_GATE_DESCRIPTOR *IdtEntry;
> + EFI_STATUS Status;
>
> //
> // Initialize spin lock
> @@ -160,7 +161,8 @@ SmmInitPageTable (
> //
> // Register Smm Page Fault Handler
> //
> - SmmRegisterExceptionHandler (&mSmmCpuService, EXCEPT_IA32_PAGE_FAULT,
> SmiPFHandler);
> + Status = SmmRegisterExceptionHandler (&mSmmCpuService,
> + EXCEPT_IA32_PAGE_FAULT,
> SmiPFHandler);
> + ASSERT_EFI_ERROR (Status);
> }
>
> //
> --
> 2.9.3.windows.2
next prev parent reply other threads:[~2016-11-17 2:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-16 14:33 [PATCH 0/2] Update RegisterCpuInterruptHandler return status Jeff Fan
2016-11-16 14:33 ` [PATCH 1/2] MdeModulePkg/CpuExceptionHanderLibNull: RegisterCpuInterruptHandler() Jeff Fan
2016-11-16 14:33 ` [PATCH 2/2] MdeModulePkg/PiSmmCpuDxeSmm: Check RegisterCpuInterruptHandler status Jeff Fan
2016-11-16 16:28 ` Kinney, Michael D
2016-11-17 2:54 ` Fan, Jeff [this message]
2016-11-17 3:17 ` Kinney, Michael D
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=542CF652F8836A4AB8DBFAAD40ED192A4A2E0088@shsmsx102.ccr.corp.intel.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