[edk2-devel] [PATCH V2 3/4] UefiCpuPkg/ResetVector: Add Main32 entry point in Main.asm

Min Xu posted 4 patches 4 years, 6 months ago
There is a newer version of this series
[edk2-devel] [PATCH V2 3/4] UefiCpuPkg/ResetVector: Add Main32 entry point in Main.asm
Posted by Min Xu 4 years, 6 months ago
RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3429

In Tdx all CPUs "reset" to run on 32-bit protected mode with flat
descriptor (paging disabled). Main32 entry point is added in
UefiCpuPkg/ResetVector/Vtf0/Main.asm so that Main.asm can support
the 32-bit protected mode.

Init32.asm is the 32-bit initialization code. It is a null stub in
UefiCpuPkg. The actual initialization can be implemented in the platform
(OvmfPkg/ResetVector/Ia32/Init32.asm is the example.)

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
---
 UefiCpuPkg/ResetVector/Vtf0/Ia32/Init32.asm | 13 +++++++++++++
 UefiCpuPkg/ResetVector/Vtf0/Main.asm        | 14 ++++++++++++++
 UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb      |  2 +-
 3 files changed, 28 insertions(+), 1 deletion(-)
 create mode 100644 UefiCpuPkg/ResetVector/Vtf0/Ia32/Init32.asm

diff --git a/UefiCpuPkg/ResetVector/Vtf0/Ia32/Init32.asm b/UefiCpuPkg/ResetVector/Vtf0/Ia32/Init32.asm
new file mode 100644
index 000000000000..0cdae4a4a84a
--- /dev/null
+++ b/UefiCpuPkg/ResetVector/Vtf0/Ia32/Init32.asm
@@ -0,0 +1,13 @@
+;------------------------------------------------------------------------------
+; @file
+;   32-bit initialization code.
+; Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
+; SPDX-License-Identifier: BSD-2-Clause-Patent
+;
+;------------------------------------------------------------------------------
+
+BITS 32
+
+Init32:
+    nop
+    OneTimeCallRet Init32
diff --git a/UefiCpuPkg/ResetVector/Vtf0/Main.asm b/UefiCpuPkg/ResetVector/Vtf0/Main.asm
index 19d08482f831..4920c6937e1b 100644
--- a/UefiCpuPkg/ResetVector/Vtf0/Main.asm
+++ b/UefiCpuPkg/ResetVector/Vtf0/Main.asm
@@ -36,6 +36,20 @@ Main16:
 
 BITS    32
 
+%ifdef ARCH_X64
+
+    jmp SearchBfv
+
+;
+; Entry point of Main32
+;
+Main32:
+
+    OneTimeCall Init32
+
+%endif
+
+SearchBfv:
     ;
     ; Search for the Boot Firmware Volume (BFV)
     ;
diff --git a/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb b/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb
index 493738c79c1c..6493b9863c48 100644
--- a/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb
+++ b/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb
@@ -51,7 +51,7 @@
 %include "Ia32/SearchForSecEntry.asm"
 
 %ifdef ARCH_X64
-%include "Ia32/Flat32ToFlat64.asm"
+%include "Ia32/Init32.asm"
 %include "Ia32/PageTables64.asm"
 %endif
 
-- 
2.29.2.windows.2



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


Re: [edk2-devel] [PATCH V2 3/4] UefiCpuPkg/ResetVector: Add Main32 entry point in Main.asm
Posted by Ni, Ray 4 years, 6 months ago
Reviewed-by: Ray Ni <ray.ni@intel.com>

> -----Original Message-----
> From: Xu, Min M <min.m.xu@intel.com>
> Sent: Thursday, July 22, 2021 1:52 PM
> To: devel@edk2.groups.io
> Cc: Xu, Min M <min.m.xu@intel.com>; Dong, Eric <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Yao, Jiewen
> <jiewen.yao@intel.com>
> Subject: [PATCH V2 3/4] UefiCpuPkg/ResetVector: Add Main32 entry point in Main.asm
> 
> RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3429
> 
> In Tdx all CPUs "reset" to run on 32-bit protected mode with flat
> descriptor (paging disabled). Main32 entry point is added in
> UefiCpuPkg/ResetVector/Vtf0/Main.asm so that Main.asm can support
> the 32-bit protected mode.
> 
> Init32.asm is the 32-bit initialization code. It is a null stub in
> UefiCpuPkg. The actual initialization can be implemented in the platform
> (OvmfPkg/ResetVector/Ia32/Init32.asm is the example.)
> 
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Signed-off-by: Min Xu <min.m.xu@intel.com>
> ---
>  UefiCpuPkg/ResetVector/Vtf0/Ia32/Init32.asm | 13 +++++++++++++
>  UefiCpuPkg/ResetVector/Vtf0/Main.asm        | 14 ++++++++++++++
>  UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb      |  2 +-
>  3 files changed, 28 insertions(+), 1 deletion(-)
>  create mode 100644 UefiCpuPkg/ResetVector/Vtf0/Ia32/Init32.asm
> 
> diff --git a/UefiCpuPkg/ResetVector/Vtf0/Ia32/Init32.asm b/UefiCpuPkg/ResetVector/Vtf0/Ia32/Init32.asm
> new file mode 100644
> index 000000000000..0cdae4a4a84a
> --- /dev/null
> +++ b/UefiCpuPkg/ResetVector/Vtf0/Ia32/Init32.asm
> @@ -0,0 +1,13 @@
> +;------------------------------------------------------------------------------
> +; @file
> +;   32-bit initialization code.
> +; Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
> +; SPDX-License-Identifier: BSD-2-Clause-Patent
> +;
> +;------------------------------------------------------------------------------
> +
> +BITS 32
> +
> +Init32:
> +    nop
> +    OneTimeCallRet Init32
> diff --git a/UefiCpuPkg/ResetVector/Vtf0/Main.asm b/UefiCpuPkg/ResetVector/Vtf0/Main.asm
> index 19d08482f831..4920c6937e1b 100644
> --- a/UefiCpuPkg/ResetVector/Vtf0/Main.asm
> +++ b/UefiCpuPkg/ResetVector/Vtf0/Main.asm
> @@ -36,6 +36,20 @@ Main16:
> 
>  BITS    32
> 
> +%ifdef ARCH_X64
> +
> +    jmp SearchBfv
> +
> +;
> +; Entry point of Main32
> +;
> +Main32:
> +
> +    OneTimeCall Init32
> +
> +%endif
> +
> +SearchBfv:
>      ;
>      ; Search for the Boot Firmware Volume (BFV)
>      ;
> diff --git a/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb b/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb
> index 493738c79c1c..6493b9863c48 100644
> --- a/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb
> +++ b/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb
> @@ -51,7 +51,7 @@
>  %include "Ia32/SearchForSecEntry.asm"
> 
>  %ifdef ARCH_X64
> -%include "Ia32/Flat32ToFlat64.asm"
> +%include "Ia32/Init32.asm"
>  %include "Ia32/PageTables64.asm"
>  %endif
> 
> --
> 2.29.2.windows.2



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


Re: [edk2-devel] [PATCH V2 3/4] UefiCpuPkg/ResetVector: Add Main32 entry point in Main.asm
Posted by Yao, Jiewen 4 years, 6 months ago
Current OvmfPkg Reser vector is a mess (see my previous email).
I also compared the ResetVector code in UefiCpuPkg and OvmfPkg. There are already duplication/override.

I suggest we just drop UefiCpuPkg change, and focus on improving OvmfPkg.
If we need add something in UefiCpuPkg, let's copy the file to OvmfPkg and update there.

I really don't want to mess up UefiCpuPkg at this moment.
We can make a better architecture to share reset vector in virtual BIOS and physical BIOS later. But at this moment, let's finish the virtual BIOS architecture at first.

Thank you
Yao Jiewen

> -----Original Message-----
> From: Xu, Min M <min.m.xu@intel.com>
> Sent: Thursday, July 22, 2021 1:52 PM
> To: devel@edk2.groups.io
> Cc: Xu, Min M <min.m.xu@intel.com>; Dong, Eric <eric.dong@intel.com>; Ni,
> Ray <ray.ni@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>
> Subject: [PATCH V2 3/4] UefiCpuPkg/ResetVector: Add Main32 entry point in
> Main.asm
> 
> RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3429
> 
> In Tdx all CPUs "reset" to run on 32-bit protected mode with flat
> descriptor (paging disabled). Main32 entry point is added in
> UefiCpuPkg/ResetVector/Vtf0/Main.asm so that Main.asm can support
> the 32-bit protected mode.
> 
> Init32.asm is the 32-bit initialization code. It is a null stub in
> UefiCpuPkg. The actual initialization can be implemented in the platform
> (OvmfPkg/ResetVector/Ia32/Init32.asm is the example.)
> 
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Signed-off-by: Min Xu <min.m.xu@intel.com>
> ---
>  UefiCpuPkg/ResetVector/Vtf0/Ia32/Init32.asm | 13 +++++++++++++
>  UefiCpuPkg/ResetVector/Vtf0/Main.asm        | 14 ++++++++++++++
>  UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb      |  2 +-
>  3 files changed, 28 insertions(+), 1 deletion(-)
>  create mode 100644 UefiCpuPkg/ResetVector/Vtf0/Ia32/Init32.asm
> 
> diff --git a/UefiCpuPkg/ResetVector/Vtf0/Ia32/Init32.asm
> b/UefiCpuPkg/ResetVector/Vtf0/Ia32/Init32.asm
> new file mode 100644
> index 000000000000..0cdae4a4a84a
> --- /dev/null
> +++ b/UefiCpuPkg/ResetVector/Vtf0/Ia32/Init32.asm
> @@ -0,0 +1,13 @@
> +;------------------------------------------------------------------------------
> +; @file
> +;   32-bit initialization code.
> +; Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
> +; SPDX-License-Identifier: BSD-2-Clause-Patent
> +;
> +;------------------------------------------------------------------------------
> +
> +BITS 32
> +
> +Init32:
> +    nop
> +    OneTimeCallRet Init32
> diff --git a/UefiCpuPkg/ResetVector/Vtf0/Main.asm
> b/UefiCpuPkg/ResetVector/Vtf0/Main.asm
> index 19d08482f831..4920c6937e1b 100644
> --- a/UefiCpuPkg/ResetVector/Vtf0/Main.asm
> +++ b/UefiCpuPkg/ResetVector/Vtf0/Main.asm
> @@ -36,6 +36,20 @@ Main16:
> 
>  BITS    32
> 
> +%ifdef ARCH_X64
> +
> +    jmp SearchBfv
> +
> +;
> +; Entry point of Main32
> +;
> +Main32:
> +
> +    OneTimeCall Init32
> +
> +%endif
> +
> +SearchBfv:
>      ;
>      ; Search for the Boot Firmware Volume (BFV)
>      ;
> diff --git a/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb
> b/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb
> index 493738c79c1c..6493b9863c48 100644
> --- a/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb
> +++ b/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb
> @@ -51,7 +51,7 @@
>  %include "Ia32/SearchForSecEntry.asm"
> 
>  %ifdef ARCH_X64
> -%include "Ia32/Flat32ToFlat64.asm"
> +%include "Ia32/Init32.asm"
>  %include "Ia32/PageTables64.asm"
>  %endif
> 
> --
> 2.29.2.windows.2



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


Re: [edk2-devel] [PATCH V2 3/4] UefiCpuPkg/ResetVector: Add Main32 entry point in Main.asm
Posted by Min Xu 4 years, 6 months ago
On July 25, 2021 2:08 PM, Yao, Jiewen wrote:
> Current OvmfPkg Reser vector is a mess (see my previous email).
> I also compared the ResetVector code in UefiCpuPkg and OvmfPkg. There
> are already duplication/override.
> 
> I suggest we just drop UefiCpuPkg change, and focus on improving OvmfPkg.
> If we need add something in UefiCpuPkg, let's copy the file to OvmfPkg and
> update there.
> 
Do you mean we create the Main.asm in OvmfPkg/ResetVector/ and update
the changes in this Main.asm?
>
> I really don't want to mess up UefiCpuPkg at this moment.
> We can make a better architecture to share reset vector in virtual BIOS and
> physical BIOS later. But at this moment, let's finish the virtual BIOS
> architecture at first.
> 
> Thank you
> Yao Jiewen
> 
> > -----Original Message-----
> > From: Xu, Min M <min.m.xu@intel.com>
> > Sent: Thursday, July 22, 2021 1:52 PM
> > To: devel@edk2.groups.io
> > Cc: Xu, Min M <min.m.xu@intel.com>; Dong, Eric <eric.dong@intel.com>;
> > Ni, Ray <ray.ni@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>
> > Subject: [PATCH V2 3/4] UefiCpuPkg/ResetVector: Add Main32 entry point
> > in Main.asm
> >
> > RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3429
> >
> > In Tdx all CPUs "reset" to run on 32-bit protected mode with flat
> > descriptor (paging disabled). Main32 entry point is added in
> > UefiCpuPkg/ResetVector/Vtf0/Main.asm so that Main.asm can support the
> > 32-bit protected mode.
> >
> > Init32.asm is the 32-bit initialization code. It is a null stub in
> > UefiCpuPkg. The actual initialization can be implemented in the
> > platform (OvmfPkg/ResetVector/Ia32/Init32.asm is the example.)
> >
> > Cc: Eric Dong <eric.dong@intel.com>
> > Cc: Ray Ni <ray.ni@intel.com>
> > Cc: Jiewen Yao <jiewen.yao@intel.com>
> > Signed-off-by: Min Xu <min.m.xu@intel.com>
> > ---
> >  UefiCpuPkg/ResetVector/Vtf0/Ia32/Init32.asm | 13 +++++++++++++
> >  UefiCpuPkg/ResetVector/Vtf0/Main.asm        | 14 ++++++++++++++
> >  UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb      |  2 +-
> >  3 files changed, 28 insertions(+), 1 deletion(-)  create mode 100644
> > UefiCpuPkg/ResetVector/Vtf0/Ia32/Init32.asm
> >
> > diff --git a/UefiCpuPkg/ResetVector/Vtf0/Ia32/Init32.asm
> > b/UefiCpuPkg/ResetVector/Vtf0/Ia32/Init32.asm
> > new file mode 100644
> > index 000000000000..0cdae4a4a84a
> > --- /dev/null
> > +++ b/UefiCpuPkg/ResetVector/Vtf0/Ia32/Init32.asm
> > @@ -0,0 +1,13 @@
> > +;--------------------------------------------------------------------
> > +----------
> > +; @file
> > +;   32-bit initialization code.
> > +; Copyright (c) 2021, Intel Corporation. All rights reserved.<BR> ;
> > +SPDX-License-Identifier: BSD-2-Clause-Patent ;
> > +;--------------------------------------------------------------------
> > +----------
> > +
> > +BITS 32
> > +
> > +Init32:
> > +    nop
> > +    OneTimeCallRet Init32
> > diff --git a/UefiCpuPkg/ResetVector/Vtf0/Main.asm
> > b/UefiCpuPkg/ResetVector/Vtf0/Main.asm
> > index 19d08482f831..4920c6937e1b 100644
> > --- a/UefiCpuPkg/ResetVector/Vtf0/Main.asm
> > +++ b/UefiCpuPkg/ResetVector/Vtf0/Main.asm
> > @@ -36,6 +36,20 @@ Main16:
> >
> >  BITS    32
> >
> > +%ifdef ARCH_X64
> > +
> > +    jmp SearchBfv
> > +
> > +;
> > +; Entry point of Main32
> > +;
> > +Main32:
> > +
> > +    OneTimeCall Init32
> > +
> > +%endif
> > +
> > +SearchBfv:
> >      ;
> >      ; Search for the Boot Firmware Volume (BFV)
> >      ;
> > diff --git a/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb
> > b/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb
> > index 493738c79c1c..6493b9863c48 100644
> > --- a/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb
> > +++ b/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb
> > @@ -51,7 +51,7 @@
> >  %include "Ia32/SearchForSecEntry.asm"
> >
> >  %ifdef ARCH_X64
> > -%include "Ia32/Flat32ToFlat64.asm"
> > +%include "Ia32/Init32.asm"
> >  %include "Ia32/PageTables64.asm"
> >  %endif
> >
> > --
> > 2.29.2.windows.2



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


Re: [edk2-devel] [PATCH V2 3/4] UefiCpuPkg/ResetVector: Add Main32 entry point in Main.asm
Posted by Yao, Jiewen 4 years, 6 months ago
Yes, if that can avoid the UefiCpuPkg change.

> -----Original Message-----
> From: Xu, Min M <min.m.xu@intel.com>
> Sent: Sunday, July 25, 2021 3:42 PM
> To: Yao, Jiewen <jiewen.yao@intel.com>; devel@edk2.groups.io
> Cc: Dong, Eric <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com>
> Subject: RE: [PATCH V2 3/4] UefiCpuPkg/ResetVector: Add Main32 entry point in
> Main.asm
> 
> On July 25, 2021 2:08 PM, Yao, Jiewen wrote:
> > Current OvmfPkg Reser vector is a mess (see my previous email).
> > I also compared the ResetVector code in UefiCpuPkg and OvmfPkg. There
> > are already duplication/override.
> >
> > I suggest we just drop UefiCpuPkg change, and focus on improving OvmfPkg.
> > If we need add something in UefiCpuPkg, let's copy the file to OvmfPkg and
> > update there.
> >
> Do you mean we create the Main.asm in OvmfPkg/ResetVector/ and update
> the changes in this Main.asm?
> >
> > I really don't want to mess up UefiCpuPkg at this moment.
> > We can make a better architecture to share reset vector in virtual BIOS and
> > physical BIOS later. But at this moment, let's finish the virtual BIOS
> > architecture at first.
> >
> > Thank you
> > Yao Jiewen
> >
> > > -----Original Message-----
> > > From: Xu, Min M <min.m.xu@intel.com>
> > > Sent: Thursday, July 22, 2021 1:52 PM
> > > To: devel@edk2.groups.io
> > > Cc: Xu, Min M <min.m.xu@intel.com>; Dong, Eric <eric.dong@intel.com>;
> > > Ni, Ray <ray.ni@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>
> > > Subject: [PATCH V2 3/4] UefiCpuPkg/ResetVector: Add Main32 entry point
> > > in Main.asm
> > >
> > > RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3429
> > >
> > > In Tdx all CPUs "reset" to run on 32-bit protected mode with flat
> > > descriptor (paging disabled). Main32 entry point is added in
> > > UefiCpuPkg/ResetVector/Vtf0/Main.asm so that Main.asm can support the
> > > 32-bit protected mode.
> > >
> > > Init32.asm is the 32-bit initialization code. It is a null stub in
> > > UefiCpuPkg. The actual initialization can be implemented in the
> > > platform (OvmfPkg/ResetVector/Ia32/Init32.asm is the example.)
> > >
> > > Cc: Eric Dong <eric.dong@intel.com>
> > > Cc: Ray Ni <ray.ni@intel.com>
> > > Cc: Jiewen Yao <jiewen.yao@intel.com>
> > > Signed-off-by: Min Xu <min.m.xu@intel.com>
> > > ---
> > >  UefiCpuPkg/ResetVector/Vtf0/Ia32/Init32.asm | 13 +++++++++++++
> > >  UefiCpuPkg/ResetVector/Vtf0/Main.asm        | 14 ++++++++++++++
> > >  UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb      |  2 +-
> > >  3 files changed, 28 insertions(+), 1 deletion(-)  create mode 100644
> > > UefiCpuPkg/ResetVector/Vtf0/Ia32/Init32.asm
> > >
> > > diff --git a/UefiCpuPkg/ResetVector/Vtf0/Ia32/Init32.asm
> > > b/UefiCpuPkg/ResetVector/Vtf0/Ia32/Init32.asm
> > > new file mode 100644
> > > index 000000000000..0cdae4a4a84a
> > > --- /dev/null
> > > +++ b/UefiCpuPkg/ResetVector/Vtf0/Ia32/Init32.asm
> > > @@ -0,0 +1,13 @@
> > > +;--------------------------------------------------------------------
> > > +----------
> > > +; @file
> > > +;   32-bit initialization code.
> > > +; Copyright (c) 2021, Intel Corporation. All rights reserved.<BR> ;
> > > +SPDX-License-Identifier: BSD-2-Clause-Patent ;
> > > +;--------------------------------------------------------------------
> > > +----------
> > > +
> > > +BITS 32
> > > +
> > > +Init32:
> > > +    nop
> > > +    OneTimeCallRet Init32
> > > diff --git a/UefiCpuPkg/ResetVector/Vtf0/Main.asm
> > > b/UefiCpuPkg/ResetVector/Vtf0/Main.asm
> > > index 19d08482f831..4920c6937e1b 100644
> > > --- a/UefiCpuPkg/ResetVector/Vtf0/Main.asm
> > > +++ b/UefiCpuPkg/ResetVector/Vtf0/Main.asm
> > > @@ -36,6 +36,20 @@ Main16:
> > >
> > >  BITS    32
> > >
> > > +%ifdef ARCH_X64
> > > +
> > > +    jmp SearchBfv
> > > +
> > > +;
> > > +; Entry point of Main32
> > > +;
> > > +Main32:
> > > +
> > > +    OneTimeCall Init32
> > > +
> > > +%endif
> > > +
> > > +SearchBfv:
> > >      ;
> > >      ; Search for the Boot Firmware Volume (BFV)
> > >      ;
> > > diff --git a/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb
> > > b/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb
> > > index 493738c79c1c..6493b9863c48 100644
> > > --- a/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb
> > > +++ b/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb
> > > @@ -51,7 +51,7 @@
> > >  %include "Ia32/SearchForSecEntry.asm"
> > >
> > >  %ifdef ARCH_X64
> > > -%include "Ia32/Flat32ToFlat64.asm"
> > > +%include "Ia32/Init32.asm"
> > >  %include "Ia32/PageTables64.asm"
> > >  %endif
> > >
> > > --
> > > 2.29.2.windows.2



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


