From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: redhat.com, ip: 209.132.183.28, mailfrom: lersek@redhat.com) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by groups.io with SMTP; Thu, 11 Apr 2019 03:49:13 -0700 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D4D2119CBC7; Thu, 11 Apr 2019 10:49:12 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-225.rdu2.redhat.com [10.10.120.225]) by smtp.corp.redhat.com (Postfix) with ESMTP id EE72360BF7; Thu, 11 Apr 2019 10:49:10 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH v2 06/31] OvmfPkg/XenResetVector: Add new entry point for Xen PVH To: devel@edk2.groups.io, anthony.perard@citrix.com Cc: Jordan Justen , Ard Biesheuvel , Julien Grall , xen-devel@lists.xenproject.org References: <20190409110844.14746-1-anthony.perard@citrix.com> <20190409110844.14746-7-anthony.perard@citrix.com> From: "Laszlo Ersek" Message-ID: Date: Thu, 11 Apr 2019 12:49:09 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20190409110844.14746-7-anthony.perard@citrix.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 11 Apr 2019 10:49:12 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 04/09/19 13:08, Anthony PERARD wrote: > This one enter directly in 32bits (1) I probably mentioned this elsewhere, but it bears repeating (it applies to all patches): please don't start the body of the commit message mid-sentence or mid-paragraph. The body should be self-contained. > Information on the expected state of the machine when this entry point > is used can be found at: > https://xenbits.xenproject.org/docs/unstable/misc/pvh.html > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Anthony PERARD > --- > {UefiCpuPkg/ResetVector/Vtf0 => OvmfPkg/XenResetVector}/Ia16/ResetVectorVtf0.asm | 18 +++++++- > OvmfPkg/XenResetVector/Ia32/XenPVHMain.asm | 47 ++++++++++++++++++++ > OvmfPkg/XenResetVector/XenResetVector.nasmb | 1 + > 3 files changed, 65 insertions(+), 1 deletion(-) > > diff --git a/UefiCpuPkg/ResetVector/Vtf0/Ia16/ResetVectorVtf0.asm b/OvmfPkg/XenResetVector/Ia16/ResetVectorVtf0.asm > similarity index 76% > copy from UefiCpuPkg/ResetVector/Vtf0/Ia16/ResetVectorVtf0.asm > copy to OvmfPkg/XenResetVector/Ia16/ResetVectorVtf0.asm > index 142d9f3212..46eec66859 100644 > --- a/UefiCpuPkg/ResetVector/Vtf0/Ia16/ResetVectorVtf0.asm > +++ b/OvmfPkg/XenResetVector/Ia16/ResetVectorVtf0.asm > @@ -3,6 +3,8 @@ > ; First code executed by processor after resetting. > ; > ; Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.
> +; Copyright (c) 2019, Citrix Systems, Inc. > +; > ; This program and the accompanying materials > ; are licensed and made available under the terms and conditions of the BSD License > ; which accompanies this distribution. The full text of the license may be found at (2) Probably also mentioned elsewhere, but all the new files should come with SPDX license IDs, if possible. (Once you rebase, such omissions will become apparent anyway, because the copy-origin files now carry SPDX IDs, but the copies you created earlier don't, and that will present itself as a difference with --find-copies-harder.) With the above two formalities fixed: Acked-by: Laszlo Ersek Thanks Laszlo > @@ -27,9 +29,23 @@ ALIGN 16 > ; located just below 0x100000000 (4GB) in the firmware device. > ; > %ifdef ALIGN_TOP_TO_4K_FOR_PAGING > - TIMES (0x1000 - ($ - EndOfPageTables) - 0x20) DB 0 > + TIMES (0x1000 - ($ - EndOfPageTables) - (fourGigabytes - xenPVHEntryPoint)) DB 0 > %endif > > +BITS 32 > +xenPVHEntryPoint: > +; > +; Entry point to use when running as a Xen PVH guest. (0xffffffd0) > +; > +; Description of the expected state of the machine when this entry point is > +; used can be found at: > +; https://xenbits.xenproject.org/docs/unstable/misc/pvh.html > +; > + jmp xenPVHMain > + > +BITS 16 > +ALIGN 16 > + > applicationProcessorEntryPoint: > ; > ; Application Processors entry point > diff --git a/OvmfPkg/XenResetVector/Ia32/XenPVHMain.asm b/OvmfPkg/XenResetVector/Ia32/XenPVHMain.asm > new file mode 100644 > index 0000000000..c4802bf4d1 > --- /dev/null > +++ b/OvmfPkg/XenResetVector/Ia32/XenPVHMain.asm > @@ -0,0 +1,47 @@ > +;------------------------------------------------------------------------------ > +; @file > +; An entry point use by Xen when a guest is started in PVH mode. > +; > +; Copyright (c) 2019, Citrix Systems, Inc. > +; > +; This program and the accompanying materials are licensed and made available > +; under the terms and conditions of the BSD License which accompanies this > +; distribution. The full text of the license may be found at > +; http://opensource.org/licenses/bsd-license.php > +; > +; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT > +; WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. > +; > +;------------------------------------------------------------------------------ > + > +BITS 32 > + > +xenPVHMain: > + mov di, 'BP' > + > + ; ESP - Initial value of the EAX register (BIST: Built-in Self Test) > + mov esp, eax > + > + cli > + > + mov ebx, ADDR_OF(gdtr) > + lgdt [ebx] > + > + mov eax, SEC_DEFAULT_CR0 > + mov cr0, eax > + > + jmp LINEAR_CODE_SEL:ADDR_OF(.jmpToNewCodeSeg) > +.jmpToNewCodeSeg: > + > + mov eax, SEC_DEFAULT_CR4 > + mov cr4, eax > + > + mov ax, LINEAR_SEL > + mov ds, ax > + mov es, ax > + mov fs, ax > + mov gs, ax > + mov ss, ax > + > + ; return to the Main16 > + OneTimeCallRet TransitionFromReal16To32BitFlat > diff --git a/OvmfPkg/XenResetVector/XenResetVector.nasmb b/OvmfPkg/XenResetVector/XenResetVector.nasmb > index 49f2bab001..d5a791c139 100644 > --- a/OvmfPkg/XenResetVector/XenResetVector.nasmb > +++ b/OvmfPkg/XenResetVector/XenResetVector.nasmb > @@ -70,6 +70,7 @@ > %include "Ia16/Init16.asm" > > %include "Main.asm" > +%include "Ia32/XenPVHMain.asm" > > %include "Ia16/ResetVectorVtf0.asm" > >