From nobody Thu Nov 14 05:47:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45533+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1565695888; cv=none; d=zoho.com; s=zohoarc; b=TwGgcD7B/4wdghreEd7y5Kyg9GQYXLWDw9r2RH8GtUN8S3/wEXNArDmcXgq+XjbjZZ79tBcmiGhJyG6gzfTYYfRCIEMEFZTT8cXyhu6P4jsP4ehbsHCOkuXqsouP3Kr3I5yKTA2VgLORuLoOd9hJEUqeMKCsvTpja92C/Y8ScCc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565695888; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=0NSDwBInENyvNQ4LuZjEfcH5iT6ftkSUwhOGFyqRF9w=; b=IoU2fSYhZgX7lhME00/ASXoc19hKV9RR/s3IXDs/dy3tuqvmfALqf0wmkuXBnX4VSXQmcA5RQRcFnfkAPVM+dHRt6bLTHO1YpjOoERVqEuUE3Ud7Kmw+Md74C3WxvqCAmLEAatCZ5IHMxiiFawcvMNghG0f0fNf3nSumW7RznZY= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45533+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 156569588842395.04186142887579; Tue, 13 Aug 2019 04:31:28 -0700 (PDT) Return-Path: X-Received: from esa4.hc3370-68.iphmx.com (esa4.hc3370-68.iphmx.com []) by groups.io with SMTP; Tue, 13 Aug 2019 04:31:27 -0700 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45533+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: None (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.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=esa4.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 (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: tQ9KhljYrLnbQSSdBTC778eAQ3xT/WKzNn23FkukpZ/MhGwQAvJgPNGyakyJgjR4M21p9mW60B OudrBg+jGyRWIJUbzYdNL4drph4X2V+zghrTAr6JWEbY0jPAfePjD1vPckiLPmkP5P9dzVPUKV Hq2wlfkYfNA+mVfiotYfc3emxJiAygEsZVvGm9xCoMMThfI95HzYQCcyRrq/wL7tk38w3QWeYh p0a2ZdWR+0Gv2jvqa8KcC+t6inWHARberrt64LR6ALpUu8oO+pDfvjOfYH24F3DbNPIqoXbLe0 DY0= X-SBRS: 2.7 X-MesageID: 4401258 X-Ironport-Server: esa4.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="4401258" From: "Anthony PERARD" To: CC: Laszlo Ersek , Jordan Justen , Julien Grall , , Ard Biesheuvel , Anthony PERARD Subject: [edk2-devel] [PATCH v5 01/35] OvmfPkg/ResetSystemLib: Add missing dependency on PciLib Date: Tue, 13 Aug 2019 12:30:45 +0100 Message-ID: <20190813113119.14804-2-anthony.perard@citrix.com> In-Reply-To: <20190813113119.14804-1-anthony.perard@citrix.com> References: <20190813113119.14804-1-anthony.perard@citrix.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,anthony.perard@citrix.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565695888; bh=0NSDwBInENyvNQ4LuZjEfcH5iT6ftkSUwhOGFyqRF9w=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=MsyIz/IolS20rIrV6GaSmoOIt6ok1JF4I+UsFUl89WGx2YR87wQCzhh7qsPoi9xblH1 9VorI85z0SRrl1d3ZVadKwFoVDyoXtr1YKX8tR6b2ACxubOJFRy4IFv1hOFSpS4/RAI3Q W/2O6m5cXl0ts7iiv5HVyEwG0d2//UzHu+g= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Add missing dependency on PciLib and remove extra includes of OvmfPlatforms.h. Signed-off-by: Anthony PERARD Reviewed-by: Laszlo Ersek --- Notes: v2: - also add PciLib.h include to the .c - and remove extra include of OvmfPlatforms.h OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf | 1 + OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf b/OvmfPkg/Li= brary/ResetSystemLib/ResetSystemLib.inf index 7c44f99a5c..2f24dac87f 100644 --- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf +++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf @@ -30,4 +30,5 @@ [Packages] [LibraryClasses] DebugLib IoLib + PciLib TimerLib diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c b/OvmfPkg/Libr= ary/ResetSystemLib/ResetSystemLib.c index 27460cd100..98dd80e33c 100644 --- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c +++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c @@ -11,11 +11,10 @@ #include #include #include +#include #include #include =20 -#include - VOID AcpiPmControl ( UINTN SuspendType --=20 Anthony PERARD -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45533): https://edk2.groups.io/g/devel/message/45533 Mute This Topic: https://groups.io/mt/32851505/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Nov 14 05:47:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45528+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1565695885; cv=none; d=zoho.com; s=zohoarc; b=FBgBu2W2WF1xb0ZJRRafObfZM7B+MYFhM9XqmMrxwUCapAWgsuWeMrICp/w5JjSxlGkBegae+vlIOv+6i02VHE0PLfshykReyG880hfJG9gB4cM1zbAEz5jFsNoj+PHT06/P8rJ1nMLFsbyzpVei97ZJfWjC2URrVGVZM+pEMeA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565695885; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=UQZ0tyqaXLJG2GfuhJn4vwcFCSeVRuZqm7LP3KVrH/8=; b=ZioDYitPNKlaVrBIz+VrZBF5loH8X6KyNkm2Rp54SwgDOC/uFeOloOCq7moGqHyCztGzcdjAYvT6D9Mht/TxXY5eVhvfPNpSXU8xMlWJY3GS5L/5AO5UGtSTfY/7FE19Pff/6tgD0HzjebaiNlWHm8BgfMWUPStlCTnrcY5DeGY= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45528+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1565695885673981.3248987769599; Tue, 13 Aug 2019 04:31:25 -0700 (PDT) Return-Path: X-Received: from esa4.hc3370-68.iphmx.com (esa4.hc3370-68.iphmx.com []) by groups.io with SMTP; Tue, 13 Aug 2019 04:31:24 -0700 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45528+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: None (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.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=esa4.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 (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: 6tQv4A9rGmye5jmzQM+BNmEjEfDM7wfd1XpKmez+yDipNN1ENqDHLumOxTcZTTwhIARH7tGv97 AX3YfD6433feZUw4PzdGxSq40AMbE8M2E1l2MWUMgqAUAdNwynuP0fHtDIx414Fes/jbCJylJw 4uxJACOwSXNcp5+fiGX2kVsGdQhenRnZoOuiVVoMpHrns1xiM3Dt0g69dmiwGMVv4TU0tE6lbe /6k9U1hGLY2VI5gJoNAIi40PvwxqSrMp279BUhiNumst60AdCNkf988Mu0IbXcxzmBmffWLzUP jXQ= X-SBRS: 2.7 X-MesageID: 4401249 X-Ironport-Server: esa4.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="4401249" From: "Anthony PERARD" To: CC: Laszlo Ersek , Jordan Justen , Julien Grall , , Ard Biesheuvel , Anthony PERARD Subject: [edk2-devel] [PATCH v5 02/35] OvmfPkg: Create platform OvmfXen Date: Tue, 13 Aug 2019 12:30:46 +0100 Message-ID: <20190813113119.14804-3-anthony.perard@citrix.com> In-Reply-To: <20190813113119.14804-1-anthony.perard@citrix.com> References: <20190813113119.14804-1-anthony.perard@citrix.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,anthony.perard@citrix.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565695885; bh=UQZ0tyqaXLJG2GfuhJn4vwcFCSeVRuZqm7LP3KVrH/8=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=vjGcCoFeWkOSZbZ6WMzMI5+0skiSFK3zJl9yoYDAw52as1DhA4m9HFFKyegYRJ/0xWy OdaFq0HfMJL3P0f5hQR2TNwGohSbLTZvPw2lJQmh7mmg85jIbBnxQCcYzNSkRTEC8QWbf YrlQcvgH+UTeKpetEeNDD50fvMLm6RKRao4= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" OvmfXen is a copy of OvmfX64, removing VirtIO and some SMM. This new platform will be changed to make it works on two types of Xen guest: HVM and PVH. Compare to OvmfX64, this patch: - changed: PLATFORM_GUID, OUTPUT_DIRECTORY, FLASH_DEFINITION - removed: VirtioLib class resolution - removed: all UEFI_DRIVER modules for virtio devices - removed: DXE_SMM_DRIVER and SMM_CORE lib class resolutions - removed: DXE_SMM_DRIVER and SMM_CORE FDF rules - removed: Everything related to SMM_REQUIRE=3D=3Dtrue - removed: Everything related to SECURE_BOOT_ENABLE=3D=3Dtrue - removed: Everything related to TPM2_ENABLE=3D=3Dtrue - changed: PcdPciDisableBusEnumeration dynamic default flipped to TRUE - changed: default FD_SIZE_IN_KB to 2M. - reverted d272449d9e1e, "OvmfPkg: raise DXEFV size to 11 MB" Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1689 Signed-off-by: Anthony PERARD Reviewed-by: Laszlo Ersek --- Notes: v4: - rebased - Update Maintainers.txt =20 v3: - rebased, SPDX + 8259/8254 changes OvmfPkg/OvmfXen.dsc | 729 ++++++++++++++++++++++++++++++++++++++++++++ OvmfPkg/OvmfXen.fdf | 439 ++++++++++++++++++++++++++ Maintainers.txt | 1 + 3 files changed, 1169 insertions(+) create mode 100644 OvmfPkg/OvmfXen.dsc create mode 100644 OvmfPkg/OvmfXen.fdf diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc new file mode 100644 index 0000000000..f224ac32b4 --- /dev/null +++ b/OvmfPkg/OvmfXen.dsc @@ -0,0 +1,729 @@ +## @file +# EFI/Framework Open Virtual Machine Firmware (OVMF) platform +# +# Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
+# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
+# Copyright (c) 2019, Citrix Systems, Inc. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +##########################################################################= ###### +# +# Defines Section - statements that will be processed to create a Makefile. +# +##########################################################################= ###### +[Defines] + PLATFORM_NAME =3D Ovmf + PLATFORM_GUID =3D e3aa4fbe-9459-482d-bd40-d3f3b5f89d6e + PLATFORM_VERSION =3D 0.1 + DSC_SPECIFICATION =3D 0x00010005 + OUTPUT_DIRECTORY =3D Build/OvmfXen + SUPPORTED_ARCHITECTURES =3D X64 + BUILD_TARGETS =3D NOOPT|DEBUG|RELEASE + SKUID_IDENTIFIER =3D DEFAULT + FLASH_DEFINITION =3D OvmfPkg/OvmfXen.fdf + + # + # Defines for default states. These can be changed on the command line. + # -D FLAG=3DVALUE + # + + # + # Network definition + # + DEFINE NETWORK_TLS_ENABLE =3D FALSE + DEFINE NETWORK_IP6_ENABLE =3D FALSE + DEFINE NETWORK_HTTP_BOOT_ENABLE =3D FALSE + DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS =3D TRUE + +!include NetworkPkg/NetworkDefines.dsc.inc + + # + # Flash size selection. Setting FD_SIZE_IN_KB on the command line direct= ly to + # one of the supported values, in place of any of the convenience macros= , is + # permitted. + # +!ifdef $(FD_SIZE_1MB) + DEFINE FD_SIZE_IN_KB =3D 1024 +!else +!ifdef $(FD_SIZE_2MB) + DEFINE FD_SIZE_IN_KB =3D 2048 +!else +!ifdef $(FD_SIZE_4MB) + DEFINE FD_SIZE_IN_KB =3D 4096 +!else + DEFINE FD_SIZE_IN_KB =3D 2048 +!endif +!endif +!endif + +[BuildOptions] + GCC:RELEASE_*_*_CC_FLAGS =3D -DMDEPKG_NDEBUG + INTEL:RELEASE_*_*_CC_FLAGS =3D /D MDEPKG_NDEBUG + MSFT:RELEASE_*_*_CC_FLAGS =3D /D MDEPKG_NDEBUG +!if $(TOOL_CHAIN_TAG) !=3D "XCODE5" + GCC:*_*_*_CC_FLAGS =3D -mno-mmx -mno-sse +!endif +!ifdef $(SOURCE_DEBUG_ENABLE) + MSFT:*_*_X64_GENFW_FLAGS =3D --keepexceptiontable + GCC:*_*_X64_GENFW_FLAGS =3D --keepexceptiontable + INTEL:*_*_X64_GENFW_FLAGS =3D --keepexceptiontable +!endif + + # + # Disable deprecated APIs. + # + MSFT:*_*_*_CC_FLAGS =3D /D DISABLE_NEW_DEPRECATED_INTERFACES + INTEL:*_*_*_CC_FLAGS =3D /D DISABLE_NEW_DEPRECATED_INTERFACES + GCC:*_*_*_CC_FLAGS =3D -D DISABLE_NEW_DEPRECATED_INTERFACES + +[BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER] + GCC:*_*_*_DLINK_FLAGS =3D -z common-page-size=3D0x1000 + XCODE:*_*_*_DLINK_FLAGS =3D + +# Force PE/COFF sections to be aligned at 4KB boundaries to support page l= evel +# protection of DXE_SMM_DRIVER/SMM_CORE modules +[BuildOptions.common.EDKII.DXE_SMM_DRIVER, BuildOptions.common.EDKII.SMM_C= ORE] + GCC:*_*_*_DLINK_FLAGS =3D -z common-page-size=3D0x1000 + XCODE:*_*_*_DLINK_FLAGS =3D + +##########################################################################= ###### +# +# SKU Identification section - list of all SKU IDs supported by this Platf= orm. +# +##########################################################################= ###### +[SkuIds] + 0|DEFAULT + +##########################################################################= ###### +# +# Library Class section - list of all Library Classes needed by this Platf= orm. +# +##########################################################################= ###### +[LibraryClasses] + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + TimerLib|OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf + PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf + BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf + BaseLib|MdePkg/Library/BaseLib/BaseLib.inf + SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf + BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.i= nf + SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchroniza= tionLib.inf + CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf + PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibN= ull.inf + PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf + CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMain= tenanceLib.inf + UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompres= sLib.inf + UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServic= esLib.inf + HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf + SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf + UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManag= erLib.inf + BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf + FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf + CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf + DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf + DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableL= ib.inf + PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeC= offGetEntryPointLib.inf + PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf + PciExpressLib|MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf + PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf + PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.i= nf + PciCapLib|OvmfPkg/Library/BasePciCapLib/BasePciCapLib.inf + PciCapPciSegmentLib|OvmfPkg/Library/BasePciCapPciSegmentLib/BasePciCapPc= iSegmentLib.inf + PciCapPciIoLib|OvmfPkg/Library/UefiPciCapPciIoLib/UefiPciCapPciIoLib.inf + IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf + OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHo= okStatusCodeLibNull.inf + SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf + MtrrLib|UefiCpuPkg/Library/MtrrLib/MtrrLib.inf + UefiLib|MdePkg/Library/UefiLib/UefiLib.inf + UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBoo= tServicesTableLib.inf + UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/U= efiRuntimeServicesTableLib.inf + UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntry= Point.inf + UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiA= pplicationEntryPoint.inf + DevicePathLib|MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDev= icePathLibDevicePathProtocol.inf + NvVarsFileLib|OvmfPkg/Library/NvVarsFileLib/NvVarsFileLib.inf + FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf + UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf + SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeS= ecurityManagementLib.inf + UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf + SerializeVariablesLib|OvmfPkg/Library/SerializeVariablesLib/SerializeVar= iablesLib.inf + QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf + LoadLinuxLib|OvmfPkg/Library/LoadLinuxLib/LoadLinuxLib.inf + MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/BaseMemEncryptSevL= ib.inf + LockBoxLib|OvmfPkg/Library/LockBoxLib/LockBoxBaseLib.inf + CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/Customize= dDisplayLib.inf + FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltL= ib.inf + +!ifdef $(SOURCE_DEBUG_ENABLE) + PeCoffExtraActionLib|SourceLevelDebugPkg/Library/PeCoffExtraActionLibDeb= ug/PeCoffExtraActionLibDebug.inf + DebugCommunicationLib|SourceLevelDebugPkg/Library/DebugCommunicationLibS= erialPort/DebugCommunicationLibSerialPort.inf +!else + PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeC= offExtraActionLibNull.inf + DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.i= nf +!endif + + ResetSystemLib|OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf + LocalApicLib|UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf + DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseD= ebugPrintErrorLevelLib.inf + + IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf +!if $(NETWORK_TLS_ENABLE) =3D=3D TRUE + OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf +!else + OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf +!endif + + AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLib= Null.inf + VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf + + + # + # Network libraries + # +!include NetworkPkg/NetworkLibs.dsc.inc + +!if $(NETWORK_TLS_ENABLE) =3D=3D TRUE + TlsLib|CryptoPkg/Library/TlsLib/TlsLib.inf +!endif + + ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf + ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf + S3BootScriptLib|MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScrip= tLib.inf + SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf + OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib= /BaseOrderedCollectionRedBlackTreeLib.inf + XenHypercallLib|OvmfPkg/Library/XenHypercallLib/XenHypercallLib.inf + + Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibNull/DxeT= cg2PhysicalPresenceLib.inf + TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurem= entLibNull.inf + +[LibraryClasses.common] + BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf + +[LibraryClasses.common.SEC] + TimerLib|OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.inf + QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSecLib.inf +!ifdef $(DEBUG_ON_SERIAL_PORT) + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf +!else + DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPor= t.inf +!endif + ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiRepor= tStatusCodeLib.inf + ExtractGuidedSectionLib|MdePkg/Library/BaseExtractGuidedSectionLib/BaseE= xtractGuidedSectionLib.inf +!ifdef $(SOURCE_DEBUG_ENABLE) + DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgentLib= .inf +!endif + HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf + PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf + PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/= PeiServicesTablePointerLibIdt.inf + MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAlloc= ationLib.inf + CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiC= puExceptionHandlerLib.inf + +[LibraryClasses.common.PEI_CORE] + HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf + PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/= PeiServicesTablePointerLibIdt.inf + PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf + MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAlloc= ationLib.inf + PeiCoreEntryPoint|MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf + ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiRepor= tStatusCodeLib.inf + OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHo= okStatusCodeLibNull.inf + PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeC= offGetEntryPointLib.inf +!ifdef $(DEBUG_ON_SERIAL_PORT) + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf +!else + DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.i= nf +!endif + PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf + +[LibraryClasses.common.PEIM] + HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf + PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/= PeiServicesTablePointerLibIdt.inf + PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf + MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAlloc= ationLib.inf + PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf + ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiRepor= tStatusCodeLib.inf + OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHo= okStatusCodeLibNull.inf + PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeC= offGetEntryPointLib.inf +!ifdef $(DEBUG_ON_SERIAL_PORT) + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf +!else + DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.i= nf +!endif + PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf + ResourcePublicationLib|MdePkg/Library/PeiResourcePublicationLib/PeiResou= rcePublicationLib.inf + ExtractGuidedSectionLib|MdePkg/Library/PeiExtractGuidedSectionLib/PeiExt= ractGuidedSectionLib.inf +!ifdef $(SOURCE_DEBUG_ENABLE) + DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgentLib= .inf +!endif + CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuE= xceptionHandlerLib.inf + MpInitLib|UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf + QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/PeiQemuFwCfgS3LibFwCfg.inf + PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf + QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPeiLib.inf + +[LibraryClasses.common.DXE_CORE] + HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf + DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf + MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeC= oreMemoryAllocationLib.inf + ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeRepor= tStatusCodeLib.inf +!ifdef $(DEBUG_ON_SERIAL_PORT) + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf +!else + DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.i= nf +!endif + ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExt= ractGuidedSectionLib.inf +!ifdef $(SOURCE_DEBUG_ENABLE) + DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf +!endif + CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuE= xceptionHandlerLib.inf + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf + +[LibraryClasses.common.DXE_RUNTIME_DRIVER] + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf + TimerLib|OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf + DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf + ReportStatusCodeLib|MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/R= untimeDxeReportStatusCodeLib.inf +!ifdef $(DEBUG_ON_SERIAL_PORT) + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf +!else + DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.i= nf +!endif + UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf + BaseCryptLib|CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf + PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf + QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/DxeQemuFwCfgS3LibFwCfg.inf + +[LibraryClasses.common.UEFI_DRIVER] + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf + TimerLib|OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf + DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf + ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeRepor= tStatusCodeLib.inf +!ifdef $(DEBUG_ON_SERIAL_PORT) + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf +!else + DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.i= nf +!endif + UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf + PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf + +[LibraryClasses.common.DXE_DRIVER] + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf + TimerLib|OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf + ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeRepor= tStatusCodeLib.inf + UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf +!ifdef $(DEBUG_ON_SERIAL_PORT) + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf +!else + DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.i= nf +!endif + PlatformBootManagerLib|OvmfPkg/Library/PlatformBootManagerLib/PlatformBo= otManagerLib.inf + PlatformBmPrintScLib|OvmfPkg/Library/PlatformBmPrintScLib/PlatformBmPrin= tScLib.inf + QemuBootOrderLib|OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf + CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuE= xceptionHandlerLib.inf + LockBoxLib|OvmfPkg/Library/LockBoxLib/LockBoxDxeLib.inf +!ifdef $(SOURCE_DEBUG_ENABLE) + DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf +!endif + PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf + MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf + QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/DxeQemuFwCfgS3LibFwCfg.inf + +[LibraryClasses.common.UEFI_APPLICATION] + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf + TimerLib|OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf + ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeRepor= tStatusCodeLib.inf +!ifdef $(DEBUG_ON_SERIAL_PORT) + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf +!else + DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.i= nf +!endif + PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf + +##########################################################################= ###### +# +# Pcd Section - list of all EDK II PCD Entries defined by this Platform. +# +##########################################################################= ###### +[PcdsFeatureFlag] + gEfiMdeModulePkgTokenSpaceGuid.PcdHiiOsRuntimeSupport|FALSE + gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial|FALSE + gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseMemory|TRUE + gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSupportUefiDecompress|FALSE + gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode|FALSE + gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE + gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE + gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE + +[PcdsFixedAtBuild] + gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeMemorySize|1 + gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FAL= SE + gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler|0x10 +!if ($(FD_SIZE_IN_KB) =3D=3D 1024) || ($(FD_SIZE_IN_KB) =3D=3D 2048) + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000 + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800 +!if $(NETWORK_TLS_ENABLE) =3D=3D FALSE + # match PcdFlashNvStorageVariableSize purely for convenience + gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0xe000 +!endif +!endif +!if $(FD_SIZE_IN_KB) =3D=3D 4096 + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x8400 + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x8400 +!if $(NETWORK_TLS_ENABLE) =3D=3D FALSE + # match PcdFlashNvStorageVariableSize purely for convenience + gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0x40000 +!endif +!endif +!if $(NETWORK_TLS_ENABLE) =3D=3D TRUE + gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0x80000 + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVolatileVariableSize|0x40000 +!endif + + gEfiMdeModulePkgTokenSpaceGuid.PcdVpdBaseAddress|0x0 + + gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x07 + + # DEBUG_INIT 0x00000001 // Initialization + # DEBUG_WARN 0x00000002 // Warnings + # DEBUG_LOAD 0x00000004 // Load events + # DEBUG_FS 0x00000008 // EFI File system + # DEBUG_POOL 0x00000010 // Alloc & Free (pool) + # DEBUG_PAGE 0x00000020 // Alloc & Free (page) + # DEBUG_INFO 0x00000040 // Informational debug messages + # DEBUG_DISPATCH 0x00000080 // PEI/DXE/SMM Dispatchers + # DEBUG_VARIABLE 0x00000100 // Variable + # DEBUG_BM 0x00000400 // Boot Manager + # DEBUG_BLKIO 0x00001000 // BlkIo Driver + # DEBUG_NET 0x00004000 // SNP Driver + # DEBUG_UNDI 0x00010000 // UNDI Driver + # DEBUG_LOADFILE 0x00020000 // LoadFile + # DEBUG_EVENT 0x00080000 // Event messages + # DEBUG_GCD 0x00100000 // Global Coherency Database changes + # DEBUG_CACHE 0x00200000 // Memory range cachability changes + # DEBUG_VERBOSE 0x00400000 // Detailed debug messages that may + # // significantly impact boot performance + # DEBUG_ERROR 0x80000000 // Error + gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x8000004F + +!ifdef $(SOURCE_DEBUG_ENABLE) + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x17 +!else + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2F +!endif + + # This PCD is used to set the base address of the PCI express hierarchy.= It + # is only consulted when OVMF runs on Q35. In that case it is programmed= into + # the PCIEXBAR register. + # + # On Q35 machine types that QEMU intends to support in the long term, QE= MU + # never lets the RAM below 4 GB exceed 2816 MB. + gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0xB0000000 + +!ifdef $(SOURCE_DEBUG_ENABLE) + gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdDebugLoadImageMethod|0x2 +!endif + + # + # Network Pcds + # +!include NetworkPkg/NetworkPcds.dsc.inc + + # IRQs 5, 9, 10, 11 are level-triggered + gUefiOvmfPkgTokenSpaceGuid.Pcd8259LegacyModeEdgeLevel|0x0E20 + + # Point to the MdeModulePkg/Application/UiApp/UiApp.inf + gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c= , 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0= x31 } + +##########################################################################= ###### +# +# Pcd Dynamic Section - list of all EDK II PCD Entries defined by this Pla= tform +# +##########################################################################= ###### + +[PcdsDynamicDefault] + gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0 + gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|TRUE + gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|800 + gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|600 + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable|FALSE + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId|0 + gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase|0x0 + gUefiOvmfPkgTokenSpaceGuid.PcdPciIoSize|0x0 + gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Base|0x0 + gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Size|0x0 + gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Base|0x0 + gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Size|0x800000000 + + gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|0 + + # Set video resolution for text setup. + gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoHorizontalResolution|640 + gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoVerticalResolution|480 + + gEfiMdeModulePkgTokenSpaceGuid.PcdSmbiosVersion|0x0208 + gEfiMdeModulePkgTokenSpaceGuid.PcdSmbiosDocRev|0x0 + gUefiOvmfPkgTokenSpaceGuid.PcdQemuSmbiosValidated|FALSE + + # Noexec settings for DXE. + gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack|FALSE + gEfiMdeModulePkgTokenSpaceGuid.PcdPropertiesTableEnable|FALSE + + # UefiCpuPkg PCDs related to initial AP bringup and general AP managemen= t. + gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber|64 + gUefiCpuPkgTokenSpaceGuid.PcdCpuApInitTimeOutInMicroSeconds|50000 + + # Set memory encryption mask + gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask|0x0 + + gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy|0x00 + +##########################################################################= ###### +# +# Components Section - list of all EDK II Modules needed by this Platform. +# +##########################################################################= ###### +[Components] + OvmfPkg/ResetVector/ResetVector.inf + + # + # SEC Phase modules + # + OvmfPkg/Sec/SecMain.inf { + + NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompre= ssLib.inf + } + + # + # PEI Phase modules + # + MdeModulePkg/Core/Pei/PeiMain.inf + MdeModulePkg/Universal/PCD/Pei/Pcd.inf { + + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + } + MdeModulePkg/Universal/ReportStatusCodeRouter/Pei/ReportStatusCodeRouter= Pei.inf { + + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + } + MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf { + + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + } + MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf + + OvmfPkg/PlatformPei/PlatformPei.inf + UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf + UefiCpuPkg/CpuMpPei/CpuMpPei.inf + + # + # DXE Phase modules + # + MdeModulePkg/Core/Dxe/DxeMain.inf { + + NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompre= ssLib.inf + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf + } + + MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCod= eRouterRuntimeDxe.inf + MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRun= timeDxe.inf + MdeModulePkg/Universal/PCD/Dxe/Pcd.inf { + + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + } + + MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf + + MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf + + MdeModulePkg/Universal/EbcDxe/EbcDxe.inf + OvmfPkg/8259InterruptControllerDxe/8259.inf + UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf + UefiCpuPkg/CpuDxe/CpuDxe.inf + OvmfPkg/8254TimerDxe/8254Timer.inf + OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf + OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf + MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf { + + PciHostBridgeLib|OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.i= nf + NULL|OvmfPkg/Library/PlatformHasIoMmuLib/PlatformHasIoMmuLib.inf + } + MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf { + + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf + } + MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf + MdeModulePkg/Universal/Metronome/Metronome.inf + PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.i= nf + MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf + MdeModulePkg/Universal/BdsDxe/BdsDxe.inf { + +!ifdef $(CSM_ENABLE) + NULL|OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf + NULL|OvmfPkg/Csm/LegacyBootManagerLib/LegacyBootManagerLib.inf +!endif + } + MdeModulePkg/Logo/LogoDxe.inf + MdeModulePkg/Application/UiApp/UiApp.inf { + + NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf + NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf + NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanc= eManagerUiLib.inf +!ifdef $(CSM_ENABLE) + NULL|OvmfPkg/Csm/LegacyBootManagerLib/LegacyBootManagerLib.inf + NULL|OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUiLib.inf +!endif + } + OvmfPkg/XenIoPciDxe/XenIoPciDxe.inf + OvmfPkg/XenBusDxe/XenBusDxe.inf + OvmfPkg/XenPvBlkDxe/XenPvBlkDxe.inf + MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf + MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntim= eDxe.inf + MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf + MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf + MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf + MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf= { + + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf + } + MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf + MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf { + + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + } + MdeModulePkg/Universal/PrintDxe/PrintDxe.inf + MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf + MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf + MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDxe.inf + MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf + FatPkg/EnhancedFatDxe/Fat.inf + MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf + MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf + MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf + OvmfPkg/SataControllerDxe/SataControllerDxe.inf + MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf + MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf + MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf + MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf + MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf + MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf + MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf + + OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf + OvmfPkg/QemuRamfbDxe/QemuRamfbDxe.inf + + # + # ISA Support + # + OvmfPkg/SioBusDxe/SioBusDxe.inf + MdeModulePkg/Bus/Pci/PciSioSerialDxe/PciSioSerialDxe.inf + MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KeyboardDxe.inf + + # + # SMBIOS Support + # + MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf { + + NULL|OvmfPkg/Library/SmbiosVersionLib/DetectSmbiosVersionLib.inf + } + OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf + + # + # ACPI Support + # + MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf + OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf + OvmfPkg/AcpiTables/AcpiTables.inf + MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf + MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.= inf + MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsRes= ourceTableDxe.inf + + # + # Network Support + # +!include NetworkPkg/NetworkComponents.dsc.inc + +!if $(NETWORK_TLS_ENABLE) =3D=3D TRUE + NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf { + + NULL|OvmfPkg/Library/TlsAuthConfigLib/TlsAuthConfigLib.inf + } +!endif + + # + # Usb Support + # + MdeModulePkg/Bus/Pci/UhciDxe/UhciDxe.inf + MdeModulePkg/Bus/Pci/EhciDxe/EhciDxe.inf + MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf + MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf + MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf + MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf + +!ifdef $(CSM_ENABLE) + OvmfPkg/Csm/BiosThunk/VideoDxe/VideoDxe.inf { + + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf + } + OvmfPkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf + OvmfPkg/Csm/Csm16/Csm16.inf +!endif + +!if $(TOOL_CHAIN_TAG) !=3D "XCODE5" + ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf { + + gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE + } +!endif + ShellPkg/Application/Shell/Shell.inf { + + ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellComman= dLib.inf + NULL|ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2Comm= andsLib.inf + NULL|ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1Comm= andsLib.inf + NULL|ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3Comm= andsLib.inf + NULL|ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1Co= mmandsLib.inf + NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Comm= andsLib.inf + NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1= CommandsLib.inf + NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1= CommandsLib.inf +!if $(NETWORK_IP6_ENABLE) =3D=3D TRUE + NULL|ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2= CommandsLib.inf +!endif + HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandlePar= singLib.inf + PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf + BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcf= gCommandLib.inf + + + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0xFF + gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE + gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|8000 + } + + OvmfPkg/PlatformDxe/Platform.inf + OvmfPkg/AmdSevDxe/AmdSevDxe.inf + OvmfPkg/IoMmuDxe/IoMmuDxe.inf + + # + # Variable driver stack (non-SMM) + # + OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf + OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf { + + PlatformFvbLib|OvmfPkg/Library/EmuVariableFvbLib/EmuVariableFvbLib.i= nf + } + MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf + MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf { + + NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf + } diff --git a/OvmfPkg/OvmfXen.fdf b/OvmfPkg/OvmfXen.fdf new file mode 100644 index 0000000000..f59647fd14 --- /dev/null +++ b/OvmfPkg/OvmfXen.fdf @@ -0,0 +1,439 @@ +## @file +# Open Virtual Machine Firmware: FDF +# +# Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
+# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
+# Copyright (c) 2019, Citrix Systems, Inc. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +##########################################################################= ###### + +[Defines] +!include OvmfPkg.fdf.inc + +# +# Build the variable store and the firmware code as one unified flash devi= ce +# image. +# +[FD.OVMF] +BaseAddress =3D $(FW_BASE_ADDRESS) +Size =3D $(FW_SIZE) +ErasePolarity =3D 1 +BlockSize =3D $(BLOCK_SIZE) +NumBlocks =3D $(FW_BLOCKS) + +!include VarStore.fdf.inc + +$(VARS_SIZE)|$(FVMAIN_SIZE) +FV =3D FVMAIN_COMPACT + +$(SECFV_OFFSET)|$(SECFV_SIZE) +FV =3D SECFV + +# +# Build the variable store and the firmware code as separate flash device +# images. +# +[FD.OVMF_VARS] +BaseAddress =3D $(FW_BASE_ADDRESS) +Size =3D $(VARS_SIZE) +ErasePolarity =3D 1 +BlockSize =3D $(BLOCK_SIZE) +NumBlocks =3D $(VARS_BLOCKS) + +!include VarStore.fdf.inc + +[FD.OVMF_CODE] +BaseAddress =3D $(CODE_BASE_ADDRESS) +Size =3D $(CODE_SIZE) +ErasePolarity =3D 1 +BlockSize =3D $(BLOCK_SIZE) +NumBlocks =3D $(CODE_BLOCKS) + +0x00000000|$(FVMAIN_SIZE) +FV =3D FVMAIN_COMPACT + +$(FVMAIN_SIZE)|$(SECFV_SIZE) +FV =3D SECFV + +##########################################################################= ###### + +[FD.MEMFD] +BaseAddress =3D $(MEMFD_BASE_ADDRESS) +Size =3D 0xB00000 +ErasePolarity =3D 1 +BlockSize =3D 0x10000 +NumBlocks =3D 0xB0 + +0x000000|0x006000 +gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesBase|gUefiOvmfPkgTokenSpace= Guid.PcdOvmfSecPageTablesSize + +0x006000|0x001000 +gUefiOvmfPkgTokenSpaceGuid.PcdOvmfLockBoxStorageBase|gUefiOvmfPkgTokenSpac= eGuid.PcdOvmfLockBoxStorageSize + +0x007000|0x001000 +gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress|gUefiOvmfPkgT= okenSpaceGuid.PcdGuidedExtractHandlerTableSize + +0x010000|0x010000 +gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamBase|gUefiOvmfPkgTokenSpace= Guid.PcdOvmfSecPeiTempRamSize + +0x020000|0x0E0000 +gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvBase|gUefiOvmfPkgTokenSpaceGuid.= PcdOvmfPeiMemFvSize +FV =3D PEIFV + +0x100000|0xA00000 +gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvBase|gUefiOvmfPkgTokenSpaceGuid.= PcdOvmfDxeMemFvSize +FV =3D DXEFV + +##########################################################################= ###### + +[FV.SECFV] +FvNameGuid =3D 763BED0D-DE9F-48F5-81F1-3E90E1B1A015 +BlockSize =3D 0x1000 +FvAlignment =3D 16 +ERASE_POLARITY =3D 1 +MEMORY_MAPPED =3D TRUE +STICKY_WRITE =3D TRUE +LOCK_CAP =3D TRUE +LOCK_STATUS =3D TRUE +WRITE_DISABLED_CAP =3D TRUE +WRITE_ENABLED_CAP =3D TRUE +WRITE_STATUS =3D TRUE +WRITE_LOCK_CAP =3D TRUE +WRITE_LOCK_STATUS =3D TRUE +READ_DISABLED_CAP =3D TRUE +READ_ENABLED_CAP =3D TRUE +READ_STATUS =3D TRUE +READ_LOCK_CAP =3D TRUE +READ_LOCK_STATUS =3D TRUE + +# +# SEC Phase modules +# +# The code in this FV handles the initial firmware startup, and +# decompresses the PEI and DXE FVs which handles the rest of the boot sequ= ence. +# +INF OvmfPkg/Sec/SecMain.inf + +INF RuleOverride=3DRESET_VECTOR OvmfPkg/ResetVector/ResetVector.inf + +##########################################################################= ###### +[FV.PEIFV] +FvNameGuid =3D 6938079B-B503-4E3D-9D24-B28337A25806 +BlockSize =3D 0x10000 +FvAlignment =3D 16 +ERASE_POLARITY =3D 1 +MEMORY_MAPPED =3D TRUE +STICKY_WRITE =3D TRUE +LOCK_CAP =3D TRUE +LOCK_STATUS =3D TRUE +WRITE_DISABLED_CAP =3D TRUE +WRITE_ENABLED_CAP =3D TRUE +WRITE_STATUS =3D TRUE +WRITE_LOCK_CAP =3D TRUE +WRITE_LOCK_STATUS =3D TRUE +READ_DISABLED_CAP =3D TRUE +READ_ENABLED_CAP =3D TRUE +READ_STATUS =3D TRUE +READ_LOCK_CAP =3D TRUE +READ_LOCK_STATUS =3D TRUE + +APRIORI PEI { + INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf +} + +# +# PEI Phase modules +# +INF MdeModulePkg/Core/Pei/PeiMain.inf +INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf +INF MdeModulePkg/Universal/ReportStatusCodeRouter/Pei/ReportStatusCodeRou= terPei.inf +INF MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf +INF OvmfPkg/PlatformPei/PlatformPei.inf +INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf +INF UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf +INF UefiCpuPkg/CpuMpPei/CpuMpPei.inf + +##########################################################################= ###### + +[FV.DXEFV] +FvForceRebase =3D FALSE +FvNameGuid =3D 7CB8BDC9-F8EB-4F34-AAEA-3EE4AF6516A1 +BlockSize =3D 0x10000 +FvAlignment =3D 16 +ERASE_POLARITY =3D 1 +MEMORY_MAPPED =3D TRUE +STICKY_WRITE =3D TRUE +LOCK_CAP =3D TRUE +LOCK_STATUS =3D TRUE +WRITE_DISABLED_CAP =3D TRUE +WRITE_ENABLED_CAP =3D TRUE +WRITE_STATUS =3D TRUE +WRITE_LOCK_CAP =3D TRUE +WRITE_LOCK_STATUS =3D TRUE +READ_DISABLED_CAP =3D TRUE +READ_ENABLED_CAP =3D TRUE +READ_STATUS =3D TRUE +READ_LOCK_CAP =3D TRUE +READ_LOCK_STATUS =3D TRUE + +APRIORI DXE { + INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf + INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf + INF OvmfPkg/AmdSevDxe/AmdSevDxe.inf + INF OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf +} + +# +# DXE Phase modules +# +INF MdeModulePkg/Core/Dxe/DxeMain.inf + +INF MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatus= CodeRouterRuntimeDxe.inf +INF MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandler= RuntimeDxe.inf +INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf + +INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf +INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf +INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf +INF OvmfPkg/8259InterruptControllerDxe/8259.inf +INF UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf +INF UefiCpuPkg/CpuDxe/CpuDxe.inf +INF OvmfPkg/8254TimerDxe/8254Timer.inf +INF OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.= inf +INF OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf +INF MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf +INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf +INF MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf +INF MdeModulePkg/Universal/Metronome/Metronome.inf +INF PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDx= e.inf + +INF OvmfPkg/XenIoPciDxe/XenIoPciDxe.inf +INF OvmfPkg/XenBusDxe/XenBusDxe.inf +INF OvmfPkg/XenPvBlkDxe/XenPvBlkDxe.inf + +INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf +INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRun= timeDxe.inf +INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf +INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf +INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf +INF MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.= inf +INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf +INF MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.= inf +INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf +INF MdeModulePkg/Application/UiApp/UiApp.inf +INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf +INF MdeModulePkg/Universal/PrintDxe/PrintDxe.inf +INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf +INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf +INF MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDxe.inf +INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf +INF MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf +INF MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf +INF OvmfPkg/SataControllerDxe/SataControllerDxe.inf +INF MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf +INF MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf +INF MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf +INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf +INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf +INF MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf +INF MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe= .inf + +INF OvmfPkg/SioBusDxe/SioBusDxe.inf +!ifndef $(SOURCE_DEBUG_ENABLE) +INF MdeModulePkg/Bus/Pci/PciSioSerialDxe/PciSioSerialDxe.inf +!endif +INF MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KeyboardDxe.inf + +INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf +INF OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf + +INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf +INF OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf +INF RuleOverride=3DACPITABLE OvmfPkg/AcpiTables/AcpiTables.inf +INF MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf +INF MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorD= xe.inf +INF MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphics= ResourceTableDxe.inf + +INF FatPkg/EnhancedFatDxe/Fat.inf +INF MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf + +!if $(TOOL_CHAIN_TAG) !=3D "XCODE5" +INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf +!endif +INF ShellPkg/Application/Shell/Shell.inf + +INF MdeModulePkg/Logo/LogoDxe.inf + +# +# Network modules +# +!if $(E1000_ENABLE) + FILE DRIVER =3D 5D695E11-9B3F-4b83-B25F-4A8D5D69BE07 { + SECTION PE32 =3D Intel3.5/EFIX64/E3522X2.EFI + } +!endif +!include NetworkPkg/Network.fdf.inc + +# +# Usb Support +# +INF MdeModulePkg/Bus/Pci/UhciDxe/UhciDxe.inf +INF MdeModulePkg/Bus/Pci/EhciDxe/EhciDxe.inf +INF MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf +INF MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf +INF MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf +INF MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf + +!ifdef $(CSM_ENABLE) +INF OvmfPkg/Csm/BiosThunk/VideoDxe/VideoDxe.inf +INF OvmfPkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf +INF RuleOverride=3DCSM OvmfPkg/Csm/Csm16/Csm16.inf +!endif + +INF OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf +INF OvmfPkg/QemuRamfbDxe/QemuRamfbDxe.inf +INF OvmfPkg/PlatformDxe/Platform.inf +INF OvmfPkg/AmdSevDxe/AmdSevDxe.inf +INF OvmfPkg/IoMmuDxe/IoMmuDxe.inf + +# +# Variable driver stack (non-SMM) +# +INF OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf +INF OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf +INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf +INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf + +##########################################################################= ###### + +[FV.FVMAIN_COMPACT] +FvNameGuid =3D 48DB5E17-707C-472D-91CD-1613E7EF51B0 +FvAlignment =3D 16 +ERASE_POLARITY =3D 1 +MEMORY_MAPPED =3D TRUE +STICKY_WRITE =3D TRUE +LOCK_CAP =3D TRUE +LOCK_STATUS =3D TRUE +WRITE_DISABLED_CAP =3D TRUE +WRITE_ENABLED_CAP =3D TRUE +WRITE_STATUS =3D TRUE +WRITE_LOCK_CAP =3D TRUE +WRITE_LOCK_STATUS =3D TRUE +READ_DISABLED_CAP =3D TRUE +READ_ENABLED_CAP =3D TRUE +READ_STATUS =3D TRUE +READ_LOCK_CAP =3D TRUE +READ_LOCK_STATUS =3D TRUE + +FILE FV_IMAGE =3D 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 { + SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED= =3D TRUE { + # + # These firmware volumes will have files placed in them uncompressed, + # and then both firmware volumes will be compressed in a single + # compression operation in order to achieve better overall compressio= n. + # + SECTION FV_IMAGE =3D PEIFV + SECTION FV_IMAGE =3D DXEFV + } + } + +!include DecomprScratchEnd.fdf.inc + +##########################################################################= ###### + +[Rule.Common.SEC] + FILE SEC =3D $(NAMED_GUID) { + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING =3D"$(MODULE_NAME)" Optional + VERSION STRING =3D"$(INF_VERSION)" Optional BUILD_NUM=3D$(BUILD_NUMBE= R) + } + +[Rule.Common.PEI_CORE] + FILE PEI_CORE =3D $(NAMED_GUID) { + PE32 PE32 Align=3DAuto $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING =3D"$(MODULE_NAME)" Optional + VERSION STRING =3D"$(INF_VERSION)" Optional BUILD_NUM=3D$(BUILD_NUMBE= R) + } + +[Rule.Common.PEIM] + FILE PEIM =3D $(NAMED_GUID) { + PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex + PE32 PE32 Align=3DAuto $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING=3D"$(MODULE_NAME)" Optional + VERSION STRING=3D"$(INF_VERSION)" Optional BUILD_NUM=3D$(BUILD_NUMBE= R) + } + +[Rule.Common.DXE_CORE] + FILE DXE_CORE =3D $(NAMED_GUID) { + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING=3D"$(MODULE_NAME)" Optional + VERSION STRING=3D"$(INF_VERSION)" Optional BUILD_NUM=3D$(BUILD_NUMBER) + } + +[Rule.Common.DXE_DRIVER] + FILE DRIVER =3D $(NAMED_GUID) { + DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING=3D"$(MODULE_NAME)" Optional + VERSION STRING=3D"$(INF_VERSION)" Optional BUILD_NUM=3D$(BUILD_NUMBER) + RAW ACPI Optional |.acpi + RAW ASL Optional |.aml + } + +[Rule.Common.DXE_RUNTIME_DRIVER] + FILE DRIVER =3D $(NAMED_GUID) { + DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING=3D"$(MODULE_NAME)" Optional + VERSION STRING=3D"$(INF_VERSION)" Optional BUILD_NUM=3D$(BUILD_NUMBER) + } + +[Rule.Common.UEFI_DRIVER] + FILE DRIVER =3D $(NAMED_GUID) { + DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING=3D"$(MODULE_NAME)" Optional + VERSION STRING=3D"$(INF_VERSION)" Optional BUILD_NUM=3D$(BUILD_NUMBER) + } + +[Rule.Common.UEFI_DRIVER.BINARY] + FILE DRIVER =3D $(NAMED_GUID) { + DXE_DEPEX DXE_DEPEX Optional |.depex + PE32 PE32 |.efi + UI STRING=3D"$(MODULE_NAME)" Optional + VERSION STRING=3D"$(INF_VERSION)" Optional BUILD_NUM=3D$(BUILD_NUMBE= R) + } + +[Rule.Common.UEFI_APPLICATION] + FILE APPLICATION =3D $(NAMED_GUID) { + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING=3D"$(MODULE_NAME)" Optional + VERSION STRING=3D"$(INF_VERSION)" Optional BUILD_NUM=3D$(BUILD_NUMBER) + } + +[Rule.Common.UEFI_APPLICATION.BINARY] + FILE APPLICATION =3D $(NAMED_GUID) { + PE32 PE32 |.efi + UI STRING=3D"$(MODULE_NAME)" Optional + VERSION STRING=3D"$(INF_VERSION)" Optional BUILD_NUM=3D$(BUILD_NUMBE= R) + } + +[Rule.Common.USER_DEFINED.ACPITABLE] + FILE FREEFORM =3D $(NAMED_GUID) { + RAW ACPI |.acpi + RAW ASL |.aml + } + +[Rule.Common.USER_DEFINED.CSM] + FILE FREEFORM =3D $(NAMED_GUID) { + RAW BIN |.bin + } + +[Rule.Common.SEC.RESET_VECTOR] + FILE RAW =3D $(NAMED_GUID) { + RAW BIN Align =3D 16 |.bin + } diff --git a/Maintainers.txt b/Maintainers.txt index 0298010809..98f6d828eb 100644 --- a/Maintainers.txt +++ b/Maintainers.txt @@ -372,6 +372,7 @@ F: OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c F: OvmfPkg/Library/XenConsoleSerialPortLib/ F: OvmfPkg/Library/XenHypercallLib/ F: OvmfPkg/Library/XenIoMmioLib/ +F: OvmfPkg/OvmfXen.* F: OvmfPkg/PlatformPei/MemDetect.c F: OvmfPkg/PlatformPei/Platform.* F: OvmfPkg/PlatformPei/Xen.* --=20 Anthony PERARD -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45528): https://edk2.groups.io/g/devel/message/45528 Mute This Topic: https://groups.io/mt/32851499/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Nov 14 05:47:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45527+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1565695885; cv=none; d=zoho.com; s=zohoarc; b=ArRJCINyv2lAGS0ig5rB12r8BOB8aPHrYs9TWlVrhbol0gu85K/WpcnA7+Qjjw4ZRQdsnOxVJk6u8za37s6LZk478BLOWJilX8szeb49K7ntWpTnFZB8IC80Q9K8aufdKqchnfNknlwK5WnyPb6sfkFkRvD+K+XAV+rrVdTlFNQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565695885; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=iTnSIaUGZ5SxDwBxWtgE9GDRu6Rm4NpU1va7CopCPyw=; b=nBP0UC4Bln5v3oUbrE220YXI5gcFXUr8CNjHQaUQii6Ta2qmUZMQnDv68JlA4UatVgXSiQ77SnNCUT+gH4qKak4j3wwEAi0XlmYRpnt7xwq9qGXBc/Rd0VEJ+P8CjdNZaZUkWuMR5ee5GpkYG52vyl/7OEKisTNWWs6O/9B3zEQ= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45527+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1565695885200429.758595105431; Tue, 13 Aug 2019 04:31:25 -0700 (PDT) Return-Path: X-Received: from esa4.hc3370-68.iphmx.com (esa4.hc3370-68.iphmx.com [216.71.155.144]) by groups.io with SMTP; Tue, 13 Aug 2019 04:31:23 -0700 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45527+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: None (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.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=esa4.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 (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: ROjcjmgjBQeyMVP3Yz39j0AYUP6x2pM4x3yYCfRTQw+qS3AnsgHn7xgeNXJRRwQ8Y/3n/PgaPI bV/wwhWJ4z8eEBsnA1DniXB96lfwfCbdiP4tmtDRXi9Kt050EBD0wMLxxgybM8875iuLdSfjlJ Sp0jyBXO6JMp2Fx6+RTKB8jfuC6TkNsRFFTJHBIJKnBJXq1DB7qPT3egE3hvQsbnOzi9om7mt4 8cbW8iIKp24t5A8BOeHeBWTHrHZa/vw6HdMawf+Qf+syGnM0A7ztgWbYZb1yU4BJaqQG2uoZPI lvA= X-SBRS: 2.7 X-MesageID: 4401247 X-Ironport-Server: esa4.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="4401247" From: "Anthony PERARD" To: CC: Laszlo Ersek , Jordan Justen , Julien Grall , , Ard Biesheuvel , Anthony PERARD Subject: [edk2-devel] [PATCH v5 03/35] OvmfPkg: Introduce XenResetVector Date: Tue, 13 Aug 2019 12:30:47 +0100 Message-ID: <20190813113119.14804-4-anthony.perard@citrix.com> In-Reply-To: <20190813113119.14804-1-anthony.perard@citrix.com> References: <20190813113119.14804-1-anthony.perard@citrix.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,anthony.perard@citrix.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565695884; bh=iTnSIaUGZ5SxDwBxWtgE9GDRu6Rm4NpU1va7CopCPyw=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=qqjhbIGcAtLMXXy5QWa2iizLoKkAkBUrJhbBCPN53awO/2Ra2atwf3CTp5BUIiAWo4X Uua84tBi66/X/Zm0mGA1R8iYP1yHLePtfoPP/BhIzQbuSQ241yoCo40WuztJ5bbPhAevu AH/8DJlSw5OKl18V3sYE+DeK/pDELCVaaZI= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Introduce XenResetVector, a copy of OvmfPkg/ResetVector, with one changes: - SEC_DEFAULT_CR0: enable cache (bit 30 or CD set to 0) Xen copies the OVMF code to RAM, there is no need to disable cache. This new module will later be modified to add a new entry point, more detail in a following commit "OvmfPkg/XenResetVector: Add new entry point for Xen PVH" Value FILE_GUID of XenResetVector have not changed compare to ResetVector because it is a special value (gEfiFirmwareVolumeTopFileGuid). Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1689 Signed-off-by: Anthony PERARD Reviewed-by: Laszlo Ersek --- Notes: v4: - Update Maintainers.txt =20 v3: - Added gEfiFirmwareVolumeTopFileGuid to the commit message. - rebased: SPDX OvmfPkg/OvmfXen.dsc | 2 +- OvmfPkg/OvmfXen.fdf | 2 +- OvmfPkg/XenResetVector/XenResetVector.inf | 38 +++++ Maintainers.txt | 1 + .../XenResetVector/Ia16/Real16ToFlat32.asm | 134 ++++++++++++++++ OvmfPkg/XenResetVector/Ia32/PageTables64.asm | 149 ++++++++++++++++++ OvmfPkg/XenResetVector/XenResetVector.nasmb | 68 ++++++++ 7 files changed, 392 insertions(+), 2 deletions(-) create mode 100644 OvmfPkg/XenResetVector/XenResetVector.inf create mode 100644 OvmfPkg/XenResetVector/Ia16/Real16ToFlat32.asm create mode 100644 OvmfPkg/XenResetVector/Ia32/PageTables64.asm create mode 100644 OvmfPkg/XenResetVector/XenResetVector.nasmb diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc index f224ac32b4..1a0e59f0cc 100644 --- a/OvmfPkg/OvmfXen.dsc +++ b/OvmfPkg/OvmfXen.dsc @@ -495,7 +495,7 @@ [PcdsDynamicDefault] # ##########################################################################= ###### [Components] - OvmfPkg/ResetVector/ResetVector.inf + OvmfPkg/XenResetVector/XenResetVector.inf =20 # # SEC Phase modules diff --git a/OvmfPkg/OvmfXen.fdf b/OvmfPkg/OvmfXen.fdf index f59647fd14..6fc8479aae 100644 --- a/OvmfPkg/OvmfXen.fdf +++ b/OvmfPkg/OvmfXen.fdf @@ -118,7 +118,7 @@ [FV.SECFV] # INF OvmfPkg/Sec/SecMain.inf =20 -INF RuleOverride=3DRESET_VECTOR OvmfPkg/ResetVector/ResetVector.inf +INF RuleOverride=3DRESET_VECTOR OvmfPkg/XenResetVector/XenResetVector.inf =20 ##########################################################################= ###### [FV.PEIFV] diff --git a/OvmfPkg/XenResetVector/XenResetVector.inf b/OvmfPkg/XenResetVe= ctor/XenResetVector.inf new file mode 100644 index 0000000000..097fc9b5b4 --- /dev/null +++ b/OvmfPkg/XenResetVector/XenResetVector.inf @@ -0,0 +1,38 @@ +## @file +# Reset Vector +# +# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+# Copyright (c) 2019, Citrix Systems, Inc. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D XenResetVector + FILE_GUID =3D 1BA0062E-C779-4582-8566-336AE8F78F09 + MODULE_TYPE =3D SEC + VERSION_STRING =3D 1.1 + +# +# The following information is for reference only and not required by the = build tools. +# +# VALID_ARCHITECTURES =3D IA32 X64 +# + +[Sources] + XenResetVector.nasmb + +[Packages] + OvmfPkg/OvmfPkg.dec + MdePkg/MdePkg.dec + UefiCpuPkg/UefiCpuPkg.dec + +[BuildOptions] + *_*_IA32_NASMB_FLAGS =3D -I$(WORKSPACE)/UefiCpuPkg/ResetVector/Vtf0/ + *_*_X64_NASMB_FLAGS =3D -I$(WORKSPACE)/UefiCpuPkg/ResetVector/Vtf0/ + +[Pcd] + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesBase + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesSize diff --git a/Maintainers.txt b/Maintainers.txt index 98f6d828eb..34bdb275b4 100644 --- a/Maintainers.txt +++ b/Maintainers.txt @@ -380,6 +380,7 @@ F: OvmfPkg/SmbiosPlatformDxe/*Xen.c F: OvmfPkg/XenBusDxe/ F: OvmfPkg/XenIoPciDxe/ F: OvmfPkg/XenPvBlkDxe/ +F: OvmfPkg/XenResetVector/ R: Anthony Perard R: Julien Grall =20 diff --git a/OvmfPkg/XenResetVector/Ia16/Real16ToFlat32.asm b/OvmfPkg/XenRe= setVector/Ia16/Real16ToFlat32.asm new file mode 100644 index 0000000000..5c329bfaea --- /dev/null +++ b/OvmfPkg/XenResetVector/Ia16/Real16ToFlat32.asm @@ -0,0 +1,134 @@ +;-------------------------------------------------------------------------= ----- +; @file +; Transition from 16 bit real mode into 32 bit flat protected mode +; +; Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.
+; Copyright (c) 2019, Citrix Systems, Inc. +; SPDX-License-Identifier: BSD-2-Clause-Patent +; +;-------------------------------------------------------------------------= ----- + +%define SEC_DEFAULT_CR0 0x00000023 +%define SEC_DEFAULT_CR4 0x640 + +BITS 16 + +; +; Modified: EAX, EBX +; +; @param[out] DS Selector allowing flat access to all addresses +; @param[out] ES Selector allowing flat access to all addresses +; @param[out] FS Selector allowing flat access to all addresses +; @param[out] GS Selector allowing flat access to all addresses +; @param[out] SS Selector allowing flat access to all addresses +; +TransitionFromReal16To32BitFlat: + + debugShowPostCode POSTCODE_16BIT_MODE + + cli + + mov bx, 0xf000 + mov ds, bx + + mov bx, ADDR16_OF(gdtr) + +o32 lgdt [cs:bx] + + mov eax, SEC_DEFAULT_CR0 + mov cr0, eax + + jmp LINEAR_CODE_SEL:dword ADDR_OF(jumpTo32BitAndLandHere) +BITS 32 +jumpTo32BitAndLandHere: + + mov eax, SEC_DEFAULT_CR4 + mov cr4, eax + + debugShowPostCode POSTCODE_32BIT_MODE + + mov ax, LINEAR_SEL + mov ds, ax + mov es, ax + mov fs, ax + mov gs, ax + mov ss, ax + + OneTimeCallRet TransitionFromReal16To32BitFlat + +ALIGN 2 + +gdtr: + dw GDT_END - GDT_BASE - 1 ; GDT limit + dd ADDR_OF(GDT_BASE) + +ALIGN 16 + +; +; Macros for GDT entries +; + +%define PRESENT_FLAG(p) (p << 7) +%define DPL(dpl) (dpl << 5) +%define SYSTEM_FLAG(s) (s << 4) +%define DESC_TYPE(t) (t) + +; Type: data, expand-up, writable, accessed +%define DATA32_TYPE 3 + +; Type: execute, readable, expand-up, accessed +%define CODE32_TYPE 0xb + +; Type: execute, readable, expand-up, accessed +%define CODE64_TYPE 0xb + +%define GRANULARITY_FLAG(g) (g << 7) +%define DEFAULT_SIZE32(d) (d << 6) +%define CODE64_FLAG(l) (l << 5) +%define UPPER_LIMIT(l) (l) + +; +; The Global Descriptor Table (GDT) +; + +GDT_BASE: +; null descriptor +NULL_SEL equ $-GDT_BASE + DW 0 ; limit 15:0 + DW 0 ; base 15:0 + DB 0 ; base 23:16 + DB 0 ; sys flag, dpl, type + DB 0 ; limit 19:16, flags + DB 0 ; base 31:24 + +; linear data segment descriptor +LINEAR_SEL equ $-GDT_BASE + DW 0xffff ; limit 15:0 + DW 0 ; base 15:0 + DB 0 ; base 23:16 + DB PRESENT_FLAG(1)|DPL(0)|SYSTEM_FLAG(1)|DESC_TYPE(DATA32_TYPE) + DB GRANULARITY_FLAG(1)|DEFAULT_SIZE32(1)|CODE64_FLAG(0)|UPPER_LIM= IT(0xf) + DB 0 ; base 31:24 + +; linear code segment descriptor +LINEAR_CODE_SEL equ $-GDT_BASE + DW 0xffff ; limit 15:0 + DW 0 ; base 15:0 + DB 0 ; base 23:16 + DB PRESENT_FLAG(1)|DPL(0)|SYSTEM_FLAG(1)|DESC_TYPE(CODE32_TYPE) + DB GRANULARITY_FLAG(1)|DEFAULT_SIZE32(1)|CODE64_FLAG(0)|UPPER_LIM= IT(0xf) + DB 0 ; base 31:24 + +%ifdef ARCH_X64 +; linear code (64-bit) segment descriptor +LINEAR_CODE64_SEL equ $-GDT_BASE + DW 0xffff ; limit 15:0 + DW 0 ; base 15:0 + DB 0 ; base 23:16 + DB PRESENT_FLAG(1)|DPL(0)|SYSTEM_FLAG(1)|DESC_TYPE(CODE64_TYPE) + DB GRANULARITY_FLAG(1)|DEFAULT_SIZE32(0)|CODE64_FLAG(1)|UPPER_LIM= IT(0xf) + DB 0 ; base 31:24 +%endif + +GDT_END: + diff --git a/OvmfPkg/XenResetVector/Ia32/PageTables64.asm b/OvmfPkg/XenRese= tVector/Ia32/PageTables64.asm new file mode 100644 index 0000000000..9f1c0e2259 --- /dev/null +++ b/OvmfPkg/XenResetVector/Ia32/PageTables64.asm @@ -0,0 +1,149 @@ +;-------------------------------------------------------------------------= ----- +; @file +; Sets the CR3 register for 64-bit paging +; +; Copyright (c) 2008 - 2013, Intel Corporation. All rights reserved.
+; Copyright (c) 2019, Citrix Systems, Inc. +; SPDX-License-Identifier: BSD-2-Clause-Patent +; +;-------------------------------------------------------------------------= ----- + +BITS 32 + +%define PAGE_PRESENT 0x01 +%define PAGE_READ_WRITE 0x02 +%define PAGE_USER_SUPERVISOR 0x04 +%define PAGE_WRITE_THROUGH 0x08 +%define PAGE_CACHE_DISABLE 0x010 +%define PAGE_ACCESSED 0x020 +%define PAGE_DIRTY 0x040 +%define PAGE_PAT 0x080 +%define PAGE_GLOBAL 0x0100 +%define PAGE_2M_MBO 0x080 +%define PAGE_2M_PAT 0x01000 + +%define PAGE_2M_PDE_ATTR (PAGE_2M_MBO + \ + PAGE_ACCESSED + \ + PAGE_DIRTY + \ + PAGE_READ_WRITE + \ + PAGE_PRESENT) + +%define PAGE_PDP_ATTR (PAGE_ACCESSED + \ + PAGE_READ_WRITE + \ + PAGE_PRESENT) + +; Check if Secure Encrypted Virtualization (SEV) feature is enabled +; +; If SEV is enabled then EAX will be at least 32 +; If SEV is disabled then EAX will be zero. +; +CheckSevFeature: + ; Check if we have a valid (0x8000_001F) CPUID leaf + mov eax, 0x80000000 + cpuid + + ; This check should fail on Intel or Non SEV AMD CPUs. In future if + ; Intel CPUs supports this CPUID leaf then we are guranteed to have ex= act + ; same bit definition. + cmp eax, 0x8000001f + jl NoSev + + ; Check for memory encryption feature: + ; CPUID Fn8000_001F[EAX] - Bit 1 + ; + mov eax, 0x8000001f + cpuid + bt eax, 1 + jnc NoSev + + ; Check if memory encryption is enabled + ; MSR_0xC0010131 - Bit 0 (SEV enabled) + mov ecx, 0xc0010131 + rdmsr + bt eax, 0 + jnc NoSev + + ; Get pte bit position to enable memory encryption + ; CPUID Fn8000_001F[EBX] - Bits 5:0 + ; + mov eax, ebx + and eax, 0x3f + jmp SevExit + +NoSev: + xor eax, eax + +SevExit: + OneTimeCallRet CheckSevFeature + +; +; Modified: EAX, EBX, ECX, EDX +; +SetCr3ForPageTables64: + + OneTimeCall CheckSevFeature + xor edx, edx + test eax, eax + jz SevNotActive + + ; If SEV is enabled, C-bit is always above 31 + sub eax, 32 + bts edx, eax + +SevNotActive: + + ; + ; For OVMF, build some initial page tables at + ; PcdOvmfSecPageTablesBase - (PcdOvmfSecPageTablesBase + 0x6000). + ; + ; This range should match with PcdOvmfSecPageTablesSize which is + ; declared in the FDF files. + ; + ; At the end of PEI, the pages tables will be rebuilt into a + ; more permanent location by DxeIpl. + ; + + mov ecx, 6 * 0x1000 / 4 + xor eax, eax +clearPageTablesMemoryLoop: + mov dword[ecx * 4 + PT_ADDR (0) - 4], eax + loop clearPageTablesMemoryLoop + + ; + ; Top level Page Directory Pointers (1 * 512GB entry) + ; + mov dword[PT_ADDR (0)], PT_ADDR (0x1000) + PAGE_PDP_ATTR + mov dword[PT_ADDR (4)], edx + + ; + ; Next level Page Directory Pointers (4 * 1GB entries =3D> 4GB) + ; + mov dword[PT_ADDR (0x1000)], PT_ADDR (0x2000) + PAGE_PDP_ATTR + mov dword[PT_ADDR (0x1004)], edx + mov dword[PT_ADDR (0x1008)], PT_ADDR (0x3000) + PAGE_PDP_ATTR + mov dword[PT_ADDR (0x100C)], edx + mov dword[PT_ADDR (0x1010)], PT_ADDR (0x4000) + PAGE_PDP_ATTR + mov dword[PT_ADDR (0x1014)], edx + mov dword[PT_ADDR (0x1018)], PT_ADDR (0x5000) + PAGE_PDP_ATTR + mov dword[PT_ADDR (0x101C)], edx + + ; + ; Page Table Entries (2048 * 2MB entries =3D> 4GB) + ; + mov ecx, 0x800 +pageTableEntriesLoop: + mov eax, ecx + dec eax + shl eax, 21 + add eax, PAGE_2M_PDE_ATTR + mov [ecx * 8 + PT_ADDR (0x2000 - 8)], eax + mov [(ecx * 8 + PT_ADDR (0x2000 - 8)) + 4], edx + loop pageTableEntriesLoop + + ; + ; Set CR3 now that the paging structures are available + ; + mov eax, PT_ADDR (0) + mov cr3, eax + + OneTimeCallRet SetCr3ForPageTables64 diff --git a/OvmfPkg/XenResetVector/XenResetVector.nasmb b/OvmfPkg/XenReset= Vector/XenResetVector.nasmb new file mode 100644 index 0000000000..89a4b08bc3 --- /dev/null +++ b/OvmfPkg/XenResetVector/XenResetVector.nasmb @@ -0,0 +1,68 @@ +;-------------------------------------------------------------------------= ----- +; @file +; This file includes all other code files to assemble the reset vector code +; +; Copyright (c) 2008 - 2013, Intel Corporation. All rights reserved.
+; Copyright (c) 2019, Citrix Systems, Inc. +; SPDX-License-Identifier: BSD-2-Clause-Patent +; +;-------------------------------------------------------------------------= ----- + +; +; If neither ARCH_IA32 nor ARCH_X64 are defined, then try to include +; Base.h to use the C pre-processor to determine the architecture. +; +%ifndef ARCH_IA32 + %ifndef ARCH_X64 + #include + #if defined (MDE_CPU_IA32) + %define ARCH_IA32 + #elif defined (MDE_CPU_X64) + %define ARCH_X64 + #endif + %endif +%endif + +%ifdef ARCH_IA32 + %ifdef ARCH_X64 + %error "Only one of ARCH_IA32 or ARCH_X64 can be defined." + %endif +%elifdef ARCH_X64 +%else + %error "Either ARCH_IA32 or ARCH_X64 must be defined." +%endif + +%include "CommonMacros.inc" + +%include "PostCodes.inc" + +%ifdef DEBUG_PORT80 + %include "Port80Debug.asm" +%elifdef DEBUG_SERIAL + %include "SerialDebug.asm" +%else + %include "DebugDisabled.asm" +%endif + +%include "Ia32/SearchForBfvBase.asm" +%include "Ia32/SearchForSecEntry.asm" + +%ifdef ARCH_X64 + #include + + %if (FixedPcdGet32 (PcdOvmfSecPageTablesSize) !=3D 0x6000) + %error "This implementation inherently depends on PcdOvmfSecPageTables= Size" + %endif + + %define PT_ADDR(Offset) (FixedPcdGet32 (PcdOvmfSecPageTablesBase) + (Off= set)) +%include "Ia32/Flat32ToFlat64.asm" +%include "Ia32/PageTables64.asm" +%endif + +%include "Ia16/Real16ToFlat32.asm" +%include "Ia16/Init16.asm" + +%include "Main.asm" + +%include "Ia16/ResetVectorVtf0.asm" + --=20 Anthony PERARD -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45527): https://edk2.groups.io/g/devel/message/45527 Mute This Topic: https://groups.io/mt/32851498/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Nov 14 05:47:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45534+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1565695888; cv=none; d=zoho.com; s=zohoarc; b=c1tiuA3BaJSQD1M8LlwzXn9dW1epCI3fteP3Puc0qzIRHV/kmfeFm6oTEfUA1yXYSV/97GttiaJ2ofT/ivpFubr3BRsEJrqpgjN/koNIe3Muekt6zfxAuQIW9rR/jWs5nft7wD/zkrusZafrL4YrRB2gUVtFahWRd7eeHGkLAnw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565695888; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=Mr9s001VEWhGOMibROOzE3eS7jjDmmZIVysSogxE1bE=; b=UkRxijaa2OCfnpSGpGR+rOdL6NqfD8Zz8PehQ4xGTGyOSdliwmEb98iaLC1wnCEPnP4Pr6lgQEDg0AxgPaYOfAAlVAlggxH1cIUUtkRHBXiZkIxCnMGHJ0qNHG/y9atIotoT53Hz472IUil3DCc3nXUNd6ePO5YAT2XxIk70jUs= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45534+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1565695888830853.5778847675456; Tue, 13 Aug 2019 04:31:28 -0700 (PDT) Return-Path: X-Received: from esa4.hc3370-68.iphmx.com (esa4.hc3370-68.iphmx.com []) by groups.io with SMTP; Tue, 13 Aug 2019 04:31:27 -0700 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45534+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: None (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.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=esa4.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 (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: Jbiwu2wA0tLoduLMtdLIjbk0WPXz8v4dXqjyP8oOy8HZPbTL2ezw1fv+uI7Dwem+TnyWopalJN xqOwZxFaF9zCZ8mKIUsc9OXfIvGvoElkRG7iqWRLAmG2u9CNj+62N47jWaW18nMqwVI00I5NQk r+lb5s7WY8YgOd4qZ1CrBn/EYShdTfivgnJsuXeYMC730z8lhGzjWUSPZ5lYat2zb7lFKrbdqV bA6pTrwNLr6iOZwJ9UDnOfRXzR1HwWHr872UNcRcJH+rGktsyrJauBwoSHVSOfm2RZ9t0ZjwQD T3I= X-SBRS: 2.7 X-MesageID: 4401260 X-Ironport-Server: esa4.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="4401260" From: "Anthony PERARD" To: CC: Laszlo Ersek , Jordan Justen , Julien Grall , , Ard Biesheuvel , Anthony PERARD Subject: [edk2-devel] [PATCH v5 04/35] OvmfPkg: Introduce XenPlatformPei Date: Tue, 13 Aug 2019 12:30:48 +0100 Message-ID: <20190813113119.14804-5-anthony.perard@citrix.com> In-Reply-To: <20190813113119.14804-1-anthony.perard@citrix.com> References: <20190813113119.14804-1-anthony.perard@citrix.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,anthony.perard@citrix.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565695888; bh=Mr9s001VEWhGOMibROOzE3eS7jjDmmZIVysSogxE1bE=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=w5p7z/34ry/lI1cHx8MHGN8Ln//GeztMfJDE3FTVSIq7yiwnU+i26HfVmHrQbSgRIhJ x/NMHs7Jdr6QqNCO4psc/w6GSWs4o+MCZtyOwosDxIfQsddWxzZ3v5uRvsZ/ef4DcfIlY dsMB3fyKttZtuJ6H7XbGmDT8Z0kSXW8rj78= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Introduce XenPlatformPei, a copy of OvmfPkg/PlatformPei without some of QEMU specific initialization, Xen does not support QemuFwCfg. This new module will be adjusted to accommodate Xen PVH. fw_cfg dependents that have been removed, which are dynamically skipped when running PlatformPei on Xen: - GetFirstNonAddress(): controlling the 64-bit PCI MMIO aperture via the (experimental) "opt/ovmf/X-PciMmio64Mb" file - GetFirstNonAddress(): honoring the hotplug DIMM area ("etc/reserved-memory-end") in the placement of the 64-bit PCI MMIO aperture - NoexecDxeInitialization() is removed, so PcdPropertiesTableEnable and PcdSetNxForStack are left constant FALSE (not set dynamically from fw_cfg "opt/ovmf/PcdXxxx") - MaxCpuCountInitialization(), PublishPeiMemory(): the max CPU count is not taken from the QemuFwCfgItemSmpCpuCount fw_cfg key; PcdCpuMaxLogicalProcessorNumber is used intact and PcdCpuApInitTimeOutInMicroSeconds is never changed or used. - InitializeXenPlatform(), S3Verification(): S3 is assumed disabled (not consulting "etc/system-states" via QemuFwCfgS3Enabled()). - InstallFeatureControlCallback(): the feature control MSR is not set from "etc/msr_feature_control" (also removed FeatureControl.c as there is nothing been executed) Also removed: - SMRAM/TSEG-related low mem size adjusting (PcdSmmSmramRequire is assumed FALSE) in PublishPeiMemory(), - QemuInitializeRam() entirely, Xen related changes: - Have removed the module variable mXen, as it should be always true. - Have the platform PEI initialization fails if Xen has not been detected. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1689 Signed-off-by: Anthony PERARD Reviewed-by: Laszlo Ersek --- Notes: v4: - replace the other EFI_D_ by DEBUG_. - Update Maintainers.txt - fix one trailing whitespace =20 v3: - fix coding style in new code (use DEBUG_xxx, add ASSERT before CpuDeadLoop) - rebased, SPDX OvmfPkg/OvmfXen.dsc | 2 +- OvmfPkg/OvmfXen.fdf | 2 +- OvmfPkg/XenPlatformPei/XenPlatformPei.inf | 96 +++++ OvmfPkg/XenPlatformPei/Cmos.h | 52 +++ OvmfPkg/XenPlatformPei/Platform.h | 108 ++++++ OvmfPkg/XenPlatformPei/Xen.h | 39 ++ OvmfPkg/XenPlatformPei/AmdSev.c | 64 ++++ OvmfPkg/XenPlatformPei/ClearCache.c | 112 ++++++ OvmfPkg/XenPlatformPei/Cmos.c | 60 +++ OvmfPkg/XenPlatformPei/Fv.c | 76 ++++ OvmfPkg/XenPlatformPei/MemDetect.c | 421 ++++++++++++++++++++ OvmfPkg/XenPlatformPei/Platform.c | 444 ++++++++++++++++++++++ OvmfPkg/XenPlatformPei/Xen.c | 219 +++++++++++ Maintainers.txt | 1 + 14 files changed, 1694 insertions(+), 2 deletions(-) create mode 100644 OvmfPkg/XenPlatformPei/XenPlatformPei.inf create mode 100644 OvmfPkg/XenPlatformPei/Cmos.h create mode 100644 OvmfPkg/XenPlatformPei/Platform.h create mode 100644 OvmfPkg/XenPlatformPei/Xen.h create mode 100644 OvmfPkg/XenPlatformPei/AmdSev.c create mode 100644 OvmfPkg/XenPlatformPei/ClearCache.c create mode 100644 OvmfPkg/XenPlatformPei/Cmos.c create mode 100644 OvmfPkg/XenPlatformPei/Fv.c create mode 100644 OvmfPkg/XenPlatformPei/MemDetect.c create mode 100644 OvmfPkg/XenPlatformPei/Platform.c create mode 100644 OvmfPkg/XenPlatformPei/Xen.c diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc index 1a0e59f0cc..7619a89382 100644 --- a/OvmfPkg/OvmfXen.dsc +++ b/OvmfPkg/OvmfXen.dsc @@ -523,7 +523,7 @@ [Components] } MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf =20 - OvmfPkg/PlatformPei/PlatformPei.inf + OvmfPkg/XenPlatformPei/XenPlatformPei.inf UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf UefiCpuPkg/CpuMpPei/CpuMpPei.inf =20 diff --git a/OvmfPkg/OvmfXen.fdf b/OvmfPkg/OvmfXen.fdf index 6fc8479aae..2ceff7baa2 100644 --- a/OvmfPkg/OvmfXen.fdf +++ b/OvmfPkg/OvmfXen.fdf @@ -152,7 +152,7 @@ [FV.PEIFV] INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf INF MdeModulePkg/Universal/ReportStatusCodeRouter/Pei/ReportStatusCodeRou= terPei.inf INF MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf -INF OvmfPkg/PlatformPei/PlatformPei.inf +INF OvmfPkg/XenPlatformPei/XenPlatformPei.inf INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf INF UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf INF UefiCpuPkg/CpuMpPei/CpuMpPei.inf diff --git a/OvmfPkg/XenPlatformPei/XenPlatformPei.inf b/OvmfPkg/XenPlatfor= mPei/XenPlatformPei.inf new file mode 100644 index 0000000000..d1265c365a --- /dev/null +++ b/OvmfPkg/XenPlatformPei/XenPlatformPei.inf @@ -0,0 +1,96 @@ +## @file +# Platform PEI driver +# +# This module provides platform specific function to detect boot mode. +# Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2019, Citrix Systems, Inc. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D XenPlatformPei + FILE_GUID =3D f112a6ee-993a-4f0b-8295-e52029d9b4ba + MODULE_TYPE =3D PEIM + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D InitializeXenPlatform + +# +# The following information is for reference only and not required by the = build tools. +# +# VALID_ARCHITECTURES =3D IA32 X64 EBC +# + +[Sources] + AmdSev.c + ClearCache.c + Cmos.c + Cmos.h + Fv.c + MemDetect.c + Platform.c + Platform.h + Xen.c + Xen.h + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + SecurityPkg/SecurityPkg.dec + UefiCpuPkg/UefiCpuPkg.dec + OvmfPkg/OvmfPkg.dec + +[Guids] + gEfiMemoryTypeInformationGuid + gEfiXenInfoGuid + +[LibraryClasses] + BaseLib + CacheMaintenanceLib + DebugLib + HobLib + IoLib + PciLib + ResourcePublicationLib + PeiServicesLib + PeimEntryPoint + MtrrLib + MemEncryptSevLib + PcdLib + +[Pcd] + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvBase + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvSize + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvBase + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvSize + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfLockBoxStorageBase + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfLockBoxStorageSize + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId + gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase + gUefiOvmfPkgTokenSpaceGuid.PcdPciIoSize + gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Base + gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Size + gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Base + gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Size + gUefiOvmfPkgTokenSpaceGuid.PcdQ35TsegMbytes + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize + gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved + gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration + gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode + gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable + gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask + gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy + gUefiCpuPkgTokenSpaceGuid.PcdCpuLocalApicBaseAddress + +[FixedPcd] + gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress + +[Ppis] + gEfiPeiMasterBootModePpiGuid + gEfiPeiMpServicesPpiGuid + +[Depex] + TRUE + diff --git a/OvmfPkg/XenPlatformPei/Cmos.h b/OvmfPkg/XenPlatformPei/Cmos.h new file mode 100644 index 0000000000..80ffcb002f --- /dev/null +++ b/OvmfPkg/XenPlatformPei/Cmos.h @@ -0,0 +1,52 @@ +/** @file + PC/AT CMOS access routines + + Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
+ Copyright (c) 2019, Citrix Systems, Inc. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __CMOS_H__ +#define __CMOS_H__ + +/** + Reads 8-bits of CMOS data. + + Reads the 8-bits of CMOS data at the location specified by Index. + The 8-bit read value is returned. + + @param Index The CMOS location to read. + + @return The value read. + +**/ +UINT8 +EFIAPI +CmosRead8 ( + IN UINTN Index + ); + +/** + Writes 8-bits of CMOS data. + + Writes 8-bits of CMOS data to the location specified by Index + with the value specified by Value and returns Value. + + @param Index The CMOS location to write. + @param Value The value to write to CMOS. + + @return The value written to CMOS. + +**/ +UINT8 +EFIAPI +CmosWrite8 ( + IN UINTN Index, + IN UINT8 Value + ); + + +#endif + diff --git a/OvmfPkg/XenPlatformPei/Platform.h b/OvmfPkg/XenPlatformPei/Pla= tform.h new file mode 100644 index 0000000000..77427496c0 --- /dev/null +++ b/OvmfPkg/XenPlatformPei/Platform.h @@ -0,0 +1,108 @@ +/** @file + Platform PEI module include file. + + Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2019, Citrix Systems, Inc. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _PLATFORM_PEI_H_INCLUDED_ +#define _PLATFORM_PEI_H_INCLUDED_ + +#include + +VOID +AddIoMemoryBaseSizeHob ( + EFI_PHYSICAL_ADDRESS MemoryBase, + UINT64 MemorySize + ); + +VOID +AddIoMemoryRangeHob ( + EFI_PHYSICAL_ADDRESS MemoryBase, + EFI_PHYSICAL_ADDRESS MemoryLimit + ); + +VOID +AddMemoryBaseSizeHob ( + EFI_PHYSICAL_ADDRESS MemoryBase, + UINT64 MemorySize + ); + +VOID +AddMemoryRangeHob ( + EFI_PHYSICAL_ADDRESS MemoryBase, + EFI_PHYSICAL_ADDRESS MemoryLimit + ); + +VOID +AddReservedMemoryBaseSizeHob ( + EFI_PHYSICAL_ADDRESS MemoryBase, + UINT64 MemorySize, + BOOLEAN Cacheable + ); + +VOID +AddressWidthInitialization ( + VOID + ); + +VOID +Q35TsegMbytesInitialization ( + VOID + ); + +EFI_STATUS +PublishPeiMemory ( + VOID + ); + +UINT32 +GetSystemMemorySizeBelow4gb ( + VOID + ); + +VOID +InitializeRamRegions ( + VOID + ); + +EFI_STATUS +PeiFvInitialization ( + VOID + ); + +VOID +InstallClearCacheCallback ( + VOID + ); + +EFI_STATUS +InitializeXen ( + VOID + ); + +BOOLEAN +XenDetect ( + VOID + ); + +VOID +AmdSevInitialize ( + VOID + ); + +VOID +XenPublishRamRegions ( + VOID + ); + +extern EFI_BOOT_MODE mBootMode; + +extern UINT8 mPhysMemAddressWidth; + +extern UINT16 mHostBridgeDevId; + +#endif // _PLATFORM_PEI_H_INCLUDED_ diff --git a/OvmfPkg/XenPlatformPei/Xen.h b/OvmfPkg/XenPlatformPei/Xen.h new file mode 100644 index 0000000000..2605481280 --- /dev/null +++ b/OvmfPkg/XenPlatformPei/Xen.h @@ -0,0 +1,39 @@ +/** @file + Ovmf info structure passed by Xen + +Copyright (c) 2013, Citrix Systems UK Ltd.
+ +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __XEN_H__ +#define __XEN_H__ + +#include + +// Physical address of OVMF info +#define OVMF_INFO_PHYSICAL_ADDRESS 0x00001000 + +// This structure must match the definition on Xen side +#pragma pack(1) +typedef struct { + CHAR8 Signature[14]; // XenHVMOVMF\0 + UINT8 Length; // Length of this structure + UINT8 Checksum; // Set such that the sum over bytes 0..length =3D= =3D 0 + // + // Physical address of an array of TablesCount elements. + // + // Each element contains the physical address of a BIOS table. + // + EFI_PHYSICAL_ADDRESS Tables; + UINT32 TablesCount; + // + // Physical address of the E820 table, contains E820EntriesCount entries. + // + EFI_PHYSICAL_ADDRESS E820; + UINT32 E820EntriesCount; +} EFI_XEN_OVMF_INFO; +#pragma pack() + +#endif /* __XEN_H__ */ diff --git a/OvmfPkg/XenPlatformPei/AmdSev.c b/OvmfPkg/XenPlatformPei/AmdSe= v.c new file mode 100644 index 0000000000..7ebbb5cc1f --- /dev/null +++ b/OvmfPkg/XenPlatformPei/AmdSev.c @@ -0,0 +1,64 @@ +/**@file + Initialize Secure Encrypted Virtualization (SEV) support + + Copyright (c) 2017, Advanced Micro Devices. All rights reserved.
+ Copyright (c) 2019, Citrix Systems, Inc. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ +// +// The package level header files this module uses +// +#include +#include +#include +#include +#include +#include + +#include "Platform.h" + +/** + + Function checks if SEV support is available, if present then it sets + the dynamic PcdPteMemoryEncryptionAddressOrMask with memory encryption m= ask. + + **/ +VOID +AmdSevInitialize ( + VOID + ) +{ + CPUID_MEMORY_ENCRYPTION_INFO_EBX Ebx; + UINT64 EncryptionMask; + RETURN_STATUS PcdStatus; + + // + // Check if SEV is enabled + // + if (!MemEncryptSevIsEnabled ()) { + return; + } + + // + // CPUID Fn8000_001F[EBX] Bit 0:5 (memory encryption bit position) + // + AsmCpuid (CPUID_MEMORY_ENCRYPTION_INFO, NULL, &Ebx.Uint32, NULL, NULL); + EncryptionMask =3D LShiftU64 (1, Ebx.Bits.PtePosBits); + + // + // Set Memory Encryption Mask PCD + // + PcdStatus =3D PcdSet64S (PcdPteMemoryEncryptionAddressOrMask, Encryption= Mask); + ASSERT_RETURN_ERROR (PcdStatus); + + DEBUG ((DEBUG_INFO, "SEV is enabled (mask 0x%lx)\n", EncryptionMask)); + + // + // Set Pcd to Deny the execution of option ROM when security + // violation. + // + PcdStatus =3D PcdSet32S (PcdOptionRomImageVerificationPolicy, 0x4); + ASSERT_RETURN_ERROR (PcdStatus); +} diff --git a/OvmfPkg/XenPlatformPei/ClearCache.c b/OvmfPkg/XenPlatformPei/C= learCache.c new file mode 100644 index 0000000000..fab53633a9 --- /dev/null +++ b/OvmfPkg/XenPlatformPei/ClearCache.c @@ -0,0 +1,112 @@ +/**@file + Install a callback to clear cache on all processors. + This is for conformance with the TCG "Platform Reset Attack Mitigation + Specification". Because clearing the CPU caches at boot doesn't impact + performance significantly, do it unconditionally, for simplicity's + sake. + + Copyright (C) 2018, Red Hat, Inc. + Copyright (c) 2019, Citrix Systems, Inc. + + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include +#include +#include +#include + +#include "Platform.h" + +/** + Invalidate data & instruction caches. + All APs execute this function in parallel. The BSP executes the function + separately. + + @param[in,out] WorkSpace Pointer to the input/output argument workspace + shared by all processors. +**/ +STATIC +VOID +EFIAPI +ClearCache ( + IN OUT VOID *WorkSpace + ) +{ + WriteBackInvalidateDataCache (); + InvalidateInstructionCache (); +} + +/** + Notification function called when EFI_PEI_MP_SERVICES_PPI becomes availa= ble. + + @param[in] PeiServices Indirect reference to the PEI Services Table. + @param[in] NotifyDescriptor Address of the notification descriptor data + structure. + @param[in] Ppi Address of the PPI that was installed. + + @return Status of the notification. The status code returned from this + function is ignored. +**/ +STATIC +EFI_STATUS +EFIAPI +ClearCacheOnMpServicesAvailable ( + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, + IN VOID *Ppi + ) +{ + EFI_PEI_MP_SERVICES_PPI *MpServices; + EFI_STATUS Status; + + DEBUG ((DEBUG_INFO, "%a: %a\n", gEfiCallerBaseName, __FUNCTION__)); + + // + // Clear cache on all the APs in parallel. + // + MpServices =3D Ppi; + Status =3D MpServices->StartupAllAPs ( + (CONST EFI_PEI_SERVICES **)PeiServices, + MpServices, + ClearCache, // Procedure + FALSE, // SingleThread + 0, // TimeoutInMicroSeconds: in= f. + NULL // ProcedureArgument + ); + if (EFI_ERROR (Status) && Status !=3D EFI_NOT_STARTED) { + DEBUG ((DEBUG_ERROR, "%a: StartupAllAps(): %r\n", __FUNCTION__, Status= )); + return Status; + } + + // + // Now clear cache on the BSP too. + // + ClearCache (NULL); + return EFI_SUCCESS; +} + +// +// Notification object for registering the callback, for when +// EFI_PEI_MP_SERVICES_PPI becomes available. +// +STATIC CONST EFI_PEI_NOTIFY_DESCRIPTOR mMpServicesNotify =3D { + EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | // Flags + EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST, + &gEfiPeiMpServicesPpiGuid, // Guid + ClearCacheOnMpServicesAvailable // Notify +}; + +VOID +InstallClearCacheCallback ( + VOID + ) +{ + EFI_STATUS Status; + + Status =3D PeiServicesNotifyPpi (&mMpServicesNotify); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: failed to set up MP Services callback: %r\n", + __FUNCTION__, Status)); + } +} diff --git a/OvmfPkg/XenPlatformPei/Cmos.c b/OvmfPkg/XenPlatformPei/Cmos.c new file mode 100644 index 0000000000..5d9ee67cd8 --- /dev/null +++ b/OvmfPkg/XenPlatformPei/Cmos.c @@ -0,0 +1,60 @@ +/** @file + PC/AT CMOS access routines + + Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
+ Copyright (c) 2019, Citrix Systems, Inc. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + + +#include "Cmos.h" +#include "Library/IoLib.h" + +/** + Reads 8-bits of CMOS data. + + Reads the 8-bits of CMOS data at the location specified by Index. + The 8-bit read value is returned. + + @param Index The CMOS location to read. + + @return The value read. + +**/ +UINT8 +EFIAPI +CmosRead8 ( + IN UINTN Index + ) +{ + IoWrite8 (0x70, (UINT8) Index); + return IoRead8 (0x71); +} + + +/** + Writes 8-bits of CMOS data. + + Writes 8-bits of CMOS data to the location specified by Index + with the value specified by Value and returns Value. + + @param Index The CMOS location to write. + @param Value The value to write to CMOS. + + @return The value written to CMOS. + +**/ +UINT8 +EFIAPI +CmosWrite8 ( + IN UINTN Index, + IN UINT8 Value + ) +{ + IoWrite8 (0x70, (UINT8) Index); + IoWrite8 (0x71, Value); + return Value; +} + diff --git a/OvmfPkg/XenPlatformPei/Fv.c b/OvmfPkg/XenPlatformPei/Fv.c new file mode 100644 index 0000000000..70e9b52700 --- /dev/null +++ b/OvmfPkg/XenPlatformPei/Fv.c @@ -0,0 +1,76 @@ +/** @file + Build FV related hobs for platform. + + Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.
+ Copyright (c) 2019, Citrix Systems, Inc. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "PiPei.h" +#include "Platform.h" +#include +#include +#include +#include + + +/** + Publish PEI & DXE (Decompressed) Memory based FVs to let PEI + and DXE know about them. + + @retval EFI_SUCCESS Platform PEI FVs were initialized successfully. + +**/ +EFI_STATUS +PeiFvInitialization ( + VOID + ) +{ + DEBUG ((DEBUG_INFO, "Platform PEI Firmware Volume Initialization\n")); + + // + // Create a memory allocation HOB for the PEI FV. + // + // Allocate as ACPI NVS is S3 is supported + // + BuildMemoryAllocationHob ( + PcdGet32 (PcdOvmfPeiMemFvBase), + PcdGet32 (PcdOvmfPeiMemFvSize), + EfiBootServicesData + ); + + // + // Let DXE know about the DXE FV + // + BuildFvHob (PcdGet32 (PcdOvmfDxeMemFvBase), PcdGet32 (PcdOvmfDxeMemFvSiz= e)); + + // + // Create a memory allocation HOB for the DXE FV. + // + // If "secure" S3 is needed, then SEC will decompress both PEI and DXE + // firmware volumes at S3 resume too, hence we need to keep away the OS = from + // DXEFV as well. Otherwise we only need to keep away DXE itself from the + // DXEFV area. + // + BuildMemoryAllocationHob ( + PcdGet32 (PcdOvmfDxeMemFvBase), + PcdGet32 (PcdOvmfDxeMemFvSize), + EfiBootServicesData + ); + + // + // Let PEI know about the DXE FV so it can find the DXE Core + // + PeiServicesInstallFvInfoPpi ( + NULL, + (VOID *)(UINTN) PcdGet32 (PcdOvmfDxeMemFvBase), + PcdGet32 (PcdOvmfDxeMemFvSize), + NULL, + NULL + ); + + return EFI_SUCCESS; +} + diff --git a/OvmfPkg/XenPlatformPei/MemDetect.c b/OvmfPkg/XenPlatformPei/Me= mDetect.c new file mode 100644 index 0000000000..cf95f9c474 --- /dev/null +++ b/OvmfPkg/XenPlatformPei/MemDetect.c @@ -0,0 +1,421 @@ +/**@file + Memory Detection for Virtual Machines. + + Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2019, Citrix Systems, Inc. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +Module Name: + + MemDetect.c + +**/ + +// +// The package level header files this module uses +// +#include +#include + +// +// The Library classes this module consumes +// +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "Platform.h" +#include "Cmos.h" + +UINT8 mPhysMemAddressWidth; + +STATIC UINT32 mS3AcpiReservedMemoryBase; +STATIC UINT32 mS3AcpiReservedMemorySize; + +STATIC UINT16 mQ35TsegMbytes; + +VOID +Q35TsegMbytesInitialization ( + VOID + ) +{ + UINT16 ExtendedTsegMbytes; + RETURN_STATUS PcdStatus; + + if (mHostBridgeDevId !=3D INTEL_Q35_MCH_DEVICE_ID) { + DEBUG (( + DEBUG_ERROR, + "%a: no TSEG (SMRAM) on host bridge DID=3D0x%04x; " + "only DID=3D0x%04x (Q35) is supported\n", + __FUNCTION__, + mHostBridgeDevId, + INTEL_Q35_MCH_DEVICE_ID + )); + ASSERT (FALSE); + CpuDeadLoop (); + } + + // + // Check if QEMU offers an extended TSEG. + // + // This can be seen from writing MCH_EXT_TSEG_MB_QUERY to the MCH_EXT_TS= EG_MB + // register, and reading back the register. + // + // On a QEMU machine type that does not offer an extended TSEG, the init= ial + // write overwrites whatever value a malicious guest OS may have placed = in + // the (unimplemented) register, before entering S3 or rebooting. + // Subsequently, the read returns MCH_EXT_TSEG_MB_QUERY unchanged. + // + // On a QEMU machine type that offers an extended TSEG, the initial write + // triggers an update to the register. Subsequently, the value read back + // (which is guaranteed to differ from MCH_EXT_TSEG_MB_QUERY) tells us t= he + // number of megabytes. + // + PciWrite16 (DRAMC_REGISTER_Q35 (MCH_EXT_TSEG_MB), MCH_EXT_TSEG_MB_QUERY); + ExtendedTsegMbytes =3D PciRead16 (DRAMC_REGISTER_Q35 (MCH_EXT_TSEG_MB)); + if (ExtendedTsegMbytes =3D=3D MCH_EXT_TSEG_MB_QUERY) { + mQ35TsegMbytes =3D PcdGet16 (PcdQ35TsegMbytes); + return; + } + + DEBUG (( + DEBUG_INFO, + "%a: QEMU offers an extended TSEG (%d MB)\n", + __FUNCTION__, + ExtendedTsegMbytes + )); + PcdStatus =3D PcdSet16S (PcdQ35TsegMbytes, ExtendedTsegMbytes); + ASSERT_RETURN_ERROR (PcdStatus); + mQ35TsegMbytes =3D ExtendedTsegMbytes; +} + + +UINT32 +GetSystemMemorySizeBelow4gb ( + VOID + ) +{ + UINT8 Cmos0x34; + UINT8 Cmos0x35; + + // + // CMOS 0x34/0x35 specifies the system memory above 16 MB. + // * CMOS(0x35) is the high byte + // * CMOS(0x34) is the low byte + // * The size is specified in 64kb chunks + // * Since this is memory above 16MB, the 16MB must be added + // into the calculation to get the total memory size. + // + + Cmos0x34 =3D (UINT8) CmosRead8 (0x34); + Cmos0x35 =3D (UINT8) CmosRead8 (0x35); + + return (UINT32) (((UINTN)((Cmos0x35 << 8) + Cmos0x34) << 16) + SIZE_16MB= ); +} + + +STATIC +UINT64 +GetSystemMemorySizeAbove4gb ( + ) +{ + UINT32 Size; + UINTN CmosIndex; + + // + // CMOS 0x5b-0x5d specifies the system memory above 4GB MB. + // * CMOS(0x5d) is the most significant size byte + // * CMOS(0x5c) is the middle size byte + // * CMOS(0x5b) is the least significant size byte + // * The size is specified in 64kb chunks + // + + Size =3D 0; + for (CmosIndex =3D 0x5d; CmosIndex >=3D 0x5b; CmosIndex--) { + Size =3D (UINT32) (Size << 8) + (UINT32) CmosRead8 (CmosIndex); + } + + return LShiftU64 (Size, 16); +} + + +/** + Return the highest address that DXE could possibly use, plus one. +**/ +STATIC +UINT64 +GetFirstNonAddress ( + VOID + ) +{ + UINT64 FirstNonAddress; + UINT64 Pci64Base, Pci64Size; + RETURN_STATUS PcdStatus; + + FirstNonAddress =3D BASE_4GB + GetSystemMemorySizeAbove4gb (); + + // + // If DXE is 32-bit, then we're done; PciBusDxe will degrade 64-bit MMIO + // resources to 32-bit anyway. See DegradeResource() in + // "PciResourceSupport.c". + // +#ifdef MDE_CPU_IA32 + if (!FeaturePcdGet (PcdDxeIplSwitchToLongMode)) { + return FirstNonAddress; + } +#endif + + // + // Otherwise, in order to calculate the highest address plus one, we must + // consider the 64-bit PCI host aperture too. Fetch the default size. + // + Pci64Size =3D PcdGet64 (PcdPciMmio64Size); + + if (Pci64Size =3D=3D 0) { + if (mBootMode !=3D BOOT_ON_S3_RESUME) { + DEBUG ((DEBUG_INFO, "%a: disabling 64-bit PCI host aperture\n", + __FUNCTION__)); + PcdStatus =3D PcdSet64S (PcdPciMmio64Size, 0); + ASSERT_RETURN_ERROR (PcdStatus); + } + + // + // There's nothing more to do; the amount of memory above 4GB fully + // determines the highest address plus one. The memory hotplug area (s= ee + // below) plays no role for the firmware in this case. + // + return FirstNonAddress; + } + + // + // SeaBIOS aligns both boundaries of the 64-bit PCI host aperture to 1GB= , so + // that the host can map it with 1GB hugepages. Follow suit. + // + Pci64Base =3D ALIGN_VALUE (FirstNonAddress, (UINT64)SIZE_1GB); + Pci64Size =3D ALIGN_VALUE (Pci64Size, (UINT64)SIZE_1GB); + + // + // The 64-bit PCI host aperture should also be "naturally" aligned. The + // alignment is determined by rounding the size of the aperture down to = the + // next smaller or equal power of two. That is, align the aperture by the + // largest BAR size that can fit into it. + // + Pci64Base =3D ALIGN_VALUE (Pci64Base, GetPowerOfTwo64 (Pci64Size)); + + if (mBootMode !=3D BOOT_ON_S3_RESUME) { + // + // The core PciHostBridgeDxe driver will automatically add this range = to + // the GCD memory space map through our PciHostBridgeLib instance; her= e we + // only need to set the PCDs. + // + PcdStatus =3D PcdSet64S (PcdPciMmio64Base, Pci64Base); + ASSERT_RETURN_ERROR (PcdStatus); + PcdStatus =3D PcdSet64S (PcdPciMmio64Size, Pci64Size); + ASSERT_RETURN_ERROR (PcdStatus); + + DEBUG ((DEBUG_INFO, "%a: Pci64Base=3D0x%Lx Pci64Size=3D0x%Lx\n", + __FUNCTION__, Pci64Base, Pci64Size)); + } + + // + // The useful address space ends with the 64-bit PCI host aperture. + // + FirstNonAddress =3D Pci64Base + Pci64Size; + return FirstNonAddress; +} + + +/** + Initialize the mPhysMemAddressWidth variable, based on guest RAM size. +**/ +VOID +AddressWidthInitialization ( + VOID + ) +{ + UINT64 FirstNonAddress; + + // + // As guest-physical memory size grows, the permanent PEI RAM requiremen= ts + // are dominated by the identity-mapping page tables built by the DXE IP= L. + // The DXL IPL keys off of the physical address bits advertized in the C= PU + // HOB. To conserve memory, we calculate the minimum address width here. + // + FirstNonAddress =3D GetFirstNonAddress (); + mPhysMemAddressWidth =3D (UINT8)HighBitSet64 (FirstNonAddress); + + // + // If FirstNonAddress is not an integral power of two, then we need an + // additional bit. + // + if ((FirstNonAddress & (FirstNonAddress - 1)) !=3D 0) { + ++mPhysMemAddressWidth; + } + + // + // The minimum address width is 36 (covers up to and excluding 64 GB, wh= ich + // is the maximum for Ia32 + PAE). The theoretical architecture maximum = for + // X64 long mode is 52 bits, but the DXE IPL clamps that down to 48 bits= . We + // can simply assert that here, since 48 bits are good enough for 256 TB. + // + if (mPhysMemAddressWidth <=3D 36) { + mPhysMemAddressWidth =3D 36; + } + ASSERT (mPhysMemAddressWidth <=3D 48); +} + + +/** + Calculate the cap for the permanent PEI memory. +**/ +STATIC +UINT32 +GetPeiMemoryCap ( + VOID + ) +{ + BOOLEAN Page1GSupport; + UINT32 RegEax; + UINT32 RegEdx; + UINT32 Pml4Entries; + UINT32 PdpEntries; + UINTN TotalPages; + + // + // If DXE is 32-bit, then just return the traditional 64 MB cap. + // +#ifdef MDE_CPU_IA32 + if (!FeaturePcdGet (PcdDxeIplSwitchToLongMode)) { + return SIZE_64MB; + } +#endif + + // + // Dependent on physical address width, PEI memory allocations can be + // dominated by the page tables built for 64-bit DXE. So we key the cap = off + // of those. The code below is based on CreateIdentityMappingPageTables(= ) in + // "MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c". + // + Page1GSupport =3D FALSE; + if (PcdGetBool (PcdUse1GPageTable)) { + AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL); + if (RegEax >=3D 0x80000001) { + AsmCpuid (0x80000001, NULL, NULL, NULL, &RegEdx); + if ((RegEdx & BIT26) !=3D 0) { + Page1GSupport =3D TRUE; + } + } + } + + if (mPhysMemAddressWidth <=3D 39) { + Pml4Entries =3D 1; + PdpEntries =3D 1 << (mPhysMemAddressWidth - 30); + ASSERT (PdpEntries <=3D 0x200); + } else { + Pml4Entries =3D 1 << (mPhysMemAddressWidth - 39); + ASSERT (Pml4Entries <=3D 0x200); + PdpEntries =3D 512; + } + + TotalPages =3D Page1GSupport ? Pml4Entries + 1 : + (PdpEntries + 1) * Pml4Entries + 1; + ASSERT (TotalPages <=3D 0x40201); + + // + // Add 64 MB for miscellaneous allocations. Note that for + // mPhysMemAddressWidth values close to 36, the cap will actually be + // dominated by this increment. + // + return (UINT32)(EFI_PAGES_TO_SIZE (TotalPages) + SIZE_64MB); +} + + +/** + Publish PEI core memory + + @return EFI_SUCCESS The PEIM initialized successfully. + +**/ +EFI_STATUS +PublishPeiMemory ( + VOID + ) +{ + EFI_STATUS Status; + EFI_PHYSICAL_ADDRESS MemoryBase; + UINT64 MemorySize; + UINT32 LowerMemorySize; + UINT32 PeiMemoryCap; + + LowerMemorySize =3D GetSystemMemorySizeBelow4gb (); + + if (mBootMode =3D=3D BOOT_ON_S3_RESUME) { + MemoryBase =3D mS3AcpiReservedMemoryBase; + MemorySize =3D mS3AcpiReservedMemorySize; + } else { + PeiMemoryCap =3D GetPeiMemoryCap (); + DEBUG ((DEBUG_INFO, "%a: mPhysMemAddressWidth=3D%d PeiMemoryCap=3D%u K= B\n", + __FUNCTION__, mPhysMemAddressWidth, PeiMemoryCap >> 10)); + + // + // Determine the range of memory to use during PEI + // + MemoryBase =3D + PcdGet32 (PcdOvmfDxeMemFvBase) + PcdGet32 (PcdOvmfDxeMemFvSize); + MemorySize =3D LowerMemorySize - MemoryBase; + if (MemorySize > PeiMemoryCap) { + MemoryBase =3D LowerMemorySize - PeiMemoryCap; + MemorySize =3D PeiMemoryCap; + } + } + + // + // Publish this memory to the PEI Core + // + Status =3D PublishSystemMemory(MemoryBase, MemorySize); + ASSERT_EFI_ERROR (Status); + + return Status; +} + + +/** + Publish system RAM and reserve memory regions + +**/ +VOID +InitializeRamRegions ( + VOID + ) +{ + XenPublishRamRegions (); + + if (mBootMode !=3D BOOT_ON_S3_RESUME) { + // + // Reserve the lock box storage area + // + // Since this memory range will be used on S3 resume, it must be + // reserved as ACPI NVS. + // + // If S3 is unsupported, then various drivers might still write to the + // LockBox area. We ought to prevent DXE from serving allocation reque= sts + // such that they would overlap the LockBox storage. + // + ZeroMem ( + (VOID*)(UINTN) PcdGet32 (PcdOvmfLockBoxStorageBase), + (UINTN) PcdGet32 (PcdOvmfLockBoxStorageSize) + ); + BuildMemoryAllocationHob ( + (EFI_PHYSICAL_ADDRESS)(UINTN) PcdGet32 (PcdOvmfLockBoxStorageBase), + (UINT64)(UINTN) PcdGet32 (PcdOvmfLockBoxStorageSize), + EfiBootServicesData + ); + } +} diff --git a/OvmfPkg/XenPlatformPei/Platform.c b/OvmfPkg/XenPlatformPei/Pla= tform.c new file mode 100644 index 0000000000..5809eadb0b --- /dev/null +++ b/OvmfPkg/XenPlatformPei/Platform.c @@ -0,0 +1,444 @@ +/**@file + Platform PEI driver + + Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2011, Andrei Warkentin + Copyright (c) 2019, Citrix Systems, Inc. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +// +// The package level header files this module uses +// +#include + +// +// The Library classes this module consumes +// +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "Platform.h" +#include "Cmos.h" + +EFI_MEMORY_TYPE_INFORMATION mDefaultMemoryTypeInformation[] =3D { + { EfiACPIMemoryNVS, 0x004 }, + { EfiACPIReclaimMemory, 0x008 }, + { EfiReservedMemoryType, 0x004 }, + { EfiRuntimeServicesData, 0x024 }, + { EfiRuntimeServicesCode, 0x030 }, + { EfiBootServicesCode, 0x180 }, + { EfiBootServicesData, 0xF00 }, + { EfiMaxMemoryType, 0x000 } +}; + + +EFI_PEI_PPI_DESCRIPTOR mPpiBootMode[] =3D { + { + EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST, + &gEfiPeiMasterBootModePpiGuid, + NULL + } +}; + + +UINT16 mHostBridgeDevId; + +EFI_BOOT_MODE mBootMode =3D BOOT_WITH_FULL_CONFIGURATION; + + +VOID +AddIoMemoryBaseSizeHob ( + EFI_PHYSICAL_ADDRESS MemoryBase, + UINT64 MemorySize + ) +{ + BuildResourceDescriptorHob ( + EFI_RESOURCE_MEMORY_MAPPED_IO, + EFI_RESOURCE_ATTRIBUTE_PRESENT | + EFI_RESOURCE_ATTRIBUTE_INITIALIZED | + EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE | + EFI_RESOURCE_ATTRIBUTE_TESTED, + MemoryBase, + MemorySize + ); +} + +VOID +AddReservedMemoryBaseSizeHob ( + EFI_PHYSICAL_ADDRESS MemoryBase, + UINT64 MemorySize, + BOOLEAN Cacheable + ) +{ + BuildResourceDescriptorHob ( + EFI_RESOURCE_MEMORY_RESERVED, + EFI_RESOURCE_ATTRIBUTE_PRESENT | + EFI_RESOURCE_ATTRIBUTE_INITIALIZED | + EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE | + (Cacheable ? + EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE | + EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE | + EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE : + 0 + ) | + EFI_RESOURCE_ATTRIBUTE_TESTED, + MemoryBase, + MemorySize + ); +} + +VOID +AddIoMemoryRangeHob ( + EFI_PHYSICAL_ADDRESS MemoryBase, + EFI_PHYSICAL_ADDRESS MemoryLimit + ) +{ + AddIoMemoryBaseSizeHob (MemoryBase, (UINT64)(MemoryLimit - MemoryBase)); +} + + +VOID +AddMemoryBaseSizeHob ( + EFI_PHYSICAL_ADDRESS MemoryBase, + UINT64 MemorySize + ) +{ + BuildResourceDescriptorHob ( + EFI_RESOURCE_SYSTEM_MEMORY, + EFI_RESOURCE_ATTRIBUTE_PRESENT | + EFI_RESOURCE_ATTRIBUTE_INITIALIZED | + EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE | + EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE | + EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE | + EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE | + EFI_RESOURCE_ATTRIBUTE_TESTED, + MemoryBase, + MemorySize + ); +} + + +VOID +AddMemoryRangeHob ( + EFI_PHYSICAL_ADDRESS MemoryBase, + EFI_PHYSICAL_ADDRESS MemoryLimit + ) +{ + AddMemoryBaseSizeHob (MemoryBase, (UINT64)(MemoryLimit - MemoryBase)); +} + + +VOID +MemMapInitialization ( + VOID + ) +{ + UINT64 PciIoBase; + UINT64 PciIoSize; + RETURN_STATUS PcdStatus; + + PciIoBase =3D 0xC000; + PciIoSize =3D 0x4000; + + // + // Create Memory Type Information HOB + // + BuildGuidDataHob ( + &gEfiMemoryTypeInformationGuid, + mDefaultMemoryTypeInformation, + sizeof(mDefaultMemoryTypeInformation) + ); + + // + // Video memory + Legacy BIOS region + // + AddIoMemoryRangeHob (0x0A0000, BASE_1MB); + + // + // Add PCI IO Port space available for PCI resource allocations. + // + BuildResourceDescriptorHob ( + EFI_RESOURCE_IO, + EFI_RESOURCE_ATTRIBUTE_PRESENT | + EFI_RESOURCE_ATTRIBUTE_INITIALIZED, + PciIoBase, + PciIoSize + ); + PcdStatus =3D PcdSet64S (PcdPciIoBase, PciIoBase); + ASSERT_RETURN_ERROR (PcdStatus); + PcdStatus =3D PcdSet64S (PcdPciIoSize, PciIoSize); + ASSERT_RETURN_ERROR (PcdStatus); +} + +VOID +PciExBarInitialization ( + VOID + ) +{ + union { + UINT64 Uint64; + UINT32 Uint32[2]; + } PciExBarBase; + + // + // We only support the 256MB size for the MMCONFIG area: + // 256 buses * 32 devices * 8 functions * 4096 bytes config space. + // + // The masks used below enforce the Q35 requirements that the MMCONFIG a= rea + // be (a) correctly aligned -- here at 256 MB --, (b) located under 64 G= B. + // + // Note that (b) also ensures that the minimum address width we have + // determined in AddressWidthInitialization(), i.e., 36 bits, will suffi= ce + // for DXE's page tables to cover the MMCONFIG area. + // + PciExBarBase.Uint64 =3D FixedPcdGet64 (PcdPciExpressBaseAddress); + ASSERT ((PciExBarBase.Uint32[1] & MCH_PCIEXBAR_HIGHMASK) =3D=3D 0); + ASSERT ((PciExBarBase.Uint32[0] & MCH_PCIEXBAR_LOWMASK) =3D=3D 0); + + // + // Clear the PCIEXBAREN bit first, before programming the high register. + // + PciWrite32 (DRAMC_REGISTER_Q35 (MCH_PCIEXBAR_LOW), 0); + + // + // Program the high register. Then program the low register, setting the + // MMCONFIG area size and enabling decoding at once. + // + PciWrite32 (DRAMC_REGISTER_Q35 (MCH_PCIEXBAR_HIGH), PciExBarBase.Uint32[= 1]); + PciWrite32 ( + DRAMC_REGISTER_Q35 (MCH_PCIEXBAR_LOW), + PciExBarBase.Uint32[0] | MCH_PCIEXBAR_BUS_FF | MCH_PCIEXBAR_EN + ); +} + +VOID +MiscInitialization ( + VOID + ) +{ + UINTN PmCmd; + UINTN Pmba; + UINT32 PmbaAndVal; + UINT32 PmbaOrVal; + UINTN AcpiCtlReg; + UINT8 AcpiEnBit; + RETURN_STATUS PcdStatus; + + // + // Disable A20 Mask + // + IoOr8 (0x92, BIT1); + + // + // Build the CPU HOB with guest RAM size dependent address width and 16-= bits + // of IO space. (Side note: unlike other HOBs, the CPU HOB is needed dur= ing + // S3 resume as well, so we build it unconditionally.) + // + BuildCpuHob (mPhysMemAddressWidth, 16); + + // + // Determine platform type and save Host Bridge DID to PCD + // + switch (mHostBridgeDevId) { + case INTEL_82441_DEVICE_ID: + PmCmd =3D POWER_MGMT_REGISTER_PIIX4 (PCI_COMMAND_OFFSET); + Pmba =3D POWER_MGMT_REGISTER_PIIX4 (PIIX4_PMBA); + PmbaAndVal =3D ~(UINT32)PIIX4_PMBA_MASK; + PmbaOrVal =3D PIIX4_PMBA_VALUE; + AcpiCtlReg =3D POWER_MGMT_REGISTER_PIIX4 (PIIX4_PMREGMISC); + AcpiEnBit =3D PIIX4_PMREGMISC_PMIOSE; + break; + case INTEL_Q35_MCH_DEVICE_ID: + PmCmd =3D POWER_MGMT_REGISTER_Q35 (PCI_COMMAND_OFFSET); + Pmba =3D POWER_MGMT_REGISTER_Q35 (ICH9_PMBASE); + PmbaAndVal =3D ~(UINT32)ICH9_PMBASE_MASK; + PmbaOrVal =3D ICH9_PMBASE_VALUE; + AcpiCtlReg =3D POWER_MGMT_REGISTER_Q35 (ICH9_ACPI_CNTL); + AcpiEnBit =3D ICH9_ACPI_CNTL_ACPI_EN; + break; + default: + DEBUG ((DEBUG_ERROR, "%a: Unknown Host Bridge Device ID: 0x%04x\n", + __FUNCTION__, mHostBridgeDevId)); + ASSERT (FALSE); + return; + } + PcdStatus =3D PcdSet16S (PcdOvmfHostBridgePciDevId, mHostBridgeDevId); + ASSERT_RETURN_ERROR (PcdStatus); + + // + // If the appropriate IOspace enable bit is set, assume the ACPI PMBA + // has been configured (e.g., by Xen) and skip the setup here. + // This matches the logic in AcpiTimerLibConstructor (). + // + if ((PciRead8 (AcpiCtlReg) & AcpiEnBit) =3D=3D 0) { + // + // The PEI phase should be exited with fully accessibe ACPI PM IO spac= e: + // 1. set PMBA + // + PciAndThenOr32 (Pmba, PmbaAndVal, PmbaOrVal); + + // + // 2. set PCICMD/IOSE + // + PciOr8 (PmCmd, EFI_PCI_COMMAND_IO_SPACE); + + // + // 3. set ACPI PM IO enable bit (PMREGMISC:PMIOSE or ACPI_CNTL:ACPI_EN) + // + PciOr8 (AcpiCtlReg, AcpiEnBit); + } + + if (mHostBridgeDevId =3D=3D INTEL_Q35_MCH_DEVICE_ID) { + // + // Set Root Complex Register Block BAR + // + PciWrite32 ( + POWER_MGMT_REGISTER_Q35 (ICH9_RCBA), + ICH9_ROOT_COMPLEX_BASE | ICH9_RCBA_EN + ); + + // + // Set PCI Express Register Range Base Address + // + PciExBarInitialization (); + } +} + + +VOID +BootModeInitialization ( + VOID + ) +{ + EFI_STATUS Status; + + if (CmosRead8 (0xF) =3D=3D 0xFE) { + mBootMode =3D BOOT_ON_S3_RESUME; + } + CmosWrite8 (0xF, 0x00); + + Status =3D PeiServicesSetBootMode (mBootMode); + ASSERT_EFI_ERROR (Status); + + Status =3D PeiServicesInstallPpi (mPpiBootMode); + ASSERT_EFI_ERROR (Status); +} + + +VOID +ReserveEmuVariableNvStore ( + ) +{ + EFI_PHYSICAL_ADDRESS VariableStore; + RETURN_STATUS PcdStatus; + + // + // Allocate storage for NV variables early on so it will be + // at a consistent address. Since VM memory is preserved + // across reboots, this allows the NV variable storage to survive + // a VM reboot. + // + VariableStore =3D + (EFI_PHYSICAL_ADDRESS)(UINTN) + AllocateRuntimePages ( + EFI_SIZE_TO_PAGES (2 * PcdGet32 (PcdFlashNvStorageFtwSpareSize)) + ); + DEBUG ((DEBUG_INFO, + "Reserved variable store memory: 0x%lX; size: %dkb\n", + VariableStore, + (2 * PcdGet32 (PcdFlashNvStorageFtwSpareSize)) / 1024 + )); + PcdStatus =3D PcdSet64S (PcdEmuVariableNvStoreReserved, VariableStore); + ASSERT_RETURN_ERROR (PcdStatus); +} + + +VOID +DebugDumpCmos ( + VOID + ) +{ + UINT32 Loop; + + DEBUG ((DEBUG_INFO, "CMOS:\n")); + + for (Loop =3D 0; Loop < 0x80; Loop++) { + if ((Loop % 0x10) =3D=3D 0) { + DEBUG ((DEBUG_INFO, "%02x:", Loop)); + } + DEBUG ((DEBUG_INFO, " %02x", CmosRead8 (Loop))); + if ((Loop % 0x10) =3D=3D 0xf) { + DEBUG ((DEBUG_INFO, "\n")); + } + } +} + + + +/** + Perform Platform PEI initialization. + + @param FileHandle Handle of the file being invoked. + @param PeiServices Describes the list of possible PEI Services. + + @return EFI_SUCCESS The PEIM initialized successfully. + +**/ +EFI_STATUS +EFIAPI +InitializeXenPlatform ( + IN EFI_PEI_FILE_HANDLE FileHandle, + IN CONST EFI_PEI_SERVICES **PeiServices + ) +{ + DEBUG ((DEBUG_INFO, "Platform PEIM Loaded\n")); + + DebugDumpCmos (); + + if (!XenDetect ()) { + DEBUG ((DEBUG_ERROR, "ERROR: Xen isn't detected\n")); + ASSERT (FALSE); + CpuDeadLoop (); + } + + BootModeInitialization (); + AddressWidthInitialization (); + + // + // Query Host Bridge DID + // + mHostBridgeDevId =3D PciRead16 (OVMF_HOSTBRIDGE_DID); + + PublishPeiMemory (); + + InitializeRamRegions (); + + InitializeXen (); + + if (mBootMode !=3D BOOT_ON_S3_RESUME) { + ReserveEmuVariableNvStore (); + PeiFvInitialization (); + MemMapInitialization (); + } + + InstallClearCacheCallback (); + AmdSevInitialize (); + MiscInitialization (); + + return EFI_SUCCESS; +} diff --git a/OvmfPkg/XenPlatformPei/Xen.c b/OvmfPkg/XenPlatformPei/Xen.c new file mode 100644 index 0000000000..f4d0d1c73b --- /dev/null +++ b/OvmfPkg/XenPlatformPei/Xen.c @@ -0,0 +1,219 @@ +/**@file + Xen Platform PEI support + + Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2011, Andrei Warkentin + Copyright (c) 2019, Citrix Systems, Inc. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +// +// The package level header files this module uses +// +#include + +// +// The Library classes this module consumes +// +#include +#include +#include +#include +#include +#include +#include +#include + +#include "Platform.h" +#include "Xen.h" + +STATIC UINT32 mXenLeaf =3D 0; + +EFI_XEN_INFO mXenInfo; + +/** + Returns E820 map provided by Xen + + @param Entries Pointer to E820 map + @param Count Number of entries + + @return EFI_STATUS +**/ +EFI_STATUS +XenGetE820Map ( + EFI_E820_ENTRY64 **Entries, + UINT32 *Count + ) +{ + EFI_XEN_OVMF_INFO *Info =3D + (EFI_XEN_OVMF_INFO *)(UINTN) OVMF_INFO_PHYSICAL_ADDRESS; + + if (AsciiStrCmp ((CHAR8 *) Info->Signature, "XenHVMOVMF")) { + return EFI_NOT_FOUND; + } + + ASSERT (Info->E820 < MAX_ADDRESS); + *Entries =3D (EFI_E820_ENTRY64 *)(UINTN) Info->E820; + *Count =3D Info->E820EntriesCount; + + return EFI_SUCCESS; +} + +/** + Connects to the Hypervisor. + + @param XenLeaf CPUID index used to connect. + + @return EFI_STATUS + +**/ +EFI_STATUS +XenConnect ( + UINT32 XenLeaf + ) +{ + UINT32 Index; + UINT32 TransferReg; + UINT32 TransferPages; + UINT32 XenVersion; + + AsmCpuid (XenLeaf + 2, &TransferPages, &TransferReg, NULL, NULL); + mXenInfo.HyperPages =3D AllocatePages (TransferPages); + if (!mXenInfo.HyperPages) { + return EFI_OUT_OF_RESOURCES; + } + + for (Index =3D 0; Index < TransferPages; Index++) { + AsmWriteMsr64 (TransferReg, + (UINTN) mXenInfo.HyperPages + + (Index << EFI_PAGE_SHIFT) + Index); + } + + AsmCpuid (XenLeaf + 1, &XenVersion, NULL, NULL, NULL); + DEBUG ((DEBUG_ERROR, "Detected Xen version %d.%d\n", + XenVersion >> 16, XenVersion & 0xFFFF)); + mXenInfo.VersionMajor =3D (UINT16)(XenVersion >> 16); + mXenInfo.VersionMinor =3D (UINT16)(XenVersion & 0xFFFF); + + /* TBD: Locate hvm_info and reserve it away. */ + mXenInfo.HvmInfo =3D NULL; + + BuildGuidDataHob ( + &gEfiXenInfoGuid, + &mXenInfo, + sizeof(mXenInfo) + ); + + return EFI_SUCCESS; +} + +/** + Figures out if we are running inside Xen HVM. + + @retval TRUE Xen was detected + @retval FALSE Xen was not detected + +**/ +BOOLEAN +XenDetect ( + VOID + ) +{ + UINT8 Signature[13]; + + if (mXenLeaf !=3D 0) { + return TRUE; + } + + Signature[12] =3D '\0'; + for (mXenLeaf =3D 0x40000000; mXenLeaf < 0x40010000; mXenLeaf +=3D 0x100= ) { + AsmCpuid (mXenLeaf, + NULL, + (UINT32 *) &Signature[0], + (UINT32 *) &Signature[4], + (UINT32 *) &Signature[8]); + + if (!AsciiStrCmp ((CHAR8 *) Signature, "XenVMMXenVMM")) { + return TRUE; + } + } + + mXenLeaf =3D 0; + return FALSE; +} + + +VOID +XenPublishRamRegions ( + VOID + ) +{ + EFI_E820_ENTRY64 *E820Map; + UINT32 E820EntriesCount; + EFI_STATUS Status; + + DEBUG ((DEBUG_INFO, "Using memory map provided by Xen\n")); + + // + // Parse RAM in E820 map + // + E820EntriesCount =3D 0; + Status =3D XenGetE820Map (&E820Map, &E820EntriesCount); + + ASSERT_EFI_ERROR (Status); + + if (E820EntriesCount > 0) { + EFI_E820_ENTRY64 *Entry; + UINT32 Loop; + + for (Loop =3D 0; Loop < E820EntriesCount; Loop++) { + Entry =3D E820Map + Loop; + + // + // Only care about RAM + // + if (Entry->Type !=3D EfiAcpiAddressRangeMemory) { + continue; + } + + AddMemoryBaseSizeHob (Entry->BaseAddr, Entry->Length); + + MtrrSetMemoryAttribute (Entry->BaseAddr, Entry->Length, CacheWriteBa= ck); + } + } +} + + +/** + Perform Xen PEI initialization. + + @return EFI_SUCCESS Xen initialized successfully + @return EFI_NOT_FOUND Not running under Xen + +**/ +EFI_STATUS +InitializeXen ( + VOID + ) +{ + RETURN_STATUS PcdStatus; + + if (mXenLeaf =3D=3D 0) { + return EFI_NOT_FOUND; + } + + XenConnect (mXenLeaf); + + // + // Reserve away HVMLOADER reserved memory [0xFC000000,0xFD000000). + // This needs to match HVMLOADER RESERVED_MEMBASE/RESERVED_MEMSIZE. + // + AddReservedMemoryBaseSizeHob (0xFC000000, 0x1000000, FALSE); + + PcdStatus =3D PcdSetBoolS (PcdPciDisableBusEnumeration, TRUE); + ASSERT_RETURN_ERROR (PcdStatus); + + return EFI_SUCCESS; +} diff --git a/Maintainers.txt b/Maintainers.txt index 34bdb275b4..42ec8d54af 100644 --- a/Maintainers.txt +++ b/Maintainers.txt @@ -379,6 +379,7 @@ F: OvmfPkg/PlatformPei/Xen.* F: OvmfPkg/SmbiosPlatformDxe/*Xen.c F: OvmfPkg/XenBusDxe/ F: OvmfPkg/XenIoPciDxe/ +F: OvmfPkg/XenPlatformPei/ F: OvmfPkg/XenPvBlkDxe/ F: OvmfPkg/XenResetVector/ R: Anthony Perard --=20 Anthony PERARD -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45534): https://edk2.groups.io/g/devel/message/45534 Mute This Topic: https://groups.io/mt/32851506/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Nov 14 05:47:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45529+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1565695885; cv=none; d=zoho.com; s=zohoarc; b=bArFG+zFvs4ujvwq2+vGzyd3VaPSacIE1SD94kl//XzQ9l4WoPzMGGpMXKZWBp/5lzH+J+IXhgkyQ4sWAS2vgXRGfaXoBB/iq4JRziV/KetwXfLXH1ytyKPsaFH1LhV+8nYKMZeGZomb2ggqaU9B+GnO1xHqBHXxK4bbtfowpQY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565695885; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=I77bAkSJbMDYkUlqhNXWZp5DmnsLJNPrg+I7PAmWOWE=; b=HoStRI5hW1zPU3nmCWA7e1ISURXCFmYNZ4jZe29sHO5eENmmV9WMcO3WS45uSdu+Al4GRAWOv74loTpfQEe+i5bpUKdgfGtPpoTzH/BxPNwhmLlfj15b51vnRlkDL0BI8BoJAccGIt8IckqeJfihg13dHwKl55Syla44o1107wI= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45529+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1565695885906723.0455740462733; Tue, 13 Aug 2019 04:31:25 -0700 (PDT) Return-Path: X-Received: from esa4.hc3370-68.iphmx.com (esa4.hc3370-68.iphmx.com []) by groups.io with SMTP; Tue, 13 Aug 2019 04:31:24 -0700 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45529+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: None (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.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=esa4.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 (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: JhiC5TzLMFxQG+HYB4XD3hKX6jf/kPo6+pyWjLO5KKGHvnVWdXuFFh9PWhnjHj0rO6/+9RZKwA HdGKgHtmnQYL3+DPzrWGR+BUna51NtHPB2TyZJLjHOxN5pLxc/exp2e0vIW4fiTBl8NbwaZS3M LoRHvXldJaXjUFUFd1kKHFsDZNpyUbE8N0V7H6gJEP9gNBIrSiLszrCQZtkaT1KM1/ERNiDJDw o7zZIY45z5d6wu7hK3gl33fm2nQ4doCJ8qurZJnzI91EK63ehurQ+RYZQEMi75pTScWSXyJLKA vtI= X-SBRS: 2.7 X-MesageID: 4401252 X-Ironport-Server: esa4.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="4401252" From: "Anthony PERARD" To: CC: Laszlo Ersek , Jordan Justen , Julien Grall , , Ard Biesheuvel , Anthony PERARD Subject: [edk2-devel] [PATCH v5 05/35] OvmfPkg/OvmfXen: Creating an ELF header Date: Tue, 13 Aug 2019 12:30:49 +0100 Message-ID: <20190813113119.14804-6-anthony.perard@citrix.com> In-Reply-To: <20190813113119.14804-1-anthony.perard@citrix.com> References: <20190813113119.14804-1-anthony.perard@citrix.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,anthony.perard@citrix.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565695885; bh=I77bAkSJbMDYkUlqhNXWZp5DmnsLJNPrg+I7PAmWOWE=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=vRCp+dJGygQI0TVduv2UDJ/n3lwIqvyI4ilXcfX2AfImW6T9qziYqSOz9kizuJqD76w SSNXO1Ef5yW4HcvMa6sUJXvZoXwplvut3gjsEPJuu42krR+Scp5TYoy/nq7dIqVax80EU dJwSdMsAcc/eCFDjWQT4HVrGxwDWi5C3BZU= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" This patch changes the flash device image of OvmfXen to make it look like it's an ELF. For this, we replace the empty embedded variable store by a binary array, which is a ELF file header. The ELF header explain to a loader to load the binary at the address 1MB, then jump to the PVH entry point which will be created in a later patch. The header also includes a Xen ELF note that is part of the PVH ABI. That patch include OvmfXenElfHeaderGenerator.c which can be use to regenerate the ELF header, but this will be a manual step. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1689 Signed-off-by: Anthony PERARD Acked-by: Laszlo Ersek --- Notes: v4: - fix top-level comment style - Update Maintainers.txt =20 v3: - added license to generate_elf_header.c which is renamed to OvmfPkg/OvmfXenElfHeaderGenerator.c - added an ELF NOTE into the header OvmfPkg/OvmfXen.fdf | 101 +++++++++++++++++++- OvmfPkg/OvmfXenElfHeaderGenerator.c | 140 ++++++++++++++++++++++++++++ Maintainers.txt | 1 + 3 files changed, 239 insertions(+), 3 deletions(-) create mode 100644 OvmfPkg/OvmfXenElfHeaderGenerator.c diff --git a/OvmfPkg/OvmfXen.fdf b/OvmfPkg/OvmfXen.fdf index 2ceff7baa2..43c268f6cb 100644 --- a/OvmfPkg/OvmfXen.fdf +++ b/OvmfPkg/OvmfXen.fdf @@ -15,8 +15,8 @@ [Defines] !include OvmfPkg.fdf.inc =20 # -# Build the variable store and the firmware code as one unified flash devi= ce -# image. +# This will allow the flash device image to be recognize as an ELF, with f= irst +# an ELF headers, then the firmware code. # [FD.OVMF] BaseAddress =3D $(FW_BASE_ADDRESS) @@ -25,7 +25,102 @@ [FD.OVMF] BlockSize =3D $(BLOCK_SIZE) NumBlocks =3D $(FW_BLOCKS) =20 -!include VarStore.fdf.inc +!if ($(FD_SIZE_IN_KB) =3D=3D 1024) || ($(FD_SIZE_IN_KB) =3D=3D 2048) +0x00000000|0x0000e000 +!endif +!if $(FD_SIZE_IN_KB) =3D=3D 4096 +0x00000000|0x00040000 +!endif +DATA =3D { + # + # This hex array have been generated by OvmfPkg/OvmfXenElfHeaderGenerato= r.c + # and copied manually. + # + # ELF file header + 0x7f, 0x45, 0x4c, 0x46, # e_ident[0..3]: Magic number + 0x01, # File class: 32-bit objects + 0x01, # Data encoding: 2's complement, little endian + 0x01, # File version + 0x03, # OS ABI identification: Object uses GNU ELF extensions + 0x00, # ABI version + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # e_ident[EI_PAD...] + 0x02, 0x00, # e_type =3D Executable file + 0x03, 0x00, # e_machine =3D Intel 80386 + 0x01, 0x00, 0x00, 0x00, # e_version + 0xd0, 0xff, 0x2f, 0x00, # e_entry: Entry point virtual address + 0x34, 0x00, 0x00, 0x00, # e_phoff: Program header table file offset + 0x00, 0x00, 0x00, 0x00, # e_shoff: Section header table file offset + 0x00, 0x00, 0x00, 0x00, # e_flags: Processor-specific flags + 0x34, 0x00, # e_ehsize: ELF header size + 0x20, 0x00, # e_phentsize: Program header table entry size + 0x02, 0x00, # e_phnum: Program header table entry count + 0x00, 0x00, # e_shentsize: Section header table entry size + 0x00, 0x00, # e_shnum: Section header table entry count + 0x00, 0x00, # e_shstrndx + + # ELF Program segment headers + # - Load segment + 0x01, 0x00, 0x00, 0x00, # p_type =3D Loadable program segment + 0x00, 0x00, 0x00, 0x00, # p_offset + 0x00, 0x00, 0x10, 0x00, # p_vaddr: Segment virtual address + 0x00, 0x00, 0x10, 0x00, # p_paddr: Segment physical address + 0x00, 0x00, 0x20, 0x00, # p_filesz: Segment size in file + 0x00, 0x00, 0x20, 0x00, # p_memsz: Segment size in memory + 0x07, 0x00, 0x00, 0x00, # p_flags =3D Segment is executable | writable |= readable + 0x00, 0x00, 0x00, 0x00, # p_align + # - ELFNOTE segment + 0x04, 0x00, 0x00, 0x00, # p_type =3D PT_NOTE + 0x74, 0x00, 0x00, 0x00, # p_offset =3D point to XEN_ELFNOTE_PHYS32_ENTRY= below + 0x74, 0x00, 0x10, 0x00, + 0x74, 0x00, 0x10, 0x00, + 0x14, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, # p_flags =3D Segment is readable + 0x00, 0x00, 0x00, 0x00, + + # XEN_ELFNOTE_PHYS32_ENTRY + 0x04, 0x00, 0x00, 0x00, # name size + 0x04, 0x00, 0x00, 0x00, # desc size + 0x12, 0x00, 0x00, 0x00, # type =3D XEN_ELFNOTE_PHYS32_ENTRY + 0x58, 0x65, 0x6e, 0x00, # name =3D "Xen" + 0xd0, 0xff, 0x2f, 0x00, # desc: PVH entry point + 0x00 +} + +!if ($(FD_SIZE_IN_KB) =3D=3D 1024) || ($(FD_SIZE_IN_KB) =3D=3D 2048) +0x0000e000|0x00001000 +!endif +!if $(FD_SIZE_IN_KB) =3D=3D 4096 +0x00040000|0x00001000 +!endif +#NV_EVENT_LOG + +!if ($(FD_SIZE_IN_KB) =3D=3D 1024) || ($(FD_SIZE_IN_KB) =3D=3D 2048) +0x0000f000|0x00001000 +!endif +!if $(FD_SIZE_IN_KB) =3D=3D 4096 +0x00041000|0x00001000 +!endif +#NV_FTW_WORKING +DATA =3D { + # EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER->Signature =3D gEdkiiWorkingBl= ockSignatureGuid =3D + # { 0x9e58292b, 0x7c68, 0x497d, { 0xa0, 0xce, 0x65, 0x0, 0xfd, 0x9f, 0= x1b, 0x95 }} + 0x2b, 0x29, 0x58, 0x9e, 0x68, 0x7c, 0x7d, 0x49, + 0xa0, 0xce, 0x65, 0x0, 0xfd, 0x9f, 0x1b, 0x95, + # Crc:UINT32 #WorkingBlockValid:1, WorkingBlockInvalid:1, Res= erved + 0x2c, 0xaf, 0x2c, 0x64, 0xFE, 0xFF, 0xFF, 0xFF, + # WriteQueueSize: UINT64 + 0xE0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +} + +!if ($(FD_SIZE_IN_KB) =3D=3D 1024) || ($(FD_SIZE_IN_KB) =3D=3D 2048) +0x00010000|0x00010000 +!endif +!if $(FD_SIZE_IN_KB) =3D=3D 4096 +0x00042000|0x00042000 +!endif +#NV_FTW_SPARE + =20 $(VARS_SIZE)|$(FVMAIN_SIZE) FV =3D FVMAIN_COMPACT diff --git a/OvmfPkg/OvmfXenElfHeaderGenerator.c b/OvmfPkg/OvmfXenElfHeader= Generator.c new file mode 100644 index 0000000000..90f0574fc6 --- /dev/null +++ b/OvmfPkg/OvmfXenElfHeaderGenerator.c @@ -0,0 +1,140 @@ +/** @file + This program generates a hex array to be manually coppied into + OvmfXen.fdf. + + The purpose is for the flash device image to be recognize as an ELF. + + Copyright (c) 2019, Citrix Systems, Inc. + + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include "elf.h" +#include "stdio.h" +#include "stddef.h" + +void print_hdr(void *s, size_t size) +{ + char *c =3D s; + + while (size--) { + printf("0x%02hhx, ", *(c++)); + } +} + +/* Format for the XEN_ELFNOTE_PHYS32_ENTRY program segment */ +#define XEN_ELFNOTE_PHYS32_ENTRY 18 +typedef struct { + uint32_t name_size; + uint32_t desc_size; + uint32_t type; + char name[4]; + uint32_t desc; +} xen_elfnote_phys32_entry; + +int main(void) +{ + /* FW_SIZE */ + size_t ovmf_blob_size =3D 0x00200000; + /* Load OVMF at 1MB when running as PVH guest */ + uint32_t ovmf_base_address =3D 0x00100000; + /* Xen PVH entry point */ + uint32_t ovmfxen_pvh_entry_point =3D ovmf_base_address + ovmf_blob_size = - 0x30; + size_t offset_into_file =3D 0; + + /* ELF file header */ + Elf32_Ehdr hdr =3D { + .e_ident =3D ELFMAG, + .e_type =3D ET_EXEC, + .e_machine =3D EM_386, + .e_version =3D EV_CURRENT, + .e_entry =3D ovmfxen_pvh_entry_point, + .e_flags =3D R_386_NONE, + .e_ehsize =3D sizeof (hdr), + .e_phentsize =3D sizeof (Elf32_Phdr), + }; + offset_into_file +=3D sizeof (hdr); + + hdr.e_ident[EI_CLASS] =3D ELFCLASS32; + hdr.e_ident[EI_DATA] =3D ELFDATA2LSB; + hdr.e_ident[EI_VERSION] =3D EV_CURRENT; + hdr.e_ident[EI_OSABI] =3D ELFOSABI_LINUX; + /* Placing program headers just after hdr */ + hdr.e_phoff =3D sizeof (hdr); + + /* program header */ + Elf32_Phdr phdr_load =3D { + .p_type =3D PT_LOAD, + .p_offset =3D 0, /* load everything */ + .p_paddr =3D ovmf_base_address, + .p_filesz =3D ovmf_blob_size, + .p_memsz =3D ovmf_blob_size, + .p_flags =3D PF_X | PF_W | PF_R, + .p_align =3D 0, + }; + phdr_load.p_vaddr =3D phdr_load.p_paddr; + hdr.e_phnum +=3D 1; + offset_into_file +=3D sizeof (phdr_load); + + /* Xen ELF Note. */ + + xen_elfnote_phys32_entry xen_elf_note =3D { + .type =3D XEN_ELFNOTE_PHYS32_ENTRY, + .name =3D "Xen", + .desc =3D ovmfxen_pvh_entry_point, + .name_size =3D + offsetof (xen_elfnote_phys32_entry, desc) - + offsetof (xen_elfnote_phys32_entry, name), + .desc_size =3D + sizeof (xen_elfnote_phys32_entry) - + offsetof (xen_elfnote_phys32_entry, desc), + }; + Elf32_Phdr phdr_note =3D { + .p_type =3D PT_NOTE, + .p_filesz =3D sizeof (xen_elf_note), + .p_memsz =3D sizeof (xen_elf_note), + .p_flags =3D PF_R, + .p_align =3D 0, + }; + hdr.e_phnum +=3D 1; + offset_into_file +=3D sizeof (phdr_note); + phdr_note.p_offset =3D offset_into_file; + phdr_note.p_paddr =3D ovmf_base_address + phdr_note.p_offset; + phdr_note.p_vaddr =3D phdr_note.p_paddr; + + + /* + * print elf header + */ + + size_t i; + size_t hdr_size =3D sizeof (hdr); + size_t entry_off =3D offsetof(typeof(hdr), e_entry); + + printf("# ELF file header\n"); + print_hdr(&hdr, entry_off); + printf("\n"); + print_hdr(&hdr.e_entry, sizeof (hdr.e_entry)); + printf(" # hdr.e_entry\n"); + print_hdr(&hdr.e_entry + 1, hdr_size - entry_off - sizeof (hdr.e_entry)); + + printf("\n\n# ELF Program segment headers\n"); + printf("# - Load segment\n"); + for (i =3D 0; i < sizeof (phdr_load); i +=3D 4) { + print_hdr(((char*)&phdr_load) + i, 4); + printf("\n"); + } + printf("# - ELFNOTE segment\n"); + for (i =3D 0; i < sizeof (phdr_note); i +=3D 4) { + print_hdr(((char*)&phdr_note) + i, 4); + printf("\n"); + } + + printf("\n# XEN_ELFNOTE_PHYS32_ENTRY\n"); + for (i =3D 0; i < sizeof (xen_elf_note); i +=3D 4) { + print_hdr(((char*)&xen_elf_note) + i, 4); + printf("\n"); + } + + return 0; +} diff --git a/Maintainers.txt b/Maintainers.txt index 42ec8d54af..016523b401 100644 --- a/Maintainers.txt +++ b/Maintainers.txt @@ -373,6 +373,7 @@ F: OvmfPkg/Library/XenConsoleSerialPortLib/ F: OvmfPkg/Library/XenHypercallLib/ F: OvmfPkg/Library/XenIoMmioLib/ F: OvmfPkg/OvmfXen.* +F: OvmfPkg/OvmfXenElfHeaderGenerator.c F: OvmfPkg/PlatformPei/MemDetect.c F: OvmfPkg/PlatformPei/Platform.* F: OvmfPkg/PlatformPei/Xen.* --=20 Anthony PERARD -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45529): https://edk2.groups.io/g/devel/message/45529 Mute This Topic: https://groups.io/mt/32851500/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Nov 14 05:47:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45531+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1565695886; cv=none; d=zoho.com; s=zohoarc; b=WW4Uo11htA1kCPk7VudF+I7jSRwlOgHHkmhYEhpeCw9XjpamBeLSkzujKu4XDerJFTwEjq7TmFU8AGrR0eSVA0H0XJTIIUYG+8H8OP15nKi3PFDfgY7MSInz+205o3+dU4X04oIYkIA4dnVZcd5wHrAnZdfwx8IaozbyMJNXqnA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565695886; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=5q1T6gzlfeXhiQSz07PUwOEA1nC4EKbJf041jSbE94M=; b=RMcexVk3EI40udnob/+21Jncbmpo7rReq9aUpHkwCEC41BZlFJ9wAKNZk9ZSgbPFOpcXrKWmGWxqm8hWDHU5ITFj3Caj6Se0xewvlSyyh0otRRDDuSibtquR2epFId8DcZWgTTb3pmDAC6VOMqo0YTR1Y3XkUzaEMlfWJ/JBoy4= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45531+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1565695886395264.9635189675164; Tue, 13 Aug 2019 04:31:26 -0700 (PDT) Return-Path: X-Received: from esa4.hc3370-68.iphmx.com (esa4.hc3370-68.iphmx.com []) by groups.io with SMTP; Tue, 13 Aug 2019 04:31:25 -0700 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45531+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: None (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.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=esa4.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 (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: DDOZdD9pGMj9Yv5DB0srb8dVW7FkXLCg2J3qpuXQrjqLY4dWBrdqLFaK0rKw4sSlnxDFfk2zbZ MjOOEBKAoLPW3cKa6ugzpCn2T7T0iCep5RDpcDgKeF/A32FTSWWQnMN/p4PdXws9oDyMcawmP8 20Xt3gKDOuu353FBdtEuoMWRS8xW1HJ8fhoA16xfxtBzf+/1LaJ9dkrtLfoYzZ8wfvQ9N/F+m5 U0Xzz9kdiKRhLEqWFPimmSUN7nE4nntytjDUxr8BOejFYHQTfUDPvaENN00x6gKXKLURdJV4nF kWE= X-SBRS: 2.7 X-MesageID: 4401254 X-Ironport-Server: esa4.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="4401254" From: "Anthony PERARD" To: CC: Laszlo Ersek , Jordan Justen , Julien Grall , , Ard Biesheuvel , Anthony PERARD Subject: [edk2-devel] [PATCH v5 06/35] OvmfPkg/XenResetVector: Add new entry point for Xen PVH Date: Tue, 13 Aug 2019 12:30:50 +0100 Message-ID: <20190813113119.14804-7-anthony.perard@citrix.com> In-Reply-To: <20190813113119.14804-1-anthony.perard@citrix.com> References: <20190813113119.14804-1-anthony.perard@citrix.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,anthony.perard@citrix.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565695886; bh=5q1T6gzlfeXhiQSz07PUwOEA1nC4EKbJf041jSbE94M=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=mPVijX6QDgasxUNK3v9Qt1q0Sz3UdIdzqZPmn6SDKACv9UKTdJbZkGTBPfjQLIBhFHL wFvN+XB2MLOI9UDCOoad15tAncnsetvNPSIYZh8cf07o2aRZzzGqiOEu3z6GRbkQNNb4/ CFWa2Kc2+qMAUF7jfPShR7W0fkgVK3t+AbY= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Add a new entry point for Xen PVH that enter directly in 32bits. 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 Also, compare to the original file [1], the two `nop' of the "resetVector" entry point are removed. There were introduced by 8332983e2e33 ("UefiCpuPkg: Replace the un-necessary WBINVD instruction at the reset vector with two NOPs in VTF0.", 2011-08-04), but don't seems to be useful. This is the entry point used by HVM guest (hvmloader). [1] UefiCpuPkg/ResetVector/Vtf0/Ia16/ResetVectorVtf0.asm Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1689 Signed-off-by: Anthony PERARD Acked-by: Laszlo Ersek --- Notes: v4: - remove the two nop in the HVM entry point =20 v3: - rebased, SPDX - remove `cli' as via PVH the interrupts are guaranteed to be off - rewrite some comments .../XenResetVector/Ia16/ResetVectorVtf0.asm | 79 +++++++++++++++++++ OvmfPkg/XenResetVector/Ia32/XenPVHMain.asm | 49 ++++++++++++ OvmfPkg/XenResetVector/XenResetVector.nasmb | 1 + 3 files changed, 129 insertions(+) create mode 100644 OvmfPkg/XenResetVector/Ia16/ResetVectorVtf0.asm create mode 100644 OvmfPkg/XenResetVector/Ia32/XenPVHMain.asm diff --git a/OvmfPkg/XenResetVector/Ia16/ResetVectorVtf0.asm b/OvmfPkg/XenR= esetVector/Ia16/ResetVectorVtf0.asm new file mode 100644 index 0000000000..56749bdbc9 --- /dev/null +++ b/OvmfPkg/XenResetVector/Ia16/ResetVectorVtf0.asm @@ -0,0 +1,79 @@ +;-------------------------------------------------------------------------= ----- +; @file +; First code executed by processor after resetting. +; +; Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.
+; Copyright (c) 2019, Citrix Systems, Inc. +; +; SPDX-License-Identifier: BSD-2-Clause-Patent +; +;-------------------------------------------------------------------------= ----- + +BITS 16 + +ALIGN 16 + +; +; Pad the image size to 4k when page tables are in VTF0 +; +; If the VTF0 image has page tables built in, then we need to make +; sure the end of VTF0 is 4k above where the page tables end. +; +; This is required so the page tables will be 4k aligned when VTF0 is +; located just below 0x100000000 (4GB) in the firmware device. +; +%ifdef ALIGN_TOP_TO_4K_FOR_PAGING + TIMES (0x1000 - ($ - EndOfPageTables) - (fourGigabytes - xenPVHEntryPo= int)) 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 +; +; GenFv generates code aligned on a 4k boundary which will jump to this +; location. (0xffffffe0) This allows the Local APIC Startup IPI to be +; used to wake up the application processors. +; + jmp EarlyApInitReal16 + +ALIGN 8 + + DD 0 + +; +; The VTF signature +; +; VTF-0 means that the VTF (Volume Top File) code does not require +; any fixups. +; +vtfSignature: + DB 'V', 'T', 'F', 0 + +ALIGN 16 + +resetVector: +; +; Reset Vector +; +; This is where the processor will begin execution +; + jmp EarlyBspInitReal16 + +ALIGN 16 + +fourGigabytes: + diff --git a/OvmfPkg/XenResetVector/Ia32/XenPVHMain.asm b/OvmfPkg/XenResetV= ector/Ia32/XenPVHMain.asm new file mode 100644 index 0000000000..2a17fed52f --- /dev/null +++ b/OvmfPkg/XenResetVector/Ia32/XenPVHMain.asm @@ -0,0 +1,49 @@ +;-------------------------------------------------------------------------= ----- +; @file +; An entry point use by Xen when a guest is started in PVH mode. +; +; Copyright (c) 2019, Citrix Systems, Inc. +; +; SPDX-License-Identifier: BSD-2-Clause-Patent +; +;-------------------------------------------------------------------------= ----- + +BITS 32 + +xenPVHMain: + ; + ; 'BP' to indicate boot-strap processor + ; + mov di, 'BP' + + ; + ; ESP will be used as initial value of the EAX register + ; in Main.asm + ; + xor esp, esp + + 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 + + ; + ; Jump to the main routine of the pre-SEC code + ; skiping the 16-bit part of the routine and + ; into the 32-bit flat mode part + ; + OneTimeCallRet TransitionFromReal16To32BitFlat diff --git a/OvmfPkg/XenResetVector/XenResetVector.nasmb b/OvmfPkg/XenReset= Vector/XenResetVector.nasmb index 89a4b08bc3..0dbc4f2c1d 100644 --- a/OvmfPkg/XenResetVector/XenResetVector.nasmb +++ b/OvmfPkg/XenResetVector/XenResetVector.nasmb @@ -63,6 +63,7 @@ %include "Ia16/Init16.asm" =20 %include "Main.asm" +%include "Ia32/XenPVHMain.asm" =20 %include "Ia16/ResetVectorVtf0.asm" =20 --=20 Anthony PERARD -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45531): https://edk2.groups.io/g/devel/message/45531 Mute This Topic: https://groups.io/mt/32851502/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Nov 14 05:47:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45535+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1565695889; cv=none; d=zoho.com; s=zohoarc; b=PqUN529aI0/sJahEJ0gcVVpLeRnbz3sTbyU1MLDkqkOSaFKgOIsMj5keh14CJPbBQBEdcWCk+FDUwfffFUVbiZbzwnzwW7kUlyrj3uFXfCxo45jMUqsb7ccKzgED5dVXLd9M/RU8djEwLUhnCvx/eg9YikwosYJSL9kuxLEAIcM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565695889; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=s6whLZKMHKtCj4WYV7pzOfZvZgaDE7SF/ZAW4kwziD8=; b=IcltweQGEk6j1P2Ft8EzHZAiJpHO5S3idgGoLAEapzvcFLesmheh1gEdfEuivgIEK4ZzUXrIXFtfvgO4HseB6+1efICkHsXV7f8RQho7E9kczwGc/i43RGGJorPCNYTHV0Iz3AjcuAxK5UYVvCYmUcVqPjM6xHNptmkoyiXZqqo= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45535+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1565695889274891.4876050068295; Tue, 13 Aug 2019 04:31:29 -0700 (PDT) Return-Path: X-Received: from esa6.hc3370-68.iphmx.com (esa6.hc3370-68.iphmx.com [216.71.155.175]) by groups.io with SMTP; Tue, 13 Aug 2019 04:31:28 -0700 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45535+1787277+3901457@groups.io; helo=web01.groups.io; 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: CC: Laszlo Ersek , Jordan Justen , Julien Grall , , Ard Biesheuvel , Anthony PERARD Subject: [edk2-devel] [PATCH v5 07/35] OvmfPkg/XenResetVector: Saving start of day pointer for PVH guests Date: Tue, 13 Aug 2019 12:30:51 +0100 Message-ID: <20190813113119.14804-8-anthony.perard@citrix.com> In-Reply-To: <20190813113119.14804-1-anthony.perard@citrix.com> References: <20190813113119.14804-1-anthony.perard@citrix.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,anthony.perard@citrix.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565695888; bh=s6whLZKMHKtCj4WYV7pzOfZvZgaDE7SF/ZAW4kwziD8=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=WZ++SwSMJLCqe293k3ziaC7/CUChOZ3J9+ZBJ3aFQsj5W6MTgrNV5RyajkKSJUNfZHN o6VF2Lb5r68I4ZGusNncDDSAk7QqEOeYepUaUETC9VOzPF3/5Ruyin2XwY+jhP++RwBxh hDmUIdj0Cn7/+bE/xRzzi7BbhXEANakFREk= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" 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=3D1689 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 =20 + gUefiOvmfPkgTokenSpaceGuid.PcdXenPvhStartOfDayStructPtr|0x0|UINT32|0x17 + gUefiOvmfPkgTokenSpaceGuid.PcdXenPvhStartOfDayStructPtrSize|0x0|UINT32|0= x32 + [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|gUefiOvmfPkgT= okenSpaceGuid.PcdGuidedExtractHandlerTableSize =20 +0x008000|0x001000 +# Used by XenResetVector to communicate with XenPlatformPei +gUefiOvmfPkgTokenSpaceGuid.PcdXenPvhStartOfDayStructPtr|gUefiOvmfPkgTokenS= paceGuid.PcdXenPvhStartOfDayStructPtrSize + 0x010000|0x010000 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamBase|gUefiOvmfPkgTokenSpace= Guid.PcdOvmfSecPeiTempRamSize =20 diff --git a/OvmfPkg/XenResetVector/XenResetVector.inf b/OvmfPkg/XenResetVe= ctor/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/XenResetV= ector/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 =20 + ; + ; 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] =20 diff --git a/OvmfPkg/XenResetVector/XenResetVector.nasmb b/OvmfPkg/XenReset= Vector/XenResetVector.nasmb index 0dbc4f2c1d..b2cb405d54 100644 --- a/OvmfPkg/XenResetVector/XenResetVector.nasmb +++ b/OvmfPkg/XenResetVector/XenResetVector.nasmb @@ -34,6 +34,8 @@ =20 %include "CommonMacros.inc" =20 +%define PVH_SPACE(Offset) (FixedPcdGet32 (PcdXenPvhStartOfDayStructPtr) + = (Offset)) + %include "PostCodes.inc" =20 %ifdef DEBUG_PORT80 --=20 Anthony PERARD -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45535): https://edk2.groups.io/g/devel/message/45535 Mute This Topic: https://groups.io/mt/32851507/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Nov 14 05:47:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45532+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1565695886; cv=none; d=zoho.com; s=zohoarc; b=G05wensWKe79D08tiSnxCGBWOLcTfGRsoFVFfIEt0pMN5MgkwtKR1fY/4jnTpIbwCfsydn2lBjyLtH/pW4e4OCA9Ove9qzJlews+EOiGVEfvY3N3qgb3/cCGgXkxtIXv+hRRVtXCRrrG4fQkHFBs2g6x4AAS50JnbfOYlcyOXpo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565695886; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=TY0vAtrNT+YlMJNQC+zKk7cnmip658ZHHXcTzAhwjAU=; b=OzIFk6fMOdt9niuMlhjfeFc85+AZ8yqumBezNY39ZbMia8QXkIwcpXxm8jqGiWLLExhL7TDHb4GWgK0hQBTHLTxI4vm+pjoR8Kna5DIAY4poXz7KBWXRKuX6nWTGzxJeTZOfkTI9qQ1ki73gHRBRjjm03GGqlyFZLKD36pvsqoQ= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45532+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1565695886963815.8582236045493; Tue, 13 Aug 2019 04:31:26 -0700 (PDT) Return-Path: X-Received: from esa4.hc3370-68.iphmx.com (esa4.hc3370-68.iphmx.com []) by groups.io with SMTP; Tue, 13 Aug 2019 04:31:26 -0700 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45532+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: None (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.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=esa4.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 (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: D9GT1034v2n03a1NT13E7G9fvKAGN2SF3cUTIn3d2XIW9A2FgmkzPg+56phF4i0qbMmdNjoePX T6uTEW43WJCmyfVmfbZs6lJAMivq9oCRc1uQX5I+u+zS/dtbJ5YLJRBp8qisJBVB01b8MwUY7Y SJcyaxS7kCmgL5b8FaK+zLhnh/KVD2S6yNILUxmiKsbpSzkGr5fIedXWJ8dF4PyxoTSITupq1w 1YYxYem1bOCNTEULurQ0rGJfyhkhvn2yPhCqeKpPxx9XplgJNotN5UYv8GC9rxtrSlGr5gESRV f5o= X-SBRS: 2.7 X-MesageID: 4401255 X-Ironport-Server: esa4.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="4401255" From: "Anthony PERARD" To: CC: Laszlo Ersek , Jordan Justen , Julien Grall , , Ard Biesheuvel , Anthony PERARD Subject: [edk2-devel] [PATCH v5 08/35] OvmfPkg/XenResetVector: Allow jumpstart from either hvmloader or PVH Date: Tue, 13 Aug 2019 12:30:52 +0100 Message-ID: <20190813113119.14804-9-anthony.perard@citrix.com> In-Reply-To: <20190813113119.14804-1-anthony.perard@citrix.com> References: <20190813113119.14804-1-anthony.perard@citrix.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,anthony.perard@citrix.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565695886; bh=TY0vAtrNT+YlMJNQC+zKk7cnmip658ZHHXcTzAhwjAU=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=gDdLq4E/Uj/Tr2kgbBL+G/l43erbnpqHwhgi+kzfbmUhoj1GfNrCODC+kU6WoZmA8Gz a75dPbIko1sZKuuLnA/dme76It80FqVDAj05WwdEsZAAYesJ3hw3ZAV/Dth7eFoYQZ0RH xfCR0cxTtdX8BHJBiTDTuHSfWh3Re9TGFR8= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" This patch allows the ResetVector to be run indenpendently from build time addresses. The goal of the patch is to avoid having to create RAM just below 4G when creating a Xen PVH guest while being compatible with the way hvmloader currently load OVMF, just below 4G. Only the new PVH entry point will do the calculation. The ResetVector will figure out its current running address by creating a temporary stack, make a call and calculate the difference between the build time address and the address at run time. This patch copies and make the necessary modification to some other asm files: - copy of UefiCpuPkg/.../Flat32ToFlat64.asm: Allow Transition32FlatTo64Flat to be run from anywhere in memory - copy of UefiCpuPkg/../SearchForBfvBase.asm: Add a extra parameter to indicate where to start the search for the boot firmware volume. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1689 Signed-off-by: Anthony PERARD Acked-by: Laszlo Ersek --- Notes: v3: - rebased, SPDX - fix commit message .../XenResetVector/Ia16/Real16ToFlat32.asm | 3 + .../XenResetVector/Ia32/Flat32ToFlat64.asm | 68 +++++++++++++++ .../XenResetVector/Ia32/SearchForBfvBase.asm | 87 +++++++++++++++++++ OvmfPkg/XenResetVector/Ia32/XenPVHMain.asm | 43 +++++++-- 4 files changed, 194 insertions(+), 7 deletions(-) create mode 100644 OvmfPkg/XenResetVector/Ia32/Flat32ToFlat64.asm create mode 100644 OvmfPkg/XenResetVector/Ia32/SearchForBfvBase.asm diff --git a/OvmfPkg/XenResetVector/Ia16/Real16ToFlat32.asm b/OvmfPkg/XenRe= setVector/Ia16/Real16ToFlat32.asm index 5c329bfaea..36ea74f7fe 100644 --- a/OvmfPkg/XenResetVector/Ia16/Real16ToFlat32.asm +++ b/OvmfPkg/XenResetVector/Ia16/Real16ToFlat32.asm @@ -54,6 +54,9 @@ jumpTo32BitAndLandHere: mov gs, ax mov ss, ax =20 + ; parameter for Flat32SearchForBfvBase + xor eax, eax ; Start searching from top of 4GB for BfvBase + OneTimeCallRet TransitionFromReal16To32BitFlat =20 ALIGN 2 diff --git a/OvmfPkg/XenResetVector/Ia32/Flat32ToFlat64.asm b/OvmfPkg/XenRe= setVector/Ia32/Flat32ToFlat64.asm new file mode 100644 index 0000000000..661a8e7028 --- /dev/null +++ b/OvmfPkg/XenResetVector/Ia32/Flat32ToFlat64.asm @@ -0,0 +1,68 @@ +;-------------------------------------------------------------------------= ----- +; @file +; Transition from 32 bit flat protected mode into 64 bit flat protected mo= de +; +; Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.
+; Copyright (c) 2019, Citrix Systems, Inc. +; +; SPDX-License-Identifier: BSD-2-Clause-Patent +; +;-------------------------------------------------------------------------= ----- + +BITS 32 + +; +; Modified: EAX, EBX, ECX, EDX, ESP +; +Transition32FlatTo64Flat: + + OneTimeCall SetCr3ForPageTables64 + + mov eax, cr4 + bts eax, 5 ; enable PAE + mov cr4, eax + + mov ecx, 0xc0000080 + rdmsr + bts eax, 8 ; set LME + wrmsr + + mov eax, cr0 + bts eax, 31 ; set PG + mov cr0, eax ; enable paging + + ; + ; backup ESP + ; + mov ebx, esp + + ; + ; recalculate delta + ; + mov esp, PVH_SPACE(16) + call .delta +.delta: + pop edx + sub edx, ADDR_OF(.delta) + + ; + ; push return addr and seg to the stack, then return far + ; + push dword LINEAR_CODE64_SEL + mov eax, ADDR_OF(jumpTo64BitAndLandHere) + add eax, edx ; add delta + push eax + retf + +BITS 64 +jumpTo64BitAndLandHere: + + ; + ; restore ESP + ; + mov esp, ebx + + debugShowPostCode POSTCODE_64BIT_MODE + + OneTimeCallRet Transition32FlatTo64Flat + diff --git a/OvmfPkg/XenResetVector/Ia32/SearchForBfvBase.asm b/OvmfPkg/Xen= ResetVector/Ia32/SearchForBfvBase.asm new file mode 100644 index 0000000000..190389c46f --- /dev/null +++ b/OvmfPkg/XenResetVector/Ia32/SearchForBfvBase.asm @@ -0,0 +1,87 @@ +;-------------------------------------------------------------------------= ----- +; @file +; Search for the Boot Firmware Volume (BFV) base address +; +; Copyright (c) 2008 - 2009, Intel Corporation. All rights reserved.
+; Copyright (c) 2019, Citrix Systems, Inc. +; +; SPDX-License-Identifier: BSD-2-Clause-Patent +; +;-------------------------------------------------------------------------= ----- + +;#define EFI_FIRMWARE_FILE_SYSTEM2_GUID \ +; { 0x8c8ce578, 0x8a3d, 0x4f1c, { 0x99, 0x35, 0x89, 0x61, 0x85, 0xc3, 0x2= d, 0xd3 } } +%define FFS_GUID_DWORD0 0x8c8ce578 +%define FFS_GUID_DWORD1 0x4f1c8a3d +%define FFS_GUID_DWORD2 0x61893599 +%define FFS_GUID_DWORD3 0xd32dc385 + +BITS 32 + +; +; Modified: EAX, EBX, ECX +; Preserved: EDI, ESP +; +; @param[in] EAX Start search from here +; @param[out] EBP Address of Boot Firmware Volume (BFV) +; +Flat32SearchForBfvBase: + + mov ecx, eax +searchingForBfvHeaderLoop: + ; + ; We check for a firmware volume at every 4KB address in the 16MB + ; just below where we started, ECX. + ; + sub eax, 0x1000 + mov ebx, ecx + sub ebx, eax + cmp ebx, 0x01000000 + ; if ECX-EAX > 16MB; jump notfound + ja searchedForBfvHeaderButNotFound + + ; + ; Check FFS GUID + ; + cmp dword [eax + 0x10], FFS_GUID_DWORD0 + jne searchingForBfvHeaderLoop + cmp dword [eax + 0x14], FFS_GUID_DWORD1 + jne searchingForBfvHeaderLoop + cmp dword [eax + 0x18], FFS_GUID_DWORD2 + jne searchingForBfvHeaderLoop + cmp dword [eax + 0x1c], FFS_GUID_DWORD3 + jne searchingForBfvHeaderLoop + + ; + ; Check FV Length + ; + cmp dword [eax + 0x24], 0 + jne searchingForBfvHeaderLoop + mov ebx, eax + add ebx, dword [eax + 0x20] + cmp ebx, ecx + jnz searchingForBfvHeaderLoop + + jmp searchedForBfvHeaderAndItWasFound + +searchedForBfvHeaderButNotFound: + ; + ; Hang if the SEC entry point was not found + ; + debugShowPostCode POSTCODE_BFV_NOT_FOUND + + ; + ; 0xbfbfbfbf in the EAX & EBP registers helps signal what failed + ; for debugging purposes. + ; + mov eax, 0xBFBFBFBF + mov ebp, eax + jmp $ + +searchedForBfvHeaderAndItWasFound: + mov ebp, eax + + debugShowPostCode POSTCODE_BFV_FOUND + + OneTimeCallRet Flat32SearchForBfvBase + diff --git a/OvmfPkg/XenResetVector/Ia32/XenPVHMain.asm b/OvmfPkg/XenResetV= ector/Ia32/XenPVHMain.asm index f42df3dba2..2df0f12e18 100644 --- a/OvmfPkg/XenResetVector/Ia32/XenPVHMain.asm +++ b/OvmfPkg/XenResetVector/Ia32/XenPVHMain.asm @@ -16,25 +16,42 @@ xenPVHMain: ; mov di, 'BP' =20 - ; - ; ESP will be used as initial value of the EAX register - ; in Main.asm - ; - xor esp, esp - ; ; Store "Start of day" struct pointer for later use ; mov dword[PVH_SPACE (0)], ebx mov dword[PVH_SPACE (4)], 'XPVH' =20 + ; + ; calculate delta between build-addr and run position + ; + mov esp, PVH_SPACE(16) ; create a temporary stack + call .delta +.delta: + pop edx ; get addr of .delta + sub edx, ADDR_OF(.delta) ; calculate delta + + ; + ; Find address of GDT and gdtr and fix the later + ; mov ebx, ADDR_OF(gdtr) + add ebx, edx ; add delta gdtr + mov eax, ADDR_OF(GDT_BASE) + add eax, edx ; add delta to GDT_BASE + mov dword[ebx + 2], eax ; fix GDT_BASE addr in gdtr lgdt [ebx] =20 mov eax, SEC_DEFAULT_CR0 mov cr0, eax =20 - jmp LINEAR_CODE_SEL:ADDR_OF(.jmpToNewCodeSeg) + ; + ; push return addr to the stack, then return far + ; + push dword LINEAR_CODE_SEL ; segment to select + mov eax, ADDR_OF(.jmpToNewCodeSeg) ; return addr + add eax, edx ; add delta to return addr + push eax + retf .jmpToNewCodeSeg: =20 mov eax, SEC_DEFAULT_CR4 @@ -47,6 +64,18 @@ xenPVHMain: mov gs, ax mov ss, ax =20 + ; + ; ESP will be used as initial value of the EAX register + ; in Main.asm + ; + xor esp, esp + + ; + ; parameter for Flat32SearchForBfvBase + ; + mov eax, ADDR_OF(fourGigabytes) + add eax, edx ; add delta + ; ; Jump to the main routine of the pre-SEC code ; skiping the 16-bit part of the routine and --=20 Anthony PERARD -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45532): https://edk2.groups.io/g/devel/message/45532 Mute This Topic: https://groups.io/mt/32851503/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Nov 14 05:47:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45530+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1565695886; cv=none; d=zoho.com; s=zohoarc; b=T5fTgBQwjgIbynXUF1x/0OHXHXtPl2aZ8GKGHR54fVH0TcFN1/inmU2LT9qmo6O3BUZKfDonHS51hBGw/a1a8JeGlalotX3rnEJwkgXDAFFPC9runIEsE98k5r5GAM9yQkJ8qDzI1vnxdzjPFhlR6n4kJXYKUQzb7KHA4fOniEg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565695886; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=vkdKHuu/mR2iAdGv+qEVMIV3rsPuKIYcJ6uh1FspTW0=; b=b3ix9xjKsyvXbLiAbshLerT6lJuZw9ac3PoksKeEmP6chlsPkCcls7UrlkPVLMZugYrhfGDa6+MVKG6iUNAGmoNiCHfjZ+ZoVxF8ny1Oz1MAufIu5uPqLv2uhXBOG9xBsYXjR6JnodB3CFRh3XlpoK4+wOrE0Q7cJaLoseBC/yc= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45530+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 15656958859581016.7908468203154; Tue, 13 Aug 2019 04:31:25 -0700 (PDT) Return-Path: X-Received: from esa4.hc3370-68.iphmx.com (esa4.hc3370-68.iphmx.com []) by groups.io with SMTP; Tue, 13 Aug 2019 04:31:24 -0700 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45530+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: None (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.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=esa4.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 (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: f5ic5juQJHflLMH71MFUJC92NjRHNN3O6jgnKAwy1E+oLqGI5Ov7aFEXRSwqv9PYum1AXB10QF OHZlvZblRB/Ahby4Uk2e/Ne77b+EYwXKFeEeGaYS1K5jloLG3yjmM7BskQIxIeHiJYKXSr7O4m gTxicIicyRCI7FJlon0NwDPFYcr5dLrrafbOJw0mHqpO5ZI8751L/g8m80UEWHR1O9vRc2SVkq tuUdeKtuFxvGkIobJNZfNbsNwacNPFwTrz2IVegZgi9grRULFsEJpSTsKs0SQF+YAbfb3+brrr 0kI= X-SBRS: 2.7 X-MesageID: 4401253 X-Ironport-Server: esa4.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="4401253" From: "Anthony PERARD" To: CC: Laszlo Ersek , Jordan Justen , Julien Grall , , Ard Biesheuvel , Anthony PERARD Subject: [edk2-devel] [PATCH v5 09/35] OvmfPkg/OvmfXen: use a TimerLib instance that depends only on the CPU Date: Tue, 13 Aug 2019 12:30:53 +0100 Message-ID: <20190813113119.14804-10-anthony.perard@citrix.com> In-Reply-To: <20190813113119.14804-1-anthony.perard@citrix.com> References: <20190813113119.14804-1-anthony.perard@citrix.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,anthony.perard@citrix.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565695885; bh=vkdKHuu/mR2iAdGv+qEVMIV3rsPuKIYcJ6uh1FspTW0=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=jXEDRvAEUSPm/oxsHchj3ZEYXm9XE/1yoayIA+NEGj2wkQq/fcL/CsduKMMEHFiSERb itTK/pRTBen9FgbjcYr+9iXfKjVctpbigDEVTkP1rgyisScQHUFupOmN4Y/XHuxTL2hDq JEIkEHg7KT7apXOCVaxtuEPrhpeSiuhtE54= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" The ACPI Timer isn't present in a PVH guest, but local APIC works on both PVH and HVM. Note that the use of SecPeiDxeTimerLibCpu might be an issue with a driver of type DXE_RUNTIME_DRIVER. I've attempted to find out which of the DXE_RUNTIME_DRIVER uses the TimerLib at runtime. I've done that by replacing the TimerLib evaluation in [LibraryClasses.common.DXE_RUNTIME_DRIVER] by a different one and checking every module that uses it (with the --report-file=3Dreport build option). ResetSystemRuntimeDxe is calling the TimerLib API at runtime to do the operation "EfiResetCold", so this may never complete if the OS have disabled the Local APIC Timer. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1689 Signed-off-by: Anthony PERARD Acked-by: Laszlo Ersek --- Notes: v4: - reworded the first sentence, use "not present" instead of "don't work= ". =20 v3: - cleanup .dsc, leave only one TimerLib resolution - Added a note in the commit message regarding the use of the local apic by runtime drivers OvmfPkg/OvmfXen.dsc | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc index 7619a89382..b40d39e003 100644 --- a/OvmfPkg/OvmfXen.dsc +++ b/OvmfPkg/OvmfXen.dsc @@ -104,7 +104,7 @@ [SkuIds] ##########################################################################= ###### [LibraryClasses] PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf - TimerLib|OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf + TimerLib|MdePkg/Library/SecPeiDxeTimerLibCpu/SecPeiDxeTimerLibCpu.inf PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf BaseLib|MdePkg/Library/BaseLib/BaseLib.inf @@ -202,7 +202,6 @@ [LibraryClasses.common] BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf =20 [LibraryClasses.common.SEC] - TimerLib|OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.inf QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSecLib.inf !ifdef $(DEBUG_ON_SERIAL_PORT) DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf @@ -281,7 +280,6 @@ [LibraryClasses.common.DXE_CORE] =20 [LibraryClasses.common.DXE_RUNTIME_DRIVER] PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf - TimerLib|OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf @@ -298,7 +296,6 @@ [LibraryClasses.common.DXE_RUNTIME_DRIVER] =20 [LibraryClasses.common.UEFI_DRIVER] PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf - TimerLib|OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf @@ -313,7 +310,6 @@ [LibraryClasses.common.UEFI_DRIVER] =20 [LibraryClasses.common.DXE_DRIVER] PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf - TimerLib|OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeRepor= tStatusCodeLib.inf @@ -337,7 +333,6 @@ [LibraryClasses.common.DXE_DRIVER] =20 [LibraryClasses.common.UEFI_APPLICATION] PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf - TimerLib|OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeRepor= tStatusCodeLib.inf --=20 Anthony PERARD -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45530): https://edk2.groups.io/g/devel/message/45530 Mute This Topic: https://groups.io/mt/32851501/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Nov 14 05:47:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45543+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1565697476; cv=none; d=zoho.com; s=zohoarc; b=SSGUCn/L4uYiLVftmZy5QQOcKA6tfzhARyJ58gkgd25vZTp4hAVWNihBdd8SdJfdd2aGuNYv+Esx/BkyDsdNKdIIeLLqRgZX+EA3Lpc3pcwn36s0vwBAD/g2jIHuCa+2o7czkELtiwQqfrQ2lw5gUAzhBvHtN/rUyilz5RHBjco= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565697476; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=Gz1shcVkV373sQSxxvdmahuOv0lQ6Mi8rqbtEj89JFU=; b=KPnJ3xmuFmXTYi9ZqgpZri92SV0KMewBO0MaqEZiqLxN+PDngfJqm5Kyoadgnlzg1TXjTvm5jBBiT2KTL2SWOKcDBe/6eQCqV6wdLYLzTXhEE7ctONZ01xp7Oy2IWy/c8jDflhGChSwT6IV/+zssnFf7IVsOQg/QFI1yb4/ldSE= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45543+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1565697476145348.15419593207537; Tue, 13 Aug 2019 04:57:56 -0700 (PDT) Return-Path: X-Received: from esa6.hc3370-68.iphmx.com (esa6.hc3370-68.iphmx.com [216.71.155.175]) by groups.io with SMTP; Tue, 13 Aug 2019 04:57:55 -0700 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45543+1787277+3901457@groups.io; helo=web01.groups.io; 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: kUE3JOw0T2mJof0gvPbvm6vJbeZ78vKYdXSzey+Dyic+mii51g3JRgo1YPjciQ772RQQtTHRtF ZTlZ5MwEV5QIytumC7tvxmuqu3yXvQI8pWNKa5OJF4hrHgmovSs13fHPgBMOhFQpeZugQwsKhR pandDLGcy9f82Daq0F/L5Vsyl3uIPBq99eJV9rxia920hmYqFB4rWTOABqn49bGgF/zH4XqxNM Z2f79iuu3oYlcaJQE4W0TG5iSBspRLI7jS6vSdBWA+x+zkNzfWOuXl68tXJ+6gG5Ku08Ad6/S5 BXQ= X-SBRS: 2.7 X-MesageID: 4374821 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="4374821" From: "Anthony PERARD" To: CC: Laszlo Ersek , Jordan Justen , Julien Grall , , Ard Biesheuvel , Anthony PERARD Subject: [edk2-devel] [PATCH v5 10/35] OvmfPkg/XenPlatformPei: Detect OVMF_INFO from hvmloader Date: Tue, 13 Aug 2019 12:30:54 +0100 Message-ID: <20190813113119.14804-11-anthony.perard@citrix.com> In-Reply-To: <20190813113119.14804-1-anthony.perard@citrix.com> References: <20190813113119.14804-1-anthony.perard@citrix.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,anthony.perard@citrix.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565697475; bh=Gz1shcVkV373sQSxxvdmahuOv0lQ6Mi8rqbtEj89JFU=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=QrsjJIxyNmwDAWMgLTydMzwEjxKsI26NfQWdcDbQr1c8A9F+vnJGY9mJCNf/oklLpa9 xJkSp5I1iIULBTgz28NdRYkjj5P/K/x8gXF9TAA+LlRO9HQLuAdWM6iru0/R+I4CJ5mIk 7eyB7XmBwnpQsprbrU2MFc8cc2e3psyxZGk= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" EFI_XEN_OVMF_INFO is only useful to retrieve the E820 table. The mXenHvmloaderInfo isn't used yet, but will be use in a further patch to retrieve the E820 table. Also remove the unused pointer from the XenInfo HOB as that information is only useful in the XenPlatformPei. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1689 Signed-off-by: Anthony PERARD Acked-by: Laszlo Ersek --- Notes: v3: - fix coding style - fix commit message OvmfPkg/Include/Guid/XenInfo.h | 4 ---- OvmfPkg/PlatformPei/Xen.c | 3 --- OvmfPkg/XenPlatformPei/Xen.c | 25 +++++++++++++++++++++++-- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/OvmfPkg/Include/Guid/XenInfo.h b/OvmfPkg/Include/Guid/XenInfo.h index 25d76a7828..b052d618fd 100644 --- a/OvmfPkg/Include/Guid/XenInfo.h +++ b/OvmfPkg/Include/Guid/XenInfo.h @@ -18,10 +18,6 @@ typedef struct { /// VOID *HyperPages; /// - /// Location of the hvm_info page. - /// - VOID *HvmInfo; - /// /// Hypervisor major version. /// UINT16 VersionMajor; diff --git a/OvmfPkg/PlatformPei/Xen.c b/OvmfPkg/PlatformPei/Xen.c index 89dc4143b2..3e15b32a73 100644 --- a/OvmfPkg/PlatformPei/Xen.c +++ b/OvmfPkg/PlatformPei/Xen.c @@ -98,9 +98,6 @@ XenConnect ( mXenInfo.VersionMajor =3D (UINT16)(XenVersion >> 16); mXenInfo.VersionMinor =3D (UINT16)(XenVersion & 0xFFFF); =20 - /* TBD: Locate hvm_info and reserve it away. */ - mXenInfo.HvmInfo =3D NULL; - BuildGuidDataHob ( &gEfiXenInfoGuid, &mXenInfo, diff --git a/OvmfPkg/XenPlatformPei/Xen.c b/OvmfPkg/XenPlatformPei/Xen.c index f4d0d1c73b..9962fe9fc7 100644 --- a/OvmfPkg/XenPlatformPei/Xen.c +++ b/OvmfPkg/XenPlatformPei/Xen.c @@ -33,6 +33,12 @@ STATIC UINT32 mXenLeaf =3D 0; =20 EFI_XEN_INFO mXenInfo; =20 +// +// Location of the firmware info struct setup by hvmloader. +// Only the E820 table is used by OVMF. +// +EFI_XEN_OVMF_INFO *mXenHvmloaderInfo; + /** Returns E820 map provided by Xen =20 @@ -78,6 +84,8 @@ XenConnect ( UINT32 TransferReg; UINT32 TransferPages; UINT32 XenVersion; + EFI_XEN_OVMF_INFO *Info; + CHAR8 Sig[sizeof (Info->Signature) + 1]; =20 AsmCpuid (XenLeaf + 2, &TransferPages, &TransferReg, NULL, NULL); mXenInfo.HyperPages =3D AllocatePages (TransferPages); @@ -97,8 +105,21 @@ XenConnect ( mXenInfo.VersionMajor =3D (UINT16)(XenVersion >> 16); mXenInfo.VersionMinor =3D (UINT16)(XenVersion & 0xFFFF); =20 - /* TBD: Locate hvm_info and reserve it away. */ - mXenInfo.HvmInfo =3D NULL; + // + // Check if there are information left by hvmloader + // + + Info =3D (EFI_XEN_OVMF_INFO *)(UINTN) OVMF_INFO_PHYSICAL_ADDRESS; + // + // Copy the signature, and make it null-terminated. + // + AsciiStrnCpyS (Sig, sizeof (Sig), (CHAR8 *) &Info->Signature, + sizeof (Info->Signature)); + if (AsciiStrCmp (Sig, "XenHVMOVMF") =3D=3D 0) { + mXenHvmloaderInfo =3D Info; + } else { + mXenHvmloaderInfo =3D NULL; + } =20 BuildGuidDataHob ( &gEfiXenInfoGuid, --=20 Anthony PERARD -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45543): https://edk2.groups.io/g/devel/message/45543 Mute This Topic: https://groups.io/mt/32851687/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Nov 14 05:47:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45536+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1565697462; cv=none; d=zoho.com; s=zohoarc; b=X9lOUK3kMX5uq93YedAPQ9Nw4z6ke3CB9ohAFd+rOKjKjSSJPU98ovadYqvisCM4pjwz+lZX0b7FqX0+gBblpaMivgnPx2C1htaUaom6tsjiP+Y6LzVDlPaMkAdJuk11jYjr7Rg6lFNz9ztj0ikMxM5YWy6M1mQ2tr2ZudDxpBM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565697462; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=k2Etdfe7XR8yyLu0jNRUVlOSmZFELhdhC5EVoL11DiA=; b=Co1OukrejRbU86+Aymw20scGz+RgF0TiUhDeYJM7wNKKzzp+81a2ByQQk5sHCQ5NuGWd6oHjIxuQjjo9NR1EyWUhdTNpl1sfBXaNi4aIM8nQqlt24A6sUKNWX4XJXVojhOIhoVSTiVM9IHbhk2D9vff1ttcsU8vdJ1i4W30+9Rc= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45536+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1565697462791962.3902517635772; Tue, 13 Aug 2019 04:57:42 -0700 (PDT) Return-Path: X-Received: from esa6.hc3370-68.iphmx.com (esa6.hc3370-68.iphmx.com [216.71.155.175]) by groups.io with SMTP; Tue, 13 Aug 2019 04:57:41 -0700 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45536+1787277+3901457@groups.io; helo=web01.groups.io; 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: zumqdGqOC67l/Scq7u0QaZH52lFdRaAssopRiLyvM4P2w9KOpoYu4Hoix/eyftvC31WeJBXLE6 EXefshgrfw5lxb+lzgjSkKpJ5lshp41jtzhkbEDaUg4HzoOgyDwuu0N2EO1howUSOHbP++Kxiw 9i2puj8Uql7PUWvDNjJgtvgwbJgK6KxZnZaFv1qNFrnAMRWmmQwod3VurxtuNsb6Key4xaNzQk fin7FnAzPbHqO8SaDU53qK/baksXc8uANVbww9mmEShLNsL7svSUEKWThwPQfUOiCRR2fSXChH FqE= X-SBRS: 2.7 X-MesageID: 4374814 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="4374814" From: "Anthony PERARD" To: CC: Laszlo Ersek , Jordan Justen , Julien Grall , , Ard Biesheuvel , Anthony PERARD Subject: [edk2-devel] [PATCH v5 11/35] OvmfPkg/XenPlatformPei: Use mXenHvmloaderInfo to get E820 Date: Tue, 13 Aug 2019 12:30:55 +0100 Message-ID: <20190813113119.14804-12-anthony.perard@citrix.com> In-Reply-To: <20190813113119.14804-1-anthony.perard@citrix.com> References: <20190813113119.14804-1-anthony.perard@citrix.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,anthony.perard@citrix.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565697462; bh=k2Etdfe7XR8yyLu0jNRUVlOSmZFELhdhC5EVoL11DiA=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=LRlKOm3DWFGz1QyJdG3BgVeNgezGbgoUIzqBcf8G8D+BwiO8iwL9TDPiRItHDijIMxF fCJio7kskkNroz1kV8J0JSkX5LJKg7qxiywrp1T11V6pYDJAC3XxKMovVR5rbBGoB7mW9 0ShhBBWPYILpXTFntObkbc9eY75jKwnoiss= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Use the already checked pointer mXenHvmloaderInfo to retrieve the E820 table produced by hvmloader. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1689 Signed-off-by: Anthony PERARD Acked-by: Laszlo Ersek --- OvmfPkg/XenPlatformPei/Xen.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/OvmfPkg/XenPlatformPei/Xen.c b/OvmfPkg/XenPlatformPei/Xen.c index 9962fe9fc7..5c7d7ddc1c 100644 --- a/OvmfPkg/XenPlatformPei/Xen.c +++ b/OvmfPkg/XenPlatformPei/Xen.c @@ -53,18 +53,18 @@ XenGetE820Map ( UINT32 *Count ) { - EFI_XEN_OVMF_INFO *Info =3D - (EFI_XEN_OVMF_INFO *)(UINTN) OVMF_INFO_PHYSICAL_ADDRESS; + // + // Get E820 produced by hvmloader + // + if (mXenHvmloaderInfo !=3D NULL) { + ASSERT (mXenHvmloaderInfo->E820 < MAX_ADDRESS); + *Entries =3D (EFI_E820_ENTRY64 *)(UINTN) mXenHvmloaderInfo->E820; + *Count =3D mXenHvmloaderInfo->E820EntriesCount; =20 - if (AsciiStrCmp ((CHAR8 *) Info->Signature, "XenHVMOVMF")) { - return EFI_NOT_FOUND; + return EFI_SUCCESS; } =20 - ASSERT (Info->E820 < MAX_ADDRESS); - *Entries =3D (EFI_E820_ENTRY64 *)(UINTN) Info->E820; - *Count =3D Info->E820EntriesCount; - - return EFI_SUCCESS; + return EFI_NOT_FOUND; } =20 /** --=20 Anthony PERARD -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45536): https://edk2.groups.io/g/devel/message/45536 Mute This Topic: https://groups.io/mt/32851680/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Nov 14 05:47:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45548+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1565697488; cv=none; d=zoho.com; s=zohoarc; b=Gcg6Hz9iOGCVFtF+37v70+nJQ5joYPXSaYE/tEU1djhV1dPW7ixekeCOcNOm8Lj6D7ca2DW692h/Vaor1hRMvh7jy8/JLbzNVwKk0HrqM+MvJw1KN1ekuNcs1AOdqLujJ/32KeSNZHG6nrmzlDbbsA9it2pIOvHJgGfUoxG/pI0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565697488; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=I29oy2s2n4LpkukeM2YGPzxh4hofnhqhv5jRtmRiJO8=; b=c0gaztDn5JCjlafsMaWfn5JVHeheFf+9HbVXUJv2qhOPOB5GYRINaZYi3PDrp+V1B79WjfuzwkfCPVc2Ob7Nhvwwh4YUJ1ZASieMhCjNPiIXWVu3inNWfSup24GqGbEOYDvguOpPGM7cv8aiQFoEZNpcAOAw6J7qCkLK6SLVQ+I= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45548+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1565697488346165.93173564059987; Tue, 13 Aug 2019 04:58:08 -0700 (PDT) Return-Path: X-Received: from esa4.hc3370-68.iphmx.com (esa4.hc3370-68.iphmx.com []) by groups.io with SMTP; Tue, 13 Aug 2019 04:58:07 -0700 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45548+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: None (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.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=esa4.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 (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: WqMj+zgq/5le8z3OmpMjmPWjUb8JfU//taGgZ5Z/aIDlegMjoX5HBCMrfYg6epy6cOXk+JMLLM T2C47ehG221kSO9iDpKHrsZmpRi/I9H+mzcz4w6XAkZ8PBVgGDG6ITvcIfso+pGEbsZmYNt/nj BftT9ODY8vnSe+Xdb2wxkazhwubc7FK966teTJ+VJGlbR7AEhoE1YqruX4RteNmZNPJd/x1cY2 D/ST34Wh5ZAnfputjoT01xhuX51aWrxlcwSeuldQkmJlrHoLNrMnNqdzp7M1Rm8Eey58+kbhJY oKA= X-SBRS: 2.7 X-MesageID: 4402030 X-Ironport-Server: esa4.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="4402030" From: "Anthony PERARD" To: CC: Laszlo Ersek , Jordan Justen , Julien Grall , , Ard Biesheuvel , Anthony PERARD Subject: [edk2-devel] [PATCH v5 12/35] OvmfPkg/XenPlatformPei: Grab RSDP from PVH guest start of day struct Date: Tue, 13 Aug 2019 12:30:56 +0100 Message-ID: <20190813113119.14804-13-anthony.perard@citrix.com> In-Reply-To: <20190813113119.14804-1-anthony.perard@citrix.com> References: <20190813113119.14804-1-anthony.perard@citrix.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,anthony.perard@citrix.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565697487; bh=I29oy2s2n4LpkukeM2YGPzxh4hofnhqhv5jRtmRiJO8=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=glm065rXmukVp6MM32ZBj76g8PxrXY7dKgQdfczZZLutceg/p5hav+DiWBbA5FiyxX+ YZlQ6fhV7PiBcG9YnsBj4W8IFAtfcgfsqoKTrRo32vbgKcQVn4X7KDXvd5AVDxjr/cTXn 1TNzBpcpTBSBlI6iLMHrTt40HDQyaekpMAM= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Check if there's a start of the day struct provided to PVH guest, save the ACPI RSDP address for later. This patch import import arch-x86/hvm/start_info.h from xen.git. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1689 Signed-off-by: Anthony PERARD Acked-by: Laszlo Ersek --- Notes: v3: - use SPDX - use SIGNATURE_32 - fix coding style OvmfPkg/XenPlatformPei/XenPlatformPei.inf | 3 + OvmfPkg/Include/Guid/XenInfo.h | 4 + .../Xen/arch-x86/hvm/start_info.h | 143 ++++++++++++++++++ OvmfPkg/XenPlatformPei/Xen.c | 25 +++ 4 files changed, 175 insertions(+) create mode 100644 OvmfPkg/Include/IndustryStandard/Xen/arch-x86/hvm/start= _info.h diff --git a/OvmfPkg/XenPlatformPei/XenPlatformPei.inf b/OvmfPkg/XenPlatfor= mPei/XenPlatformPei.inf index d1265c365a..4d00206d09 100644 --- a/OvmfPkg/XenPlatformPei/XenPlatformPei.inf +++ b/OvmfPkg/XenPlatformPei/XenPlatformPei.inf @@ -84,6 +84,9 @@ [Pcd] gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy gUefiCpuPkgTokenSpaceGuid.PcdCpuLocalApicBaseAddress =20 + gUefiOvmfPkgTokenSpaceGuid.PcdXenPvhStartOfDayStructPtr + gUefiOvmfPkgTokenSpaceGuid.PcdXenPvhStartOfDayStructPtrSize + [FixedPcd] gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress =20 diff --git a/OvmfPkg/Include/Guid/XenInfo.h b/OvmfPkg/Include/Guid/XenInfo.h index b052d618fd..25743b3884 100644 --- a/OvmfPkg/Include/Guid/XenInfo.h +++ b/OvmfPkg/Include/Guid/XenInfo.h @@ -25,6 +25,10 @@ typedef struct { /// Hypervisor minor version. /// UINT16 VersionMinor; + /// + /// Pointer to the RSDP found in the hvm_start_info provided to a PVH gu= est + /// + VOID *RsdpPvh; } EFI_XEN_INFO; =20 extern EFI_GUID gEfiXenInfoGuid; diff --git a/OvmfPkg/Include/IndustryStandard/Xen/arch-x86/hvm/start_info.h= b/OvmfPkg/Include/IndustryStandard/Xen/arch-x86/hvm/start_info.h new file mode 100644 index 0000000000..15708d6dd5 --- /dev/null +++ b/OvmfPkg/Include/IndustryStandard/Xen/arch-x86/hvm/start_info.h @@ -0,0 +1,143 @@ +/* + * SPDX-License-Identifier: MIT + * + * Copyright (c) 2016, Citrix Systems, Inc. + */ + +#ifndef __XEN_PUBLIC_ARCH_X86_HVM_START_INFO_H__ +#define __XEN_PUBLIC_ARCH_X86_HVM_START_INFO_H__ + +/* + * Start of day structure passed to PVH guests and to HVM guests in %ebx. + * + * NOTE: nothing will be loaded at physical address 0, so a 0 value in any + * of the address fields should be treated as not present. + * + * 0 +----------------+ + * | magic | Contains the magic value XEN_HVM_START_MAGIC_VALUE + * | | ("xEn3" with the 0x80 bit of the "E" set). + * 4 +----------------+ + * | version | Version of this structure. Current version is 1. = New + * | | versions are guaranteed to be backwards-compatibl= e. + * 8 +----------------+ + * | flags | SIF_xxx flags. + * 12 +----------------+ + * | nr_modules | Number of modules passed to the kernel. + * 16 +----------------+ + * | modlist_paddr | Physical address of an array of modules + * | | (layout of the structure below). + * 24 +----------------+ + * | cmdline_paddr | Physical address of the command line, + * | | a zero-terminated ASCII string. + * 32 +----------------+ + * | rsdp_paddr | Physical address of the RSDP ACPI data structure. + * 40 +----------------+ + * | memmap_paddr | Physical address of the (optional) memory map. On= ly + * | | present in version 1 and newer of the structure. + * 48 +----------------+ + * | memmap_entries | Number of entries in the memory map table. Zero + * | | if there is no memory map being provided. Only + * | | present in version 1 and newer of the structure. + * 52 +----------------+ + * | reserved | Version 1 and newer only. + * 56 +----------------+ + * + * The layout of each entry in the module structure is the following: + * + * 0 +----------------+ + * | paddr | Physical address of the module. + * 8 +----------------+ + * | size | Size of the module in bytes. + * 16 +----------------+ + * | cmdline_paddr | Physical address of the command line, + * | | a zero-terminated ASCII string. + * 24 +----------------+ + * | reserved | + * 32 +----------------+ + * + * The layout of each entry in the memory map table is as follows: + * + * 0 +----------------+ + * | addr | Base address + * 8 +----------------+ + * | size | Size of mapping in bytes + * 16 +----------------+ + * | type | Type of mapping as defined between the hypervisor + * | | and guest. See XEN_HVM_MEMMAP_TYPE_* values below. + * 20 +----------------| + * | reserved | + * 24 +----------------+ + * + * The address and sizes are always a 64bit little endian unsigned integer. + * + * NB: Xen on x86 will always try to place all the data below the 4GiB + * boundary. + * + * Version numbers of the hvm_start_info structure have evolved like this: + * + * Version 0: Initial implementation. + * + * Version 1: Added the memmap_paddr/memmap_entries fields (plus 4 bytes = of + * padding) to the end of the hvm_start_info struct. These new + * fields can be used to pass a memory map to the guest. The + * memory map is optional and so guests that understand versio= n 1 + * of the structure must check that memmap_entries is non-zero + * before trying to read the memory map. + */ +#define XEN_HVM_START_MAGIC_VALUE 0x336ec578 + +/* + * The values used in the type field of the memory map table entries are + * defined below and match the Address Range Types as defined in the "Syst= em + * Address Map Interfaces" section of the ACPI Specification. Please refer= to + * section 15 in version 6.2 of the ACPI spec: http://uefi.org/specificati= ons + */ +#define XEN_HVM_MEMMAP_TYPE_RAM 1 +#define XEN_HVM_MEMMAP_TYPE_RESERVED 2 +#define XEN_HVM_MEMMAP_TYPE_ACPI 3 +#define XEN_HVM_MEMMAP_TYPE_NVS 4 +#define XEN_HVM_MEMMAP_TYPE_UNUSABLE 5 +#define XEN_HVM_MEMMAP_TYPE_DISABLED 6 +#define XEN_HVM_MEMMAP_TYPE_PMEM 7 + +/* + * C representation of the x86/HVM start info layout. + * + * The canonical definition of this layout is above, this is just a way to + * represent the layout described there using C types. + */ +struct hvm_start_info { + UINT32 magic; /* Contains the magic value 0x336ec578 = */ + /* ("xEn3" with the 0x80 bit of the "E" set)= .*/ + UINT32 version; /* Version of this structure. = */ + UINT32 flags; /* SIF_xxx flags. = */ + UINT32 nr_modules; /* Number of modules passed to the kernel. = */ + UINT64 modlist_paddr; /* Physical address of an array of = */ + /* hvm_modlist_entry. = */ + UINT64 cmdline_paddr; /* Physical address of the command line. = */ + UINT64 rsdp_paddr; /* Physical address of the RSDP ACPI data = */ + /* structure. = */ + /* All following fields only present in version 1 and newer */ + UINT64 memmap_paddr; /* Physical address of an array of = */ + /* hvm_memmap_table_entry. = */ + UINT32 memmap_entries; /* Number of entries in the memmap table. = */ + /* Value will be zero if there is no memory = */ + /* map being provided. = */ + UINT32 reserved; /* Must be zero. = */ +}; + +struct hvm_modlist_entry { + UINT64 paddr; /* Physical address of the module. = */ + UINT64 size; /* Size of the module in bytes. = */ + UINT64 cmdline_paddr; /* Physical address of the command line. = */ + UINT64 reserved; +}; + +struct hvm_memmap_table_entry { + UINT64 addr; /* Base address of the memory region = */ + UINT64 size; /* Size of the memory region in bytes = */ + UINT32 type; /* Mapping type = */ + UINT32 reserved; /* Must be zero for Version 1. = */ +}; + +#endif /* __XEN_PUBLIC_ARCH_X86_HVM_START_INFO_H__ */ diff --git a/OvmfPkg/XenPlatformPei/Xen.c b/OvmfPkg/XenPlatformPei/Xen.c index 5c7d7ddc1c..b366139a0a 100644 --- a/OvmfPkg/XenPlatformPei/Xen.c +++ b/OvmfPkg/XenPlatformPei/Xen.c @@ -25,6 +25,7 @@ #include #include #include +#include =20 #include "Platform.h" #include "Xen.h" @@ -86,6 +87,7 @@ XenConnect ( UINT32 XenVersion; EFI_XEN_OVMF_INFO *Info; CHAR8 Sig[sizeof (Info->Signature) + 1]; + UINT32 *PVHResetVectorData; =20 AsmCpuid (XenLeaf + 2, &TransferPages, &TransferReg, NULL, NULL); mXenInfo.HyperPages =3D AllocatePages (TransferPages); @@ -121,6 +123,29 @@ XenConnect ( mXenHvmloaderInfo =3D NULL; } =20 + mXenInfo.RsdpPvh =3D NULL; + + // + // Locate and use information from the start of day structure if we have + // booted via the PVH entry point. + // + + PVHResetVectorData =3D (VOID *)(UINTN) PcdGet32 (PcdXenPvhStartOfDayStru= ctPtr); + // + // That magic value is written in XenResetVector/Ia32/XenPVHMain.asm + // + if (PVHResetVectorData[1] =3D=3D SIGNATURE_32 ('X', 'P', 'V', 'H')) { + struct hvm_start_info *HVMStartInfo; + + HVMStartInfo =3D (VOID *)(UINTN) PVHResetVectorData[0]; + if (HVMStartInfo->magic =3D=3D XEN_HVM_START_MAGIC_VALUE) { + ASSERT (HVMStartInfo->rsdp_paddr !=3D 0); + if (HVMStartInfo->rsdp_paddr !=3D 0) { + mXenInfo.RsdpPvh =3D (VOID *)(UINTN)HVMStartInfo->rsdp_paddr; + } + } + } + BuildGuidDataHob ( &gEfiXenInfoGuid, &mXenInfo, --=20 Anthony PERARD -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45548): https://edk2.groups.io/g/devel/message/45548 Mute This Topic: https://groups.io/mt/32851696/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Nov 14 05:47:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45542+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1565697474; cv=none; d=zoho.com; s=zohoarc; b=i0e9I4TZUk5ryoB28gYULCYvISkSKQp7c+EgFpgedX7VwqF+GXS36a8U1YToTYbMAAHOELqhg7VNraKzxO589CNUzrzwJxpDvouzaD1aan4pBpoI+jlXVwDQiqJDV6dT7cRlivlZKWKjIxGOi2q/uWyW781+pDBmY0ysBHWHZxU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565697474; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=zYrvr0jss5bn0rTvmF2dT1kAKjyt5J2Zr8m7Dj+By8s=; b=CAG37ncSik0V5of7tWa/oxOOy3c0lZz/SyBsljvvo9pOuHFeIYpR3bOFF423NcPtKCHHYBpehXLAMTGuV49f5f8quMGQfZJx9MneFJPwK0zZRm50nbzMUqXt0LGsL/lLCu8ZZjYyWOFB4l63Uvb/IeXflliF9XGmCWz4Oit1+D4= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45542+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1565697474832110.2477261374089; Tue, 13 Aug 2019 04:57:54 -0700 (PDT) Return-Path: X-Received: from esa1.hc3370-68.iphmx.com (esa1.hc3370-68.iphmx.com [216.71.145.142]) by groups.io with SMTP; Tue, 13 Aug 2019 04:57:53 -0700 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45542+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: None (esa1.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=esa1.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.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=esa1.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 (esa1.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=esa1.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: T9QfOht1AkLrhOSSjpG00qHXQQFO8DlAjhIZ83SXDdtM9zipSDGLOZ5kGIxq7kH87JBmMLHk4C zzhJJlmCdM5cJFpB/qq4WSu67ru64C62gSPqJmWD0/W1KQeXdLZzNsYMMSOKzudlh5W2mpg97z F9J6rFIZUb37VwW567VvnobTrEgYNH7vD+DqnQJaRBN5v7WRRKjCO9PemspW0trZhgailxPJux dCb88M+Xaq3qSk9rqLLRp2jQJzEjFbRT4it/IBdyzHXIjM2yLxi3fIxkZcx76Oj0Obj3Px7PIL jK0= X-SBRS: 2.7 X-MesageID: 4242240 X-Ironport-Server: esa1.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="4242240" From: "Anthony PERARD" To: CC: Laszlo Ersek , Jordan Justen , Julien Grall , , Ard Biesheuvel , Anthony PERARD Subject: [edk2-devel] [PATCH v5 13/35] OvmfPkg/Library/XenPlatformLib: New library Date: Tue, 13 Aug 2019 12:30:57 +0100 Message-ID: <20190813113119.14804-14-anthony.perard@citrix.com> In-Reply-To: <20190813113119.14804-1-anthony.perard@citrix.com> References: <20190813113119.14804-1-anthony.perard@citrix.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,anthony.perard@citrix.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565697474; bh=zYrvr0jss5bn0rTvmF2dT1kAKjyt5J2Zr8m7Dj+By8s=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=FFbR3/4BgKAzqIrtBzM+lfkDrBrTtQ4Ov5QB9QWmeUzzJLQ+zzGKiwcBcsGA7ugYe2B RUmhxpYvIg5RrOPaGKJWFy5MZRUVDDYHkNUcj8N7vsRnMOXFXXTXObInevsRVtzdO2L4v Lt2GEAIQlY2HrYRxg1dNYn3nhSERqOKPy9Q= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" The purpose of XenPlatformLib is to regroup the few functions that are used in several places to detect if Xen is detected, and to get the XenInfo HOB. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1689 Signed-off-by: Anthony PERARD Reviewed-by: Laszlo Ersek --- Notes: v4: - fix top-level comment style - Update Maintainers.txt =20 v3: - use SPDX - add XenPlatformLib.h to [LibraryClasses] in OvmfPkg.dec - fix typos OvmfPkg/OvmfPkg.dec | 4 ++ OvmfPkg/OvmfXen.dsc | 1 + .../Library/XenPlatformLib/XenPlatformLib.inf | 33 +++++++++ OvmfPkg/Include/Library/XenPlatformLib.h | 53 ++++++++++++++ .../Library/XenPlatformLib/XenPlatformLib.c | 69 +++++++++++++++++++ Maintainers.txt | 2 + 6 files changed, 162 insertions(+) create mode 100644 OvmfPkg/Library/XenPlatformLib/XenPlatformLib.inf create mode 100644 OvmfPkg/Include/Library/XenPlatformLib.h create mode 100644 OvmfPkg/Library/XenPlatformLib/XenPlatformLib.c diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec index c2a2ebfb95..04d5e29272 100644 --- a/OvmfPkg/OvmfPkg.dec +++ b/OvmfPkg/OvmfPkg.dec @@ -70,6 +70,10 @@ [LibraryClasses] # XenIoMmioLib|Include/Library/XenIoMmioLib.h =20 + ## @libraryclass Get information about Xen + # + XenPlatformLib|Include/Library/XenPlatformLib.h + [Guids] gUefiOvmfPkgTokenSpaceGuid =3D {0x93bb96af, 0xb9f2, 0x4eb8, {0x= 94, 0x62, 0xe0, 0xba, 0x74, 0x56, 0x42, 0x36}} gEfiXenInfoGuid =3D {0xd3b46f3b, 0xd441, 0x1244, {0x= 9a, 0x12, 0x0, 0x12, 0x27, 0x3f, 0xc1, 0x4d}} diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc index b40d39e003..22970eda5d 100644 --- a/OvmfPkg/OvmfXen.dsc +++ b/OvmfPkg/OvmfXen.dsc @@ -194,6 +194,7 @@ [LibraryClasses] SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib= /BaseOrderedCollectionRedBlackTreeLib.inf XenHypercallLib|OvmfPkg/Library/XenHypercallLib/XenHypercallLib.inf + XenPlatformLib|OvmfPkg/Library/XenPlatformLib/XenPlatformLib.inf =20 Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibNull/DxeT= cg2PhysicalPresenceLib.inf TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurem= entLibNull.inf diff --git a/OvmfPkg/Library/XenPlatformLib/XenPlatformLib.inf b/OvmfPkg/Li= brary/XenPlatformLib/XenPlatformLib.inf new file mode 100644 index 0000000000..32adb246d6 --- /dev/null +++ b/OvmfPkg/Library/XenPlatformLib/XenPlatformLib.inf @@ -0,0 +1,33 @@ +## @file +# Get information about Xen +# +# This library simply allow to find out if OVMF is running under Xen and +# allow to get more information when it is the case. +# +# Copyright (c) 2019, Citrix Systems, Inc. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +# +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D XenPlatformLib + FILE_GUID =3D DB54DBB7-8142-4EE5-9364-78C824B582EB + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D XenPlatformLib + +[Sources] + XenPlatformLib.c + +[Packages] + MdePkg/MdePkg.dec + OvmfPkg/OvmfPkg.dec + +[LibraryClasses] + HobLib + +[Guids] + gEfiXenInfoGuid diff --git a/OvmfPkg/Include/Library/XenPlatformLib.h b/OvmfPkg/Include/Lib= rary/XenPlatformLib.h new file mode 100644 index 0000000000..8b8c0d057f --- /dev/null +++ b/OvmfPkg/Include/Library/XenPlatformLib.h @@ -0,0 +1,53 @@ +/** @file + Get information about Xen + + This library simply allow to find out if OVMF is running under Xen and + allow to get more information when it is the case. + + Copyright (c) 2019, Citrix Systems, Inc. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _XEN_PLATFORM_LIB_H_ +#define _XEN_PLATFORM_LIB_H_ + +#include + +/** + This function detects if OVMF is running on Xen. + + @retval TRUE OVMF is running on Xen + @retval FALSE Xen has not been detected +**/ +BOOLEAN +EFIAPI +XenDetected ( + VOID + ); + +/** + This function detect if OVMF have started via the PVH entry point. + + @retval TRUE PVH entry point as been used + @retval FALSE OVMF have started via the HVM route +**/ +BOOLEAN +EFIAPI +XenPvhDetected ( + VOID + ); + +/** + This function return a pointer to the XenInfo HOB. + + @return XenInfo pointer or NULL if not available +**/ +EFI_XEN_INFO * +EFIAPI +XenGetInfoHOB ( + VOID + ); + +#endif diff --git a/OvmfPkg/Library/XenPlatformLib/XenPlatformLib.c b/OvmfPkg/Libr= ary/XenPlatformLib/XenPlatformLib.c new file mode 100644 index 0000000000..974a0e73f1 --- /dev/null +++ b/OvmfPkg/Library/XenPlatformLib/XenPlatformLib.c @@ -0,0 +1,69 @@ +/** @file + Get information about Xen + + This library simply allow to find out if OVMF is running under Xen and + allow to get more information when it is the case. + + Copyright (c) 2019, Citrix Systems, Inc. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include + +/** + This function return a pointer to the XenInfo HOB. + + @return XenInfo pointer or NULL if not available +**/ +EFI_XEN_INFO * +EFIAPI +XenGetInfoHOB ( + VOID + ) +{ + EFI_HOB_GUID_TYPE *GuidHob; + + GuidHob =3D GetFirstGuidHob (&gEfiXenInfoGuid); + if (GuidHob =3D=3D NULL) { + return NULL; + } + + return (EFI_XEN_INFO *) GET_GUID_HOB_DATA (GuidHob); +} + +/** + This function detects if OVMF is running on Xen. + + @retval TRUE OVMF is running on Xen + @retval FALSE Xen has not been detected +**/ +BOOLEAN +EFIAPI +XenDetected ( + VOID + ) +{ + return (XenGetInfoHOB () !=3D NULL); +} + +/** + This function detect if OVMF have started via the PVH entry point. + + @retval TRUE PVH entry point as been used + @retval FALSE OVMF have started via the HVM route +**/ +BOOLEAN +EFIAPI +XenPvhDetected ( + VOID + ) +{ + EFI_XEN_INFO *XenInfo; + + XenInfo =3D XenGetInfoHOB (); + return (XenInfo !=3D NULL && XenInfo->RsdpPvh !=3D NULL); +} diff --git a/Maintainers.txt b/Maintainers.txt index 016523b401..f51731a6b6 100644 --- a/Maintainers.txt +++ b/Maintainers.txt @@ -365,6 +365,7 @@ F: OvmfPkg/Include/Guid/XenInfo.h F: OvmfPkg/Include/IndustryStandard/Xen/ F: OvmfPkg/Include/Library/XenHypercallLib.h F: OvmfPkg/Include/Library/XenIoMmioLib.h +F: OvmfPkg/Include/Library/XenPlatformLib.h F: OvmfPkg/Include/Protocol/XenBus.h F: OvmfPkg/Include/Protocol/XenIo.h F: OvmfPkg/Library/PciHostBridgeLib/XenSupport.c @@ -372,6 +373,7 @@ F: OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c F: OvmfPkg/Library/XenConsoleSerialPortLib/ F: OvmfPkg/Library/XenHypercallLib/ F: OvmfPkg/Library/XenIoMmioLib/ +F: OvmfPkg/Library/XenPlatformLib/ F: OvmfPkg/OvmfXen.* F: OvmfPkg/OvmfXenElfHeaderGenerator.c F: OvmfPkg/PlatformPei/MemDetect.c --=20 Anthony PERARD -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45542): https://edk2.groups.io/g/devel/message/45542 Mute This Topic: https://groups.io/mt/32851686/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Nov 14 05:47:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45549+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1565697489; cv=none; d=zoho.com; s=zohoarc; b=HXCk5TCi+npGYXbckhFN5seOHErnz55r16JWn2mEFSoCtkpJuP0abYWhv8WavFJCR9DSjElUO4BWXcdZmxjOnRAkuYt7rrWAzDNB38/Po3sQwlb/EInGw8Q7vB+RkYK1Vg7oOK1XApMzwicQtCaTs+gOitzNPYy4NSOUEolJj1Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565697489; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=+nUzxnYVIhYze/wtKHErpsPikDZzgx4BQgRd5x9lDC4=; b=ojBOuWEUVgyO1PA+6KidDVA+YTgeda4HmV9gjqcM85UhA3GeakOYoAJK5unifTQUJKXYpH+xbOeEq2560BGqUsklblP81Yk204og02ewIdiQSEqq19gxFHbVQqZZV0XayyqfU9cweqvaE7G8wS73mL9raH3Hg9xWzBZR6oRaPHI= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45549+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1565697489543165.8747231012003; Tue, 13 Aug 2019 04:58:09 -0700 (PDT) Return-Path: X-Received: from esa1.hc3370-68.iphmx.com (esa1.hc3370-68.iphmx.com [216.71.145.142]) by groups.io with SMTP; Tue, 13 Aug 2019 04:58:08 -0700 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45549+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: None (esa1.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=esa1.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.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=esa1.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 (esa1.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=esa1.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: bFwtNUR30w8wOXgmCH2ZO5B0Kh3kNhmh+sPfcTND4Ygoi3Z9Ru/RFpe5MRB8iquQ1LsZ8r3nd/ bV7dpItBa8PQEKr6sPQxxz9SR/QbMfDv7UcQ2gu9o48U8MzImZk0GSo3UWQ39Zyvrgr5AtNL2c YfJ7T2/cXW/DBOL9ulgeiMGogfcslUGtLX1E6835F7+QiRIZMelP1u27yY2OGIyLDcea3xmng2 QNl82lJlS7e43brBZ9MEIRHjoYfX3MWKiGca0Ertwkbp3rsm46DSfw3atGdbyB/LlR3rbWq8iS 4VM= X-SBRS: 2.7 X-MesageID: 4242247 X-Ironport-Server: esa1.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="4242247" From: "Anthony PERARD" To: CC: Laszlo Ersek , Jordan Justen , Julien Grall , , Ard Biesheuvel , Anthony PERARD Subject: [edk2-devel] [PATCH v5 14/35] OvmfPkg/AcpiPlatformDxe: Use XenPlatformLib Date: Tue, 13 Aug 2019 12:30:58 +0100 Message-ID: <20190813113119.14804-15-anthony.perard@citrix.com> In-Reply-To: <20190813113119.14804-1-anthony.perard@citrix.com> References: <20190813113119.14804-1-anthony.perard@citrix.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,anthony.perard@citrix.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565697489; bh=+nUzxnYVIhYze/wtKHErpsPikDZzgx4BQgRd5x9lDC4=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=mMAiL5INnSpVVChEoh9A0v3rmSQkVdA2HYvB/3eZQ20yIUJtOFGSi0CAuxnDWLTrwY4 WscHPhbEz/xn2Gehp6KhiMLxUCoCqF3wUEPwrRPgvqHs9rAjjYK+69s0JlnKlpL2qiZM5 WH1mDbHk01ySuVE2T2XgS/yyHu0SeVESokM= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" This patch replace the XenDetected() function by the one in XenPlatformLib. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1689 Signed-off-by: Anthony PERARD Reviewed-by: Laszlo Ersek --- Notes: v4: - removed gEfiXenInfoGuid from Guids list. =20 v3: - new patch, splited from the next patch (which was OvmfPkg/AcpiPlatformDxe: Use PVH RSDP if exist) OvmfPkg/OvmfPkgIa32.dsc | 1 + OvmfPkg/OvmfPkgIa32X64.dsc | 1 + OvmfPkg/OvmfPkgX64.dsc | 1 + OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf | 3 +-- OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h | 6 +----- OvmfPkg/AcpiPlatformDxe/Xen.c | 24 --------------------- 6 files changed, 5 insertions(+), 31 deletions(-) diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc index 6ab7300186..66e944436a 100644 --- a/OvmfPkg/OvmfPkgIa32.dsc +++ b/OvmfPkg/OvmfPkgIa32.dsc @@ -200,6 +200,7 @@ [LibraryClasses] SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib= /BaseOrderedCollectionRedBlackTreeLib.inf XenHypercallLib|OvmfPkg/Library/XenHypercallLib/XenHypercallLib.inf + XenPlatformLib|OvmfPkg/Library/XenPlatformLib/XenPlatformLib.inf =20 !if $(TPM2_ENABLE) =3D=3D TRUE Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc index f163aa2671..51c2bfb44f 100644 --- a/OvmfPkg/OvmfPkgIa32X64.dsc +++ b/OvmfPkg/OvmfPkgIa32X64.dsc @@ -205,6 +205,7 @@ [LibraryClasses] SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib= /BaseOrderedCollectionRedBlackTreeLib.inf XenHypercallLib|OvmfPkg/Library/XenHypercallLib/XenHypercallLib.inf + XenPlatformLib|OvmfPkg/Library/XenPlatformLib/XenPlatformLib.inf =20 !if $(TPM2_ENABLE) =3D=3D TRUE Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc index fa98f16a3f..ba7a758844 100644 --- a/OvmfPkg/OvmfPkgX64.dsc +++ b/OvmfPkg/OvmfPkgX64.dsc @@ -205,6 +205,7 @@ [LibraryClasses] SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib= /BaseOrderedCollectionRedBlackTreeLib.inf XenHypercallLib|OvmfPkg/Library/XenHypercallLib/XenHypercallLib.inf + XenPlatformLib|OvmfPkg/Library/XenPlatformLib/XenPlatformLib.inf =20 !if $(TPM2_ENABLE) =3D=3D TRUE Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf diff --git a/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf b/OvmfPkg/AcpiPlat= formDxe/AcpiPlatformDxe.inf index 24634eeae2..e486b8afa5 100644 --- a/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf +++ b/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf @@ -44,13 +44,13 @@ [LibraryClasses] DebugLib UefiBootServicesTableLib UefiDriverEntryPoint - HobLib QemuFwCfgLib QemuFwCfgS3Lib MemoryAllocationLib BaseLib DxeServicesTableLib OrderedCollectionLib + XenPlatformLib =20 [Protocols] gEfiAcpiTableProtocolGuid # PROTOCOL ALWAYS_CONSUMED @@ -58,7 +58,6 @@ [Protocols] gEfiPciIoProtocolGuid # PROTOCOL SOMETIMES_CONSU= MED =20 [Guids] - gEfiXenInfoGuid gRootBridgesConnectedEventGroupGuid =20 [Pcd] diff --git a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h b/OvmfPkg/AcpiPlatformD= xe/AcpiPlatform.h index 3037afcf18..9597e028e4 100644 --- a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h +++ b/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h @@ -19,6 +19,7 @@ #include #include #include +#include =20 #include =20 @@ -52,11 +53,6 @@ QemuInstallAcpiTable ( OUT UINTN *TableKey ); =20 -BOOLEAN -XenDetected ( - VOID - ); - EFI_STATUS EFIAPI InstallXenTables ( diff --git a/OvmfPkg/AcpiPlatformDxe/Xen.c b/OvmfPkg/AcpiPlatformDxe/Xen.c index e4e47bf0e8..82794b933e 100644 --- a/OvmfPkg/AcpiPlatformDxe/Xen.c +++ b/OvmfPkg/AcpiPlatformDxe/Xen.c @@ -9,8 +9,6 @@ **/=20 =20 #include "AcpiPlatform.h" -#include -#include #include =20 #define XEN_ACPI_PHYSICAL_ADDRESS 0x000EA020 @@ -18,28 +16,6 @@ =20 EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER *XenAcpiRsdpStructurePtr =3D= NULL; =20 -/** - This function detects if OVMF is running on Xen. - -**/ -BOOLEAN -XenDetected ( - VOID - ) -{ - EFI_HOB_GUID_TYPE *GuidHob; - - // - // See if a XenInfo HOB is available - // - GuidHob =3D GetFirstGuidHob (&gEfiXenInfoGuid); - if (GuidHob =3D=3D NULL) { - return FALSE; - } - - return TRUE; -} - /** Get the address of Xen ACPI Root System Description Pointer (RSDP) structure. --=20 Anthony PERARD -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45549): https://edk2.groups.io/g/devel/message/45549 Mute This Topic: https://groups.io/mt/32851697/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Nov 14 05:47:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45537+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1565697464; cv=none; d=zoho.com; s=zohoarc; b=SD0WgCn0z7ZaDIh/OeerGPgW8UkEbXNKL1aHiuAFNJrA/4OpBB6Q0xyR8NABnfyBDZPFD9yOeE6k9U/T3CTi+J811JKSPCZLse+/NnZakPsqjpvk/KjgctP0jn8Q+jPoIab2ds979Wv1KKOuVa2CK6HLppsyqAtykKtKiivePPE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565697464; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=hivPCW+D6g73zAxuJ2dNSf6YRsJPWMxK0gahKHO8HNo=; b=WwIw5RlRGgPC4CPO9LRRzwnAYld7fbUyvyv7e9phn0VbPtW2IjTHeBWwxHDZ9UEPKRltXVSZCI08x+LYvz/SGq1yFs6BptnzY3+nFEpEb93V2gQr3jPAOSdbJv8bIPzcj9+IkRDbIi1XXdySNfRtnuN6hXsdlXpldm08W+dwFI8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45537+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1565697464634399.52129468291935; Tue, 13 Aug 2019 04:57:44 -0700 (PDT) Return-Path: X-Received: from esa2.hc3370-68.iphmx.com (esa2.hc3370-68.iphmx.com [216.71.145.153]) by groups.io with SMTP; Tue, 13 Aug 2019 04:57:43 -0700 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45537+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: None (esa2.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=esa2.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa2.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=esa2.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 (esa2.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=esa2.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: GtdYychCvOSGzUmuIHrE7cljevJE83X5RSJOJyUiig7baU7z0OCn7ZtDGnHu0aklVrIMp1bNqO 2QaEkv2fDPOn3RzWD+y6Chsig4e5TZmWXh9wjtzduWUxESMd8tBhciy+v/oCClPeKtOsk9iw6r dMbZtCX8IrLtYJyiJ9WMUbYa9riBTGVg2xQI6AcNCqHtzVCaJyIMGNEkaDfZrfOsCCGuHIvoJE INDIyFhB7LVIS+yBJidRn0cjyTKev4sQt4CN/iQL668zq2tPNJARYecTTH712D91S5TYS/s7uh Lmw= X-SBRS: 2.7 X-MesageID: 4198429 X-Ironport-Server: esa2.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="4198429" From: "Anthony PERARD" To: CC: Laszlo Ersek , Jordan Justen , Julien Grall , , Ard Biesheuvel , Anthony PERARD Subject: [edk2-devel] [PATCH v5 15/35] OvmfPkg/AcpiPlatformDxe: Use Xen PVH RSDP if it exist Date: Tue, 13 Aug 2019 12:30:59 +0100 Message-ID: <20190813113119.14804-16-anthony.perard@citrix.com> In-Reply-To: <20190813113119.14804-1-anthony.perard@citrix.com> References: <20190813113119.14804-1-anthony.perard@citrix.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,anthony.perard@citrix.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565697464; bh=hivPCW+D6g73zAxuJ2dNSf6YRsJPWMxK0gahKHO8HNo=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=ZzipIN8kUV2YdCwFFm4tUdVm6OLYjcA0tyxULyskVEMO/L6qnY4nPtWdI0RqsVYHSsZ U60SZMRq/m3LB6fyjgeqnEDOsmXycJslG0xq5hi2INjYBofaKUF3gTm6aSxyZO2uTZo+Z DUTXqXVsUTShFVZoJA4qswq0ecPno35EHmU= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" If the firmware have been started via the Xen PVH entry point, a RSDP pointer would have been provided. Use it. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1689 Signed-off-by: Anthony PERARD Reviewed-by: Laszlo Ersek --- Notes: v4: - fix coding style =20 v3: - patch splited from the previous one - Fix DEBUG format string, use %p for pointers. and use gEfiCallerBaseName to print module name OvmfPkg/AcpiPlatformDxe/Xen.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/OvmfPkg/AcpiPlatformDxe/Xen.c b/OvmfPkg/AcpiPlatformDxe/Xen.c index 82794b933e..f80dfe1a57 100644 --- a/OvmfPkg/AcpiPlatformDxe/Xen.c +++ b/OvmfPkg/AcpiPlatformDxe/Xen.c @@ -36,10 +36,27 @@ GetXenAcpiRsdp ( EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER *RsdpStructurePtr; UINT8 *XenAcpiPtr; UINT8 Sum; + EFI_XEN_INFO *XenInfo; =20 // // Detect the RSDP structure // + + // + // First look for PVH one + // + XenInfo =3D XenGetInfoHOB (); + ASSERT (XenInfo !=3D NULL); + if (XenInfo->RsdpPvh !=3D NULL) { + DEBUG ((DEBUG_INFO, "%a: Use ACPI RSDP table at 0x%p\n", + gEfiCallerBaseName, XenInfo->RsdpPvh)); + *RsdpPtr =3D XenInfo->RsdpPvh; + return EFI_SUCCESS; + } + + // + // Otherwise, look for the HVM one + // for (XenAcpiPtr =3D (UINT8*)(UINTN) XEN_ACPI_PHYSICAL_ADDRESS; XenAcpiPtr < (UINT8*)(UINTN) XEN_BIOS_PHYSICAL_END; XenAcpiPtr +=3D 0x10) { --=20 Anthony PERARD -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45537): https://edk2.groups.io/g/devel/message/45537 Mute This Topic: https://groups.io/mt/32851681/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Nov 14 05:47:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1565697545; cv=none; d=zoho.com; s=zohoarc; b=DPmhnniAuHacPZKaxRJEmJ7NONJbUcLxB8mAXMNN0jHYGOLyTpTt1xcbqlgANbB0N+PPti2TRD54q3eHVnV8f0HQUC2M2/Ml3oRUYETX9gLx2Z/GpDYsKSwJUkmhBEWgXuNjtSm/CM8iJv74+aMnjme610Dn8cXnkOUlDYxdFNs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565697545; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Q9QUfFdomRuQuU1KmameUpY/sEeftl+vXjfz/k5mSAk=; b=RpA8GL+SK+neRaEZPKmPKO6pm7zTTQx6QJZiGRQvRllxv4UwTyjH24l3oZxhEGWQDm1yjT9vTn4x4Wc++6NgKLSchlFXdJHHRzPjEzwYDqTfxccLmuO+jAWigg9yjjInPHpLQRpY5ZUDc3Xy3sgZA+F26Gf/6PcaPoEMXb9X5xM= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 156569754597860.17498486674708; Tue, 13 Aug 2019 04:59:05 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hxVR9-0000wR-0m; Tue, 13 Aug 2019 11:57:59 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hxVR8-0000uy-DK for xen-devel@lists.xenproject.org; Tue, 13 Aug 2019 11:57:58 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 973232f8-bdc1-11e9-8946-f7793df9f4a9; Tue, 13 Aug 2019 11:57:57 +0000 (UTC) X-Inumbo-ID: 973232f8-bdc1-11e9-8946-f7793df9f4a9 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1565697477; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HE2s/I4b1Unte9Tykddj6mloowKoBYC7bC2CyfCDxf4=; b=bJDdTqMt5HfgUVu9hdR1hsBlOootK0NiKZFylFPNyZzhWegaekFBOap1 7MBetxIffwnwXn7AsWqP9ZTfActxLJ+hIWpyxi7Bm+855FonQwL+5YeKB vAuEqsTwyTUs4ZKmsvuBk9KMfe+C9jyXo2zE2ZlJZV7S66PUkn0qDgnOF o=; 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 (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; 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: ULL+6DBOBP9Yf3NwolFXgYmj/1sO1EhSK8CBe/PfYlVvySFgtCmwukBvQ5r0kKHGzWY9BJvbhZ 3rw0vrwMzibUtiavw9Il/cTAFNJFFgo4f/77S6IG94+Wy60Lf65vibfbt2yzrPGB5NmBnCsSK5 5Z90u6Vr+18gsoEvEdrFskITnuwCv0xu4AyJ0/cXNbVpdWJNKAwAvkc+HaY7c3BO5uwPF/qZ/I 1rlaQzpq7VM8jNOWflGiIq7Z7MVOVHiQzEXsMN2MQ0WCWIEnZn0Du+blGTP1Bo1XGytz+kc5XY w4w= X-SBRS: 2.7 X-MesageID: 4374824 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="4374824" From: Anthony PERARD To: Date: Tue, 13 Aug 2019 12:31:00 +0100 Message-ID: <20190813113119.14804-17-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 16/35] OvmfPkg/XenHypercallLib: Enable it in PEIM 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Allow to use Xen hypercalls earlier, during the PEIM stage, but XenHypercallLibInit() must be called once the XenInfo HOB is created with the HyperPage setup. Change the return value of XenHypercallLibInit so failure can be detected when the call shouldn't fail, but still have the constructor always succeed. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1689 Signed-off-by: Anthony PERARD Reviewed-by: Laszlo Ersek --- Notes: v3: - only modify XenHypercallLib, and to the modification of XenPlatformPei in a separated patch. - Allow XenHypercallLibInit to be called outside the library instead of creating a new function, but also return failure on failure, and have a new constructor that never fail. .../Library/XenHypercallLib/XenHypercallLib.inf | 4 ++-- OvmfPkg/Include/Library/XenHypercallLib.h | 12 ++++++++++++ .../Library/XenHypercallLib/X86XenHypercall.c | 8 +------- OvmfPkg/Library/XenHypercallLib/XenHypercall.c | 16 ++++++++++++++++ 4 files changed, 31 insertions(+), 9 deletions(-) diff --git a/OvmfPkg/Library/XenHypercallLib/XenHypercallLib.inf b/OvmfPkg/= Library/XenHypercallLib/XenHypercallLib.inf index 1208f0057a..21ce5b4434 100644 --- a/OvmfPkg/Library/XenHypercallLib/XenHypercallLib.inf +++ b/OvmfPkg/Library/XenHypercallLib/XenHypercallLib.inf @@ -12,10 +12,10 @@ [Defines] FILE_GUID =3D B5EE9A32-CA5A-49A8-82E3-ADA4CCB77C7C MODULE_TYPE =3D BASE VERSION_STRING =3D 1.0 - CONSTRUCTOR =3D XenHypercallLibInit + CONSTRUCTOR =3D XenHypercallLibConstruct =20 [Defines.IA32, Defines.X64] - LIBRARY_CLASS =3D XenHypercallLib|DXE_DRIVER UEFI_DRIVER + LIBRARY_CLASS =3D XenHypercallLib|PEIM DXE_DRIVER UEFI_= DRIVER =20 [Defines.ARM, Defines.AARCH64] LIBRARY_CLASS =3D XenHypercallLib diff --git a/OvmfPkg/Include/Library/XenHypercallLib.h b/OvmfPkg/Include/Li= brary/XenHypercallLib.h index c43822782b..c1491dd652 100644 --- a/OvmfPkg/Include/Library/XenHypercallLib.h +++ b/OvmfPkg/Include/Library/XenHypercallLib.h @@ -10,6 +10,18 @@ #ifndef __XEN_HYPERCALL_LIB_H__ #define __XEN_HYPERCALL_LIB_H__ =20 +/** + To call when the gEfiXenInfoGuid HOB became available after the library = init + function has already been executed. + + This allow to make hypercall in the PEIM stage. +**/ +RETURN_STATUS +EFIAPI +XenHypercallLibInit ( + VOID + ); + /** Check if the Xen Hypercall library is able to make calls to the Xen hypervisor. diff --git a/OvmfPkg/Library/XenHypercallLib/X86XenHypercall.c b/OvmfPkg/Li= brary/XenHypercallLib/X86XenHypercall.c index 27083f924f..f779e46470 100644 --- a/OvmfPkg/Library/XenHypercallLib/X86XenHypercall.c +++ b/OvmfPkg/Library/XenHypercallLib/X86XenHypercall.c @@ -59,13 +59,7 @@ XenHypercallLibInit ( =20 GuidHob =3D GetFirstGuidHob (&gEfiXenInfoGuid); if (GuidHob =3D=3D NULL) { - // - // We don't fail library construction, since that has catastrophic - // consequences for client modules (whereas those modules may easily be - // running on a non-Xen platform). Instead, XenHypercallIsAvailable() = above - // will return FALSE. - // - return RETURN_SUCCESS; + return RETURN_NOT_FOUND; } XenInfo =3D (EFI_XEN_INFO *) GET_GUID_HOB_DATA (GuidHob); HyperPage =3D XenInfo->HyperPages; diff --git a/OvmfPkg/Library/XenHypercallLib/XenHypercall.c b/OvmfPkg/Libra= ry/XenHypercallLib/XenHypercall.c index a2c41a2a69..d4fa802743 100644 --- a/OvmfPkg/Library/XenHypercallLib/XenHypercall.c +++ b/OvmfPkg/Library/XenHypercallLib/XenHypercall.c @@ -15,6 +15,22 @@ #include #include =20 +RETURN_STATUS +EFIAPI +XenHypercallLibConstruct ( + VOID + ) +{ + XenHypercallLibInit (); + // + // We don't fail library construction, since that has catastrophic + // consequences for client modules (whereas those modules may easily be + // running on a non-Xen platform). Instead, XenHypercallIsAvailable() + // will return FALSE. + // + return RETURN_SUCCESS; +} + UINT64 EFIAPI XenHypercallHvmGetParam ( --=20 Anthony PERARD _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Thu Nov 14 05:47:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45558+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1565697510; cv=none; d=zoho.com; s=zohoarc; b=YIYjLwsRD/v8RQCx1Nt3mvBYc++dvNifbGd4pNdNYRdsJXtoxY0nQIopDN9CLotMil40TW9Sz8IN87D4iHz6zlZXCw2ezQFvUPUXNlxXOXoo8SXO8Q9B3KsFxuF/3+W8+mKz3SfE8jH2541AaAqsHNRcJRh3LoP5w+n9gL4Ce4I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565697510; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=q4ahNYZAo5o79Jw49u1Br9Iqn39Ot5s2b66ggsUqgdk=; b=TIODlSLm37TA3RI5MTSkEDTJo+8Td82x2Hn/cHlFWKHRycpsRBxP/pRMg2MasIyFYtkbInUK5YKZq2NFbTJjxiXcqGvaSaVNSpW7mXSn7Lq2cMITC1Q5viixie7kuQ7IHYxe9ASfVPy4lcJpSScKVeRLYss8xqoH158sAU+Gigs= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45558+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1565697510010446.28018686045016; Tue, 13 Aug 2019 04:58:30 -0700 (PDT) Return-Path: X-Received: from esa4.hc3370-68.iphmx.com (esa4.hc3370-68.iphmx.com [216.71.155.144]) by groups.io with SMTP; Tue, 13 Aug 2019 04:58:29 -0700 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45558+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: None (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.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=esa4.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 (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: c9dKx3rlE0ig9P9rBp9ypO7aAfDLnkrtR1mabr16OHaDweclFuvWSzSyyqwgSFaVWM9ybkyw3Q FHoZnvwo94aVT2k4wGDVU50gQzVeLBxK3fgQLpDsa6r+4kpUCe/77A4Wp2xKkVMZsjAXvKTKjV gkHIAFXuLaGG4lK1vh2zwK3hgU4iI7mEVoC8bm0/Fcslj6ZIy0LXmOwG5w953GQzNT16AkzDYm YuDOxxxjYlpTaBIiRnQzAGVdvi0AGLGdjBEh3gUekTSQVSwX+xmJHBtaCtiy4pvry78B5mN9wp IU0= X-SBRS: 2.7 X-MesageID: 4402045 X-Ironport-Server: esa4.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="4402045" From: "Anthony PERARD" To: CC: Laszlo Ersek , Jordan Justen , Julien Grall , , Ard Biesheuvel , Anthony PERARD Subject: [edk2-devel] [PATCH v5 17/35] OvmfPkg/XenPlatformPei: Reinit XenHypercallLib Date: Tue, 13 Aug 2019 12:31:01 +0100 Message-ID: <20190813113119.14804-18-anthony.perard@citrix.com> In-Reply-To: <20190813113119.14804-1-anthony.perard@citrix.com> References: <20190813113119.14804-1-anthony.perard@citrix.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,anthony.perard@citrix.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565697509; bh=q4ahNYZAo5o79Jw49u1Br9Iqn39Ot5s2b66ggsUqgdk=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=ezLuDySX+dvO57oKrQaNJbcG2x0p7B1MlyZaGYjWikVxv4zg0ucxVzrFFskdauMub3O 2zeL5e0mYWmiskW+lO0nj+hkqw3xGYypTce0h4s4FllXCmBK7DD14v91XRFAJt6Ky6beb ihNNSlSiycyndFra4ofCJmSzLVmwiVj2xNk= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" The XenPlatformPei needs to make hypercalls, but the XenHypercallLib was initialised before the HyperPage was ready. Now that XenPlatformPei has initialised the HyperPage, reinitialise the XenHypercallLib. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1689 Signed-off-by: Anthony PERARD Reviewed-by: Laszlo Ersek --- Notes: v3: - new patch split from XenHypercallLib: Enable it in PEIM. - check for Lib initialisation failure. OvmfPkg/XenPlatformPei/XenPlatformPei.inf | 1 + OvmfPkg/XenPlatformPei/Xen.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/OvmfPkg/XenPlatformPei/XenPlatformPei.inf b/OvmfPkg/XenPlatfor= mPei/XenPlatformPei.inf index 4d00206d09..0ef77db92c 100644 --- a/OvmfPkg/XenPlatformPei/XenPlatformPei.inf +++ b/OvmfPkg/XenPlatformPei/XenPlatformPei.inf @@ -59,6 +59,7 @@ [LibraryClasses] MtrrLib MemEncryptSevLib PcdLib + XenHypercallLib =20 [Pcd] gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvBase diff --git a/OvmfPkg/XenPlatformPei/Xen.c b/OvmfPkg/XenPlatformPei/Xen.c index b366139a0a..c67f4c9697 100644 --- a/OvmfPkg/XenPlatformPei/Xen.c +++ b/OvmfPkg/XenPlatformPei/Xen.c @@ -26,6 +26,7 @@ #include #include #include +#include =20 #include "Platform.h" #include "Xen.h" @@ -88,6 +89,7 @@ XenConnect ( EFI_XEN_OVMF_INFO *Info; CHAR8 Sig[sizeof (Info->Signature) + 1]; UINT32 *PVHResetVectorData; + RETURN_STATUS Status; =20 AsmCpuid (XenLeaf + 2, &TransferPages, &TransferReg, NULL, NULL); mXenInfo.HyperPages =3D AllocatePages (TransferPages); @@ -152,6 +154,13 @@ XenConnect ( sizeof(mXenInfo) ); =20 + // + // Initialize the XenHypercall library, now that the XenInfo HOB is + // available + // + Status =3D XenHypercallLibInit (); + ASSERT_RETURN_ERROR (Status); + return EFI_SUCCESS; } =20 --=20 Anthony PERARD -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45558): https://edk2.groups.io/g/devel/message/45558 Mute This Topic: https://groups.io/mt/32851706/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Nov 14 05:47:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45541+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1565697473; cv=none; d=zoho.com; s=zohoarc; b=Z4na1HhuwBqP+IF+tK76fe1BzgWJ5WhYqwlzG8PLVmKeGXC6LLkCvwpxqmTf6t4FdUzRjzDg0zGUwl/rkps+UTEazW1k5wgaCPoGAPBaETJQc2CQq7HQZMFHfBEjXvdQ7Mbqvvgq+6Eo6/BC1ew/zaJWy5JwmxUuv9gmSaUVuhY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565697473; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=DzfXn6a4H6s4KLnH/1Q0jOMr/mzCwQmbAFuGEoV83mw=; b=YQk3NWMWoqkMkwoyatCUyEK9eycuMhZf8osQwAHEfrHtpQu8C/2y7FxlY7v/yZf4FP2OmUATCGPQzZWU5l1FSCGv3czbGbuDpo2HTqzO36GsnqdkuK7BEsdbSinw7sXFKzviCcEyc7lI1EFocmpCaCTF4h6ywWEb5B20gD7c9Ao= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45541+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1565697473301104.41793492056172; Tue, 13 Aug 2019 04:57:53 -0700 (PDT) Return-Path: X-Received: from esa4.hc3370-68.iphmx.com (esa4.hc3370-68.iphmx.com []) by groups.io with SMTP; Tue, 13 Aug 2019 04:57:52 -0700 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45541+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: None (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.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=esa4.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 (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: vOBcRdsoYEIymEIL4/8J1SDF4tO0ZuOmoJiIv6mDtn6kuyOm6lj+SfesWiyoQvZZCKC4aZStnT rJWjhMNcxnsb9plYpJ7uL1WdQm7HllEBRzpGc1WZEwoeD97e2WZ9BIzvS9/Zu8sfRlLUC3bB4H yijsAA4yv/DBrI6QhybFGXtAKUJ4XRa3Umb/i7g6urGLPjaxdceR5CesX4Bor7CpyAXR8d3ND+ GIU1F5GEOhF7lGrl/X5C87yJ0CJu+E6GdG26ywXaHgCcjsJon9kcn2N+G4IJkP72fFJCj5IVwi TLM= X-SBRS: 2.7 X-MesageID: 4402021 X-Ironport-Server: esa4.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="4402021" From: "Anthony PERARD" To: CC: Laszlo Ersek , Jordan Justen , Julien Grall , , Ard Biesheuvel , Anthony PERARD Subject: [edk2-devel] [PATCH v5 18/35] OvmfPkg/XenPlatformPei: Introduce XenHvmloaderDetected Date: Tue, 13 Aug 2019 12:31:02 +0100 Message-ID: <20190813113119.14804-19-anthony.perard@citrix.com> In-Reply-To: <20190813113119.14804-1-anthony.perard@citrix.com> References: <20190813113119.14804-1-anthony.perard@citrix.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,anthony.perard@citrix.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565697472; bh=DzfXn6a4H6s4KLnH/1Q0jOMr/mzCwQmbAFuGEoV83mw=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=ekzsK/YxMB1rKUxOZz94PXxns48KPpjMabMQGXAl+RpEWGqsAQdOMWPbbBU8oONDlOu rTt1R1D1MPp/6/2FsLeYkeBDFZHWM+QZ4LGseaoeusNVSirzbofuyE//0LSmMoZjCqPo9 d8EomBI7+LpMXG3ODkcXpamVs8912IxjdLQ= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" This new XenHvmloaderDetected() return true if the hvmloader firmware has runned before OVMF. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1689 Signed-off-by: Anthony PERARD Acked-by: Laszlo Ersek --- Notes: v3: - Added one sentence in the commit message. OvmfPkg/XenPlatformPei/Platform.h | 5 +++++ OvmfPkg/XenPlatformPei/Xen.c | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/OvmfPkg/XenPlatformPei/Platform.h b/OvmfPkg/XenPlatformPei/Pla= tform.h index 77427496c0..925df31f88 100644 --- a/OvmfPkg/XenPlatformPei/Platform.h +++ b/OvmfPkg/XenPlatformPei/Platform.h @@ -89,6 +89,11 @@ XenDetect ( VOID ); =20 +BOOLEAN +XenHvmloaderDetected ( + VOID + ); + VOID AmdSevInitialize ( VOID diff --git a/OvmfPkg/XenPlatformPei/Xen.c b/OvmfPkg/XenPlatformPei/Xen.c index c67f4c9697..2105304c41 100644 --- a/OvmfPkg/XenPlatformPei/Xen.c +++ b/OvmfPkg/XenPlatformPei/Xen.c @@ -199,6 +199,13 @@ XenDetect ( return FALSE; } =20 +BOOLEAN +XenHvmloaderDetected ( + VOID + ) +{ + return (mXenHvmloaderInfo !=3D NULL); +} =20 VOID XenPublishRamRegions ( --=20 Anthony PERARD -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45541): https://edk2.groups.io/g/devel/message/45541 Mute This Topic: https://groups.io/mt/32851685/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Nov 14 05:47:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45555+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1565697501; cv=none; d=zoho.com; s=zohoarc; b=WY1MGqWXbXLgqtADfeLEaT0Ltuh8JR8pIwj0XEobtnDoouslBtNYi00OikZJAhQl+GHunTjfp3yqNTKpRN9WM97i2NNTcLb4eFfBvBIHdBXp3ojTbOiOSYY1kcQEFWHl6J0/WJXbnbjqF9zpMoe6YwVAHEN51MFgULP5YVjYPRo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565697501; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=+19/sUf2tU1aTjaMdNp+8Tf1VddqcavpX94lPn/doT8=; b=cFIZ+wJurs1XfBDzh5bPYauCKI754esOmY7QCoNWbHjVzNC1FMHP+2WOGR84ItCVOl7hAgRttAO1jUAvGvqxHi9ge1HbjfjcaFbVFB8GCO4McKNsjJebA+i/WKyEZ2ouUrfvQG6KdeWbl77U7uzcQeBRajf4p3x+jyfCL3q/Mms= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45555+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1565697501672812.3706883980049; Tue, 13 Aug 2019 04:58:21 -0700 (PDT) Return-Path: X-Received: from esa6.hc3370-68.iphmx.com (esa6.hc3370-68.iphmx.com [216.71.155.175]) by groups.io with SMTP; Tue, 13 Aug 2019 04:58:20 -0700 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45555+1787277+3901457@groups.io; helo=web01.groups.io; 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: H6T5xgy/h6VB28fOoYPAT1wRPhfDBPKDEzOS6yThpMpwCUFvNBGf/cK5JyRTyGmIziuv4xBP7e 8t/nVqBoLA/L7b8KwachBcRoEzEh25ujRPNUVLNbadWhpDOYNDxlldexhbOCLeFfSOlUXIazPp 6Gm1KernZROmlVTJhWrcCNLoUrwDCABkwDSM0ZEFI6BDxY8ZRqLXDwwhTPmdTR6iVJwdXmWHBV p7A0ASTSiS3d9PtoZsr0RvuMQUrdc+kYgrbiWGRNdNbAWtZUf/Ec+j9a6IpdTmaF9nb9rkHrB8 FNo= X-SBRS: 2.7 X-MesageID: 4374842 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="4374842" From: "Anthony PERARD" To: CC: Laszlo Ersek , Jordan Justen , Julien Grall , , Ard Biesheuvel , Anthony PERARD Subject: [edk2-devel] [PATCH v5 19/35] OvmfPkg/XenPlatformPei: Setup HyperPages earlier Date: Tue, 13 Aug 2019 12:31:03 +0100 Message-ID: <20190813113119.14804-20-anthony.perard@citrix.com> In-Reply-To: <20190813113119.14804-1-anthony.perard@citrix.com> References: <20190813113119.14804-1-anthony.perard@citrix.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,anthony.perard@citrix.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565697501; bh=+19/sUf2tU1aTjaMdNp+8Tf1VddqcavpX94lPn/doT8=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=neesQh8py+vaP2urC1/nXntrvDWDh12xUE1xbmzUDhYUmqaw1IdrPH8B9QXOog/JK4x bPlrj88mUeOgvJayeodFKUx93Oz1H3JAPRBMCcYixyF6BQtWZU+cUKg/GhINHIYK21AVq VR2EPcBB54lbYz6WI6BEVf5OEhux2Dt7wrA= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" We are going to need to make an hypercall in order to retreive the E820 table from the hypervisor before been able to setup the memory. Calling XenConnect earlier will allow to setup the XenHypercallLib earlier to allow to make hypercalls. While here, add some comments in XenConnect(). Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1689 Signed-off-by: Anthony PERARD Acked-by: Laszlo Ersek --- OvmfPkg/XenPlatformPei/Platform.h | 5 +++++ OvmfPkg/XenPlatformPei/Platform.c | 2 ++ OvmfPkg/XenPlatformPei/Xen.c | 23 ++++++++++++----------- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/OvmfPkg/XenPlatformPei/Platform.h b/OvmfPkg/XenPlatformPei/Pla= tform.h index 925df31f88..4a80057bdc 100644 --- a/OvmfPkg/XenPlatformPei/Platform.h +++ b/OvmfPkg/XenPlatformPei/Platform.h @@ -79,6 +79,11 @@ InstallClearCacheCallback ( VOID ); =20 +EFI_STATUS +XenConnect ( + VOID + ); + EFI_STATUS InitializeXen ( VOID diff --git a/OvmfPkg/XenPlatformPei/Platform.c b/OvmfPkg/XenPlatformPei/Pla= tform.c index 5809eadb0b..6aaafc3ee9 100644 --- a/OvmfPkg/XenPlatformPei/Platform.c +++ b/OvmfPkg/XenPlatformPei/Platform.c @@ -416,6 +416,8 @@ InitializeXenPlatform ( CpuDeadLoop (); } =20 + XenConnect (); + BootModeInitialization (); AddressWidthInitialization (); =20 diff --git a/OvmfPkg/XenPlatformPei/Xen.c b/OvmfPkg/XenPlatformPei/Xen.c index 2105304c41..29b42b746c 100644 --- a/OvmfPkg/XenPlatformPei/Xen.c +++ b/OvmfPkg/XenPlatformPei/Xen.c @@ -72,14 +72,11 @@ XenGetE820Map ( /** Connects to the Hypervisor. =20 - @param XenLeaf CPUID index used to connect. - @return EFI_STATUS =20 **/ EFI_STATUS XenConnect ( - UINT32 XenLeaf ) { UINT32 Index; @@ -91,7 +88,13 @@ XenConnect ( UINT32 *PVHResetVectorData; RETURN_STATUS Status; =20 - AsmCpuid (XenLeaf + 2, &TransferPages, &TransferReg, NULL, NULL); + ASSERT (mXenLeaf !=3D 0); + + // + // Prepare HyperPages to be able to make hypercalls + // + + AsmCpuid (mXenLeaf + 2, &TransferPages, &TransferReg, NULL, NULL); mXenInfo.HyperPages =3D AllocatePages (TransferPages); if (!mXenInfo.HyperPages) { return EFI_OUT_OF_RESOURCES; @@ -103,7 +106,11 @@ XenConnect ( (Index << EFI_PAGE_SHIFT) + Index); } =20 - AsmCpuid (XenLeaf + 1, &XenVersion, NULL, NULL, NULL); + // + // Find out the Xen version + // + + AsmCpuid (mXenLeaf + 1, &XenVersion, NULL, NULL, NULL); DEBUG ((DEBUG_ERROR, "Detected Xen version %d.%d\n", XenVersion >> 16, XenVersion & 0xFFFF)); mXenInfo.VersionMajor =3D (UINT16)(XenVersion >> 16); @@ -262,12 +269,6 @@ InitializeXen ( { RETURN_STATUS PcdStatus; =20 - if (mXenLeaf =3D=3D 0) { - return EFI_NOT_FOUND; - } - - XenConnect (mXenLeaf); - // // Reserve away HVMLOADER reserved memory [0xFC000000,0xFD000000). // This needs to match HVMLOADER RESERVED_MEMBASE/RESERVED_MEMSIZE. --=20 Anthony PERARD -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45555): https://edk2.groups.io/g/devel/message/45555 Mute This Topic: https://groups.io/mt/32851703/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Nov 14 05:47:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45560+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1565697512; cv=none; d=zoho.com; s=zohoarc; b=RzO+Fjb899vsNDI0AeVgwkIK6pF6V23LPBE+WoTHAO2oxVNM6VX/88vaumtfqUFEq7T2nrJJ33k+3T5ok6D/MqVmwucjDGH2gYv6SFP0t89/BHOUKOGG45Qwdx58mOFF9jp4gClXXKcA9SiUo1cyy0e3mxSWwCLNcgFr5G0Qnbg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565697512; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=JnLQZY4k2D6kHokGzmI9TWaMcEuqpz6OZTCrcsrHtac=; b=eTQUbhpWHxkKKCtx1/249fyjHRKvf9u0qt4++BWJ+Cdl9oPO5TjQdB6dAgRFj9msNZUeGLTzDvg/wPD6sFpY+rXyr+UpEtQKTCyXWMHK8AB9TAdhNK4PFYhb7I0jlhp2bT/5FVkxXryYX/aAFsutgUVMHyXIqiuDFykx8acSwvo= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45560+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1565697512455894.4837292149958; Tue, 13 Aug 2019 04:58:32 -0700 (PDT) Return-Path: X-Received: from esa3.hc3370-68.iphmx.com (esa3.hc3370-68.iphmx.com [216.71.145.155]) by groups.io with SMTP; Tue, 13 Aug 2019 04:58:31 -0700 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45560+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: None (esa3.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=esa3.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa3.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=esa3.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 (esa3.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=esa3.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: p9p0LnWBoAgODO0cxwFEMiklYQURe8f5Wmfyxxg/Pipp9LNrW864t7Y4R6P1GraBpQ3zaL0UGP h1J0Y0LFO+hLDPxBtgZL5006w8l1d1Zz6dwB8aZEHMzPhxy1hNCTRQ8Ht0nxuQe9eIGiIRqkSI 98PUsjB6/u+R9UVoDb8sC+WixZ/lNMFjGzJy3+TgCCR7Wo0z1srRbJL2dusF23fHpI1ppymCls tZOqZ3TplQYuvtyVKA8TPxi2Ll7cJ4wof1pC5N0X6IJYgQOar1qmEPeoLywM5RK6npb0WkbdRB rwc= X-SBRS: 2.7 X-MesageID: 4210855 X-Ironport-Server: esa3.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="4210855" From: "Anthony PERARD" To: CC: Laszlo Ersek , Jordan Justen , Julien Grall , , Ard Biesheuvel , Anthony PERARD Subject: [edk2-devel] [PATCH v5 20/35] OvmfPkg/XenPlatformPei: Introduce XenPvhDetected Date: Tue, 13 Aug 2019 12:31:04 +0100 Message-ID: <20190813113119.14804-21-anthony.perard@citrix.com> In-Reply-To: <20190813113119.14804-1-anthony.perard@citrix.com> References: <20190813113119.14804-1-anthony.perard@citrix.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,anthony.perard@citrix.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565697512; bh=JnLQZY4k2D6kHokGzmI9TWaMcEuqpz6OZTCrcsrHtac=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=XnrE9T/1GpesvWHsdBswg9bOpcWkVzpM08YhqA0jclyffC+5CyaqzYaXJvJ5us/osmG I7l2tVfgFY69QnGlc8bYXhng1nSKuAn7AA6/hoJTibr3DDFFNgKycK3+TBHuxIMETHsIE 9vjn5Epopsw3UveCfoNFLNlRTyZB6x6WOso= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" XenPvhDetected() can be used to figure out if OVMF has started via the Xen PVH entry point. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1689 Signed-off-by: Anthony PERARD Acked-by: Laszlo Ersek --- Notes: v5: - in XenPvhDetected, check mXenInfo.HyperPages instead of .VersionMajor OvmfPkg/XenPlatformPei/Platform.h | 5 +++++ OvmfPkg/XenPlatformPei/Xen.c | 13 +++++++++++++ 2 files changed, 18 insertions(+) diff --git a/OvmfPkg/XenPlatformPei/Platform.h b/OvmfPkg/XenPlatformPei/Pla= tform.h index 4a80057bdc..db9a62572f 100644 --- a/OvmfPkg/XenPlatformPei/Platform.h +++ b/OvmfPkg/XenPlatformPei/Platform.h @@ -99,6 +99,11 @@ XenHvmloaderDetected ( VOID ); =20 +BOOLEAN +XenPvhDetected ( + VOID + ); + VOID AmdSevInitialize ( VOID diff --git a/OvmfPkg/XenPlatformPei/Xen.c b/OvmfPkg/XenPlatformPei/Xen.c index 29b42b746c..f26f0e56dd 100644 --- a/OvmfPkg/XenPlatformPei/Xen.c +++ b/OvmfPkg/XenPlatformPei/Xen.c @@ -214,6 +214,19 @@ XenHvmloaderDetected ( return (mXenHvmloaderInfo !=3D NULL); } =20 +BOOLEAN +XenPvhDetected ( + VOID + ) +{ + // + // This function should only be used after XenConnect + // + ASSERT (mXenInfo.HyperPages !=3D NULL); + + return mXenHvmloaderInfo =3D=3D NULL; +} + VOID XenPublishRamRegions ( VOID --=20 Anthony PERARD -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45560): https://edk2.groups.io/g/devel/message/45560 Mute This Topic: https://groups.io/mt/32851708/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Nov 14 05:47:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45554+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1565697495; cv=none; d=zoho.com; s=zohoarc; b=Nwt1tpx9qK++XohX6mj0f1+5HuBusIR3SftKwQwg+V8Cb6g//wmPHeeTGPuxS1TMdS29f6v28+VdgHD1xyCalikQ/JeVQmB8Nyv8t2lPgknPXSJHV1le6OfFmHdM1T57HIcIjFbMrLkqmfOUGXK6QBrs1xjmjV/SfLXZSUaxKAk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565697495; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=7EHCHd4cJRzwXh8Aox8ZknBWiXS61n9jqqRCGkxSOOs=; b=Ik115Ken3SEBySxDv6uTwUHt7M518AYam66uFaqGdiO/gtF77ohAhr5J3c2FxMMDaYdcKS8QzV+K/Bx8lYmNuUrQYWFhIYb54lDgdVnagK3miNBcS+QlPko+nTjXtlW3h052bcL5iF5xKItxgIQd2rWMbmu+m0BU7/3ky3Utaf0= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45554+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1565697495100848.7366578325663; Tue, 13 Aug 2019 04:58:15 -0700 (PDT) Return-Path: X-Received: from esa1.hc3370-68.iphmx.com (esa1.hc3370-68.iphmx.com [216.71.145.142]) by groups.io with SMTP; Tue, 13 Aug 2019 04:58:14 -0700 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45554+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: None (esa1.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=esa1.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.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=esa1.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 (esa1.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=esa1.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: GMvXREy0Oo1jPkAYjbwAW1n3MU6nv7bCEX8gq/Uoz7xZQG152unI7QOhFTjZyn8P1gCjtToUQX rFaxPz4XKlbKdmKagB4eamy3XtbodfzQWGqFzVthem2FpLnwmLxWgQy5NgmIcUi6AeRBEQhqb5 aacxE3MCHXfpJqrvBDRUxGPBjxKXcZE9MBqly4DUMgjE/NooHPo+M+hAlAj5d2YzptEBxZlS/z R4gAd8pkO5xkMRfTTWCgFVLbpbnRkzr10bfhEaUpekf6seJVDtQ2Ew1OD8zsLO2I4cTaaQmedr xwM= X-SBRS: 2.7 X-MesageID: 4242249 X-Ironport-Server: esa1.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="4242249" From: "Anthony PERARD" To: CC: Laszlo Ersek , Jordan Justen , Julien Grall , , Ard Biesheuvel , Anthony PERARD Subject: [edk2-devel] [PATCH v5 21/35] OvmfPkg: Import XENMEM_memory_map hypercall to Xen/memory.h Date: Tue, 13 Aug 2019 12:31:05 +0100 Message-ID: <20190813113119.14804-22-anthony.perard@citrix.com> In-Reply-To: <20190813113119.14804-1-anthony.perard@citrix.com> References: <20190813113119.14804-1-anthony.perard@citrix.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,anthony.perard@citrix.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565697494; bh=7EHCHd4cJRzwXh8Aox8ZknBWiXS61n9jqqRCGkxSOOs=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=ulva9bRzmO5xf+J++0OOn0lmGNNRlyTW3Y0uo/GRibJuOoDGZe+MmwBwfxFRwmMfshf Q/XZ/iRPqm/dTNq7w2ftSuPYeaoJQFMorJh3R+C8T6Smo8Y4aZ9M5ZU3Gdz8YrXb083jl 7QWWWAr6yq3XVDHSSZF9z476x2nKD372huM= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" The informations to make a XENMEM_memory_map hypercall is copied over from the public header of the Xen Project, with the type name modified to build on OVMF. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1689 Signed-off-by: Anthony PERARD Acked-by: Laszlo Ersek --- Notes: v3: - expanded the "This" that was starting the commit message body. OvmfPkg/Include/IndustryStandard/Xen/memory.h | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/OvmfPkg/Include/IndustryStandard/Xen/memory.h b/OvmfPkg/Includ= e/IndustryStandard/Xen/memory.h index 81e981331a..4a33a26d4e 100644 --- a/OvmfPkg/Include/IndustryStandard/Xen/memory.h +++ b/OvmfPkg/Include/IndustryStandard/Xen/memory.h @@ -65,6 +65,29 @@ struct xen_remove_from_physmap { typedef struct xen_remove_from_physmap xen_remove_from_physmap_t; DEFINE_XEN_GUEST_HANDLE(xen_remove_from_physmap_t); =20 +/* + * Returns the pseudo-physical memory map as it was when the domain + * was started (specified by XENMEM_set_memory_map). + * arg =3D=3D addr of xen_memory_map_t. + */ +#define XENMEM_memory_map 9 +struct xen_memory_map { + /* + * On call the number of entries which can be stored in buffer. On + * return the number of entries which have been stored in + * buffer. + */ + UINT32 nr_entries; + + /* + * Entries in the buffer are in the same format as returned by the + * BIOS INT 0x15 EAX=3D0xE820 call. + */ + XEN_GUEST_HANDLE(void) buffer; +}; +typedef struct xen_memory_map xen_memory_map_t; +DEFINE_XEN_GUEST_HANDLE(xen_memory_map_t); + #endif /* __XEN_PUBLIC_MEMORY_H__ */ =20 /* --=20 Anthony PERARD -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45554): https://edk2.groups.io/g/devel/message/45554 Mute This Topic: https://groups.io/mt/32851702/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Nov 14 05:47:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45547+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1565697486; cv=none; d=zoho.com; s=zohoarc; b=DejaRWRqQsxNwVWacDydqyeoCR/vwpVgAMaxThDdqAMGSN/FMFaV/0DwAsh3DlCLb1DIQzzEWEh1TLmMdMuLN5sQ7QfwLrYTEJU9xN3IxmywL3nBLrfqoGhtpEI/wF7JHtsbx43zF/n3mFB+hkZlMhu4D9vGO2geHiY8wRiq56U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565697486; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=cpNEIGiEmWK9bel16f+q26Hxxg0KmNgxTKcDmVAnQIE=; b=VevyQqEKb0C5TG4hQ3wRuupfTGuoRpCmpESJLlJtZMnaBQ7m7QkHpXxVLJgVZO12HBk1kKQ71k7WRtYW2n7r2FYNosG4U4tCYgpePwtDz3csFXwoTEb0475i5LElxmCL+YPQathyzMR2WviS8XliLg1Ak0H9ANhg2LxugRg518w= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45547+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1565697486428854.5798584973878; Tue, 13 Aug 2019 04:58:06 -0700 (PDT) Return-Path: X-Received: from esa2.hc3370-68.iphmx.com (esa2.hc3370-68.iphmx.com [216.71.145.153]) by groups.io with SMTP; Tue, 13 Aug 2019 04:58:05 -0700 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45547+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: None (esa2.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=esa2.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa2.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=esa2.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 (esa2.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=esa2.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: v/mVwBaGG/mQEs/xWzpqEWzCH58rjRfN8J84LjSayZ/RX3cxIug+Px/k+PvhRczyDrtLFhTmEA T/FQNz2cF39384NGV0y0hVlvqRQ7EVlCUkvhtsVLII8O6OiISZvKJwWbX9tCM3Sqx44eIR9JyJ vCFs7TuWFa/YIiXMO6XIAJOXKzgvz7R8MLm5AN3DNDvM2vB5mOGKucYLo7ZUkuH5q76DHW9eyi nBs5wxEV2a5aszVkDUZm24QySdGL+YsvUFBTaPH8wQJfJDDx8pinbKR/y0LRPyjxge+XTUlwvW B/c= X-SBRS: 2.7 X-MesageID: 4198441 X-Ironport-Server: esa2.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="4198441" From: "Anthony PERARD" To: CC: Laszlo Ersek , Jordan Justen , Julien Grall , , Ard Biesheuvel , Anthony PERARD Subject: [edk2-devel] [PATCH v5 22/35] OvmfPkg/XenPlatformPei: no hvmloader: get the E820 table via hypercall Date: Tue, 13 Aug 2019 12:31:06 +0100 Message-ID: <20190813113119.14804-23-anthony.perard@citrix.com> In-Reply-To: <20190813113119.14804-1-anthony.perard@citrix.com> References: <20190813113119.14804-1-anthony.perard@citrix.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,anthony.perard@citrix.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565697486; bh=cpNEIGiEmWK9bel16f+q26Hxxg0KmNgxTKcDmVAnQIE=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=bHjxmJI+eEaOzgCGZWb0BmlyfogcWjeFdB4Z3A9XWWNJR8hn2EfXBUkYxcuGOAi4OQW JOdssb0q+bZFzqkby9dWGSpfmHExtOBsZZGLd+OAPYqz76TjIndWVG8kzMYDKTWe96cDz 2PKYAtULGEE+HX7LCYxebKoNQHFGekqwo1c= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" When the Xen PVH entry point has been used, hvmloader hasn't run and hasn't prepared an E820 table. The only way left to get an E820 table is to ask Xen via an hypercall. We keep the result cached to avoid making a second hypercall which would give the same result. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1689 Signed-off-by: Anthony PERARD Acked-by: Laszlo Ersek --- Notes: v5: - fix commit message, the hypercall *can* be made several time, but we still cache the result. =20 v3: - fix commit message - add 'm' prefix to the global variables and make them static OvmfPkg/XenPlatformPei/Xen.c | 46 +++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/OvmfPkg/XenPlatformPei/Xen.c b/OvmfPkg/XenPlatformPei/Xen.c index f26f0e56dd..72f6f37b46 100644 --- a/OvmfPkg/XenPlatformPei/Xen.c +++ b/OvmfPkg/XenPlatformPei/Xen.c @@ -27,6 +27,7 @@ #include #include #include +#include =20 #include "Platform.h" #include "Xen.h" @@ -40,6 +41,8 @@ EFI_XEN_INFO mXenInfo; // Only the E820 table is used by OVMF. // EFI_XEN_OVMF_INFO *mXenHvmloaderInfo; +STATIC EFI_E820_ENTRY64 mE820Entries[128]; +STATIC UINT32 mE820EntriesCount; =20 /** Returns E820 map provided by Xen @@ -55,6 +58,12 @@ XenGetE820Map ( UINT32 *Count ) { + INTN ReturnCode; + xen_memory_map_t Parameters; + UINTN LoopIndex; + UINTN Index; + EFI_E820_ENTRY64 TmpEntry; + // // Get E820 produced by hvmloader // @@ -66,7 +75,42 @@ XenGetE820Map ( return EFI_SUCCESS; } =20 - return EFI_NOT_FOUND; + // + // Otherwise, get the E820 table from the Xen hypervisor + // + + if (mE820EntriesCount > 0) { + *Entries =3D mE820Entries; + *Count =3D mE820EntriesCount; + return EFI_SUCCESS; + } + + Parameters.nr_entries =3D 128; + set_xen_guest_handle (Parameters.buffer, mE820Entries); + + // Returns a errno + ReturnCode =3D XenHypercallMemoryOp (XENMEM_memory_map, &Parameters); + ASSERT (ReturnCode =3D=3D 0); + + mE820EntriesCount =3D Parameters.nr_entries; + + // + // Sort E820 entries + // + for (LoopIndex =3D 1; LoopIndex < mE820EntriesCount; LoopIndex++) { + for (Index =3D LoopIndex; Index < mE820EntriesCount; Index++) { + if (mE820Entries[Index - 1].BaseAddr > mE820Entries[Index].BaseAddr)= { + TmpEntry =3D mE820Entries[Index]; + mE820Entries[Index] =3D mE820Entries[Index - 1]; + mE820Entries[Index - 1] =3D TmpEntry; + } + } + } + + *Count =3D mE820EntriesCount; + *Entries =3D mE820Entries; + + return EFI_SUCCESS; } =20 /** --=20 Anthony PERARD -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45547): https://edk2.groups.io/g/devel/message/45547 Mute This Topic: https://groups.io/mt/32851694/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Nov 14 05:47:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1565697576; cv=none; d=zoho.com; s=zohoarc; b=KD/XhaJ/DTokSLt9cb0+wswid3Op+nZxLWjaHhPfvYzp7PuEsFFAw8o+5OtZLKZUQi/fKlbtCg7ZAtDVTEz+Ic11q9dEfHlEw6klHFjmkF5LdmKv5DYaUQWX7hXSJVt6M1upOXV97hF40CqRfSOMN6G28dSxOQwXZZ/tPkigbxs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565697576; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=aNJPWj1NLEEISydCOeG3WiDTStd4DRhW9jR7DqW1TcE=; b=js/2Q5TPQ2hhAJji7Mj2zfZSq0DzPG8gDx9ZCs5SmZNaUFn/FJEHw9raNfd5c6VxRWre/dszoCEXSwmBT5P3ltQXXLLksb1sMIZw/8ytCZyBQV6NbUrIFE9ukFAdMNHdCAj3MHHmi0E/+aWlTSQvczELKb+gUm5w99KJHSkN2rQ= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1565697576825970.1428125517622; Tue, 13 Aug 2019 04:59:36 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hxVRv-00022K-NC; Tue, 13 Aug 2019 11:58:47 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hxVRu-00020O-DJ for xen-devel@lists.xenproject.org; Tue, 13 Aug 2019 11:58:46 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id b36b873a-bdc1-11e9-a88d-1f9cc3d11dae; Tue, 13 Aug 2019 11:58:45 +0000 (UTC) X-Inumbo-ID: b36b873a-bdc1-11e9-a88d-1f9cc3d11dae DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1565697525; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LxIWAL2otNxzMxkwpzbh1CtLvNL30mSsL6IS4d0CuVk=; b=L8VTlm6zCHNnnoZvs4erBKoLmSjFJqN0NORkJM6+jd5ISwYBN9Ypll81 I0WwoUACVXSaccmAND3o+cYeQ4Sm0VWChfrcn8BjAhIl5TclQ4ixTFcll HA6hgQfK3cg1Q+pZVw9KuRHRi+jOSetc9Oi0NdDMbds3xPSGbRlO/uFd6 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 (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; 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: JWz3jpstM9ApbuaHtI5wmMENGY14NAASH7i3+0Usdt4qhIxzCn+hPEU36eNaSNV+gkZwxgOgNr qeWOLd822YhtN+e8aLfXLY45bitGuMqJV5sPhUwoS+cbV82wQfv71PADC2ZFRh1n4Zdqg4hFUm 5U6/2E5NqwcXAeufn5zXXGcgCYu4eePzouTGhcL2VyL1YOZT4hUoMFdnJnO0TC3tWLw2qlCt1Q 1spFFD9J2bmX8wPmQ8AwDViPiohLeSPvkP7ls+rEvRpa8R8qAEgpLoI+LgjbcdOkICsCtjYhxO 6bo= X-SBRS: 2.7 X-MesageID: 4374849 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="4374849" From: Anthony PERARD To: Date: Tue, 13 Aug 2019 12:31:07 +0100 Message-ID: <20190813113119.14804-24-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 23/35] OvmfPkg/XenPlatformPei: Rework memory detection 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) When running as a Xen PVH guest, there is no CMOS to read the memory size from. Rework GetSystemMemorySize(Below|Above)4gb() so they can work without CMOS by reading the e820 table. Rework XenPublishRamRegions to also care for the reserved and ACPI entry in the e820 table. The region that was added by InitializeXen() isn't needed as that same entry is in the e820 table provided by hvmloader. MTRR settings aren't modified anymore, on HVM it's already done by hvmloader, on PVH it is supposed to have sane default. MTRR will need to be done properly but keeping what's already been done by programs that have run before OVMF will do for now. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1689 Signed-off-by: Anthony PERARD Acked-by: Laszlo Ersek --- Notes: v5: - fix coding style - fix typo in commit message - Handle all possible cases of a E820 reserved range overlapping with t= he LAPIC range. =20 v4: - some coding style - Added AddReservedMemoryRangeHob, and using it. - this patch now replace "OvmfPkg/XenPlatformPei: Reserve hvmloader's m= emory only when it has run" from v3. hvmloader have added an entry in the e820 table, there is no need for a special case. - now, everything that is in the e820 table is added to OVMF's memory map, no more skipping ACPI entries or hvmloader's reserved entries. Instead, we look for the local APIC region and avoid it if it is present in the e820. - rework commit message OvmfPkg/XenPlatformPei/Platform.h | 13 ++++++ OvmfPkg/XenPlatformPei/MemDetect.c | 69 +++++++++++++++++++++++++++ OvmfPkg/XenPlatformPei/Platform.c | 11 +++++ OvmfPkg/XenPlatformPei/Xen.c | 75 +++++++++++++++++++++--------- 4 files changed, 147 insertions(+), 21 deletions(-) diff --git a/OvmfPkg/XenPlatformPei/Platform.h b/OvmfPkg/XenPlatformPei/Pla= tform.h index db9a62572f..7661f4a8de 100644 --- a/OvmfPkg/XenPlatformPei/Platform.h +++ b/OvmfPkg/XenPlatformPei/Platform.h @@ -44,6 +44,13 @@ AddReservedMemoryBaseSizeHob ( BOOLEAN Cacheable ); =20 +VOID +AddReservedMemoryRangeHob ( + EFI_PHYSICAL_ADDRESS MemoryBase, + EFI_PHYSICAL_ADDRESS MemoryLimit, + BOOLEAN Cacheable + ); + VOID AddressWidthInitialization ( VOID @@ -114,6 +121,12 @@ XenPublishRamRegions ( VOID ); =20 +EFI_STATUS +XenGetE820Map ( + EFI_E820_ENTRY64 **Entries, + UINT32 *Count + ); + extern EFI_BOOT_MODE mBootMode; =20 extern UINT8 mPhysMemAddressWidth; diff --git a/OvmfPkg/XenPlatformPei/MemDetect.c b/OvmfPkg/XenPlatformPei/Me= mDetect.c index cf95f9c474..1f81eee407 100644 --- a/OvmfPkg/XenPlatformPei/MemDetect.c +++ b/OvmfPkg/XenPlatformPei/MemDetect.c @@ -96,6 +96,45 @@ Q35TsegMbytesInitialization ( mQ35TsegMbytes =3D ExtendedTsegMbytes; } =20 +STATIC +UINT64 +GetHighestSystemMemoryAddress ( + BOOLEAN Below4gb + ) +{ + EFI_E820_ENTRY64 *E820Map; + UINT32 E820EntriesCount; + EFI_E820_ENTRY64 *Entry; + EFI_STATUS Status; + UINT32 Loop; + UINT64 HighestAddress; + UINT64 EntryEnd; + + HighestAddress =3D 0; + + Status =3D XenGetE820Map (&E820Map, &E820EntriesCount); + ASSERT_EFI_ERROR (Status); + + for (Loop =3D 0; Loop < E820EntriesCount; Loop++) { + Entry =3D E820Map + Loop; + EntryEnd =3D Entry->BaseAddr + Entry->Length; + + if (Entry->Type =3D=3D EfiAcpiAddressRangeMemory && + EntryEnd > HighestAddress) { + + if (Below4gb && (EntryEnd <=3D BASE_4GB)) { + HighestAddress =3D EntryEnd; + } else if (!Below4gb && (EntryEnd >=3D BASE_4GB)) { + HighestAddress =3D EntryEnd; + } + } + } + + // + // Round down the end address. + // + return HighestAddress & ~(UINT64)EFI_PAGE_MASK; +} =20 UINT32 GetSystemMemorySizeBelow4gb ( @@ -105,6 +144,19 @@ GetSystemMemorySizeBelow4gb ( UINT8 Cmos0x34; UINT8 Cmos0x35; =20 + // + // In PVH case, there is no CMOS, we have to calculate the memory size + // from parsing the E820 + // + if (XenPvhDetected ()) { + UINT64 HighestAddress; + + HighestAddress =3D GetHighestSystemMemoryAddress (TRUE); + ASSERT (HighestAddress > 0 && HighestAddress <=3D BASE_4GB); + + return HighestAddress; + } + // // CMOS 0x34/0x35 specifies the system memory above 16 MB. // * CMOS(0x35) is the high byte @@ -129,6 +181,23 @@ GetSystemMemorySizeAbove4gb ( UINT32 Size; UINTN CmosIndex; =20 + // + // In PVH case, there is no CMOS, we have to calculate the memory size + // from parsing the E820 + // + if (XenPvhDetected ()) { + UINT64 HighestAddress; + + HighestAddress =3D GetHighestSystemMemoryAddress (FALSE); + ASSERT (HighestAddress =3D=3D 0 || HighestAddress >=3D BASE_4GB); + + if (HighestAddress >=3D BASE_4GB) { + HighestAddress -=3D BASE_4GB; + } + + return HighestAddress; + } + // // CMOS 0x5b-0x5d specifies the system memory above 4GB MB. // * CMOS(0x5d) is the most significant size byte diff --git a/OvmfPkg/XenPlatformPei/Platform.c b/OvmfPkg/XenPlatformPei/Pla= tform.c index 6aaafc3ee9..2f42ca6ccd 100644 --- a/OvmfPkg/XenPlatformPei/Platform.c +++ b/OvmfPkg/XenPlatformPei/Platform.c @@ -102,6 +102,17 @@ AddReservedMemoryBaseSizeHob ( ); } =20 +VOID +AddReservedMemoryRangeHob ( + EFI_PHYSICAL_ADDRESS MemoryBase, + EFI_PHYSICAL_ADDRESS MemoryLimit, + BOOLEAN Cacheable + ) +{ + AddReservedMemoryBaseSizeHob (MemoryBase, + (UINT64)(MemoryLimit - MemoryBase), Cacheable); +} + VOID AddIoMemoryRangeHob ( EFI_PHYSICAL_ADDRESS MemoryBase, diff --git a/OvmfPkg/XenPlatformPei/Xen.c b/OvmfPkg/XenPlatformPei/Xen.c index 72f6f37b46..c4506def9a 100644 --- a/OvmfPkg/XenPlatformPei/Xen.c +++ b/OvmfPkg/XenPlatformPei/Xen.c @@ -276,9 +276,14 @@ XenPublishRamRegions ( VOID ) { - EFI_E820_ENTRY64 *E820Map; - UINT32 E820EntriesCount; - EFI_STATUS Status; + EFI_E820_ENTRY64 *E820Map; + UINT32 E820EntriesCount; + EFI_STATUS Status; + EFI_E820_ENTRY64 *Entry; + UINTN Index; + UINT64 LapicBase; + UINT64 LapicEnd; + =20 DEBUG ((DEBUG_INFO, "Using memory map provided by Xen\n")); =20 @@ -287,26 +292,60 @@ XenPublishRamRegions ( // E820EntriesCount =3D 0; Status =3D XenGetE820Map (&E820Map, &E820EntriesCount); - ASSERT_EFI_ERROR (Status); =20 - if (E820EntriesCount > 0) { - EFI_E820_ENTRY64 *Entry; - UINT32 Loop; + LapicBase =3D PcdGet32 (PcdCpuLocalApicBaseAddress); + LapicEnd =3D LapicBase + SIZE_1MB; + AddIoMemoryRangeHob (LapicBase, LapicEnd); =20 - for (Loop =3D 0; Loop < E820EntriesCount; Loop++) { - Entry =3D E820Map + Loop; + for (Index =3D 0; Index < E820EntriesCount; Index++) { + UINT64 Base; + UINT64 End; + UINT64 ReservedBase; + UINT64 ReservedEnd; =20 + Entry =3D &E820Map[Index]; + + // + // Round up the start address, and round down the end address. + // + Base =3D ALIGN_VALUE (Entry->BaseAddr, (UINT64)EFI_PAGE_SIZE); + End =3D (Entry->BaseAddr + Entry->Length) & ~(UINT64)EFI_PAGE_MASK; + + switch (Entry->Type) { + case EfiAcpiAddressRangeMemory: + AddMemoryRangeHob (Base, End); + break; + case EfiAcpiAddressRangeACPI: + AddReservedMemoryRangeHob (Base, End, FALSE); + break; + case EfiAcpiAddressRangeReserved: // - // Only care about RAM + // hvmloader marks a range that overlaps with the local APIC memory + // mapped region as reserved, but CpuDxe wants it as mapped IO. We + // have already added it as mapped IO, so skip it here. // - if (Entry->Type !=3D EfiAcpiAddressRangeMemory) { - continue; - } =20 - AddMemoryBaseSizeHob (Entry->BaseAddr, Entry->Length); + // + // add LAPIC predecessor range, if any + // + ReservedBase =3D Base; + ReservedEnd =3D MIN (End, LapicBase); + if (ReservedBase < ReservedEnd) { + AddReservedMemoryRangeHob (ReservedBase, ReservedEnd, FALSE); + } =20 - MtrrSetMemoryAttribute (Entry->BaseAddr, Entry->Length, CacheWriteBa= ck); + // + // add LAPIC successor range, if any + // + ReservedBase =3D MAX (Base, LapicEnd); + ReservedEnd =3D End; + if (ReservedBase < ReservedEnd) { + AddReservedMemoryRangeHob (ReservedBase, ReservedEnd, FALSE); + } + break; + default: + break; } } } @@ -326,12 +365,6 @@ InitializeXen ( { RETURN_STATUS PcdStatus; =20 - // - // Reserve away HVMLOADER reserved memory [0xFC000000,0xFD000000). - // This needs to match HVMLOADER RESERVED_MEMBASE/RESERVED_MEMSIZE. - // - AddReservedMemoryBaseSizeHob (0xFC000000, 0x1000000, FALSE); - PcdStatus =3D PcdSetBoolS (PcdPciDisableBusEnumeration, TRUE); ASSERT_RETURN_ERROR (PcdStatus); =20 --=20 Anthony PERARD _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Thu Nov 14 05:47:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45540+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1565697473; cv=none; d=zoho.com; s=zohoarc; b=i7FVSoyih7kgkdXjuP0PrdA0SP+nAnQ4C7GHOJbJYHvxXkKGyRZ6q/xuGP6rqRPwehE/GYJ9NqCoZiR1MUrhnJJih1IAMEbhteIHcNVKlLuJTucAe24QeRll6TIcMtRRy0QA/RZInpIgqsI8TTxAv1nGaJOSZ4PegqNSbr1h3J0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565697473; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=2fpkrjY5W9lzKmQ57tEGWC8wxYu2+Zbp9ZU8kOtPFZ8=; b=a9PAORrL0Av914qrc6VcyN8wA5cjnu7rbwq7VFCke+UFN6TcApYT6LN6nEWu7P9TKoWQarmDHZf7x6zHqTuw4pNU9byBYhutFYqK1pLemUJrV9wHpluZ3Js5YGJHG70+rnzDCBdK5EQQtYwx0Ge52hELZyrj5XG9IOKs2iJ1xCI= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45540+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1565697473091892.9440870489167; Tue, 13 Aug 2019 04:57:53 -0700 (PDT) Return-Path: X-Received: from esa2.hc3370-68.iphmx.com (esa2.hc3370-68.iphmx.com [216.71.145.153]) by groups.io with SMTP; Tue, 13 Aug 2019 04:57:51 -0700 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45540+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: None (esa2.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=esa2.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa2.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=esa2.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 (esa2.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=esa2.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: tshFiBo75oKp6/rg1WM7Wix4AFcyxcizAtrq2i/DwpcajnSO3hYWKq3U1m+BYFL6B/zh9Euxry S3HNTDs9qjr+8vulASqOjH+pdaGVLJAEcwChjKfxWs7K46k4MLlg04ue6ObnLnTtlZidvEqMjJ KlmocxMGZ+bJPH7FN8QGvamY9fhbYsp22L9iMS/lHOv2P6oxVuzR2w+ur/xrkK/lQVV9+nj9iF hO4S9nysxmFP6Y1UN4lJ40i6mPKN4xfvgVTyje9zxZmXEji4dCtca9DE4pBfwRApLAtcwShXU2 mSI= X-SBRS: 2.7 X-MesageID: 4198435 X-Ironport-Server: esa2.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="4198435" From: "Anthony PERARD" To: CC: Laszlo Ersek , Jordan Justen , Julien Grall , , Ard Biesheuvel , Anthony PERARD Subject: [edk2-devel] [PATCH v5 24/35] OvmfPkg/XenPlatformPei: Reserve VGA memory region, to boot Linux Date: Tue, 13 Aug 2019 12:31:08 +0100 Message-ID: <20190813113119.14804-25-anthony.perard@citrix.com> In-Reply-To: <20190813113119.14804-1-anthony.perard@citrix.com> References: <20190813113119.14804-1-anthony.perard@citrix.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,anthony.perard@citrix.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565697472; bh=2fpkrjY5W9lzKmQ57tEGWC8wxYu2+Zbp9ZU8kOtPFZ8=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=TLQQVNqag/dYgrqkANlSFxJHGem1Nk7rt2YenkZ/ektfqIkeElXmeMwjQzZLgn2a6ei jeMsnN4n8GyKuLZShJncyBnVBLF6jfEogfbZjBTmSQ/JfaVH6L8r5ylVZ0JYK07B2MjKb HNEGE92J/DG52zAv95FtCqEo3+SP3BA907E= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Linux panic if the VGA region isn't reserved. When Linux is booted on EFI system, it expects the memory at 0xa0000 to _not_ be conventional memory. Otherwise a variable isn't initialised properly and Linux panic when a virtual console/terminal is asked to be created. See for more detail: https://lists.xenproject.org/archives/html/xen-devel/2019-03/msg02139.html Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1689 Signed-off-by: Anthony PERARD Acked-by: Laszlo Ersek --- Notes: v3: - fix commit message OvmfPkg/XenPlatformPei/Xen.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/OvmfPkg/XenPlatformPei/Xen.c b/OvmfPkg/XenPlatformPei/Xen.c index c4506def9a..c41fecdc48 100644 --- a/OvmfPkg/XenPlatformPei/Xen.c +++ b/OvmfPkg/XenPlatformPei/Xen.c @@ -294,6 +294,12 @@ XenPublishRamRegions ( Status =3D XenGetE820Map (&E820Map, &E820EntriesCount); ASSERT_EFI_ERROR (Status); =20 + AddMemoryBaseSizeHob (0, 0xA0000); + // + // Video memory + Legacy BIOS region, to allow Linux to boot. + // + AddReservedMemoryBaseSizeHob (0xA0000, BASE_1MB - 0xA0000, TRUE); + LapicBase =3D PcdGet32 (PcdCpuLocalApicBaseAddress); LapicEnd =3D LapicBase + SIZE_1MB; AddIoMemoryRangeHob (LapicBase, LapicEnd); @@ -312,6 +318,16 @@ XenPublishRamRegions ( Base =3D ALIGN_VALUE (Entry->BaseAddr, (UINT64)EFI_PAGE_SIZE); End =3D (Entry->BaseAddr + Entry->Length) & ~(UINT64)EFI_PAGE_MASK; =20 + // + // Ignore the first 1MB, this is handled before the loop. + // + if (Base < BASE_1MB) { + Base =3D BASE_1MB; + } + if (Base >=3D End) { + continue; + } + switch (Entry->Type) { case EfiAcpiAddressRangeMemory: AddMemoryRangeHob (Base, End); --=20 Anthony PERARD -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45540): https://edk2.groups.io/g/devel/message/45540 Mute This Topic: https://groups.io/mt/32851684/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Nov 14 05:47:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45550+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1565697490; cv=none; d=zoho.com; s=zohoarc; b=c9ggUvz7bf2aDYEKyjE/hwZjeJiVVj87YDXbBFAXuoiE24oZ0dJ16gCCjxSJs9pCUD6oIsspO0+AktaYI4QII5WwrKvVdE/n4IhVXQiJnhKGTI0zpMs8ju6+/dJ6vlNIPajmNl4y4tmqzfdBWKgxZ5Fkpf+QNnf6OAl29i9PxLo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565697490; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=4SJK2vg2GW9EogBpgyomUb5vu7+awpABqnjwv8WiosA=; b=To2n6FeZAFet1hGAeMN9kn2bqAhLh6Syuy1UgZd5aGUEgarc5KJ7wI8dey77yUXgyXQyricAsKQlk/pN+nJOSTtez/55VV5QNPpToYN2Me4GavDhOltXrVSMNVxoDSUmxr2Kq5+opy05R5dYcDEq3jfbk36JYiizwwB4ZiBtGT8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45550+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1565697490322624.4777236354297; Tue, 13 Aug 2019 04:58:10 -0700 (PDT) Return-Path: X-Received: from esa5.hc3370-68.iphmx.com (esa5.hc3370-68.iphmx.com [216.71.155.168]) by groups.io with SMTP; Tue, 13 Aug 2019 04:58:09 -0700 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45550+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: None (esa5.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=esa5.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa5.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=esa5.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 (esa5.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=esa5.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: ha52D1JzoEpFeO685uyC4yBchibWPy3pRkCCGlPtqPL/LcuDqg4c/LTaLhdHAqHSg2HgjExZEF q/n33UyE6jzGopDzQDkT5E3ZS4oBOcRWe4gonxKJ/KMSxXVf3xu77JocpO2Dq5KrLBFxzXl/fm f+HfF+TXcl0wcd59uYndNZx9NllaeyNr59wbyPwBPW7kP1M2cdqHD3d+8G+hPkl9WgRe4mLHiR yA/LXPdWml5JUYCLlzcYc2vVgq79BoLhrRdhjwymNAzkvrMQxjvpEIXfHZ8jnMzNvV/yUKIsvP zGE= X-SBRS: 2.7 X-MesageID: 4347489 X-Ironport-Server: esa5.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="4347489" From: "Anthony PERARD" To: CC: Laszlo Ersek , Jordan Justen , Julien Grall , , Ard Biesheuvel , Anthony PERARD Subject: [edk2-devel] [PATCH v5 25/35] OvmfPkg/XenPlatformPei: Ignore missing PCI Host Bridge on Xen PVH Date: Tue, 13 Aug 2019 12:31:09 +0100 Message-ID: <20190813113119.14804-26-anthony.perard@citrix.com> In-Reply-To: <20190813113119.14804-1-anthony.perard@citrix.com> References: <20190813113119.14804-1-anthony.perard@citrix.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,anthony.perard@citrix.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565697489; bh=4SJK2vg2GW9EogBpgyomUb5vu7+awpABqnjwv8WiosA=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=Vme9bpc3KNPrd1r8YUqNTCQDP36sJZ42n5SyxLGgW3Ikc7iKEZr4ym1zptp1ExOEQL+ vtC8ZS1yDBEd6wtUe/KS6FpJOeWVWiuHINSiLscGf2K/fcFLguerOCZ2YLZtrKO1koSuI fSo3cCvVyi5XJ25xA8YJuoW0FSS2FF2vlrA= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" When the device ID of the host bridge is unknown, check if we are running as a PVH guest as there is no PCI bus in that case. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1689 Signed-off-by: Anthony PERARD Acked-by: Laszlo Ersek --- Notes: v3: - Remove use of XEN_PVH_PCI_HOST_BRIDGE_DEVICE_ID, and simply don't set PcdOvmfHostBridgePciDevId. =20 v2: - Use new XEN_PVH_PCI_HOST_BRIDGE_DEVICE_ID macro OvmfPkg/XenPlatformPei/Platform.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/OvmfPkg/XenPlatformPei/Platform.c b/OvmfPkg/XenPlatformPei/Pla= tform.c index 2f42ca6ccd..717fd0ab1a 100644 --- a/OvmfPkg/XenPlatformPei/Platform.c +++ b/OvmfPkg/XenPlatformPei/Platform.c @@ -283,6 +283,12 @@ MiscInitialization ( AcpiEnBit =3D ICH9_ACPI_CNTL_ACPI_EN; break; default: + if (XenPvhDetected ()) { + // + // There is no PCI bus in this case + // + return; + } DEBUG ((DEBUG_ERROR, "%a: Unknown Host Bridge Device ID: 0x%04x\n", __FUNCTION__, mHostBridgeDevId)); ASSERT (FALSE); --=20 Anthony PERARD -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45550): https://edk2.groups.io/g/devel/message/45550 Mute This Topic: https://groups.io/mt/32851698/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Nov 14 05:47:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45553+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1565697493; cv=none; d=zoho.com; s=zohoarc; b=iFHU/D7gZWVhj5+Htuo+QZDS7zz4279P7aHG7wdCYhcIRtIp0ZAgMCL6IF/XRlDb1TchRsof+U8OItc1B7vHqHi3CTKiyd1P9lbl7+0CEnDAcenS1LkJIpkPFmO1niaiyRp6cCcOypeBYQi8YpFs83sSBtIS7cTJ/nrNTmMmnSs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565697493; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=EX6XIUSIU0f6qeUDnjlTXBrMhf5Gf9lpW6ooL4npleY=; b=Cig2yjn+j0q2CwGZGT0zFhy56IjDors12Yg/NhV3MLf/eR9wT/lQJ5FDsQB9W0MC/hBGwF2WCN8CkzC72CgVR9RxaXzV9M7beNoJBssbl5DGmJStLxbbQ5FcHgMF5gnPBj0CX018Ts4XBicC/O0cMqD5g72VTMl02a7C5RxkBb8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45553+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1565697493698152.2137868680436; Tue, 13 Aug 2019 04:58:13 -0700 (PDT) Return-Path: X-Received: from esa2.hc3370-68.iphmx.com (esa2.hc3370-68.iphmx.com [216.71.145.153]) by groups.io with SMTP; Tue, 13 Aug 2019 04:58:12 -0700 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45553+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: None (esa2.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=esa2.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa2.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=esa2.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 (esa2.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=esa2.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: BkUH713FC1WKWIjCIRIDfuw2LkvZh6Hc8YcqXXJG/BzqzDu5LdXwvpMxTVAN3IF3uWfmLcNQ99 NCtGMu6KJnTLbgaWM9Hu2wC8TnZesH0BtI8/B13f/defJoQsgt7KiTClD08/xNPEXHpSl7bIwV k5kyxVexEGrXe6fdnBcoR/r02pJY9slJeF/1Y2CIp3x5q4GEUQ1qyIZLLs24/9ulo4tgXwfdhb l/peZl/V6s8Qybg38VZh9BzEcAJgtjbpusiNDA+b5wwkTOqFUxXXuEYtBERh8n6c6iEA+3+97H Ub4= X-SBRS: 2.7 X-MesageID: 4198448 X-Ironport-Server: esa2.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="4198448" From: "Anthony PERARD" To: CC: Laszlo Ersek , Jordan Justen , Julien Grall , , Ard Biesheuvel , Anthony PERARD Subject: [edk2-devel] [PATCH v5 26/35] OvmfPkg/XenPlatformLib: Cache result for XenDetected Date: Tue, 13 Aug 2019 12:31:10 +0100 Message-ID: <20190813113119.14804-27-anthony.perard@citrix.com> In-Reply-To: <20190813113119.14804-1-anthony.perard@citrix.com> References: <20190813113119.14804-1-anthony.perard@citrix.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,anthony.perard@citrix.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565697493; bh=EX6XIUSIU0f6qeUDnjlTXBrMhf5Gf9lpW6ooL4npleY=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=Q93n01w5XEwy4NP84uheW7WtltGYW9594YFToxwdQuh7R7n55ABz/V97niWFNLEwItC 2BuwqIsDHKoSyI5kfPGBoRd2fedqgyBmmUAeUSdgm+4KPk5RHUsTzcdYvOPbLIdSg/cm6 BwoCGqSRE8lsxSFZBAnsskbhb/MNicz2teg= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" We are going to replace XenDetected() implementation in PlatformBootManagerLib by the one in XenPlatformLib. PlatformBootManagerLib's implementation does cache the result of GetFirstGuidHob(), so we do something similar in XenPlatformLib. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1689 Signed-off-by: Anthony PERARD Reviewed-by: Laszlo Ersek --- Notes: v4: - fix coding style =20 v3: - new patch .../Library/XenPlatformLib/XenPlatformLib.c | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/OvmfPkg/Library/XenPlatformLib/XenPlatformLib.c b/OvmfPkg/Libr= ary/XenPlatformLib/XenPlatformLib.c index 974a0e73f1..8f20ae2d45 100644 --- a/OvmfPkg/Library/XenPlatformLib/XenPlatformLib.c +++ b/OvmfPkg/Library/XenPlatformLib/XenPlatformLib.c @@ -25,14 +25,26 @@ XenGetInfoHOB ( VOID ) { - EFI_HOB_GUID_TYPE *GuidHob; + EFI_HOB_GUID_TYPE *GuidHob; + STATIC BOOLEAN Cached =3D FALSE; + STATIC EFI_XEN_INFO *XenInfo; + + // + // Return the cached result for the benefit of XenDetected that can be + // called many times. + // + if (Cached) { + return XenInfo; + } =20 GuidHob =3D GetFirstGuidHob (&gEfiXenInfoGuid); if (GuidHob =3D=3D NULL) { - return NULL; + XenInfo =3D NULL; + } else { + XenInfo =3D (EFI_XEN_INFO *) GET_GUID_HOB_DATA (GuidHob); } - - return (EFI_XEN_INFO *) GET_GUID_HOB_DATA (GuidHob); + Cached =3D TRUE; + return XenInfo; } =20 /** --=20 Anthony PERARD -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45553): https://edk2.groups.io/g/devel/message/45553 Mute This Topic: https://groups.io/mt/32851701/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Nov 14 05:47:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45538+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1565697465; cv=none; d=zoho.com; s=zohoarc; b=P8OPRVo3Cfp6MuBNfpCocpuatqewABTIXXoKfvpfxpUL4vsULDzKAAOjXabxyD63fh3FVWaL6ArfO/7WL9oduWgMX7fDO0vDI2lH9Z75NOtfO5GNoKupnBSVWLaA9GCrJgQ0E07qXJdGLfZGN7x6EzZ3kQ1r7R3nrC5GeuHTOTQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565697465; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=KT39GEO6BqKU9WGjVEPL1hznKhN3O8ysdqRzgfiL1Yg=; b=PPxUphu7qRSbIYGRh8WxIxKKriO74TOv2IqtdlXF3QJOLL87kkMzP8jkhimkdWjTuDYJzuNcMeQXFiAKo9D1wyu7tdD8HSrkubArG7QEd3QYWYcr4D8LBmo9XzBAKa5LjZBYO9U8Ztd21AN53M03SGNznM2fDpmyZ4hUSat/HNg= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45538+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1565697465008285.82505612362377; Tue, 13 Aug 2019 04:57:45 -0700 (PDT) Return-Path: X-Received: from esa6.hc3370-68.iphmx.com (esa6.hc3370-68.iphmx.com []) by groups.io with SMTP; Tue, 13 Aug 2019 04:57:43 -0700 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45538+1787277+3901457@groups.io; helo=web01.groups.io; 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: XJ7aHeML77RlHXWSMObqCWwI21TLVYaeVeX/tyh3auEIF4cvE9eqE6rxJjEiGRGclgIAHWMmOr EgajjgLc15PF+VyCeQBU8wGyZ2OkjDN3uv2JBz+tqjD42W537YcOQE/kslTi1HpuktSHmplJoz SYgh5Gw+A/7vFcx04qdNMIW1+EdkTS7PxMT/7EnpNNfj8PToidBZQFjDiKg6MsLQoCLc2FgbPY fpL63a0TXJX1+2MK+8Ttup6jrusD57OL0j1fMlyWyQEw4yTV4dBx1837Tk9wlPlljPPgD/1EQg M6A= X-SBRS: 2.7 X-MesageID: 4374816 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="4374816" From: "Anthony PERARD" To: CC: Laszlo Ersek , Jordan Justen , Julien Grall , , Ard Biesheuvel , Anthony PERARD Subject: [edk2-devel] [PATCH v5 27/35] OvmfPkg/PlatformBootManagerLib: Use XenDetected from XenPlatformLib Date: Tue, 13 Aug 2019 12:31:11 +0100 Message-ID: <20190813113119.14804-28-anthony.perard@citrix.com> In-Reply-To: <20190813113119.14804-1-anthony.perard@citrix.com> References: <20190813113119.14804-1-anthony.perard@citrix.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,anthony.perard@citrix.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565697464; bh=KT39GEO6BqKU9WGjVEPL1hznKhN3O8ysdqRzgfiL1Yg=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=YCkBGivQ+RufFzP4IAAmhbhHIvj+nvCCNx2bg4trZ91nuG94Q1XR65v5hgfz5G4vqwp l9u1KYq+Fi4bQzuuivpIk6BgP7QJQCaHfJpqX5kprnePlbo9miAcZsPXIUf9tHnt2UVRw RNyfv31fx4AWmgIPq5BZ32AQpOCVF3QnyUQ= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Replace the XenDetected() implementation by the one from XenPlatformLib. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1689 Signed-off-by: Anthony PERARD Reviewed-by: Laszlo Ersek --- Notes: v4: - removed gEfiXenInfoGuid from Guids list and the associated include of Guid/XenInfo.h =20 v3: - new patch .../PlatformBootManagerLib.inf | 2 +- .../PlatformBootManagerLib/BdsPlatform.c | 34 +------------------ 2 files changed, 2 insertions(+), 34 deletions(-) diff --git a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.= inf b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf index 060a3ab4c5..04d614cd49 100644 --- a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf +++ b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf @@ -54,6 +54,7 @@ [LibraryClasses] UefiLib PlatformBmPrintScLib Tcg2PhysicalPresenceLib + XenPlatformLib =20 [Pcd] gUefiOvmfPkgTokenSpaceGuid.PcdEmuVariableEvent @@ -73,7 +74,6 @@ [Protocols] gEfiFirmwareVolume2ProtocolGuid # PROTOCOL SOMETIMES_CONSU= MED =20 [Guids] - gEfiXenInfoGuid gEfiEndOfDxeEventGroupGuid gRootBridgesConnectedEventGroupGuid gUefiShellFileGuid diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg= /Library/PlatformBootManagerLib/BdsPlatform.c index 797731a41c..d5d5d20fd8 100644 --- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c +++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c @@ -7,11 +7,11 @@ **/ =20 #include "BdsPlatform.h" -#include #include #include #include #include +#include =20 =20 // @@ -1225,38 +1225,6 @@ PciAcpiInitialization ( IoOr16 ((PciRead32 (Pmba) & ~BIT0) + 4, BIT0); } =20 -/** - This function detects if OVMF is running on Xen. - -**/ -STATIC -BOOLEAN -XenDetected ( - VOID - ) -{ - EFI_HOB_GUID_TYPE *GuidHob; - STATIC INTN FoundHob =3D -1; - - if (FoundHob =3D=3D 0) { - return FALSE; - } else if (FoundHob =3D=3D 1) { - return TRUE; - } - - // - // See if a XenInfo HOB is available - // - GuidHob =3D GetFirstGuidHob (&gEfiXenInfoGuid); - if (GuidHob =3D=3D NULL) { - FoundHob =3D 0; - return FALSE; - } - - FoundHob =3D 1; - return TRUE; -} - EFI_STATUS EFIAPI ConnectRecursivelyIfPciMassStorage ( --=20 Anthony PERARD -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45538): https://edk2.groups.io/g/devel/message/45538 Mute This Topic: https://groups.io/mt/32851682/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Nov 14 05:47:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45559+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1565697511; cv=none; d=zoho.com; s=zohoarc; b=L4dDgcRfKDQuyKUBYtswWsG59yG1tIRHi32gsTTtmEh3kFL1pTf2Ry06XvTE+BaVNAWb185d9U86RDceP0g9tblhJ5V6w8W5Bxd3QRjOKDXgdQXHhl0cU1MLVScbAFwkp2l3JV3ANuYR+709JCtHrLVC5ZaRPmqnIa3AtgciQ/E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565697511; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=Fw7Hht832n5AWPNBcVeup+JiRV5nM/Lco1VwYc0MsuQ=; b=lL3eE2hZIMkPtcwS9g2UX+iG227FaPba/XIzVEk8Qo67H/1nnavtsZ5i8OImvPtj32JIDzT1vkvEP053sTMWC/n2azBxyeRP8Rpg74V2RYpAWhxfY8woR8v2thvoSZ42ri4sw8nOXr66uClc3/oWJLVXyIRnq83qi8QlDFwTG+I= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45559+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1565697511060543.4951175734062; Tue, 13 Aug 2019 04:58:31 -0700 (PDT) Return-Path: X-Received: from esa1.hc3370-68.iphmx.com (esa1.hc3370-68.iphmx.com [216.71.145.142]) by groups.io with SMTP; Tue, 13 Aug 2019 04:58:30 -0700 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45559+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: None (esa1.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=esa1.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.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=esa1.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 (esa1.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=esa1.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: keGfDCmOa8D92M74fhwRqEgvCzuMVfRT0xWYqnhV9WGp9g7eFMNchreSWvwZKJO6AOQAjH3XPG aiTIcWzw55cdmAOb3ju+nK3AY0PHBbMamqPG0uz883u0JETHOYCkM/RwwoXQkvhartsNLEMJbs rF66WepkwKBdcnh5JexObm2X2XkyZWr+Q98yjsrFRL+VuhUBLd0h4nvYaVxGExv9uqlde3ht5P JHgCt3gdxWXqGRFIhmPdyv0HiojCZ6CPloVw2OEi5tmnjr2NUorvONtA1IXME8G2fNaltNbE4m a+k= X-SBRS: 2.7 X-MesageID: 4242263 X-Ironport-Server: esa1.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="4242263" From: "Anthony PERARD" To: CC: Laszlo Ersek , Jordan Justen , Julien Grall , , Ard Biesheuvel , Anthony PERARD Subject: [edk2-devel] [PATCH v5 28/35] OvmfPkg/PlatformBootManagerLib: Handle the absence of PCI bus on Xen PVH Date: Tue, 13 Aug 2019 12:31:12 +0100 Message-ID: <20190813113119.14804-29-anthony.perard@citrix.com> In-Reply-To: <20190813113119.14804-1-anthony.perard@citrix.com> References: <20190813113119.14804-1-anthony.perard@citrix.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,anthony.perard@citrix.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565697510; bh=Fw7Hht832n5AWPNBcVeup+JiRV5nM/Lco1VwYc0MsuQ=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=FFoIgp2KU+2CFPQimuPE5gcnL5o1mtKGI8woNGDoKVg+vOoZ+C9YpQlkVOp8UHFCUP2 +D4VWcuxnJTtMqOwCXUT5sQCWbJ+1euXXBxmvSDc1Xu2moUMkjW/BZiqocwLLeFLQOwLx Tsa4MEd16jFi/vNDr2abyitQnY5ZZR8rTaQ= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" When running in a Xen PVH guest, there's nothing to do in PciAcpiInitialization() because there isn't any PCI bus. When the Host Bridge DID isn't recognised, simply continue. (The value of PcdOvmfHostBridgePciDevId would be 0 because it isn't set.) Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1689 Signed-off-by: Anthony PERARD Reviewed-by: Laszlo Ersek --- Notes: v3: - Instead of checking for a false value, XEN_PVH_PCI_HOST_BRIDGE_DEVICE_ID, simply check if we are running xen when the HostBridge device ID isn't recognised. OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg= /Library/PlatformBootManagerLib/BdsPlatform.c index d5d5d20fd8..1eba304f09 100644 --- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c +++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c @@ -1208,6 +1208,12 @@ PciAcpiInitialization ( PciWrite8 (PCI_LIB_ADDRESS (0, 0x1f, 0, 0x6b), 0x0b); // H break; default: + if (XenDetected ()) { + // + // There is no PCI bus in this case. + // + return; + } DEBUG ((EFI_D_ERROR, "%a: Unknown Host Bridge Device ID: 0x%04x\n", __FUNCTION__, mHostBridgeDevId)); ASSERT (FALSE); --=20 Anthony PERARD -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45559): https://edk2.groups.io/g/devel/message/45559 Mute This Topic: https://groups.io/mt/32851707/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Nov 14 05:47:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45556+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1565697502; cv=none; d=zoho.com; s=zohoarc; b=LG//jflgt2nh7ddtdjclOfxFyY/YlYDflo1GNuluoSNOe8VQgmBRWe3Cc5uLJUDYpmqK+DnsugsJA7SyQnlgWwry9HM+Ob4ANbxaEu2vVi+pzvjbVLCIJ/YU2mA7/FJ+j4HS9NQPfpqbJlvLE1cvdsg8HysOwHbab7dhv1m0sUE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565697502; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=nNlGHQ+UrdPBgKXGPfdLDSwRvPC/xwojRP+dqvH3qLw=; b=glnwZEd2v18h7L1CPhflCq+K95NYfpbh5J0nXclfteD/9javT+9kxEJG7vxOz6BtmVeUIrFZX4bS+jw3tUofXcjrabY5l97y7sS0ZTDuD9xEHWJKGeqH/RdQkY+uhUZzOIMvAJpB/h52G86KbbH3AUokfJVaOsSw/h8bTAFnCuY= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45556+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1565697502693891.9373101215436; Tue, 13 Aug 2019 04:58:22 -0700 (PDT) Return-Path: X-Received: from esa2.hc3370-68.iphmx.com (esa2.hc3370-68.iphmx.com [216.71.145.153]) by groups.io with SMTP; Tue, 13 Aug 2019 04:58:21 -0700 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45556+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: None (esa2.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=esa2.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa2.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=esa2.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 (esa2.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=esa2.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: ou/KXrGAoY8j81wQ0cZFE/FTe48bwzWVb5+zhDdUB7p1FPSlWiB37wrDmzps1o2rrObRgeuRoI /y54zDkrWWRwtOj0UIkJYK8IKXVnhOLFRwv7J1vgJOIaun8SSgzG9fDFafrvC4xQLmGREFZ8ez w3fdtQubbuGm1+2sXjXGda6mUEWQAn4yx5IestOQKJla1e34eWQrrIR13kWP6Zvl+DdlK06oHl Q1ajDgEzo51sKCXDq03ExuQMkSVt5NLI/YZX4+Fct/tR7i7idli4vkzAt0vh0UsiNOHAzxSNeb kdk= X-SBRS: 2.7 X-MesageID: 4198454 X-Ironport-Server: esa2.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="4198454" From: "Anthony PERARD" To: CC: Laszlo Ersek , Jordan Justen , Julien Grall , , Ard Biesheuvel , Anthony PERARD Subject: [edk2-devel] [PATCH v5 29/35] OvmfPkg/OvmfXen: Override PcdFSBClock to Xen vLAPIC timer frequency Date: Tue, 13 Aug 2019 12:31:13 +0100 Message-ID: <20190813113119.14804-30-anthony.perard@citrix.com> In-Reply-To: <20190813113119.14804-1-anthony.perard@citrix.com> References: <20190813113119.14804-1-anthony.perard@citrix.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,anthony.perard@citrix.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565697502; bh=nNlGHQ+UrdPBgKXGPfdLDSwRvPC/xwojRP+dqvH3qLw=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=ctlbawqGaWB86TYTx9zYwxa/7M5Q9pC5D0/M3LokBgCeIXj7yGxDxg81OjN9T7tOAtH xI7znoPqc5DrSSVhVnd4RH72CWJCEZ3k4iXlLV3RHAyVHvjunlWDqT2OSEjVxoo2Fsypb 1AHczDGbgGzyeRevulYAPuwZOgEo89ShL9s= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" PcdFSBClock is used by SecPeiDxeTimerLibCpu, the TimerLib implementation. It will also be used by XenTimerDxe. Override PcdFSBClock to match Xen vLAPIC timer frequency. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1689 Signed-off-by: Anthony PERARD Acked-by: Laszlo Ersek --- Notes: v3: - expand commit message body to be standalone OvmfPkg/OvmfXen.dsc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc index 22970eda5d..477d8c76a1 100644 --- a/OvmfPkg/OvmfXen.dsc +++ b/OvmfPkg/OvmfXen.dsc @@ -439,6 +439,9 @@ [PcdsFixedAtBuild] # Point to the MdeModulePkg/Application/UiApp/UiApp.inf gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c= , 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0= x31 } =20 + ## Xen vlapic's frequence is 100 MHz + gEfiMdePkgTokenSpaceGuid.PcdFSBClock|100000000 + ##########################################################################= ###### # # Pcd Dynamic Section - list of all EDK II PCD Entries defined by this Pla= tform --=20 Anthony PERARD -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45556): https://edk2.groups.io/g/devel/message/45556 Mute This Topic: https://groups.io/mt/32851704/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Nov 14 05:47:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45546+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1565697485; cv=none; d=zoho.com; s=zohoarc; b=W+AGr6jZEvajHYhecDaAfek9Bmg8nLPiyujgYVVDmUI3hEtnyFyjIToa0SK/ZzsEDI1yRXWBeHOZ7o9GrhHL1xcmPMSWaABO/1TqFS8heTj5VL2In/VOP8PAXppoWq6AFJHHd72TMvszurUnmp5tl2F0jeuiM0S/ct20XFINPVE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565697485; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=DEdrVbet1QfwtHUXSjZIxK1AailvSEtFrshWsmuBnAA=; b=YDlZojQOzLkeUkAi8t/PNvcl39gL2GD5Cep00sX5BkQiY5NPsisMsGj9KEVn48rL3c5zTGsH7axahM/tvkzNRyNE3VDO/k69Apegoj8lvut1E5hVl6Bjw2diSUCKm6mG3b1JVBbuLNb4LcZjQBFQzsxIh9sJxbMPCVTk38uthkc= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45546+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1565697485590971.1129337781438; Tue, 13 Aug 2019 04:58:05 -0700 (PDT) Return-Path: X-Received: from esa4.hc3370-68.iphmx.com (esa4.hc3370-68.iphmx.com [216.71.155.144]) by groups.io with SMTP; Tue, 13 Aug 2019 04:58:04 -0700 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45546+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: None (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.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=esa4.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 (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: MXmWJW2EjzG7Itm9paK+ZTvJqS131ZHJlZj85+ltqO5EZW1PpS7Ng2ycYKhWhd00iqW5UHqQ0H zuo5jnDhvlxgGDYo3WpqJt0r+ywdeOFXhY+kxJhFWsyHOog6gIX8oczQ2Ur2qsDh92BV67+nJP 4FYW1sLQA02zi+1n08qsBjovGHW5YAmFY6tRHno8hsxlKrhhjdT9Telx649c5109fzF8byOG9l 1+HxwppUPNz4PjW3o7RwAZ8t9HFIi2KTFv/7JH5ph6iddMMAoiWQ/bZ50LucFeXQqVMC5CwkKI o+A= X-SBRS: 2.7 X-MesageID: 4402028 X-Ironport-Server: esa4.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="4402028" From: "Anthony PERARD" To: CC: Laszlo Ersek , Jordan Justen , Julien Grall , , Ard Biesheuvel , Anthony PERARD Subject: [edk2-devel] [PATCH v5 30/35] OvmfPkg/OvmfXen: Introduce XenTimerDxe Date: Tue, 13 Aug 2019 12:31:14 +0100 Message-ID: <20190813113119.14804-31-anthony.perard@citrix.com> In-Reply-To: <20190813113119.14804-1-anthony.perard@citrix.com> References: <20190813113119.14804-1-anthony.perard@citrix.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,anthony.perard@citrix.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565697485; bh=DEdrVbet1QfwtHUXSjZIxK1AailvSEtFrshWsmuBnAA=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=o4KP6MtEJQUyH7iEHdZ106W50HAtrUfM6Kvwbx4r5pmOj/lwgJ1ojvudgyhfmYWdcOn HjCxR3nl2sy03C+I2nPf5xZa2E02njMV5k+Sk8YPUT5FEMh+3RfAfGJGlUOl75C7fr0Ef z65rHqIaMNWCb5LKu63URYMWp8fgAQ1qoCw= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" "OvmfPkg/8254TimerDxe" is replaced with a Xen-specific EFI_TIMER_ARCH_PROTOCOL implementation. Also remove 8259InterruptControllerDxe as it is not used anymore. This Timer uses the local APIC timer as time source as it can work on both a Xen PVH guest and an HVM one. Based on the "OvmfPkg/8254TimerDxe" implementation. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1689 Signed-off-by: Anthony PERARD Acked-by: Laszlo Ersek --- Notes: v4: - fix the commit message to reflect the fact that the original code as moved. - Update Maintainers.txt =20 v3: - rebased, SPDX, copyright =20 v2: - Use InitializeApicTimer instead of WriteLocalApicReg - rework comments (remove many that don't apply) - remove unused includes, and libs - have a macro to the timervector. - cleanup, copyright - rework calculation of TimerCount, value to be use by the APIC timer - check for overflow of TimerPeriod, with the apic timer, the period can be up to about 42s on Xen (or even higher by changing the DivideValue= ). OvmfPkg/OvmfXen.dsc | 3 +- OvmfPkg/OvmfXen.fdf | 3 +- OvmfPkg/XenTimerDxe/XenTimerDxe.inf | 42 ++++ OvmfPkg/XenTimerDxe/XenTimerDxe.h | 177 ++++++++++++++ OvmfPkg/XenTimerDxe/XenTimerDxe.c | 355 ++++++++++++++++++++++++++++ Maintainers.txt | 1 + 6 files changed, 577 insertions(+), 4 deletions(-) create mode 100644 OvmfPkg/XenTimerDxe/XenTimerDxe.inf create mode 100644 OvmfPkg/XenTimerDxe/XenTimerDxe.h create mode 100644 OvmfPkg/XenTimerDxe/XenTimerDxe.c diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc index 477d8c76a1..54ac910d8e 100644 --- a/OvmfPkg/OvmfXen.dsc +++ b/OvmfPkg/OvmfXen.dsc @@ -547,10 +547,9 @@ [Components] MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf =20 MdeModulePkg/Universal/EbcDxe/EbcDxe.inf - OvmfPkg/8259InterruptControllerDxe/8259.inf + OvmfPkg/XenTimerDxe/XenTimerDxe.inf UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf UefiCpuPkg/CpuDxe/CpuDxe.inf - OvmfPkg/8254TimerDxe/8254Timer.inf OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf { diff --git a/OvmfPkg/OvmfXen.fdf b/OvmfPkg/OvmfXen.fdf index 49997fee9b..fa0830a324 100644 --- a/OvmfPkg/OvmfXen.fdf +++ b/OvmfPkg/OvmfXen.fdf @@ -298,10 +298,9 @@ [FV.DXEFV] INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf -INF OvmfPkg/8259InterruptControllerDxe/8259.inf +INF OvmfPkg/XenTimerDxe/XenTimerDxe.inf INF UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf INF UefiCpuPkg/CpuDxe/CpuDxe.inf -INF OvmfPkg/8254TimerDxe/8254Timer.inf INF OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.= inf INF OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf INF MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf diff --git a/OvmfPkg/XenTimerDxe/XenTimerDxe.inf b/OvmfPkg/XenTimerDxe/XenT= imerDxe.inf new file mode 100644 index 0000000000..add1d01bbf --- /dev/null +++ b/OvmfPkg/XenTimerDxe/XenTimerDxe.inf @@ -0,0 +1,42 @@ +## @file +# Local APIC timer driver that provides Timer Arch protocol. +# +# Copyright (c) 2005 - 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2019, Citrix Systems, Inc. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D XenTimerDxe + FILE_GUID =3D 52fe8196-f9de-4d07-b22f-51f77a0e7c41 + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + + ENTRY_POINT =3D TimerDriverInitialize + +[Packages] + MdePkg/MdePkg.dec + UefiCpuPkg/UefiCpuPkg.dec + OvmfPkg/OvmfPkg.dec + +[LibraryClasses] + UefiBootServicesTableLib + BaseLib + DebugLib + UefiDriverEntryPoint + LocalApicLib + +[Sources] + XenTimerDxe.h + XenTimerDxe.c + +[Protocols] + gEfiCpuArchProtocolGuid ## CONSUMES + gEfiTimerArchProtocolGuid ## PRODUCES +[Pcd] + gEfiMdePkgTokenSpaceGuid.PcdFSBClock ## CONSUMES +[Depex] + gEfiCpuArchProtocolGuid diff --git a/OvmfPkg/XenTimerDxe/XenTimerDxe.h b/OvmfPkg/XenTimerDxe/XenTim= erDxe.h new file mode 100644 index 0000000000..e0a3d95fd0 --- /dev/null +++ b/OvmfPkg/XenTimerDxe/XenTimerDxe.h @@ -0,0 +1,177 @@ +/** @file + Private data structures + +Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2019, Citrix Systems, Inc. + +SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef _TIMER_H_ +#define _TIMER_H_ + +#include + +#include +#include + +#include + +#include +#include +#include +#include +#include + +// The default timer tick duration is set to 10 ms =3D 100000 100 ns units +// +#define DEFAULT_TIMER_TICK_DURATION 100000 + +// +// The Timer Vector use for interrupt +// +#define LOCAL_APIC_TIMER_VECTOR 32 + +// +// Function Prototypes +// +/** + Initialize the Timer Architectural Protocol driver + + @param ImageHandle ImageHandle of the loaded driver + @param SystemTable Pointer to the System Table + + @retval EFI_SUCCESS Timer Architectural Protocol created + @retval EFI_OUT_OF_RESOURCES Not enough resources available to initial= ize driver. + @retval EFI_DEVICE_ERROR A device error occurred attempting to ini= tialize the driver. + +**/ +EFI_STATUS +EFIAPI +TimerDriverInitialize ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +; + +/** + + This function adjusts the period of timer interrupts to the value specif= ied + by TimerPeriod. If the timer period is updated, then the selected timer + period is stored in EFI_TIMER.TimerPeriod, and EFI_SUCCESS is returned. = If + the timer hardware is not programmable, then EFI_UNSUPPORTED is returned. + If an error occurs while attempting to update the timer period, then the + timer hardware will be put back in its state prior to this call, and + EFI_DEVICE_ERROR is returned. If TimerPeriod is 0, then the timer inter= rupt + is disabled. This is not the same as disabling the CPU's interrupts. + Instead, it must either turn off the timer hardware, or it must adjust t= he + interrupt controller so that a CPU interrupt is not generated when the t= imer + interrupt fires. + + + @param This The EFI_TIMER_ARCH_PROTOCOL instance. + @param NotifyFunction The rate to program the timer interrupt in 100 nS= units. If + the timer hardware is not programmable, then EFI_= UNSUPPORTED is + returned. If the timer is programmable, then the= timer period + will be rounded up to the nearest timer period th= at is supported + by the timer hardware. If TimerPeriod is set to = 0, then the + timer interrupts will be disabled. + + @retval EFI_SUCCESS The timer period was changed. + @retval EFI_UNSUPPORTED The platform cannot change the period o= f the timer interrupt. + @retval EFI_DEVICE_ERROR The timer period could not be changed d= ue to a device error. + +**/ +EFI_STATUS +EFIAPI +TimerDriverRegisterHandler ( + IN EFI_TIMER_ARCH_PROTOCOL *This, + IN EFI_TIMER_NOTIFY NotifyFunction + ) +; + +/** + + This function adjusts the period of timer interrupts to the value specif= ied + by TimerPeriod. If the timer period is updated, then the selected timer + period is stored in EFI_TIMER.TimerPeriod, and EFI_SUCCESS is returned. = If + the timer hardware is not programmable, then EFI_UNSUPPORTED is returned. + If an error occurs while attempting to update the timer period, then the + timer hardware will be put back in its state prior to this call, and + EFI_DEVICE_ERROR is returned. If TimerPeriod is 0, then the timer inter= rupt + is disabled. This is not the same as disabling the CPU's interrupts. + Instead, it must either turn off the timer hardware, or it must adjust t= he + interrupt controller so that a CPU interrupt is not generated when the t= imer + interrupt fires. + + + @param This The EFI_TIMER_ARCH_PROTOCOL instance. + @param TimerPeriod The rate to program the timer interrupt in 100 nS= units. If + the timer hardware is not programmable, then EFI_= UNSUPPORTED is + returned. If the timer is programmable, then the= timer period + will be rounded up to the nearest timer period th= at is supported + by the timer hardware. If TimerPeriod is set to = 0, then the + timer interrupts will be disabled. + + @retval EFI_SUCCESS The timer period was changed. + @retval EFI_UNSUPPORTED The platform cannot change the period o= f the timer interrupt. + @retval EFI_DEVICE_ERROR The timer period could not be changed d= ue to a device error. + +**/ +EFI_STATUS +EFIAPI +TimerDriverSetTimerPeriod ( + IN EFI_TIMER_ARCH_PROTOCOL *This, + IN UINT64 TimerPeriod + ) +; + +/** + + This function retrieves the period of timer interrupts in 100 ns units, + returns that value in TimerPeriod, and returns EFI_SUCCESS. If TimerPer= iod + is NULL, then EFI_INVALID_PARAMETER is returned. If a TimerPeriod of 0 = is + returned, then the timer is currently disabled. + + + @param This The EFI_TIMER_ARCH_PROTOCOL instance. + @param TimerPeriod A pointer to the timer period to retrieve in 100 = ns units. If + 0 is returned, then the timer is currently disabl= ed. + + @retval EFI_SUCCESS The timer period was returned in TimerPer= iod. + @retval EFI_INVALID_PARAMETER TimerPeriod is NULL. + +**/ +EFI_STATUS +EFIAPI +TimerDriverGetTimerPeriod ( + IN EFI_TIMER_ARCH_PROTOCOL *This, + OUT UINT64 *TimerPeriod + ) +; + +/** + + This function generates a soft timer interrupt. If the platform does not= support soft + timer interrupts, then EFI_UNSUPPORTED is returned. Otherwise, EFI_SUCCE= SS is returned. + If a handler has been registered through the EFI_TIMER_ARCH_PROTOCOL.Reg= isterHandler() + service, then a soft timer interrupt will be generated. If the timer int= errupt is + enabled when this service is called, then the registered handler will be= invoked. The + registered handler should not be able to distinguish a hardware-generate= d timer + interrupt from a software-generated timer interrupt. + + + @param This The EFI_TIMER_ARCH_PROTOCOL instance. + + @retval EFI_SUCCESS The soft timer interrupt was generated. + @retval EFI_UNSUPPORTED The platform does not support the generation o= f soft timer interrupts. + +**/ +EFI_STATUS +EFIAPI +TimerDriverGenerateSoftInterrupt ( + IN EFI_TIMER_ARCH_PROTOCOL *This + ) +; + +#endif diff --git a/OvmfPkg/XenTimerDxe/XenTimerDxe.c b/OvmfPkg/XenTimerDxe/XenTim= erDxe.c new file mode 100644 index 0000000000..9f9e04766c --- /dev/null +++ b/OvmfPkg/XenTimerDxe/XenTimerDxe.c @@ -0,0 +1,355 @@ +/** @file + Timer Architectural Protocol as defined in the DXE CIS + +Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2019, Citrix Systems, Inc. + +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "XenTimerDxe.h" + +// +// The handle onto which the Timer Architectural Protocol will be installed +// +EFI_HANDLE mTimerHandle =3D NULL; + +// +// The Timer Architectural Protocol that this driver produces +// +EFI_TIMER_ARCH_PROTOCOL mTimer =3D { + TimerDriverRegisterHandler, + TimerDriverSetTimerPeriod, + TimerDriverGetTimerPeriod, + TimerDriverGenerateSoftInterrupt +}; + +// +// Pointer to the CPU Architectural Protocol instance +// +EFI_CPU_ARCH_PROTOCOL *mCpu; + +// +// The notification function to call on every timer interrupt. +// A bug in the compiler prevents us from initializing this here. +// +EFI_TIMER_NOTIFY mTimerNotifyFunction; + +// +// The current period of the timer interrupt +// +volatile UINT64 mTimerPeriod =3D 0; + +// +// Worker Functions +// +/** + Interrupt Handler. + + @param InterruptType The type of interrupt that occurred + @param SystemContext A pointer to the system context when the interru= pt occurred +**/ +VOID +EFIAPI +TimerInterruptHandler ( + IN EFI_EXCEPTION_TYPE InterruptType, + IN EFI_SYSTEM_CONTEXT SystemContext + ) +{ + EFI_TPL OriginalTPL; + + OriginalTPL =3D gBS->RaiseTPL (TPL_HIGH_LEVEL); + + SendApicEoi(); + + if (mTimerNotifyFunction !=3D NULL) { + // + // @bug : This does not handle missed timer interrupts + // + mTimerNotifyFunction (mTimerPeriod); + } + + gBS->RestoreTPL (OriginalTPL); +} + +/** + + This function registers the handler NotifyFunction so it is called every= time + the timer interrupt fires. It also passes the amount of time since the = last + handler call to the NotifyFunction. If NotifyFunction is NULL, then the + handler is unregistered. If the handler is registered, then EFI_SUCCESS= is + returned. If the CPU does not support registering a timer interrupt han= dler, + then EFI_UNSUPPORTED is returned. If an attempt is made to register a h= andler + when a handler is already registered, then EFI_ALREADY_STARTED is return= ed. + If an attempt is made to unregister a handler when a handler is not regi= stered, + then EFI_INVALID_PARAMETER is returned. If an error occurs attempting to + register the NotifyFunction with the timer interrupt, then EFI_DEVICE_ER= ROR + is returned. + + + @param This The EFI_TIMER_ARCH_PROTOCOL instance. + @param NotifyFunction The function to call when a timer interrupt fire= s. This + function executes at TPL_HIGH_LEVEL. The DXE Co= re will + register a handler for the timer interrupt, so i= t can know + how much time has passed. This information is u= sed to + signal timer based events. NULL will unregister= the handler. + + @retval EFI_SUCCESS The timer handler was registered. + @retval EFI_UNSUPPORTED The platform does not support time= r interrupts. + @retval EFI_ALREADY_STARTED NotifyFunction is not NULL, and a = handler is already + registered. + @retval EFI_INVALID_PARAMETER NotifyFunction is NULL, and a hand= ler was not + previously registered. + @retval EFI_DEVICE_ERROR The timer handler could not be reg= istered. + +**/ +EFI_STATUS +EFIAPI +TimerDriverRegisterHandler ( + IN EFI_TIMER_ARCH_PROTOCOL *This, + IN EFI_TIMER_NOTIFY NotifyFunction + ) +{ + // + // Check for invalid parameters + // + if (NotifyFunction =3D=3D NULL && mTimerNotifyFunction =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + if (NotifyFunction !=3D NULL && mTimerNotifyFunction !=3D NULL) { + return EFI_ALREADY_STARTED; + } + + mTimerNotifyFunction =3D NotifyFunction; + + return EFI_SUCCESS; +} + +/** + + This function adjusts the period of timer interrupts to the value specif= ied + by TimerPeriod. If the timer period is updated, then the selected timer + period is stored in EFI_TIMER.TimerPeriod, and EFI_SUCCESS is returned. = If + the timer hardware is not programmable, then EFI_UNSUPPORTED is returned. + If an error occurs while attempting to update the timer period, then the + timer hardware will be put back in its state prior to this call, and + EFI_DEVICE_ERROR is returned. If TimerPeriod is 0, then the timer inter= rupt + is disabled. This is not the same as disabling the CPU's interrupts. + Instead, it must either turn off the timer hardware, or it must adjust t= he + interrupt controller so that a CPU interrupt is not generated when the t= imer + interrupt fires. + + + @param This The EFI_TIMER_ARCH_PROTOCOL instance. + @param TimerPeriod The rate to program the timer interrupt in 100 nS= units. If + the timer hardware is not programmable, then EFI_= UNSUPPORTED is + returned. If the timer is programmable, then the= timer period + will be rounded up to the nearest timer period th= at is supported + by the timer hardware. If TimerPeriod is set to = 0, then the + timer interrupts will be disabled. + + @retval EFI_SUCCESS The timer period was changed. + @retval EFI_UNSUPPORTED The platform cannot change the period o= f the timer interrupt. + @retval EFI_DEVICE_ERROR The timer period could not be changed d= ue to a device error. + +**/ +EFI_STATUS +EFIAPI +TimerDriverSetTimerPeriod ( + IN EFI_TIMER_ARCH_PROTOCOL *This, + IN UINT64 TimerPeriod + ) +{ + UINT64 TimerCount; + UINT32 TimerFrequency; + UINTN DivideValue =3D 1; + + if (TimerPeriod =3D=3D 0) { + // + // Disable timer interrupt for a TimerPeriod of 0 + // + DisableApicTimerInterrupt(); + } else { + TimerFrequency =3D PcdGet32(PcdFSBClock) / DivideValue; + + // + // Convert TimerPeriod into local APIC counts + // + // TimerPeriod is in 100ns + // TimerPeriod/10000000 will be in seconds. + TimerCount =3D DivU64x32 (MultU64x32 (TimerPeriod, TimerFrequency), + 10000000); + + // Check for overflow + if (TimerCount > MAX_UINT32) { + TimerCount =3D MAX_UINT32; + /* TimerPeriod =3D (MAX_UINT32 / TimerFrequency) * 10000000; */ + TimerPeriod =3D 429496730; + } + + // + // Program the timer with the new count value + // + InitializeApicTimer(DivideValue, TimerCount, TRUE, LOCAL_APIC_TIMER_VE= CTOR); + + // + // Enable timer interrupt + // + EnableApicTimerInterrupt(); + } + // + // Save the new timer period + // + mTimerPeriod =3D TimerPeriod; + + return EFI_SUCCESS; +} + +/** + + This function retrieves the period of timer interrupts in 100 ns units, + returns that value in TimerPeriod, and returns EFI_SUCCESS. If TimerPer= iod + is NULL, then EFI_INVALID_PARAMETER is returned. If a TimerPeriod of 0 = is + returned, then the timer is currently disabled. + + + @param This The EFI_TIMER_ARCH_PROTOCOL instance. + @param TimerPeriod A pointer to the timer period to retrieve in 100 = ns units. If + 0 is returned, then the timer is currently disabl= ed. + + @retval EFI_SUCCESS The timer period was returned in TimerPer= iod. + @retval EFI_INVALID_PARAMETER TimerPeriod is NULL. + +**/ +EFI_STATUS +EFIAPI +TimerDriverGetTimerPeriod ( + IN EFI_TIMER_ARCH_PROTOCOL *This, + OUT UINT64 *TimerPeriod + ) +{ + if (TimerPeriod =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + *TimerPeriod =3D mTimerPeriod; + + return EFI_SUCCESS; +} + +/** + + This function generates a soft timer interrupt. If the platform does not= support soft + timer interrupts, then EFI_UNSUPPORTED is returned. Otherwise, EFI_SUCCE= SS is returned. + If a handler has been registered through the EFI_TIMER_ARCH_PROTOCOL.Reg= isterHandler() + service, then a soft timer interrupt will be generated. If the timer int= errupt is + enabled when this service is called, then the registered handler will be= invoked. The + registered handler should not be able to distinguish a hardware-generate= d timer + interrupt from a software-generated timer interrupt. + + + @param This The EFI_TIMER_ARCH_PROTOCOL instance. + + @retval EFI_SUCCESS The soft timer interrupt was generated. + @retval EFI_UNSUPPORTED The platform does not support the generation o= f soft timer interrupts. + +**/ +EFI_STATUS +EFIAPI +TimerDriverGenerateSoftInterrupt ( + IN EFI_TIMER_ARCH_PROTOCOL *This + ) +{ + EFI_TPL OriginalTPL; + + if (GetApicTimerInterruptState()) { + // + // Invoke the registered handler + // + OriginalTPL =3D gBS->RaiseTPL (TPL_HIGH_LEVEL); + + if (mTimerNotifyFunction !=3D NULL) { + // + // @bug : This does not handle missed timer interrupts + // + mTimerNotifyFunction (mTimerPeriod); + } + + gBS->RestoreTPL (OriginalTPL); + } else { + return EFI_UNSUPPORTED; + } + + return EFI_SUCCESS; +} + +/** + Initialize the Timer Architectural Protocol driver + + @param ImageHandle ImageHandle of the loaded driver + @param SystemTable Pointer to the System Table + + @retval EFI_SUCCESS Timer Architectural Protocol created + @retval EFI_OUT_OF_RESOURCES Not enough resources available to initial= ize driver. + @retval EFI_DEVICE_ERROR A device error occurred attempting to ini= tialize the driver. + +**/ +EFI_STATUS +EFIAPI +TimerDriverInitialize ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + + // + // Initialize the pointer to our notify function. + // + mTimerNotifyFunction =3D NULL; + + // + // Make sure the Timer Architectural Protocol is not already installed i= n the system + // + ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiTimerArchProtocolGuid); + + // + // Find the CPU architectural protocol. + // + Status =3D gBS->LocateProtocol (&gEfiCpuArchProtocolGuid, NULL, (VOID **= ) &mCpu); + ASSERT_EFI_ERROR (Status); + + // + // Force the timer to be disabled + // + Status =3D TimerDriverSetTimerPeriod (&mTimer, 0); + ASSERT_EFI_ERROR (Status); + + // + // Install interrupt handler for Local APIC Timer + // + Status =3D mCpu->RegisterInterruptHandler (mCpu, LOCAL_APIC_TIMER_VECTOR, + TimerInterruptHandler); + ASSERT_EFI_ERROR (Status); + + // + // Force the timer to be enabled at its default period + // + Status =3D TimerDriverSetTimerPeriod (&mTimer, DEFAULT_TIMER_TICK_DURATI= ON); + ASSERT_EFI_ERROR (Status); + + // + // Install the Timer Architectural Protocol onto a new handle + // + Status =3D gBS->InstallMultipleProtocolInterfaces ( + &mTimerHandle, + &gEfiTimerArchProtocolGuid, &mTimer, + NULL + ); + ASSERT_EFI_ERROR (Status); + + return Status; +} + diff --git a/Maintainers.txt b/Maintainers.txt index f51731a6b6..78e9f889ab 100644 --- a/Maintainers.txt +++ b/Maintainers.txt @@ -385,6 +385,7 @@ F: OvmfPkg/XenIoPciDxe/ F: OvmfPkg/XenPlatformPei/ F: OvmfPkg/XenPvBlkDxe/ F: OvmfPkg/XenResetVector/ +F: OvmfPkg/XenTimerDxe/ R: Anthony Perard R: Julien Grall =20 --=20 Anthony PERARD -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45546): https://edk2.groups.io/g/devel/message/45546 Mute This Topic: https://groups.io/mt/32851693/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Nov 14 05:47:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45552+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1565697493; cv=none; d=zoho.com; s=zohoarc; b=YDDSXbHNR0uB3R7F0WYav+UsYbn+cGpm5rEbFg0KbK3zcWlZJPsuZjhxcvBUWH3yDm7QvmMvm91LMW08GZfgvGb0QNkey5Vc3Z8+AKkgqX8pckptRbBBPnDFmom+pr/JvT+ywIvabnL4LyjvXw/LPuK6H/a1HaWAr0NkuVNsim8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565697493; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=Cqw8T2pP/GbofOHVsbY18B01pJZs4fnALzuczW1frME=; b=eaSWn00ClXOkhW55KSnEXRoXl3PFJWulXG+qlHvcaHgtg51wcf7wGRN29rlDB63VZqRChJ3I21GYyAFiJTZ/6WW8w43E17IvHRSAC5ar8PsXpw0wtrtJkLm32pgiTIB5cG3VMKNIG5ch0ajZZN3JIYnTGwszUNj5VQdh4qEHOA0= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45552+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1565697493255503.7833736321943; Tue, 13 Aug 2019 04:58:13 -0700 (PDT) Return-Path: X-Received: from esa5.hc3370-68.iphmx.com (esa5.hc3370-68.iphmx.com []) by groups.io with SMTP; Tue, 13 Aug 2019 04:58:11 -0700 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45552+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: None (esa5.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=esa5.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa5.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=esa5.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 (esa5.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=esa5.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: Zrvu6fLvVDO8W1GC0aIK5SfixZpX5ou96PRyInnWMeUQl/sEWLvFyqy/O77lgXEQzGNoSX42K/ wywCmNuJ2BmHd664w0nufGHPt0+SzmROqauSN7dZ5FUWQXuEVh5osL0iefPoedlhCUvH60Fg3T nMAChHS2QwyNGMvJlylaVcl6DB3GVvFJer7NrjgkxezSZk2LFBmO/P5+c6to4jWST7WVdE06wQ usOkle8IkKr39ubTL60zyJEiqkgSyR7w2qDC7LTqS3W4JWfJxKm8ik78Ex3yXq58t67Fum0nri ZHI= X-SBRS: 2.7 X-MesageID: 4347490 X-Ironport-Server: esa5.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="4347490" From: "Anthony PERARD" To: CC: Laszlo Ersek , Jordan Justen , Julien Grall , , Ard Biesheuvel , Anthony PERARD Subject: [edk2-devel] [PATCH v5 31/35] OvmfPkg/PlatformBootManagerLib: Use a Xen console for ConOut/ConIn Date: Tue, 13 Aug 2019 12:31:15 +0100 Message-ID: <20190813113119.14804-32-anthony.perard@citrix.com> In-Reply-To: <20190813113119.14804-1-anthony.perard@citrix.com> References: <20190813113119.14804-1-anthony.perard@citrix.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,anthony.perard@citrix.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565697492; bh=Cqw8T2pP/GbofOHVsbY18B01pJZs4fnALzuczW1frME=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=ul4P+z9W4PHjrhAudbeG62ulVuRrjxxPT5YYX5KHwByYXVLiWecNvmwZm03faCRPMsM pFjX0uDWSu1pCrn9UF0FXAx8o6KVhSq2t1CaGQi1uf+UP82OnkMUhuuZPqIRjt8jQwN0U PFRWaVcLs6rj4aXONGCIJwIioDBzeC+QBds= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" On a Xen PVH guest, none of the existing serial or console interface works, so we add a new one, based on XenConsoleSerialPortLib, and implemented via SerialDxe. That is a simple console implementation that can work on both PVH guest and HVM guests, even if it is rarely going to be used on HVM. Have PlatformBootManagerLib look for the new console, when running as a Xen guest. Since we use VENDOR_UART_DEVICE_PATH, fix its description and coding style. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1689 Signed-off-by: Anthony PERARD Reviewed-by: Laszlo Ersek --- Notes: v5: - fix typos in commit message. =20 v4: - instead of creating a new XEN_CONSOLE_DEVICE_PATH, use the existing VENDOR_UART_DEVICE_PATH. And explain why VENDOR_UART_DEVICE_PATH changed in the commit message. =20 v3: - removed PciSioSerialDxe and IsaSerialDxe from OvmfXen, since they would not be used, maybe, to check. - some coding style fix =20 - not changed: PciSioSerialDxe: even if we add SerialDxe, we still needs PciSioSerialDxe to have OVMF use the emulated serial port on HVM. =20 v2: - Use MdeModulePkg/Universal/SerialDxe instead of something new. - Have PlatformInitializeConsole() look for it by using the known-in-advance device path for the xen console in the PLATFORM_CONSOLE_CONNECT_ENTRY. OvmfPkg/OvmfXen.dsc | 4 ++ OvmfPkg/OvmfXen.fdf | 1 + .../PlatformBootManagerLib.inf | 4 ++ .../PlatformBootManagerLib/BdsPlatform.h | 1 + .../PlatformBootManagerLib/BdsPlatform.c | 3 +- .../PlatformBootManagerLib/PlatformData.c | 49 +++++++++++++++++-- 6 files changed, 58 insertions(+), 4 deletions(-) diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc index 54ac910d8e..e719a168f8 100644 --- a/OvmfPkg/OvmfXen.dsc +++ b/OvmfPkg/OvmfXen.dsc @@ -586,6 +586,10 @@ [Components] OvmfPkg/XenIoPciDxe/XenIoPciDxe.inf OvmfPkg/XenBusDxe/XenBusDxe.inf OvmfPkg/XenPvBlkDxe/XenPvBlkDxe.inf + MdeModulePkg/Universal/SerialDxe/SerialDxe.inf { + + SerialPortLib|OvmfPkg/Library/XenConsoleSerialPortLib/XenConsoleSeri= alPortLib.inf + } MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntim= eDxe.inf MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf diff --git a/OvmfPkg/OvmfXen.fdf b/OvmfPkg/OvmfXen.fdf index fa0830a324..5c1a925d6a 100644 --- a/OvmfPkg/OvmfXen.fdf +++ b/OvmfPkg/OvmfXen.fdf @@ -312,6 +312,7 @@ [FV.DXEFV] INF OvmfPkg/XenIoPciDxe/XenIoPciDxe.inf INF OvmfPkg/XenBusDxe/XenBusDxe.inf INF OvmfPkg/XenPvBlkDxe/XenPvBlkDxe.inf +INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf =20 INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRun= timeDxe.inf diff --git a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.= inf b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf index 04d614cd49..f89cce1879 100644 --- a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf +++ b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf @@ -61,6 +61,10 @@ [Pcd] gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashVariablesEnable gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate ## CONSUMES + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits ## CONSUMES + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity ## CONSUMES + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits ## CONSUMES =20 [Pcd.IA32, Pcd.X64] gEfiMdePkgTokenSpaceGuid.PcdFSBClock diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h b/OvmfPkg= /Library/PlatformBootManagerLib/BdsPlatform.h index 49a072b400..153e215101 100644 --- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h +++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h @@ -165,6 +165,7 @@ typedef struct { #define CONSOLE_IN BIT1 #define STD_ERROR BIT2 extern PLATFORM_CONSOLE_CONNECT_ENTRY gPlatformConsole[]; +extern PLATFORM_CONSOLE_CONNECT_ENTRY gXenPlatformConsole[]; =20 // // Platform BDS Functions diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg= /Library/PlatformBootManagerLib/BdsPlatform.c index 1eba304f09..70df6b841a 100644 --- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c +++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c @@ -398,7 +398,8 @@ PlatformBootManagerBeforeConsole ( // EfiBootManagerDispatchDeferredImages (); =20 - PlatformInitializeConsole (gPlatformConsole); + PlatformInitializeConsole ( + XenDetected() ? gXenPlatformConsole : gPlatformConsole); PcdStatus =3D PcdSet16S (PcdPlatformBootTimeOut, GetFrontPageTimeoutFromQemu ()); ASSERT_RETURN_ERROR (PcdStatus); diff --git a/OvmfPkg/Library/PlatformBootManagerLib/PlatformData.c b/OvmfPk= g/Library/PlatformBootManagerLib/PlatformData.c index 36aab784d7..2858c3dfd5 100644 --- a/OvmfPkg/Library/PlatformBootManagerLib/PlatformData.c +++ b/OvmfPkg/Library/PlatformBootManagerLib/PlatformData.c @@ -9,18 +9,19 @@ =20 #include "BdsPlatform.h" #include +#include =20 // -// Debug Agent UART Device Path structure +// Vendor UART Device Path structure // -#pragma pack(1) +#pragma pack (1) typedef struct { VENDOR_DEVICE_PATH VendorHardware; UART_DEVICE_PATH Uart; VENDOR_DEVICE_PATH TerminalType; EFI_DEVICE_PATH_PROTOCOL End; } VENDOR_UART_DEVICE_PATH; -#pragma pack() +#pragma pack () =20 // // USB Keyboard Device Path structure @@ -141,6 +142,37 @@ STATIC VENDOR_RAMFB_DEVICE_PATH gQemuRamfbDevicePath = =3D { gEndEntire }; =20 +STATIC VENDOR_UART_DEVICE_PATH gXenConsoleDevicePath =3D { + { + { + HARDWARE_DEVICE_PATH, + HW_VENDOR_DP, + { + (UINT8) (sizeof (VENDOR_DEVICE_PATH)), + (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8) + } + }, + EDKII_SERIAL_PORT_LIB_VENDOR_GUID + }, + { + { + MESSAGING_DEVICE_PATH, + MSG_UART_DP, + { + (UINT8) (sizeof (UART_DEVICE_PATH)), + (UINT8) ((sizeof (UART_DEVICE_PATH)) >> 8) + } + }, + 0, + FixedPcdGet64 (PcdUartDefaultBaudRate), + FixedPcdGet8 (PcdUartDefaultDataBits), + FixedPcdGet8 (PcdUartDefaultParity), + FixedPcdGet8 (PcdUartDefaultStopBits), + }, + gPcAnsiTerminal, + gEndEntire +}; + // // Predefined platform default console device path // @@ -163,6 +195,17 @@ PLATFORM_CONSOLE_CONNECT_ENTRY gPlatformConsole[] = =3D { } }; =20 +PLATFORM_CONSOLE_CONNECT_ENTRY gXenPlatformConsole[] =3D { + { + (EFI_DEVICE_PATH_PROTOCOL *)&gXenConsoleDevicePath, + (CONSOLE_OUT | CONSOLE_IN | STD_ERROR) + }, + { + NULL, + 0 + } +}; + // // Predefined platform connect sequence // --=20 Anthony PERARD -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45552): https://edk2.groups.io/g/devel/message/45552 Mute This Topic: https://groups.io/mt/32851700/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Nov 14 05:47:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45544+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1565697477; cv=none; d=zoho.com; s=zohoarc; b=k0gcA9wYmqKFZti1p/RaV/UgO3NfB8s1n8jDg/N2fXuP766mgK8Sq7rn1fSkp4driYobHAGGi6yB3kf8nFsD9lrwEr5loL7mQAcy2d4FyBLN2qQ2HMyPsHEugg3RIOsCm+mGymIetZnyjPx+c4kaJDqRHxZZXyie8+VIlQ2EWOQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565697477; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=u4nm766GBolquE5bH0CZxUyLBpogh+ydMU9dKNZiKRw=; b=O24GSzxEC0t3j6WcyosFvZqPsrvA8+6a8B/oD3Std/Ypf6wcbdAne3HgOCAJVKuZCgYVNOQue94Hqb54tBXMFVQWfkLThD/iOFFUxTLu3azFWmILb3G03KqR63/Y9Tr4Pzfeq74Mz1gckzFlsmcr8qM3MC7kxh1NnRb3Qq5Ber4= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45544+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1565697477318503.6180015007702; Tue, 13 Aug 2019 04:57:57 -0700 (PDT) Return-Path: X-Received: from esa3.hc3370-68.iphmx.com (esa3.hc3370-68.iphmx.com [216.71.145.155]) by groups.io with SMTP; Tue, 13 Aug 2019 04:57:56 -0700 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45544+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: None (esa3.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=esa3.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa3.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=esa3.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 (esa3.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=esa3.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: JSGYgwJynx42Wg4ESZWLvES884rRtA4gT5D8G8NRpvwt2ThABOfDSzZeYNvczJPJrrWuWG3HnR mLCRJF+KoXkCMPBH1J2XHd6WioSUgijYYE9oSMnsKFJJ0Gba2U5BL9RDMJGCQvgnV6jmYIPzHJ 2zsje8OmM5IrA6YBVQ/mq0BO/FQ3ZdnQZS9aTm8a7NDiR97venpYojahWVo4B0B0Pa61pQciBp SdtcdQnRnZanz1yDtN7Mnl9nBm7xc/6Lhb37R8r4RRhcsovJxxBlBAqSIwJwsafewLt5355JID dAY= X-SBRS: 2.7 X-MesageID: 4210839 X-Ironport-Server: esa3.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="4210839" From: "Anthony PERARD" To: CC: Laszlo Ersek , Jordan Justen , Julien Grall , , Ard Biesheuvel , Anthony PERARD Subject: [edk2-devel] [PATCH v5 32/35] OvmfPkg: Introduce PcdXenGrantFrames Date: Tue, 13 Aug 2019 12:31:16 +0100 Message-ID: <20190813113119.14804-33-anthony.perard@citrix.com> In-Reply-To: <20190813113119.14804-1-anthony.perard@citrix.com> References: <20190813113119.14804-1-anthony.perard@citrix.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,anthony.perard@citrix.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565697476; bh=u4nm766GBolquE5bH0CZxUyLBpogh+ydMU9dKNZiKRw=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=OVHChP1Wnu9xRlbeX2/zaD38OftdU0alc3hQkUf1gUzYsuXbseWnEEpCiV9h6qbGHIN M+U70Qoa7CNiWdjteioxMfulrxQOrklhQzyjyc6LDOu0e3YNq13a7gDqhPyHfgmzAFR2Y dFP1YumVuO/bf950F3xFQUNa4ftey3EkW5U= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Introduce PcdXenGrantFrames to replace a define in XenBusDxe and allow the same value to be used in a different module. The reason for the number of page to be 4 doesn't exist anymore, so simply remove the comment. Signed-off-by: Anthony PERARD Reviewed-by: Laszlo Ersek --- Notes: v5: - add missing PcdLib to [LibraryClasses] =20 v4: - new patch OvmfPkg/OvmfPkg.dec | 3 +++ OvmfPkg/XenBusDxe/XenBusDxe.inf | 3 +++ OvmfPkg/XenBusDxe/XenBusDxe.h | 1 + OvmfPkg/XenBusDxe/GrantTable.c | 3 +-- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec index 04d5e29272..d5fee805ef 100644 --- a/OvmfPkg/OvmfPkg.dec +++ b/OvmfPkg/OvmfPkg.dec @@ -225,6 +225,9 @@ [PcdsFixedAtBuild] gUefiOvmfPkgTokenSpaceGuid.PcdXenPvhStartOfDayStructPtr|0x0|UINT32|0x17 gUefiOvmfPkgTokenSpaceGuid.PcdXenPvhStartOfDayStructPtrSize|0x0|UINT32|0= x32 =20 + ## Number of page frames to use for storing grant table entries. + gUefiOvmfPkgTokenSpaceGuid.PcdXenGrantFrames|4|UINT32|0x33 + [PcdsDynamic, PcdsDynamicEx] gUefiOvmfPkgTokenSpaceGuid.PcdEmuVariableEvent|0|UINT64|2 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashVariablesEnable|FALSE|BOOLEAN|0x10 diff --git a/OvmfPkg/XenBusDxe/XenBusDxe.inf b/OvmfPkg/XenBusDxe/XenBusDxe.= inf index 86e0fb8224..536b49fa8c 100644 --- a/OvmfPkg/XenBusDxe/XenBusDxe.inf +++ b/OvmfPkg/XenBusDxe/XenBusDxe.inf @@ -51,6 +51,7 @@ [LibraryClasses] XenHypercallLib SynchronizationLib PrintLib + PcdLib =20 [Protocols] gEfiDriverBindingProtocolGuid @@ -59,3 +60,5 @@ [Protocols] gXenBusProtocolGuid gXenIoProtocolGuid =20 +[FixedPcd] + gUefiOvmfPkgTokenSpaceGuid.PcdXenGrantFrames diff --git a/OvmfPkg/XenBusDxe/XenBusDxe.h b/OvmfPkg/XenBusDxe/XenBusDxe.h index 8510361bca..b1dcc3549c 100644 --- a/OvmfPkg/XenBusDxe/XenBusDxe.h +++ b/OvmfPkg/XenBusDxe/XenBusDxe.h @@ -22,6 +22,7 @@ #include #include #include +#include =20 =20 // diff --git a/OvmfPkg/XenBusDxe/GrantTable.c b/OvmfPkg/XenBusDxe/GrantTable.c index 6575e9b88c..1130404cd1 100644 --- a/OvmfPkg/XenBusDxe/GrantTable.c +++ b/OvmfPkg/XenBusDxe/GrantTable.c @@ -22,8 +22,7 @@ =20 #define NR_RESERVED_ENTRIES 8 =20 -/* NR_GRANT_FRAMES must be less than or equal to that configured in Xen */ -#define NR_GRANT_FRAMES 4 +#define NR_GRANT_FRAMES (FixedPcdGet32 (PcdXenGrantFrames)) #define NR_GRANT_ENTRIES (NR_GRANT_FRAMES * EFI_PAGE_SIZE / sizeof(grant_e= ntry_v1_t)) =20 STATIC grant_entry_v1_t *GrantTable =3D NULL; --=20 Anthony PERARD -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45544): https://edk2.groups.io/g/devel/message/45544 Mute This Topic: https://groups.io/mt/32851690/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Nov 14 05:47:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45557+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1565697509; cv=none; d=zoho.com; s=zohoarc; b=YS35IsEUyu2DwJRqgVTEf3O1u76ylj9TmYBbjJvyw9ZJJBhKyAwsdqupniwm4A2x2bHKcqB+RNBjUFiVAtnsUQTQQKMp+8gbD10HecgyYHchBESoGpI85c7IHRbQJpbSaL0vGA3Xd5d1PqP9OL7cWTIBDLTke9+hbLpQKFStTmQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565697509; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=E8TfwLUc44R3JV103tgvQVbJ12pUdZxvrKl3IOjUd1k=; b=SBfgH2WOqIyinbgQ5jafQevasZcV6ja0M8VgnTdVotYfS3sRUYYNZO+KXNxjEXZfIFOytRDEY2A3ksTQbBeOqxIAxdOP3qynBumniQQQGeX8WVN5kqv6BzCgPxwj/pdFLCRNX2vc6oCIXryXvgjeY9qjHAE2FoVx5SzcF3iX0mM= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45557+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 156569750947767.74611027289757; Tue, 13 Aug 2019 04:58:29 -0700 (PDT) Return-Path: X-Received: from esa5.hc3370-68.iphmx.com (esa5.hc3370-68.iphmx.com [216.71.155.168]) by groups.io with SMTP; Tue, 13 Aug 2019 04:58:28 -0700 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45557+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: None (esa5.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=esa5.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa5.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=esa5.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 (esa5.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=esa5.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: 3igOo/eflFaplot55F9aQI48jVDVeTmTVYlgUwgcDiLk7mjrwKSPqt/v0clOQN9DBZxdd16yFf QSPfgUx0hRsYbCPmkXeGBtY5yuAUX05uQ3DWgabN1wqlvHQrTYkXwmBsFAG67sc3suRWfAF3u4 eP+Ew2GoIZVvMvId8U+ZxO5dtMrlMEmT8cywRYRBbLcOH1tOslHZTCrfLgpzWUoMxLbsnk/z8J e8WnRMZ9wC4Bju9FovQG26809wwA5yALzDEr7fL7bqNu8DPgyEt5JGKYHelL87e3LtQGIRtGtA IHU= X-SBRS: 2.7 X-MesageID: 4347506 X-Ironport-Server: esa5.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="4347506" From: "Anthony PERARD" To: CC: Laszlo Ersek , Jordan Justen , Julien Grall , , Ard Biesheuvel , Anthony PERARD Subject: [edk2-devel] [PATCH v5 33/35] OvmfPkg: Introduce XenIoPvhDxe to initialize Grant Tables Date: Tue, 13 Aug 2019 12:31:17 +0100 Message-ID: <20190813113119.14804-34-anthony.perard@citrix.com> In-Reply-To: <20190813113119.14804-1-anthony.perard@citrix.com> References: <20190813113119.14804-1-anthony.perard@citrix.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,anthony.perard@citrix.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565697509; bh=E8TfwLUc44R3JV103tgvQVbJ12pUdZxvrKl3IOjUd1k=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=V95xYFOtcLd325InFluDnz7Fi5a49GgH29Lzrp9yMC/X3Pv4m6bCk+Irb8lKR+/lAml ZSjtKGQdS5vxlBpLhTmQREXTIFz03Js8QRPzBfASI8hfdJma7XpBnYhSQKMHa2BTYCFZJ 26S1/elVppGsEQV20LVb9qQ1jcwpGZm5WMw= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" XenIoPvhDxe use XenIoMmioLib to reserve some space to be use by the Grant Tables. The call is only done if it is necessary, we simply detect if the guest is PVH, as in this case there is currently no PCI bus, and no PCI Xen platform device which would start the XenIoPciDxe and allocate the space for the Grant Tables. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1689 Signed-off-by: Anthony PERARD Reviewed-by: Laszlo Ersek --- Notes: v5: - add missing PcdLib as #include and in [LibraryClasses] =20 v4: - Removed XenIoPvhDxeNotifyExitBoot() which was doing action that should not be done in an ExitBootServices notification. (InitializeXenIoPvhDxe() has been cleaned up following this.) - Use new PcdXenGrantFrames. - Some coding style fix - Update Maintainers.txt =20 v3: - downgrade type to DXE_DRIVER - use SPDX - rework InitializeXenIoPvhDxe, and handle errors properly. - Free the reserved allocation in ExitBootServices even if the XenIo protocol could successfully been uninstalled. =20 v2: - do allocation in EntryPoint like the other user of XenIoMmioLib. - allocate memory instead of hardcoded addr. - cleanup, add copyright - detect if we are running in PVH mode OvmfPkg/OvmfXen.dsc | 2 ++ OvmfPkg/OvmfXen.fdf | 1 + OvmfPkg/XenIoPvhDxe/XenIoPvhDxe.inf | 36 +++++++++++++++++++ OvmfPkg/XenIoPvhDxe/XenIoPvhDxe.c | 54 +++++++++++++++++++++++++++++ Maintainers.txt | 1 + 5 files changed, 94 insertions(+) create mode 100644 OvmfPkg/XenIoPvhDxe/XenIoPvhDxe.inf create mode 100644 OvmfPkg/XenIoPvhDxe/XenIoPvhDxe.c diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc index e719a168f8..5e07b37279 100644 --- a/OvmfPkg/OvmfXen.dsc +++ b/OvmfPkg/OvmfXen.dsc @@ -195,6 +195,7 @@ [LibraryClasses] OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib= /BaseOrderedCollectionRedBlackTreeLib.inf XenHypercallLib|OvmfPkg/Library/XenHypercallLib/XenHypercallLib.inf XenPlatformLib|OvmfPkg/Library/XenPlatformLib/XenPlatformLib.inf + XenIoMmioLib|OvmfPkg/Library/XenIoMmioLib/XenIoMmioLib.inf =20 Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibNull/DxeT= cg2PhysicalPresenceLib.inf TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurem= entLibNull.inf @@ -583,6 +584,7 @@ [Components] NULL|OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUiLib.inf !endif } + OvmfPkg/XenIoPvhDxe/XenIoPvhDxe.inf OvmfPkg/XenIoPciDxe/XenIoPciDxe.inf OvmfPkg/XenBusDxe/XenBusDxe.inf OvmfPkg/XenPvBlkDxe/XenPvBlkDxe.inf diff --git a/OvmfPkg/OvmfXen.fdf b/OvmfPkg/OvmfXen.fdf index 5c1a925d6a..517a492f14 100644 --- a/OvmfPkg/OvmfXen.fdf +++ b/OvmfPkg/OvmfXen.fdf @@ -309,6 +309,7 @@ [FV.DXEFV] INF MdeModulePkg/Universal/Metronome/Metronome.inf INF PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDx= e.inf =20 +INF OvmfPkg/XenIoPvhDxe/XenIoPvhDxe.inf INF OvmfPkg/XenIoPciDxe/XenIoPciDxe.inf INF OvmfPkg/XenBusDxe/XenBusDxe.inf INF OvmfPkg/XenPvBlkDxe/XenPvBlkDxe.inf diff --git a/OvmfPkg/XenIoPvhDxe/XenIoPvhDxe.inf b/OvmfPkg/XenIoPvhDxe/XenI= oPvhDxe.inf new file mode 100644 index 0000000000..1c27f8aae0 --- /dev/null +++ b/OvmfPkg/XenIoPvhDxe/XenIoPvhDxe.inf @@ -0,0 +1,36 @@ +## @file +# Driver for the XenIo protocol +# +# Copyright (c) 2019, Citrix Systems, Inc. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D XenIoPvhDxe + FILE_GUID =3D 7a567cc4-0e75-4d7a-a305-c3db109b53ad + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D InitializeXenIoPvhDxe + +[Packages] + MdePkg/MdePkg.dec + OvmfPkg/OvmfPkg.dec + +[Sources] + XenIoPvhDxe.c + +[LibraryClasses] + MemoryAllocationLib + PcdLib + UefiDriverEntryPoint + XenIoMmioLib + XenPlatformLib + +[FixedPcd] + gUefiOvmfPkgTokenSpaceGuid.PcdXenGrantFrames + +[Depex] + TRUE diff --git a/OvmfPkg/XenIoPvhDxe/XenIoPvhDxe.c b/OvmfPkg/XenIoPvhDxe/XenIoP= vhDxe.c new file mode 100644 index 0000000000..9264a85df1 --- /dev/null +++ b/OvmfPkg/XenIoPvhDxe/XenIoPvhDxe.c @@ -0,0 +1,54 @@ +/** @file + + Driver for the XenIo protocol + + This driver simply allocate space for the grant tables. + + Copyright (c) 2019, Citrix Systems, Inc. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include + +EFI_STATUS +EFIAPI +InitializeXenIoPvhDxe ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + VOID *Allocation; + EFI_STATUS Status; + EFI_HANDLE XenIoHandle; + + Allocation =3D NULL; + XenIoHandle =3D NULL; + + if (!XenPvhDetected ()) { + return EFI_UNSUPPORTED; + } + + Allocation =3D AllocateReservedPages (FixedPcdGet32 (PcdXenGrantFrames)); + if (Allocation =3D=3D NULL) { + Status =3D EFI_OUT_OF_RESOURCES; + goto Error; + } + + Status =3D XenIoMmioInstall (&XenIoHandle, (UINTN) Allocation); + if (EFI_ERROR (Status)) { + goto Error; + } + + return EFI_SUCCESS; + +Error: + if (Allocation !=3D NULL) { + FreePages (Allocation, FixedPcdGet32 (PcdXenGrantFrames)); + } + return Status; +} diff --git a/Maintainers.txt b/Maintainers.txt index 78e9f889ab..79defd13bf 100644 --- a/Maintainers.txt +++ b/Maintainers.txt @@ -382,6 +382,7 @@ F: OvmfPkg/PlatformPei/Xen.* F: OvmfPkg/SmbiosPlatformDxe/*Xen.c F: OvmfPkg/XenBusDxe/ F: OvmfPkg/XenIoPciDxe/ +F: OvmfPkg/XenIoPvhDxe/ F: OvmfPkg/XenPlatformPei/ F: OvmfPkg/XenPvBlkDxe/ F: OvmfPkg/XenResetVector/ --=20 Anthony PERARD -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45557): https://edk2.groups.io/g/devel/message/45557 Mute This Topic: https://groups.io/mt/32851705/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Nov 14 05:47:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45539+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1565697472; cv=none; d=zoho.com; s=zohoarc; b=oliEMECvE/wFLytGs43Nk7abTbCiL1mJScUqOa3xk/AvX95KTuZ3ZyISGWR+51GR2V29N1E0pJnetZS7MmN7LZcNxmqqRrGTAq6kwnWEu+1wZc/tLfqYc5WFyMXEfK7l9GgWCxCfcrb9sxOkdLIiMUAUxYgeggKpV16GaT0buSc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565697472; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=bODyby56H6MEEZWhpL5RBa9UeLsuF9XlEtk7TQuAE1M=; b=eiHqbPiL5eQ0ZKlI441RWX3k0zTIdmznAICMpx9DVo/9i6ZwqL970xbr4Pgih0f573wobdIvCuN78sMbR/qHloa0hEK4McECZM+B+dSXtUkl+RZjVDALP9LZMYO6nSVlraVFpmfxEFROFE72bESXBaNSgTjJXyqBVq3Km9AaymU= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45539+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 15656974721851006.1454947469825; Tue, 13 Aug 2019 04:57:52 -0700 (PDT) Return-Path: X-Received: from esa4.hc3370-68.iphmx.com (esa4.hc3370-68.iphmx.com [216.71.155.144]) by groups.io with SMTP; Tue, 13 Aug 2019 04:57:50 -0700 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45539+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: None (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.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=esa4.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 (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: 0RTL1XTjlAHWmnU0mSqewYG3ushZ1D0fnEPY8/uRBfsg+v/o5Wjsd3uk/tXIe5VrI7xrz7WY9o W6l2XJGyRVh8yiOr35YQu+LHwzLYEYnQtK2TICxOiNNRxaLr0mfNyVGVCcEYsApq2usjoWE9rh 2CABYGMLeuVdlxFtC5picXBqJB/mar6+tey5VrznSRMlT2AMkNuzMEILdcTpf9naINoEIYzkCs gvmMK9FL66B/pH+ysIVmHG+5gGqHiy81oWAXQ0PX5bjPLXrte0IpWNs+xl5KleaxmdYJXyQdBy JqU= X-SBRS: 2.7 X-MesageID: 4402016 X-Ironport-Server: esa4.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="4402016" From: "Anthony PERARD" To: CC: Laszlo Ersek , Jordan Justen , Julien Grall , , Ard Biesheuvel , Anthony PERARD Subject: [edk2-devel] [PATCH v5 34/35] OvmfPkg: Move XenRealTimeClockLib from ArmVirtPkg Date: Tue, 13 Aug 2019 12:31:18 +0100 Message-ID: <20190813113119.14804-35-anthony.perard@citrix.com> In-Reply-To: <20190813113119.14804-1-anthony.perard@citrix.com> References: <20190813113119.14804-1-anthony.perard@citrix.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,anthony.perard@citrix.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565697471; bh=bODyby56H6MEEZWhpL5RBa9UeLsuF9XlEtk7TQuAE1M=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=pe1eTd3W0fqDtFFm+uJnfttJknGvrMp7dLoCzGK+8BoCTY+JfzuFk/1GVg5JQ3KnHAz F5yoDIX4eOG169ypojVEqK/f6gwLnY8fIygoQfTMnAsbjsuwLPo/TjHK/2960VvwN9GDH m9DrAWKOoQ4uN0CdyFcovgM+36Z8LJOTwwQ= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Move XenRealTimeClockLib from ArmVirtPkg to OvmfPkg so it can be used from the OvmfPkg by the following patch, "OvmfPkg/OvmfXen: use RealTimeClockRuntimeDxe from EmbeddedPkg" Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1689 Signed-off-by: Anthony PERARD Reviewed-by: Laszlo Ersek --- Notes: v4: - Update Maintainers.txt =20 v3: - fix the commit message body ArmVirtPkg/ArmVirtXen.dsc | 2 +- .../Library/XenRealTimeClockLib/XenRealTimeClockLib.inf | 0 .../Library/XenRealTimeClockLib/XenRealTimeClockLib.c | 0 Maintainers.txt | 2 +- 4 files changed, 2 insertions(+), 2 deletions(-) rename {ArmVirtPkg =3D> OvmfPkg}/Library/XenRealTimeClockLib/XenRealTimeCl= ockLib.inf (100%) rename {ArmVirtPkg =3D> OvmfPkg}/Library/XenRealTimeClockLib/XenRealTimeCl= ockLib.c (100%) diff --git a/ArmVirtPkg/ArmVirtXen.dsc b/ArmVirtPkg/ArmVirtXen.dsc index 79304ee61d..1b42a9a813 100644 --- a/ArmVirtPkg/ArmVirtXen.dsc +++ b/ArmVirtPkg/ArmVirtXen.dsc @@ -27,7 +27,7 @@ [Defines] =20 [LibraryClasses] SerialPortLib|OvmfPkg/Library/XenConsoleSerialPortLib/XenConsoleSerialPo= rtLib.inf - RealTimeClockLib|ArmVirtPkg/Library/XenRealTimeClockLib/XenRealTimeClock= Lib.inf + RealTimeClockLib|OvmfPkg/Library/XenRealTimeClockLib/XenRealTimeClockLib= .inf XenHypercallLib|OvmfPkg/Library/XenHypercallLib/XenHypercallLib.inf =20 ArmGenericTimerCounterLib|ArmVirtPkg/Library/XenArmGenericTimerVirtCount= erLib/XenArmGenericTimerVirtCounterLib.inf diff --git a/ArmVirtPkg/Library/XenRealTimeClockLib/XenRealTimeClockLib.inf= b/OvmfPkg/Library/XenRealTimeClockLib/XenRealTimeClockLib.inf similarity index 100% rename from ArmVirtPkg/Library/XenRealTimeClockLib/XenRealTimeClockLib.inf rename to OvmfPkg/Library/XenRealTimeClockLib/XenRealTimeClockLib.inf diff --git a/ArmVirtPkg/Library/XenRealTimeClockLib/XenRealTimeClockLib.c b= /OvmfPkg/Library/XenRealTimeClockLib/XenRealTimeClockLib.c similarity index 100% rename from ArmVirtPkg/Library/XenRealTimeClockLib/XenRealTimeClockLib.c rename to OvmfPkg/Library/XenRealTimeClockLib/XenRealTimeClockLib.c diff --git a/Maintainers.txt b/Maintainers.txt index 79defd13bf..919baccc56 100644 --- a/Maintainers.txt +++ b/Maintainers.txt @@ -114,7 +114,6 @@ R: Leif Lindholm ArmVirtPkg: modules used on Xen F: ArmVirtPkg/ArmVirtXen.* F: ArmVirtPkg/Library/XenArmGenericTimerVirtCounterLib/ -F: ArmVirtPkg/Library/XenRealTimeClockLib/ F: ArmVirtPkg/Library/XenVirtMemInfoLib/ F: ArmVirtPkg/PrePi/ F: ArmVirtPkg/XenAcpiPlatformDxe/ @@ -374,6 +373,7 @@ F: OvmfPkg/Library/XenConsoleSerialPortLib/ F: OvmfPkg/Library/XenHypercallLib/ F: OvmfPkg/Library/XenIoMmioLib/ F: OvmfPkg/Library/XenPlatformLib/ +F: OvmfPkg/Library/XenRealTimeClockLib/ F: OvmfPkg/OvmfXen.* F: OvmfPkg/OvmfXenElfHeaderGenerator.c F: OvmfPkg/PlatformPei/MemDetect.c --=20 Anthony PERARD -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45539): https://edk2.groups.io/g/devel/message/45539 Mute This Topic: https://groups.io/mt/32851683/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Nov 14 05:47:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45551+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1565697493; cv=none; d=zoho.com; s=zohoarc; b=CT9RgM8fp4/OFuzqeIW5qx/EgiZWymqXB+SDth8sRZZ7VBKBEPqvfKocWkcqInn0Hxx2/iOSt6dL49/+dlfWzqgiY4dSiN0uQLglqGIFGXxrU5wr5tfd0DnG+uHswYzGopMfp1iX1mIkRkXuD43mgTN+V2d6MAuTzzwRbesPMEY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565697493; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=U2DIKAsWLGuhjSh5yHM3qu9yDH5pTZ1IOvMoluSjUO8=; b=C9rC7mYnBgjc4rSPAudsUdu2nEakqdg0nGw3nsiK6NIeEico621PeFn5wvumgJn8VcG5IIwqkGFRFFrSvUyVyejGtFuRi9yk38MF/EagJ3U9AykvAgnk1peXl3Nw6BGii+Qj6DwCHJaaHBV1nHXMZfjdbhls2sU/TLDyNJ6yH38= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45551+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 15656974932591007.3372915817706; Tue, 13 Aug 2019 04:58:13 -0700 (PDT) Return-Path: X-Received: from esa3.hc3370-68.iphmx.com (esa3.hc3370-68.iphmx.com [216.71.145.155]) by groups.io with SMTP; Tue, 13 Aug 2019 04:58:11 -0700 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45551+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: None (esa3.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=esa3.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa3.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=esa3.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 (esa3.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=esa3.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: arHufaVQdJBQ7z2v4CqLg/cRzWuqw5Rd8g8QIokuMArBAnBk0QveLzZRLEYRenvDjPeTMUFZQp MB17H6+bgO+5xFO/fiivojDobcDbF0dWuljTw6Rn8VRtp9JvCujKuOBwiTL9vdzPwYLMgC8KrR A5rgwwAeMI74eZhJsa+2JoEPkHyekKtzYIuF92/E6wiQrOTDbRfELdyL+w/KjlAX6lzkzkaPBB BihSq2sdwZU+9juc7ffwdqkb6VblHQt219gUIkncCqzpgum97Lzqa+ZV1EmWMENad7mr9cwPpj HHQ= X-SBRS: 2.7 X-MesageID: 4210844 X-Ironport-Server: esa3.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="4210844" From: "Anthony PERARD" To: CC: Laszlo Ersek , Jordan Justen , Julien Grall , , Ard Biesheuvel , Anthony PERARD Subject: [edk2-devel] [PATCH v5 35/35] OvmfPkg/OvmfXen: use RealTimeClockRuntimeDxe from EmbeddedPkg Date: Tue, 13 Aug 2019 12:31:19 +0100 Message-ID: <20190813113119.14804-36-anthony.perard@citrix.com> In-Reply-To: <20190813113119.14804-1-anthony.perard@citrix.com> References: <20190813113119.14804-1-anthony.perard@citrix.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,anthony.perard@citrix.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565697492; bh=U2DIKAsWLGuhjSh5yHM3qu9yDH5pTZ1IOvMoluSjUO8=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=B8XNipjOvbhYfFSr2yFfqYYeGDOL8GndsjB9EWWL5407nizm4SDZppvIqHNRBi4tNu8 luCx3FwquIDBOMNk2KXGcFP7DozZ7nBRwyAoCYfUJ0D0HsZwLPuxIkGOb24D81iBfN42l M1Au6n8Xz98+ejgeEj2ApsYLoesz3YKd9eU= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" A Xen PVH guest doesn't have a RTC that OVMF would expect, so PcatRealTimeClockRuntimeDxe fails to initialize and prevent the firmware from finish to boot. To prevent that, we will use XenRealTimeClockLib which simply always return the same time. This will work on both Xen PVH and HVM guests. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1689 Signed-off-by: Anthony PERARD Acked-by: Laszlo Ersek --- Notes: v3: - moved RealTimeClockLib|*/XenRealTimeClockLib.inf to the global [LibraryClasses] OvmfPkg/OvmfXen.dsc | 3 ++- OvmfPkg/OvmfXen.fdf | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc index 5e07b37279..5a31f75f05 100644 --- a/OvmfPkg/OvmfXen.dsc +++ b/OvmfPkg/OvmfXen.dsc @@ -199,6 +199,7 @@ [LibraryClasses] =20 Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibNull/DxeT= cg2PhysicalPresenceLib.inf TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurem= entLibNull.inf + RealTimeClockLib|OvmfPkg/Library/XenRealTimeClockLib/XenRealTimeClockLib= .inf =20 [LibraryClasses.common] BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf @@ -564,7 +565,7 @@ [Components] } MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf MdeModulePkg/Universal/Metronome/Metronome.inf - PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.i= nf + EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf MdeModulePkg/Universal/BdsDxe/BdsDxe.inf { diff --git a/OvmfPkg/OvmfXen.fdf b/OvmfPkg/OvmfXen.fdf index 517a492f14..e6e9e184ef 100644 --- a/OvmfPkg/OvmfXen.fdf +++ b/OvmfPkg/OvmfXen.fdf @@ -307,7 +307,7 @@ [FV.DXEFV] INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf INF MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf INF MdeModulePkg/Universal/Metronome/Metronome.inf -INF PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDx= e.inf +INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf =20 INF OvmfPkg/XenIoPvhDxe/XenIoPvhDxe.inf INF OvmfPkg/XenIoPciDxe/XenIoPciDxe.inf --=20 Anthony PERARD -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45551): https://edk2.groups.io/g/devel/message/45551 Mute This Topic: https://groups.io/mt/32851699/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-