* [PATCH 1/2] OvmfPkg: Fix TDVMCALL error in ApRunLoop.nasm
2022-05-31 14:31 [PATCH 0/2] Fix 2 issues in TDVF Min Xu
@ 2022-05-31 14:31 ` Min Xu
2022-06-01 8:49 ` Gerd Hoffmann
2022-05-31 14:31 ` [PATCH 2/2] OvmfPkg: Search EFI_RESOURCE_MEMORY_UNACCEPTED for Fw hoblist Min Xu
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Min Xu @ 2022-05-31 14:31 UTC (permalink / raw)
To: devel
Cc: Min Xu, Erdem Aktas, Gerd Hoffmann, James Bottomley, Jiewen Yao,
Tom Lendacky
According to GHCI Spec Table 2-1, in TDVMCALL R10 should be cleared
to 0 in input operands, and be checked for the return result.
https://cdrdv2.intel.com/v1/dl/getContent/726790
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
---
OvmfPkg/TdxDxe/X64/ApRunLoop.nasm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/OvmfPkg/TdxDxe/X64/ApRunLoop.nasm b/OvmfPkg/TdxDxe/X64/ApRunLoop.nasm
index 52fb3b4944bf..0bef89c48552 100644
--- a/OvmfPkg/TdxDxe/X64/ApRunLoop.nasm
+++ b/OvmfPkg/TdxDxe/X64/ApRunLoop.nasm
@@ -42,10 +42,11 @@ AsmRelocateApMailBoxLoopStart:
mov rax, TDVMCALL
mov rcx, TDVMCALL_EXPOSE_REGS_MASK
+ xor r10, r10
mov r11, EXIT_REASON_CPUID
mov r12, 0xb
tdcall
- test rax, rax
+ test r10, r10
jnz Panic
mov r8, r15
--
2.29.2.windows.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] OvmfPkg: Fix TDVMCALL error in ApRunLoop.nasm
2022-05-31 14:31 ` [PATCH 1/2] OvmfPkg: Fix TDVMCALL error in ApRunLoop.nasm Min Xu
@ 2022-06-01 8:49 ` Gerd Hoffmann
0 siblings, 0 replies; 7+ messages in thread
From: Gerd Hoffmann @ 2022-06-01 8:49 UTC (permalink / raw)
To: Min Xu; +Cc: devel, Erdem Aktas, James Bottomley, Jiewen Yao, Tom Lendacky
On Tue, May 31, 2022 at 10:31:16PM +0800, Min Xu wrote:
> According to GHCI Spec Table 2-1, in TDVMCALL R10 should be cleared
> to 0 in input operands, and be checked for the return result.
> https://cdrdv2.intel.com/v1/dl/getContent/726790
>
> Cc: Erdem Aktas <erdemaktas@google.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: James Bottomley <jejb@linux.ibm.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Tom Lendacky <thomas.lendacky@amd.com>
> Signed-off-by: Min Xu <min.m.xu@intel.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/2] OvmfPkg: Search EFI_RESOURCE_MEMORY_UNACCEPTED for Fw hoblist
2022-05-31 14:31 [PATCH 0/2] Fix 2 issues in TDVF Min Xu
2022-05-31 14:31 ` [PATCH 1/2] OvmfPkg: Fix TDVMCALL error in ApRunLoop.nasm Min Xu
@ 2022-05-31 14:31 ` Min Xu
2022-06-01 8:53 ` [edk2-devel] " Gerd Hoffmann
2022-06-02 8:47 ` [PATCH 0/2] Fix 2 issues in TDVF Yao, Jiewen
[not found] ` <16F4C173DC6EFECF.9239@groups.io>
3 siblings, 1 reply; 7+ messages in thread
From: Min Xu @ 2022-05-31 14:31 UTC (permalink / raw)
To: devel
Cc: Min Xu, Erdem Aktas, James Bottomley, Jiewen Yao, Gerd Hoffmann,
Tom Lendacky
In current TDVF implementation all unaccepted memory passed in Hoblist
are tagged as EFI_RESOURCE_MEMORY_UNACCEPTED. They're all accepted before
they can be accessed. After accepting memory region, the Hob ResourceType
is unchanged (still be EFI_RESOURCE_MEMORY_UNACCEPTED).
TDVF Config-B skip PEI phase and it tries to find a memory region which
is the largest one below 4GB. Then this memory region will be used as the
firmware hoblist.
So we should walk thru the input hoblist and search for the memory region
with the type of EFI_RESOURCE_MEMORY_UNACCEPTED.
Because EFI_RESOURCE_MEMORY_UNACCEPTED has not been officially in PI spec.
So it cannot be defined in MdePkg/Include/Pi/PiHob.h. As a temporary
solution it is defined in Hob.c.
There is a patch-set for lazy-accept very soon. In that patch-set
EFI_RESOURCE_MEMORY_UNACCEPTED will be defined in MdeModulePkg.
Config-B: https://edk2.groups.io/g/devel/message/76367
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Ccigned-off-by: Min Xu <min.m.xu@intel.com>
---
OvmfPkg/Library/PeilessStartupLib/Hob.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/OvmfPkg/Library/PeilessStartupLib/Hob.c b/OvmfPkg/Library/PeilessStartupLib/Hob.c
index 3c544ca1f67d..5fc84a809025 100644
--- a/OvmfPkg/Library/PeilessStartupLib/Hob.c
+++ b/OvmfPkg/Library/PeilessStartupLib/Hob.c
@@ -22,6 +22,8 @@
#include <OvmfPlatforms.h>
#include "PeilessStartupInternal.h"
+#define EFI_RESOURCE_MEMORY_UNACCEPTED 7
+
/**
* Construct the HobList in SEC phase.
*
@@ -90,7 +92,7 @@ ConstructFwHobList (
//
while (!END_OF_HOB_LIST (Hob)) {
if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) {
- if (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) {
+ if (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_MEMORY_UNACCEPTED) {
PhysicalEnd = Hob.ResourceDescriptor->PhysicalStart + Hob.ResourceDescriptor->ResourceLength;
ResourceLength = Hob.ResourceDescriptor->ResourceLength;
--
2.29.2.windows.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [edk2-devel] [PATCH 2/2] OvmfPkg: Search EFI_RESOURCE_MEMORY_UNACCEPTED for Fw hoblist
2022-05-31 14:31 ` [PATCH 2/2] OvmfPkg: Search EFI_RESOURCE_MEMORY_UNACCEPTED for Fw hoblist Min Xu
@ 2022-06-01 8:53 ` Gerd Hoffmann
0 siblings, 0 replies; 7+ messages in thread
From: Gerd Hoffmann @ 2022-06-01 8:53 UTC (permalink / raw)
To: devel, min.m.xu; +Cc: Erdem Aktas, James Bottomley, Jiewen Yao, Tom Lendacky
On Tue, May 31, 2022 at 10:31:17PM +0800, Min Xu wrote:
> In current TDVF implementation all unaccepted memory passed in Hoblist
> are tagged as EFI_RESOURCE_MEMORY_UNACCEPTED. They're all accepted before
> they can be accessed. After accepting memory region, the Hob ResourceType
> is unchanged (still be EFI_RESOURCE_MEMORY_UNACCEPTED).
>
> TDVF Config-B skip PEI phase and it tries to find a memory region which
> is the largest one below 4GB. Then this memory region will be used as the
> firmware hoblist.
>
> So we should walk thru the input hoblist and search for the memory region
> with the type of EFI_RESOURCE_MEMORY_UNACCEPTED.
>
> Because EFI_RESOURCE_MEMORY_UNACCEPTED has not been officially in PI spec.
> So it cannot be defined in MdePkg/Include/Pi/PiHob.h. As a temporary
> solution it is defined in Hob.c.
>
> There is a patch-set for lazy-accept very soon. In that patch-set
> EFI_RESOURCE_MEMORY_UNACCEPTED will be defined in MdeModulePkg.
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
take care,
Gerd
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] Fix 2 issues in TDVF
2022-05-31 14:31 [PATCH 0/2] Fix 2 issues in TDVF Min Xu
2022-05-31 14:31 ` [PATCH 1/2] OvmfPkg: Fix TDVMCALL error in ApRunLoop.nasm Min Xu
2022-05-31 14:31 ` [PATCH 2/2] OvmfPkg: Search EFI_RESOURCE_MEMORY_UNACCEPTED for Fw hoblist Min Xu
@ 2022-06-02 8:47 ` Yao, Jiewen
[not found] ` <16F4C173DC6EFECF.9239@groups.io>
3 siblings, 0 replies; 7+ messages in thread
From: Yao, Jiewen @ 2022-06-02 8:47 UTC (permalink / raw)
To: Xu, Min M, devel@edk2.groups.io
Cc: Aktas, Erdem, Gerd Hoffmann, James Bottomley, Tom Lendacky
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
> -----Original Message-----
> From: Xu, Min M <min.m.xu@intel.com>
> Sent: Tuesday, May 31, 2022 10:31 PM
> To: devel@edk2.groups.io
> Cc: Xu, Min M <min.m.xu@intel.com>; Aktas, Erdem
> <erdemaktas@google.com>; Gerd Hoffmann <kraxel@redhat.com>; James
> Bottomley <jejb@linux.ibm.com>; Yao, Jiewen <jiewen.yao@intel.com>; Tom
> Lendacky <thomas.lendacky@amd.com>
> Subject: [PATCH 0/2] Fix 2 issues in TDVF
>
> During the integration test with TDX upstreaming KVM/QEMU there are 2
> issues are found. This patch-set are to fix these 2 issue.
> - Fix TDVMCALL error in ApRunLoop.nasm
> - Search EFI_RESOURCE_MEMORY_UNACCEPTED for Fw hoblist
>
> Cc: Erdem Aktas <erdemaktas@google.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: James Bottomley <jejb@linux.ibm.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Tom Lendacky <thomas.lendacky@amd.com>
> Signed-off-by: Min Xu <min.m.xu@intel.com>
> *** BLURB HERE ***
>
> Min Xu (2):
> OvmfPkg: Fix TDVMCALL error in ApRunLoop.nasm
> OvmfPkg: Search EFI_RESOURCE_MEMORY_UNACCEPTED for Fw hoblist
>
> OvmfPkg/Library/PeilessStartupLib/Hob.c | 4 +++-
> OvmfPkg/TdxDxe/X64/ApRunLoop.nasm | 3 ++-
> 2 files changed, 5 insertions(+), 2 deletions(-)
>
> --
> 2.29.2.windows.2
^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <16F4C173DC6EFECF.9239@groups.io>]
* Re: [edk2-devel] [PATCH 0/2] Fix 2 issues in TDVF
[not found] ` <16F4C173DC6EFECF.9239@groups.io>
@ 2022-06-02 9:12 ` Yao, Jiewen
0 siblings, 0 replies; 7+ messages in thread
From: Yao, Jiewen @ 2022-06-02 9:12 UTC (permalink / raw)
To: devel@edk2.groups.io, Yao, Jiewen, Xu, Min M
Cc: Aktas, Erdem, Gerd Hoffmann, James Bottomley, Tom Lendacky
https://github.com/tianocore/edk2/pull/2937
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Yao, Jiewen
> Sent: Thursday, June 2, 2022 4:48 PM
> To: Xu, Min M <min.m.xu@intel.com>; devel@edk2.groups.io
> Cc: Aktas, Erdem <erdemaktas@google.com>; Gerd Hoffmann
> <kraxel@redhat.com>; James Bottomley <jejb@linux.ibm.com>; Tom Lendacky
> <thomas.lendacky@amd.com>
> Subject: Re: [edk2-devel] [PATCH 0/2] Fix 2 issues in TDVF
>
> Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
>
> > -----Original Message-----
> > From: Xu, Min M <min.m.xu@intel.com>
> > Sent: Tuesday, May 31, 2022 10:31 PM
> > To: devel@edk2.groups.io
> > Cc: Xu, Min M <min.m.xu@intel.com>; Aktas, Erdem
> > <erdemaktas@google.com>; Gerd Hoffmann <kraxel@redhat.com>; James
> > Bottomley <jejb@linux.ibm.com>; Yao, Jiewen <jiewen.yao@intel.com>; Tom
> > Lendacky <thomas.lendacky@amd.com>
> > Subject: [PATCH 0/2] Fix 2 issues in TDVF
> >
> > During the integration test with TDX upstreaming KVM/QEMU there are 2
> > issues are found. This patch-set are to fix these 2 issue.
> > - Fix TDVMCALL error in ApRunLoop.nasm
> > - Search EFI_RESOURCE_MEMORY_UNACCEPTED for Fw hoblist
> >
> > Cc: Erdem Aktas <erdemaktas@google.com>
> > Cc: Gerd Hoffmann <kraxel@redhat.com>
> > Cc: James Bottomley <jejb@linux.ibm.com>
> > Cc: Jiewen Yao <jiewen.yao@intel.com>
> > Cc: Tom Lendacky <thomas.lendacky@amd.com>
> > Signed-off-by: Min Xu <min.m.xu@intel.com>
> > *** BLURB HERE ***
> >
> > Min Xu (2):
> > OvmfPkg: Fix TDVMCALL error in ApRunLoop.nasm
> > OvmfPkg: Search EFI_RESOURCE_MEMORY_UNACCEPTED for Fw hoblist
> >
> > OvmfPkg/Library/PeilessStartupLib/Hob.c | 4 +++-
> > OvmfPkg/TdxDxe/X64/ApRunLoop.nasm | 3 ++-
> > 2 files changed, 5 insertions(+), 2 deletions(-)
> >
> > --
> > 2.29.2.windows.2
>
>
>
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread