* BUG: OvmfPkgX64 is broken with cee5b0441af3 UefiCpuPkg/CpuDxe: Fix boot error
@ 2020-12-14 23:51 James Bottomley
2020-12-15 3:47 ` [edk2-devel] " James Bottomley
0 siblings, 1 reply; 2+ messages in thread
From: James Bottomley @ 2020-12-14 23:51 UTC (permalink / raw)
To: devel; +Cc: Guo Dong, Dong, Eric, Ni, Ray, Kumar, Rahul1, LaszloErsek
I found this trying to test out the upstream SEV secret injection on an
AMD rome system. However, I rebuilt the OvmfPkgX64 (still on a rome
system) just to check. I get a boot loop here if I leave this commit
unreverted:
InstallProtocolInterface: BC62157E-3E33-4FEC-9920-2D3B36D750DF 7F1AD918
ProtectUefiImageCommon - 0x7F1AD2C0
- 0x000000007F068000 - 0x000000000000FCC0
Paging: added 512 pages to page table pool
CurrentPagingContext:
MachineType - 0x8664
PageTableBase - 0x7F801000
Attributes - 0xC0000006
SecCoreStartupWithStack(0xFFFCC000, 0x820000)
If I revert this commit, it will boot up normally.
The memory specification for qemu-kvm I'm using is
-m 4096M,slots=5,maxmem=30G
but reducing it to under 4GB doesn't help
James
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [edk2-devel] BUG: OvmfPkgX64 is broken with cee5b0441af3 UefiCpuPkg/CpuDxe: Fix boot error
2020-12-14 23:51 BUG: OvmfPkgX64 is broken with cee5b0441af3 UefiCpuPkg/CpuDxe: Fix boot error James Bottomley
@ 2020-12-15 3:47 ` James Bottomley
0 siblings, 0 replies; 2+ messages in thread
From: James Bottomley @ 2020-12-15 3:47 UTC (permalink / raw)
To: devel; +Cc: Guo Dong, Dong, Eric, Ni, Ray, Kumar, Rahul1, LaszloErsek
On Mon, 2020-12-14 at 15:51 -0800, James Bottomley wrote:
> I found this trying to test out the upstream SEV secret injection on
> an
> AMD rome system. However, I rebuilt the OvmfPkgX64 (still on a rome
> system) just to check. I get a boot loop here if I leave this commit
> unreverted:
>
> InstallProtocolInterface: BC62157E-3E33-4FEC-9920-2D3B36D750DF
> 7F1AD918
> ProtectUefiImageCommon - 0x7F1AD2C0
> - 0x000000007F068000 - 0x000000000000FCC0
> Paging: added 512 pages to page table pool
> CurrentPagingContext:
> MachineType - 0x8664
> PageTableBase - 0x7F801000
> Attributes - 0xC0000006
> SecCoreStartupWithStack(0xFFFCC000, 0x820000)
>
> If I revert this commit, it will boot up normally.
>
> The memory specification for qemu-kvm I'm using is
>
> -m 4096M,slots=5,maxmem=30G
>
> but reducing it to under 4GB doesn't help
I think I found the source of the problem: nasm is generating this
assembly sequence (disassembled by objdump):
14: 48 ff 2c 24 rex.W ljmp *(%rsp)
However, on AMD the rex.W prefix to a ljmp can be ineffective and the
recommended way to do this is with lretq (or retfq in nasm speak). If
I apply the patch below, I can get the long word version to work for me
on SEV.
James
---
diff --git a/UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm b/UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm
index 6ad32b49f4ef..a2490073cef6 100644
--- a/UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm
+++ b/UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm
@@ -20,13 +20,11 @@
;------------------------------------------------------------------------------
global ASM_PFX(SetCodeSelector)
ASM_PFX(SetCodeSelector):
- sub rsp, 0x10
lea rax, [setCodeSelectorLongJump]
- mov [rsp], rax
- mov [rsp+8], cx
- jmp qword far [rsp]
+ push rcx
+ push rax
+ retfq
setCodeSelectorLongJump:
- add rsp, 0x10
ret
;------------------------------------------------------------------------------
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-12-15 3:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-14 23:51 BUG: OvmfPkgX64 is broken with cee5b0441af3 UefiCpuPkg/CpuDxe: Fix boot error James Bottomley
2020-12-15 3:47 ` [edk2-devel] " James Bottomley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox