[edk2-devel] [PATCH] Revert "UefiCpuPkg/CpuDxe: Fix boot error"

Laszlo Ersek posted 1 patch 3 years, 4 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/edk2 tags/patchew/20201217085055.15131-1-lersek@redhat.com
UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[edk2-devel] [PATCH] Revert "UefiCpuPkg/CpuDxe: Fix boot error"
Posted by Laszlo Ersek 3 years, 4 months ago
This reverts commit cee5b0441af39dd6f76cc4e0447a1c7f788cbb00.

Commit cee5b0441af3 ("UefiCpuPkg/CpuDxe: Fix boot error", 2020-12-08)
breaks CpuDxe (and with it, OVMF boot) on AMD processors. AMD processors
cannot do far jumps to 64-bit targets, as documented in the AMD64
Architecture Programmer's Manual.

Revert the patch until a RETFQ-based substitute is posted.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Guo Dong <guo.dong@intel.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Thomas Lendacky <thomas.lendacky@amd.com>
Ref: https://edk2.groups.io/g/devel/message/68597
Ref: https://www.redhat.com/archives/edk2-devel-archive/2020-December/msg00493.html
Reported-by: Thomas Lendacky <thomas.lendacky@amd.com>
Ref: https://edk2.groups.io/g/devel/message/68832
Ref: https://www.redhat.com/archives/edk2-devel-archive/2020-December/msg00737.html
Reported-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---

Notes:
    The broken patch was committed on December 8th; Tom reported the
    regression the next day, and James reported it independently on Dec
    14th/15th (dependent on one's time zone).
    
    Nine days after merging the broken patch, I've only seen "pondering" of
    how we should fix the issue. I'll tell you how: I'm going to merge this
    revert later today unless I see a patch that implements the RETFQ-based
    replacement.
    
    Regressing code and not working diligently to address the problem is
    unacceptable.

 UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm b/UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm
index 6ad32b49f4ef..c3489bcc3e89 100644
--- a/UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm
+++ b/UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm
@@ -23,8 +23,8 @@ ASM_PFX(SetCodeSelector):
     sub     rsp, 0x10
     lea     rax, [setCodeSelectorLongJump]
     mov     [rsp], rax
-    mov     [rsp+8], cx
-    jmp     qword far [rsp]
+    mov     [rsp+4], cx
+    jmp     dword far [rsp]
 setCodeSelectorLongJump:
     add     rsp, 0x10
     ret
-- 
2.19.1.3.g30247aa5d201



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#69087): https://edk2.groups.io/g/devel/message/69087
Mute This Topic: https://groups.io/mt/79032725/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH] Revert "UefiCpuPkg/CpuDxe: Fix boot error"
Posted by Laszlo Ersek 3 years, 4 months ago
On 12/17/20 09:50, Laszlo Ersek wrote:
> This reverts commit cee5b0441af39dd6f76cc4e0447a1c7f788cbb00.
> 
> Commit cee5b0441af3 ("UefiCpuPkg/CpuDxe: Fix boot error", 2020-12-08)
> breaks CpuDxe (and with it, OVMF boot) on AMD processors. AMD processors
> cannot do far jumps to 64-bit targets, as documented in the AMD64
> Architecture Programmer's Manual.
> 
> Revert the patch until a RETFQ-based substitute is posted.
> 
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Guo Dong <guo.dong@intel.com>
> Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
> Cc: Rahul Kumar <rahul1.kumar@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Thomas Lendacky <thomas.lendacky@amd.com>
> Ref: https://edk2.groups.io/g/devel/message/68597
> Ref: https://www.redhat.com/archives/edk2-devel-archive/2020-December/msg00493.html
> Reported-by: Thomas Lendacky <thomas.lendacky@amd.com>
> Ref: https://edk2.groups.io/g/devel/message/68832
> Ref: https://www.redhat.com/archives/edk2-devel-archive/2020-December/msg00737.html
> Reported-by: James Bottomley <James.Bottomley@HansenPartnership.com>
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>

Ticket:

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

Thanks
Laszlo

> ---
> 
> Notes:
>     The broken patch was committed on December 8th; Tom reported the
>     regression the next day, and James reported it independently on Dec
>     14th/15th (dependent on one's time zone).
>     
>     Nine days after merging the broken patch, I've only seen "pondering" of
>     how we should fix the issue. I'll tell you how: I'm going to merge this
>     revert later today unless I see a patch that implements the RETFQ-based
>     replacement.
>     
>     Regressing code and not working diligently to address the problem is
>     unacceptable.
> 
>  UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm b/UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm
> index 6ad32b49f4ef..c3489bcc3e89 100644
> --- a/UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm
> +++ b/UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm
> @@ -23,8 +23,8 @@ ASM_PFX(SetCodeSelector):
>      sub     rsp, 0x10
>      lea     rax, [setCodeSelectorLongJump]
>      mov     [rsp], rax
> -    mov     [rsp+8], cx
> -    jmp     qword far [rsp]
> +    mov     [rsp+4], cx
> +    jmp     dword far [rsp]
>  setCodeSelectorLongJump:
>      add     rsp, 0x10
>      ret
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#69137): https://edk2.groups.io/g/devel/message/69137
Mute This Topic: https://groups.io/mt/79032725/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH] Revert "UefiCpuPkg/CpuDxe: Fix boot error"
Posted by Laszlo Ersek 3 years, 4 months ago
On 12/17/20 09:50, Laszlo Ersek wrote:
> This reverts commit cee5b0441af39dd6f76cc4e0447a1c7f788cbb00.
> 
> Commit cee5b0441af3 ("UefiCpuPkg/CpuDxe: Fix boot error", 2020-12-08)
> breaks CpuDxe (and with it, OVMF boot) on AMD processors. AMD processors
> cannot do far jumps to 64-bit targets, as documented in the AMD64
> Architecture Programmer's Manual.
> 
> Revert the patch until a RETFQ-based substitute is posted.
> 
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Guo Dong <guo.dong@intel.com>
> Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
> Cc: Rahul Kumar <rahul1.kumar@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Thomas Lendacky <thomas.lendacky@amd.com>
> Ref: https://edk2.groups.io/g/devel/message/68597
> Ref: https://www.redhat.com/archives/edk2-devel-archive/2020-December/msg00493.html
> Reported-by: Thomas Lendacky <thomas.lendacky@amd.com>
> Ref: https://edk2.groups.io/g/devel/message/68832
> Ref: https://www.redhat.com/archives/edk2-devel-archive/2020-December/msg00737.html
> Reported-by: James Bottomley <James.Bottomley@HansenPartnership.com>
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
> 
> Notes:
>     The broken patch was committed on December 8th; Tom reported the
>     regression the next day, and James reported it independently on Dec
>     14th/15th (dependent on one's time zone).
>     
>     Nine days after merging the broken patch, I've only seen "pondering" of
>     how we should fix the issue. I'll tell you how: I'm going to merge this
>     revert later today unless I see a patch that implements the RETFQ-based
>     replacement.
>     
>     Regressing code and not working diligently to address the problem is
>     unacceptable.
> 
>  UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm b/UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm
> index 6ad32b49f4ef..c3489bcc3e89 100644
> --- a/UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm
> +++ b/UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm
> @@ -23,8 +23,8 @@ ASM_PFX(SetCodeSelector):
>      sub     rsp, 0x10
>      lea     rax, [setCodeSelectorLongJump]
>      mov     [rsp], rax
> -    mov     [rsp+8], cx
> -    jmp     qword far [rsp]
> +    mov     [rsp+4], cx
> +    jmp     dword far [rsp]
>  setCodeSelectorLongJump:
>      add     rsp, 0x10
>      ret
> 

Merged as commit 089285b42c69, via
<https://github.com/tianocore/edk2/pull/1241>.

Laszlo



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#69184): https://edk2.groups.io/g/devel/message/69184
Mute This Topic: https://groups.io/mt/79032725/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-