From patchwork Mon Apr 8 14:23:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 10889599 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E3E2A17E0 for ; Mon, 8 Apr 2019 14:26:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC62226224 for ; Mon, 8 Apr 2019 14:26:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C09E4286F6; Mon, 8 Apr 2019 14:26:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5D8A126224 for ; Mon, 8 Apr 2019 14:26:37 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hDVC8-0000wu-He; Mon, 08 Apr 2019 14:24:20 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hDVC6-0000w7-Hj for xen-devel@lists.xenproject.org; Mon, 08 Apr 2019 14:24:18 +0000 X-Inumbo-ID: fcd7f2ee-5a09-11e9-99b6-53921e9ff5f0 Received: from SMTP03.CITRIX.COM (unknown [162.221.156.55]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id fcd7f2ee-5a09-11e9-99b6-53921e9ff5f0; Mon, 08 Apr 2019 14:24:15 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.60,325,1549929600"; d="scan'208";a="83009849" From: Anthony PERARD To: Date: Mon, 8 Apr 2019 15:23:44 +0100 Message-ID: <20190408142408.30419-8-anthony.perard@citrix.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190408142408.30419-1-anthony.perard@citrix.com> References: <20190408142408.30419-1-anthony.perard@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v2 07/31] OvmfPkg/XenResetVector: Saving start of day pointer for PVH guests X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel , Jordan Justen , Julien Grall , Anthony PERARD , xen-devel@lists.xenproject.org, Laszlo Ersek Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP As described in the Xen PVH documentation [1], "ebx: contains the physical memory address where the loader has placed the boot start info structure". To have this pointer saved to be able to use it later in the PEI phase, we allocate some space in the MEMFD for it. We use 'XPVH' as a signature (for "Xen PVH"). [1] https://xenbits.xenproject.org/docs/unstable/misc/pvh.html Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Anthony PERARD --- OvmfPkg/OvmfPkg.dec | 4 ++++ OvmfPkg/XenOvmf.fdf | 4 ++++ OvmfPkg/XenResetVector/XenResetVector.inf | 3 +++ OvmfPkg/XenResetVector/Ia32/XenPVHMain.asm | 4 ++++ OvmfPkg/XenResetVector/XenResetVector.nasmb | 2 ++ 5 files changed, 17 insertions(+) diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec index e50c6179a2..1cbbc49a6b 100644 --- a/OvmfPkg/OvmfPkg.dec +++ b/OvmfPkg/OvmfPkg.dec @@ -127,6 +127,10 @@ [PcdsFixedAtBuild] gUefiOvmfPkgTokenSpaceGuid.PcdGuidedExtractHandlerTableSize|0x0|UINT32|0x1a gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDecompressionScratchEnd|0x0|UINT32|0x1f + # Used by XenOvmf + gUefiOvmfPkgTokenSpaceGuid.PcdXenStartOfDayStructPtr|0x0|UINT32|0x30 + gUefiOvmfPkgTokenSpaceGuid.PcdXenStartOfDayStructPtrSize|0x0|UINT32|0x31 + [PcdsDynamic, PcdsDynamicEx] gUefiOvmfPkgTokenSpaceGuid.PcdEmuVariableEvent|0|UINT64|2 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashVariablesEnable|FALSE|BOOLEAN|0x10 diff --git a/OvmfPkg/XenOvmf.fdf b/OvmfPkg/XenOvmf.fdf index 20ebacd673..f9e58befd6 100644 --- a/OvmfPkg/XenOvmf.fdf +++ b/OvmfPkg/XenOvmf.fdf @@ -159,6 +159,10 @@ [FD.MEMFD] 0x007000|0x001000 gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress|gUefiOvmfPkgTokenSpaceGuid.PcdGuidedExtractHandlerTableSize +0x008000|0x001000 +# Used by XenResetVector to communicate with XenPlatformPei +gUefiOvmfPkgTokenSpaceGuid.PcdXenStartOfDayStructPtr|gUefiOvmfPkgTokenSpaceGuid.PcdXenStartOfDayStructPtrSize + 0x010000|0x010000 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamSize diff --git a/OvmfPkg/XenResetVector/XenResetVector.inf b/OvmfPkg/XenResetVector/XenResetVector.inf index 5c05f02285..ec98c17876 100644 --- a/OvmfPkg/XenResetVector/XenResetVector.inf +++ b/OvmfPkg/XenResetVector/XenResetVector.inf @@ -41,3 +41,6 @@ [BuildOptions] [Pcd] gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesBase gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesSize + + gUefiOvmfPkgTokenSpaceGuid.PcdXenStartOfDayStructPtr + gUefiOvmfPkgTokenSpaceGuid.PcdXenStartOfDayStructPtrSize diff --git a/OvmfPkg/XenResetVector/Ia32/XenPVHMain.asm b/OvmfPkg/XenResetVector/Ia32/XenPVHMain.asm index c4802bf4d1..4e55b0ac1f 100644 --- a/OvmfPkg/XenResetVector/Ia32/XenPVHMain.asm +++ b/OvmfPkg/XenResetVector/Ia32/XenPVHMain.asm @@ -22,6 +22,10 @@ xenPVHMain: ; ESP - Initial value of the EAX register (BIST: Built-in Self Test) mov esp, eax + ;; Store "Start of day" struct pointer for later use + mov dword[PVH_SPACE (0)], ebx + mov dword[PVH_SPACE (4)], 'XPVH' + cli mov ebx, ADDR_OF(gdtr) diff --git a/OvmfPkg/XenResetVector/XenResetVector.nasmb b/OvmfPkg/XenResetVector/XenResetVector.nasmb index d5a791c139..50cb81fcd1 100644 --- a/OvmfPkg/XenResetVector/XenResetVector.nasmb +++ b/OvmfPkg/XenResetVector/XenResetVector.nasmb @@ -41,6 +41,8 @@ %include "CommonMacros.inc" +%define PVH_SPACE(Offset) (FixedPcdGet32 (PcdXenStartOfDayStructPtr) + (Offset)) + %include "PostCodes.inc" %ifdef DEBUG_PORT80