Re: [edk2-devel] [PATCH V2 3/4] UefiCpuPkg/ResetVector: Add Main32 entry point in Main.asm
Posted by Min Xu 4 years, 6 months ago
I see. I will update it in the next version.

Thanks!

> -----Original Message-----
> From: Yao, Jiewen <jiewen.yao@intel.com>
> Sent: Sunday, July 25, 2021 3:44 PM
> To: Xu, Min M <min.m.xu@intel.com>; devel@edk2.groups.io
> Cc: Dong, Eric <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com>
> Subject: RE: [PATCH V2 3/4] UefiCpuPkg/ResetVector: Add Main32 entry point
> in Main.asm
> 
> Yes, if that can avoid the UefiCpuPkg change.
> 
> > -----Original Message-----
> > From: Xu, Min M <min.m.xu@intel.com>
> > Sent: Sunday, July 25, 2021 3:42 PM
> > To: Yao, Jiewen <jiewen.yao@intel.com>; devel@edk2.groups.io
> > Cc: Dong, Eric <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com>
> > Subject: RE: [PATCH V2 3/4] UefiCpuPkg/ResetVector: Add Main32 entry
> > point in Main.asm
> >
> > On July 25, 2021 2:08 PM, Yao, Jiewen wrote:
> > > Current OvmfPkg Reser vector is a mess (see my previous email).
> > > I also compared the ResetVector code in UefiCpuPkg and OvmfPkg.
> > > There are already duplication/override.
> > >
> > > I suggest we just drop UefiCpuPkg change, and focus on improving OvmfPkg.
> > > If we need add something in UefiCpuPkg, let's copy the file to
> > > OvmfPkg and update there.
> > >
> > Do you mean we create the Main.asm in OvmfPkg/ResetVector/ and update
> > the changes in this Main.asm?
> > >
> > > I really don't want to mess up UefiCpuPkg at this moment.
> > > We can make a better architecture to share reset vector in virtual
> > > BIOS and physical BIOS later. But at this moment, let's finish the
> > > virtual BIOS architecture at first.
> > >
> > > Thank you
> > > Yao Jiewen
> > >
> > > > -----Original Message-----
> > > > From: Xu, Min M <min.m.xu@intel.com>
> > > > Sent: Thursday, July 22, 2021 1:52 PM
> > > > To: devel@edk2.groups.io
> > > > Cc: Xu, Min M <min.m.xu@intel.com>; Dong, Eric
> > > > <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Yao, Jiewen
> > > > <jiewen.yao@intel.com>
> > > > Subject: [PATCH V2 3/4] UefiCpuPkg/ResetVector: Add Main32 entry
> > > > point in Main.asm
> > > >
> > > > RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3429
> > > >
> > > > In Tdx all CPUs "reset" to run on 32-bit protected mode with flat
> > > > descriptor (paging disabled). Main32 entry point is added in
> > > > UefiCpuPkg/ResetVector/Vtf0/Main.asm so that Main.asm can support
> > > > the 32-bit protected mode.
> > > >
> > > > Init32.asm is the 32-bit initialization code. It is a null stub in
> > > > UefiCpuPkg. The actual initialization can be implemented in the
> > > > platform (OvmfPkg/ResetVector/Ia32/Init32.asm is the example.)
> > > >
> > > > Cc: Eric Dong <eric.dong@intel.com>
> > > > Cc: Ray Ni <ray.ni@intel.com>
> > > > Cc: Jiewen Yao <jiewen.yao@intel.com>
> > > > Signed-off-by: Min Xu <min.m.xu@intel.com>
> > > > ---
> > > >  UefiCpuPkg/ResetVector/Vtf0/Ia32/Init32.asm | 13 +++++++++++++
> > > >  UefiCpuPkg/ResetVector/Vtf0/Main.asm        | 14 ++++++++++++++
> > > >  UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb      |  2 +-
> > > >  3 files changed, 28 insertions(+), 1 deletion(-)  create mode
> > > > 100644 UefiCpuPkg/ResetVector/Vtf0/Ia32/Init32.asm
> > > >
> > > > diff --git a/UefiCpuPkg/ResetVector/Vtf0/Ia32/Init32.asm
> > > > b/UefiCpuPkg/ResetVector/Vtf0/Ia32/Init32.asm
> > > > new file mode 100644
> > > > index 000000000000..0cdae4a4a84a
> > > > --- /dev/null
> > > > +++ b/UefiCpuPkg/ResetVector/Vtf0/Ia32/Init32.asm
> > > > @@ -0,0 +1,13 @@
> > > > +;----------------------------------------------------------------
> > > > +----
> > > > +----------
> > > > +; @file
> > > > +;   32-bit initialization code.
> > > > +; Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
> > > > +;
> > > > +SPDX-License-Identifier: BSD-2-Clause-Patent ;
> > > > +;----------------------------------------------------------------
> > > > +----
> > > > +----------
> > > > +
> > > > +BITS 32
> > > > +
> > > > +Init32:
> > > > +    nop
> > > > +    OneTimeCallRet Init32
> > > > diff --git a/UefiCpuPkg/ResetVector/Vtf0/Main.asm
> > > > b/UefiCpuPkg/ResetVector/Vtf0/Main.asm
> > > > index 19d08482f831..4920c6937e1b 100644
> > > > --- a/UefiCpuPkg/ResetVector/Vtf0/Main.asm
> > > > +++ b/UefiCpuPkg/ResetVector/Vtf0/Main.asm
> > > > @@ -36,6 +36,20 @@ Main16:
> > > >
> > > >  BITS    32
> > > >
> > > > +%ifdef ARCH_X64
> > > > +
> > > > +    jmp SearchBfv
> > > > +
> > > > +;
> > > > +; Entry point of Main32
> > > > +;
> > > > +Main32:
> > > > +
> > > > +    OneTimeCall Init32
> > > > +
> > > > +%endif
> > > > +
> > > > +SearchBfv:
> > > >      ;
> > > >      ; Search for the Boot Firmware Volume (BFV)
> > > >      ;
> > > > diff --git a/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb
> > > > b/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb
> > > > index 493738c79c1c..6493b9863c48 100644
> > > > --- a/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb
> > > > +++ b/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb
> > > > @@ -51,7 +51,7 @@
> > > >  %include "Ia32/SearchForSecEntry.asm"
> > > >
> > > >  %ifdef ARCH_X64
> > > > -%include "Ia32/Flat32ToFlat64.asm"
> > > > +%include "Ia32/Init32.asm"
> > > >  %include "Ia32/PageTables64.asm"
> > > >  %endif
> > > >
> > > > --
> > > > 2.29.2.windows.2



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