From patchwork Tue Aug 13 11:30:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 11091869 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 BCED714F7 for ; Tue, 13 Aug 2019 11:32:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE6C2285E3 for ; Tue, 13 Aug 2019 11:32:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A3158285E8; Tue, 13 Aug 2019 11:32:52 +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.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 9E6F828608 for ; Tue, 13 Aug 2019 11:32:51 +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 1hxV1X-0006Ox-Hn; Tue, 13 Aug 2019 11:31:31 +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 1hxV1V-0006Ln-Ee for xen-devel@lists.xenproject.org; Tue, 13 Aug 2019 11:31:29 +0000 X-Inumbo-ID: e3ad4b4e-bdbd-11e9-a9f0-a314ad3f28dc Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id e3ad4b4e-bdbd-11e9-a9f0-a314ad3f28dc; Tue, 13 Aug 2019 11:31:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1565695888; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=w+liTcVRavSpZGXaMp7ZRfUQNjZhlY2McqyT6sGd3Fw=; b=M5eQP6h4sjHr6wwNS3BpjJBV2XO5Ayn+X1wzP/rZhnk3pDq4NTSDP7WE mDlg9dfiTqRQL7AxLfml9xTuGJfZxyiB8/RlSJfw/4nUYC4AcEHzS+5Gy Wioir/YEdcghgSNzXdlX7DkaNuQeRcQ1UhizxYno0rZOF+e5ghzkbTTlH I=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=anthony.perard@citrix.com; spf=Pass smtp.mailfrom=anthony.perard@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of anthony.perard@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa6.hc3370-68.iphmx.com: domain of anthony.perard@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ~all" Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: dhQjzfxImr2P6pDDCFMMa3hYL1AuaaHfBiSLaDhrkVLAB319UuqdN1BFvjrmT1CEUhemaNkDJ1 Uur8nbXJOKVeYoq9Upx4X44G6sVeicd97V0Wgm0ppvvffdh15xT+S65I6gOYv2cwqHVEtkyi+e nParxWU0F4HU69G0BRpb+pHcK8YQAa9C3ILVD0zJXlraGCNZ/bZO3yozt5vHwxCJQLoMiDu8rQ 8B4b0YU4MSzxZhWz7tDCxgDSLsk4sUyTkNMnTAXz4mPnkfxfbM6pHyz69zWC5ZkA2MtGwlNFFU Hx8= X-SBRS: 2.7 X-MesageID: 4374132 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.64,381,1559534400"; d="scan'208";a="4374132" From: Anthony PERARD To: Date: Tue, 13 Aug 2019 12:30:51 +0100 Message-ID: <20190813113119.14804-8-anthony.perard@citrix.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190813113119.14804-1-anthony.perard@citrix.com> References: <20190813113119.14804-1-anthony.perard@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v5 07/35] 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 Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689 Signed-off-by: Anthony PERARD Acked-by: Laszlo Ersek --- Notes: v3: - rename PcdXenStartOfDay* to PcdXenPvhStartOfDay* - Use first available token value for those (0x17 and 0x28) OvmfPkg/OvmfPkg.dec | 3 +++ OvmfPkg/OvmfXen.fdf | 4 ++++ OvmfPkg/XenResetVector/XenResetVector.inf | 3 +++ OvmfPkg/XenResetVector/Ia32/XenPVHMain.asm | 6 ++++++ OvmfPkg/XenResetVector/XenResetVector.nasmb | 2 ++ 5 files changed, 18 insertions(+) diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec index 9640360f62..c2a2ebfb95 100644 --- a/OvmfPkg/OvmfPkg.dec +++ b/OvmfPkg/OvmfPkg.dec @@ -218,6 +218,9 @@ [PcdsFixedAtBuild] # The value should be a multiple of 4KB. gUefiOvmfPkgTokenSpaceGuid.PcdHighPmmMemorySize|0x400000|UINT32|0x31 + gUefiOvmfPkgTokenSpaceGuid.PcdXenPvhStartOfDayStructPtr|0x0|UINT32|0x17 + gUefiOvmfPkgTokenSpaceGuid.PcdXenPvhStartOfDayStructPtrSize|0x0|UINT32|0x32 + [PcdsDynamic, PcdsDynamicEx] gUefiOvmfPkgTokenSpaceGuid.PcdEmuVariableEvent|0|UINT64|2 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashVariablesEnable|FALSE|BOOLEAN|0x10 diff --git a/OvmfPkg/OvmfXen.fdf b/OvmfPkg/OvmfXen.fdf index 43c268f6cb..49997fee9b 100644 --- a/OvmfPkg/OvmfXen.fdf +++ b/OvmfPkg/OvmfXen.fdf @@ -172,6 +172,10 @@ [FD.MEMFD] 0x007000|0x001000 gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress|gUefiOvmfPkgTokenSpaceGuid.PcdGuidedExtractHandlerTableSize +0x008000|0x001000 +# Used by XenResetVector to communicate with XenPlatformPei +gUefiOvmfPkgTokenSpaceGuid.PcdXenPvhStartOfDayStructPtr|gUefiOvmfPkgTokenSpaceGuid.PcdXenPvhStartOfDayStructPtrSize + 0x010000|0x010000 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamSize diff --git a/OvmfPkg/XenResetVector/XenResetVector.inf b/OvmfPkg/XenResetVector/XenResetVector.inf index 097fc9b5b4..46b133a834 100644 --- a/OvmfPkg/XenResetVector/XenResetVector.inf +++ b/OvmfPkg/XenResetVector/XenResetVector.inf @@ -36,3 +36,6 @@ [BuildOptions] [Pcd] gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesBase gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesSize + + gUefiOvmfPkgTokenSpaceGuid.PcdXenPvhStartOfDayStructPtr + gUefiOvmfPkgTokenSpaceGuid.PcdXenPvhStartOfDayStructPtrSize diff --git a/OvmfPkg/XenResetVector/Ia32/XenPVHMain.asm b/OvmfPkg/XenResetVector/Ia32/XenPVHMain.asm index 2a17fed52f..f42df3dba2 100644 --- a/OvmfPkg/XenResetVector/Ia32/XenPVHMain.asm +++ b/OvmfPkg/XenResetVector/Ia32/XenPVHMain.asm @@ -22,6 +22,12 @@ xenPVHMain: ; xor esp, esp + ; + ; Store "Start of day" struct pointer for later use + ; + mov dword[PVH_SPACE (0)], ebx + mov dword[PVH_SPACE (4)], 'XPVH' + mov ebx, ADDR_OF(gdtr) lgdt [ebx] diff --git a/OvmfPkg/XenResetVector/XenResetVector.nasmb b/OvmfPkg/XenResetVector/XenResetVector.nasmb index 0dbc4f2c1d..b2cb405d54 100644 --- a/OvmfPkg/XenResetVector/XenResetVector.nasmb +++ b/OvmfPkg/XenResetVector/XenResetVector.nasmb @@ -34,6 +34,8 @@ %include "CommonMacros.inc" +%define PVH_SPACE(Offset) (FixedPcdGet32 (PcdXenPvhStartOfDayStructPtr) + (Offset)) + %include "PostCodes.inc" %ifdef DEBUG_PORT80