]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiCpuPkg/MpInitLib: Disable interrupt at ExitBootServices AP Mwait
authorHao Wu <hao.a.wu@intel.com>
Mon, 19 Mar 2018 05:00:13 +0000 (13:00 +0800)
committerHao Wu <hao.a.wu@intel.com>
Tue, 20 Mar 2018 07:53:25 +0000 (15:53 +0800)
Within function ApWakeupFunction():

When source level debugger is enabled, AP interrupts will be enabled by
EnableDebugAgent(). Then the AP function will be executed by:

Procedure (Parameter);

After the AP function returns, AP interrupts will be disabled when the
APs are placed in loop mode (both HltLoop and MwaiLoop).

However, at ExitBootServices, ApWakeupFunction() is called with
'Procedure' equals to RelocateApLoop().

(ExitBootServices callback registered within InitMpGlobalData())

RelocateApLoop() never returns, so it has to disable the AP interrupts by
itself. However, we find that interrupts are only disabled for the
HltLoop case, but not for the MwaitLoop case (within file MpFuncs.nasm).

This commit adds the missing disabling of AP interrupts for MwaitLoop.

Also, for X64, this commit will disable the interrupts before switching to
32-bit mode.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Jeff Fan <vanjeff_919@hotmail.com>
UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm
UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm

index bd79be0f5e764452562cabcf144642337c7b2170..59e88d3f8fe28b013be19ab4236fcb4c8a05b64a 100644 (file)
@@ -1,5 +1,5 @@
 ;------------------------------------------------------------------------------ ;\r
-; Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>\r
+; Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>\r
 ; This program and the accompanying materials\r
 ; are licensed and made available under the terms and conditions of the BSD License\r
 ; which accompanies this distribution.  The full text of the license may be found at\r
@@ -239,6 +239,7 @@ AsmRelocateApLoopStart:
     cmp        cl,  1              ; Check mwait-monitor support\r
     jnz        HltLoop\r
 MwaitLoop:\r
+    cli\r
     mov        eax, esp\r
     xor        ecx, ecx\r
     xor        edx, edx\r
index 75959888849e4666926d9ff7063ffe3de6cc13d6..76f8c078abffc848373cacf41c09b6a110a5d207 100644 (file)
@@ -1,5 +1,5 @@
 ;------------------------------------------------------------------------------ ;\r
-; Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>\r
+; Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>\r
 ; This program and the accompanying materials\r
 ; are licensed and made available under the terms and conditions of the BSD License\r
 ; which accompanies this distribution.  The full text of the license may be found at\r
@@ -253,6 +253,7 @@ RendezvousFunnelProcEnd:
 global ASM_PFX(AsmRelocateApLoop)\r
 ASM_PFX(AsmRelocateApLoop):\r
 AsmRelocateApLoopStart:\r
+    cli                          ; Disable interrupt before switching to 32-bit mode\r
     mov        rax, [rsp + 40]   ; CountTofinish\r
     lock dec   dword [rax]       ; (*CountTofinish)--\r
     mov        rsp, r9\r
@@ -288,6 +289,7 @@ PmEntry:
     jnz        HltLoop\r
     mov        ebx, edx           ; Save C-State to ebx\r
 MwaitLoop:\r
+    cli\r
     mov        eax, esp           ; Set Monitor Address\r
     xor        ecx, ecx           ; ecx = 0\r
     xor        edx, edx           ; edx = 0\r