public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] OvmfPkg: TdxDxe: Fix AsmRelocateApMailBoxLoop
@ 2022-05-24  7:53 isaku.yamahata
  2022-05-24  9:14 ` Min Xu
  0 siblings, 1 reply; 5+ messages in thread
From: isaku.yamahata @ 2022-05-24  7:53 UTC (permalink / raw)
  To: devel; +Cc: isaku.yamahata, Min Xu

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@intel.com>
Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
---
 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] OvmfPkg: TdxDxe: Fix AsmRelocateApMailBoxLoop
  2022-05-24  7:53 [PATCH] OvmfPkg: TdxDxe: Fix AsmRelocateApMailBoxLoop isaku.yamahata
@ 2022-05-24  9:14 ` Min Xu
  2022-05-25  2:39   ` 回复: [edk2-devel] " gaoliming
  0 siblings, 1 reply; 5+ messages in thread
From: Min Xu @ 2022-05-24  9:14 UTC (permalink / raw)
  To: Yamahata, Isaku, devel@edk2.groups.io

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@intel.com>
> Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
> ---
>  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@intel.com>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* 回复: [edk2-devel] [PATCH] OvmfPkg: TdxDxe: Fix AsmRelocateApMailBoxLoop
  2022-05-24  9:14 ` Min Xu
@ 2022-05-25  2:39   ` gaoliming
  2022-05-25  3:00     ` Yao, Jiewen
  0 siblings, 1 reply; 5+ messages in thread
From: gaoliming @ 2022-05-25  2:39 UTC (permalink / raw)
  To: devel, min.m.xu, 'Yamahata, Isaku'; +Cc: 'Jiewen Yao'

Min, Isaku, Jiewen:
  Is this patch required to catch edk2 202205 stable tag?

Thanks
Liming
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Min Xu
> 发送时间: 2022年5月24日 17:14
> 收件人: Yamahata, Isaku <isaku.yamahata@intel.com>;
> devel@edk2.groups.io
> 主题: Re: [edk2-devel] [PATCH] OvmfPkg: TdxDxe: Fix
> AsmRelocateApMailBoxLoop
> 
> 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@intel.com>
> > Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
> > ---
> >  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@intel.com>
> 
> 
> 
> 
> 






^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [edk2-devel] [PATCH] OvmfPkg: TdxDxe: Fix AsmRelocateApMailBoxLoop
  2022-05-25  2:39   ` 回复: [edk2-devel] " gaoliming
@ 2022-05-25  3:00     ` Yao, Jiewen
  2022-05-25 13:44       ` Yao, Jiewen
  0 siblings, 1 reply; 5+ messages in thread
From: Yao, Jiewen @ 2022-05-25  3:00 UTC (permalink / raw)
  To: Gao, Liming, devel@edk2.groups.io, Xu, Min M, Yamahata, Isaku

Agree to merge to stable tag. Thanks for the reminder.

Reviewed-by: Jiewen Yao@intel.com

> -----Original Message-----
> From: gaoliming <gaoliming@byosoft.com.cn>
> Sent: Wednesday, May 25, 2022 10:40 AM
> To: devel@edk2.groups.io; Xu, Min M <min.m.xu@intel.com>; Yamahata, Isaku
> <isaku.yamahata@intel.com>
> Cc: Yao, Jiewen <jiewen.yao@intel.com>
> Subject: 回复: [edk2-devel] [PATCH] OvmfPkg: TdxDxe: Fix
> AsmRelocateApMailBoxLoop
> 
> Min, Isaku, Jiewen:
>   Is this patch required to catch edk2 202205 stable tag?
> 
> Thanks
> Liming
> > -----邮件原件-----
> > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Min Xu
> > 发送时间: 2022年5月24日 17:14
> > 收件人: Yamahata, Isaku <isaku.yamahata@intel.com>;
> > devel@edk2.groups.io
> > 主题: Re: [edk2-devel] [PATCH] OvmfPkg: TdxDxe: Fix
> > AsmRelocateApMailBoxLoop
> >
> > 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@intel.com>
> > > Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
> > > ---
> > >  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@intel.com>
> >
> >
> >
> > 
> >
> 
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [edk2-devel] [PATCH] OvmfPkg: TdxDxe: Fix AsmRelocateApMailBoxLoop
  2022-05-25  3:00     ` Yao, Jiewen
@ 2022-05-25 13:44       ` Yao, Jiewen
  0 siblings, 0 replies; 5+ messages in thread
From: Yao, Jiewen @ 2022-05-25 13:44 UTC (permalink / raw)
  To: Gao, Liming, devel@edk2.groups.io, Xu, Min M, Yamahata, Isaku

Merged https://github.com/tianocore/edk2/pull/2915

> -----Original Message-----
> From: Yao, Jiewen
> Sent: Wednesday, May 25, 2022 11:01 AM
> To: 'gaoliming' <gaoliming@byosoft.com.cn>; devel@edk2.groups.io; Xu, Min
> M <min.m.xu@intel.com>; Yamahata, Isaku <isaku.yamahata@intel.com>
> Subject: RE: [edk2-devel] [PATCH] OvmfPkg: TdxDxe: Fix
> AsmRelocateApMailBoxLoop
> 
> Agree to merge to stable tag. Thanks for the reminder.
> 
> Reviewed-by: Jiewen Yao@intel.com
> 
> > -----Original Message-----
> > From: gaoliming <gaoliming@byosoft.com.cn>
> > Sent: Wednesday, May 25, 2022 10:40 AM
> > To: devel@edk2.groups.io; Xu, Min M <min.m.xu@intel.com>; Yamahata,
> Isaku
> > <isaku.yamahata@intel.com>
> > Cc: Yao, Jiewen <jiewen.yao@intel.com>
> > Subject: 回复: [edk2-devel] [PATCH] OvmfPkg: TdxDxe: Fix
> > AsmRelocateApMailBoxLoop
> >
> > Min, Isaku, Jiewen:
> >   Is this patch required to catch edk2 202205 stable tag?
> >
> > Thanks
> > Liming
> > > -----邮件原件-----
> > > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Min Xu
> > > 发送时间: 2022年5月24日 17:14
> > > 收件人: Yamahata, Isaku <isaku.yamahata@intel.com>;
> > > devel@edk2.groups.io
> > > 主题: Re: [edk2-devel] [PATCH] OvmfPkg: TdxDxe: Fix
> > > AsmRelocateApMailBoxLoop
> > >
> > > 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@intel.com>
> > > > Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
> > > > ---
> > > >  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@intel.com>
> > >
> > >
> > >
> > > 
> > >
> >
> >


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-05-25 13:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-24  7:53 [PATCH] OvmfPkg: TdxDxe: Fix AsmRelocateApMailBoxLoop isaku.yamahata
2022-05-24  9:14 ` Min Xu
2022-05-25  2:39   ` 回复: [edk2-devel] " gaoliming
2022-05-25  3:00     ` Yao, Jiewen
2022-05-25 13:44       ` Yao, Jiewen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox