public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Min Xu" <min.m.xu@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"kraxel@redhat.com" <kraxel@redhat.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>,
	"Justen, Jordan L" <jordan.l.justen@intel.com>,
	Brijesh Singh <brijesh.singh@amd.com>,
	"Erdem Aktas" <erdemaktas@google.com>,
	James Bottomley <jejb@linux.ibm.com>,
	"Yao, Jiewen" <jiewen.yao@intel.com>,
	Tom Lendacky <thomas.lendacky@amd.com>
Subject: Re: [edk2-devel] [PATCH V9 4/4] OvmfPkg: Enable TDX in ResetVector
Date: Wed, 13 Oct 2021 05:16:15 +0000	[thread overview]
Message-ID: <PH0PR11MB506416B568A859EF7784A339C5B79@PH0PR11MB5064.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20211012074318.evyxxk67jbbauv57@sirius.home.kraxel.org>

On October 12, 2021 3:43 PM, Gerd Hoffmann wrote:
>   Hi,
> 
> > +; Load the GDT and set the CR0.
> > +;
> > +; Modified:  EAX, EBX, CR0, CR4, DS, ES, FS, GS, SS, CS ;
> > +ReloadFlat32:
> > +
> > +    cli
> > +    mov     ebx, ADDR_OF(gdtr)
> > +    lgdt    [ebx]
> 
> No need to modify ebx here, eax should do fine.
You're right. It will be updated in next version.
> 
> > +    mov     eax, SEC_DEFAULT_CR0
> > +    mov     cr0, eax
> > +
> > +    jmp     LINEAR_CODE_SEL:dword ADDR_OF(jumpToFlat32BitAndLandHere)
> > +
> > +jumpToFlat32BitAndLandHere:
> 
> Strictly speaking this is not correct, you are already in Flat32 mode, so this only
> loads cs.
TDX: https://software.intel.com/content/dam/develop/external/us/en/documents/tdx-module-1.0-public-spec-v0.931.pdf
In [TDX] Section 10.1.3 CR0 and CR4 are initialized when Tdx guest is created. So initialization of CR0 and CR4 are not needed.
It will be updated in next version.
> 
> > +InitTdx:
> > +    ;
> > +    ; Save EBX in EBP because EBX will be changed in ReloadFlat32
> > +    ;
> > +    mov     ebp, ebx
> 
> See above, there is no need to modify ebx in ReloadFlat32.
> Also: seems ebx is never restored ...
In [TDX] Section 10.1.2 EBX[5:0] contains the GPAW. Since EBX is not changed in ReloadFlat32, *mov ebp, ebx* is not needed.
It will be removed in next version.
> 

Thanks!
Min

      reply	other threads:[~2021-10-13  5:17 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-12  2:37 [PATCH V9 0/4] Add Intel TDX support in OvmfPkg/ResetVector Min Xu
2021-10-12  2:37 ` [PATCH V9 1/4] OvmfPkg: Copy Main.asm from UefiCpuPkg to OvmfPkg's ResetVector Min Xu
2021-10-12  7:02   ` Gerd Hoffmann
2021-10-13  0:39     ` Min Xu
2021-10-12  2:37 ` [PATCH V9 2/4] OvmfPkg: Clear WORK_AREA_GUEST_TYPE in Main.asm Min Xu
2021-10-12  7:02   ` Gerd Hoffmann
2021-10-12 13:22   ` Lendacky, Thomas
2021-10-13  0:58     ` [edk2-devel] " Min Xu
2021-10-13 15:45       ` Brijesh Singh
2021-10-14  1:50         ` Min Xu
2021-10-12  2:37 ` [PATCH V9 3/4] OvmfPkg: Add IntelTdxMetadata.asm Min Xu
2021-10-12  7:22   ` Gerd Hoffmann
2021-10-13 11:44     ` [edk2-devel] " Brijesh Singh
2021-10-13 13:07       ` Gerd Hoffmann
2021-10-12  2:37 ` [PATCH V9 4/4] OvmfPkg: Enable TDX in ResetVector Min Xu
2021-10-12  7:43   ` Gerd Hoffmann
2021-10-13  5:16     ` Min Xu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=PH0PR11MB506416B568A859EF7784A339C5B79@PH0PR11MB5064.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox