public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 0/2] Update RegisterCpuInterruptHandler return status
@ 2016-11-16 14:33 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
  0 siblings, 2 replies; 6+ messages in thread
From: Jeff Fan @ 2016-11-16 14:33 UTC (permalink / raw)
  To: edk2-devel; +Cc: Feng Tian, Michael D Kinney

Updated RegisterCpuInterruptHandler() in CpuExceptionHandlerLib NULL
instance to return EFI_UNSUPPORTED instead of EFI_SUCCESS.

https://bugzilla.tianocore.org/show_bug.cgi?id=199

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>

Jeff Fan (2):
  MdeModulePkg/CpuExceptionHanderLibNull: RegisterCpuInterruptHandler()
  MdeModulePkg/PiSmmCpuDxeSmm: Check RegisterCpuInterruptHandler status

 .../Library/CpuExceptionHandlerLibNull/CpuExceptionHandlerLibNull.c  | 4 ++--
 UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c                             | 4 +++-
 UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c                               | 5 ++++-
 UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c                              | 4 +++-
 4 files changed, 12 insertions(+), 5 deletions(-)

-- 
2.9.3.windows.2



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] MdeModulePkg/CpuExceptionHanderLibNull: RegisterCpuInterruptHandler()
  2016-11-16 14:33 [PATCH 0/2] Update RegisterCpuInterruptHandler return status Jeff Fan
@ 2016-11-16 14:33 ` Jeff Fan
  2016-11-16 14:33 ` [PATCH 2/2] MdeModulePkg/PiSmmCpuDxeSmm: Check RegisterCpuInterruptHandler status Jeff Fan
  1 sibling, 0 replies; 6+ messages in thread
From: Jeff Fan @ 2016-11-16 14:33 UTC (permalink / raw)
  To: edk2-devel; +Cc: Feng Tian, Michael D Kinney

Current CpuExceptionHanderLibNull instance returns EFI_SUCCESS for all three
services. If platform does not want to hook the Exception vector for some
modules (For example DxeCore), it could select this NULL instance in DSC file
for those module. But some modules that want to consume
RegisterCpuInterruptHandler() cannot use NULL instance. If platform does not
select the correct library instance, it will does work. But the caller does not
recognize it.

This update is to return EFI_UNSUPPORTED on RegisterCpuInterruptHandler() in
NULL instance instead of return EFI_SUCCESS. Once platform selects this NULL
instance, the caller could know it from return status.

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>
---
 .../Library/CpuExceptionHandlerLibNull/CpuExceptionHandlerLibNull.c   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Library/CpuExceptionHandlerLibNull/CpuExceptionHandlerLibNull.c b/MdeModulePkg/Library/CpuExceptionHandlerLibNull/CpuExceptionHandlerLibNull.c
index 2fea24a..68ee9a9 100644
--- a/MdeModulePkg/Library/CpuExceptionHandlerLibNull/CpuExceptionHandlerLibNull.c
+++ b/MdeModulePkg/Library/CpuExceptionHandlerLibNull/CpuExceptionHandlerLibNull.c
@@ -1,7 +1,7 @@
 /** @file
   CPU Exception Handler library implementition with empty functions.
 
-  Copyright (c) 2012 - 2013, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2012 - 2016, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
   which accompanies this distribution.  The full text of the license may be found at
@@ -94,6 +94,6 @@ RegisterCpuInterruptHandler (
   IN EFI_CPU_INTERRUPT_HANDLER     InterruptHandler
   )
 {
-  return EFI_SUCCESS;
+  return EFI_UNSUPPORTED;
 }
 
-- 
2.9.3.windows.2



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] MdeModulePkg/PiSmmCpuDxeSmm: Check RegisterCpuInterruptHandler status
  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 ` Jeff Fan
  2016-11-16 16:28   ` Kinney, Michael D
  1 sibling, 1 reply; 6+ messages in thread
From: Jeff Fan @ 2016-11-16 14:33 UTC (permalink / raw)
  To: edk2-devel; +Cc: Feng Tian, Michael D Kinney

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



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] MdeModulePkg/PiSmmCpuDxeSmm: Check RegisterCpuInterruptHandler status
  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
  0 siblings, 1 reply; 6+ messages in thread
From: Kinney, Michael D @ 2016-11-16 16:28 UTC (permalink / raw)
  To: Fan, Jeff, edk2-devel@lists.01.org, Kinney, Michael D; +Cc: Tian, Feng

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



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] MdeModulePkg/PiSmmCpuDxeSmm: Check RegisterCpuInterruptHandler status
  2016-11-16 16:28   ` Kinney, Michael D
@ 2016-11-17  2:54     ` Fan, Jeff
  2016-11-17  3:17       ` Kinney, Michael D
  0 siblings, 1 reply; 6+ messages in thread
From: Fan, Jeff @ 2016-11-17  2:54 UTC (permalink / raw)
  To: Kinney, Michael D, edk2-devel@lists.01.org; +Cc: Tian, Feng

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



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] MdeModulePkg/PiSmmCpuDxeSmm: Check RegisterCpuInterruptHandler status
  2016-11-17  2:54     ` Fan, Jeff
@ 2016-11-17  3:17       ` Kinney, Michael D
  0 siblings, 0 replies; 6+ messages in thread
From: Kinney, Michael D @ 2016-11-17  3:17 UTC (permalink / raw)
  To: Fan, Jeff, edk2-devel@lists.01.org, Kinney, Michael D; +Cc: Tian, Feng

Jeff,

I agree that SMM modules that call 
EFI_SMM_CPU_SERVICE_PROTOCOL.RegisterExceptionHandler()
always need to check for error return status and we do
not want an ASSERT() there.

Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>

Mike




> -----Original Message-----
> From: Fan, Jeff
> Sent: Wednesday, November 16, 2016 6:54 PM
> To: Kinney, Michael D <michael.d.kinney@intel.com>; edk2-devel@lists.01.org
> Cc: Tian, Feng <feng.tian@intel.com>
> Subject: RE: [PATCH 2/2] MdeModulePkg/PiSmmCpuDxeSmm: Check
> RegisterCpuInterruptHandler status
> 
> 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



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-11-17  3:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2016-11-17  3:17       ` Kinney, Michael D

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox