Re: [edk2] [PATCH] MdeModulePkg/DxeMain: Fix BSP interrupts reenabled in ExitBootServices
On 3/19/2018 3:15 PM, Hao Wu wrote: Within function CoreExitBootServices(), this commit will move the call of: MemoryProtectionExitBootServicesCallback(); before: SaveAndSetDebugTimerInterrupt (FALSE); and gCpu->DisableInterrupt (gCpu); The reason is that, within MemoryProtectionExitBootServicesCallback(), APIs like RaiseTpl and RestoreTpl maybe called. An example will be: DebugLib (using PeiDxeDebugLibReportStatusCode instance) | v ReportStatusCodeLib (using DxeReportStatusCodeLib instance) | v Raise/RestoreTpl The call of Raise/RestoreTpl APIs will re-enable BSP interrupts. Hence, this commit refine the calling sequence to ensure BSP interrupts before leaving CoreExitBootServices(). Cc: Ruiyu Ni Cc: Jiewen Yao Cc: Jian J Wang Cc: Star Zeng Cc: Eric Dong Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu --- MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c index 62a597edaf..07c7403462 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c +++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c @@ -1,7 +1,7 @@ /** @file DXE Core Main Entry Point -Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved. +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved. 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 @@ -805,6 +805,8 @@ CoreExitBootServices ( (EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_BS_PC_EXIT_BOOT_SERVICES) ); + MemoryProtectionExitBootServicesCallback(); + // // Disable interrupt of Debug timer. // @@ -815,8 +817,6 @@ CoreExitBootServices ( // gCpu->DisableInterrupt (gCpu); - MemoryProtectionExitBootServicesCallback(); - // // Clear the non-runtime values of the EFI System Table // Reviewed-by: Ruiyu Ni -- Thanks, Ray ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH] MdeModulePkg/DxeMain: Fix BSP interrupts reenabled in ExitBootServices
reviewed-by: jiewen@intel.com thank you! Yao, Jiewen > 在 2018年3月19日,下午3:15,Hao Wu 写道: > > Within function CoreExitBootServices(), this commit will move the call > of: > > MemoryProtectionExitBootServicesCallback(); > > before: > > SaveAndSetDebugTimerInterrupt (FALSE); > and > gCpu->DisableInterrupt (gCpu); > > The reason is that, within MemoryProtectionExitBootServicesCallback(), > APIs like RaiseTpl and RestoreTpl maybe called. An example will be: > > DebugLib (using PeiDxeDebugLibReportStatusCode instance) > | > v > ReportStatusCodeLib (using DxeReportStatusCodeLib instance) > | > v > Raise/RestoreTpl > > The call of Raise/RestoreTpl APIs will re-enable BSP interrupts. Hence, > this commit refine the calling sequence to ensure BSP interrupts before > leaving CoreExitBootServices(). > > Cc: Ruiyu Ni > Cc: Jiewen Yao > Cc: Jian J Wang > Cc: Star Zeng > Cc: Eric Dong > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Hao Wu > --- > MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c > b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c > index 62a597edaf..07c7403462 100644 > --- a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c > +++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c > @@ -1,7 +1,7 @@ > /** @file > DXE Core Main Entry Point > > -Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved. > +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved. > 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 > @@ -805,6 +805,8 @@ CoreExitBootServices ( > (EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_BS_PC_EXIT_BOOT_SERVICES) > ); > > + MemoryProtectionExitBootServicesCallback(); > + > // > // Disable interrupt of Debug timer. > // > @@ -815,8 +817,6 @@ CoreExitBootServices ( > // > gCpu->DisableInterrupt (gCpu); > > - MemoryProtectionExitBootServicesCallback(); > - > // > // Clear the non-runtime values of the EFI System Table > // > -- > 2.12.0.windows.1 > > ___ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] MdeModulePkg/DxeMain: Fix BSP interrupts reenabled in ExitBootServices
Within function CoreExitBootServices(), this commit will move the call of: MemoryProtectionExitBootServicesCallback(); before: SaveAndSetDebugTimerInterrupt (FALSE); and gCpu->DisableInterrupt (gCpu); The reason is that, within MemoryProtectionExitBootServicesCallback(), APIs like RaiseTpl and RestoreTpl maybe called. An example will be: DebugLib (using PeiDxeDebugLibReportStatusCode instance) | v ReportStatusCodeLib (using DxeReportStatusCodeLib instance) | v Raise/RestoreTpl The call of Raise/RestoreTpl APIs will re-enable BSP interrupts. Hence, this commit refine the calling sequence to ensure BSP interrupts before leaving CoreExitBootServices(). Cc: Ruiyu Ni Cc: Jiewen Yao Cc: Jian J Wang Cc: Star Zeng Cc: Eric Dong Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu --- MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c index 62a597edaf..07c7403462 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c +++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c @@ -1,7 +1,7 @@ /** @file DXE Core Main Entry Point -Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved. +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved. 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 @@ -805,6 +805,8 @@ CoreExitBootServices ( (EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_BS_PC_EXIT_BOOT_SERVICES) ); + MemoryProtectionExitBootServicesCallback(); + // // Disable interrupt of Debug timer. // @@ -815,8 +817,6 @@ CoreExitBootServices ( // gCpu->DisableInterrupt (gCpu); - MemoryProtectionExitBootServicesCallback(); - // // Clear the non-runtime values of the EFI System Table // -- 2.12.0.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel