[PATCH] OvmfPkg: TdxDxe: Fix AsmRelocateApMailBoxLoop


Min Xu
 

On May 24, 2022 3:54 PM, Yamahata, Isaku wrote:

In TDX, Application Processor busy-loops on Mailbox for OS to issue
MpProtectedModeWakeupCommandWakeup command to UEFI. As the AP
acking to it, it clears the command member according to ACPI spec 6.4,
5.2.12.19 Multiprocessor Wakeup Structure: "The application processor
need clear the command to Noop(0) as the acknowledgement that the
command is received."
However, AsmRelocateApMailBoxLoop wrongly clears WakeupVector.
Correctly clear command instead of WakeupVector.

Without this patch, TD guest kernel fails to boot APs.

Fixes: fae5c1464d ("OvmfPkg: Add TdxDxe driver")
Cc: Min Xu <min.m.xu@...>
Signed-off-by: Isaku Yamahata <isaku.yamahata@...>
---
OvmfPkg/TdxDxe/X64/ApRunLoop.nasm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/OvmfPkg/TdxDxe/X64/ApRunLoop.nasm
b/OvmfPkg/TdxDxe/X64/ApRunLoop.nasm
index 49bd04415c..a859375fb8 100644
--- a/OvmfPkg/TdxDxe/X64/ApRunLoop.nasm
+++ b/OvmfPkg/TdxDxe/X64/ApRunLoop.nasm
@@ -69,7 +69,7 @@ MailBoxWakeUp:
mov rax, [rbx + WakeupVectorOffset] ; OS sends a wakeup command
for a given APIC ID, firmware is supposed to reset ; the command field back
to zero as acknowledgement.- mov qword [rbx + WakeupVectorOffset],
0+ mov qword [rbx + CommandOffset], 0 jmp rax MailBoxSleep:
jmp $--
2.25.1
Thanks Isaku.
Reviewed-by: Min Xu <min.m.xu@...>


Isaku Yamahata
 

In TDX, Application Processor busy-loops on Mailbox for OS to issue
MpProtectedModeWakeupCommandWakeup command to UEFI. As the AP acking to
it, it clears the command member according to ACPI spec 6.4, 5.2.12.19
Multiprocessor Wakeup Structure: "The application processor need clear the
command to Noop(0) as the acknowledgement that the command is received."
However, AsmRelocateApMailBoxLoop wrongly clears WakeupVector. Correctly
clear command instead of WakeupVector.

Without this patch, TD guest kernel fails to boot APs.

Fixes: fae5c1464d ("OvmfPkg: Add TdxDxe driver")
Cc: Min Xu <min.m.xu@...>
Signed-off-by: Isaku Yamahata <isaku.yamahata@...>
---
OvmfPkg/TdxDxe/X64/ApRunLoop.nasm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/OvmfPkg/TdxDxe/X64/ApRunLoop.nasm b/OvmfPkg/TdxDxe/X64/ApRunLo=
op.nasm
index 49bd04415c..a859375fb8 100644
--- a/OvmfPkg/TdxDxe/X64/ApRunLoop.nasm
+++ b/OvmfPkg/TdxDxe/X64/ApRunLoop.nasm
@@ -69,7 +69,7 @@ MailBoxWakeUp:
mov rax, [rbx + WakeupVectorOffset]=0D
; OS sends a wakeup command for a given APIC ID, firmware is supposed =
to reset=0D
; the command field back to zero as acknowledgement.=0D
- mov qword [rbx + WakeupVectorOffset], 0=0D
+ mov qword [rbx + CommandOffset], 0=0D
jmp rax=0D
MailBoxSleep:=0D
jmp $=0D
--=20
2.25.1