From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: citrix.com, ip: 216.71.145.142, mailfrom: anthony.perard@citrix.com) Received: from esa1.hc3370-68.iphmx.com (esa1.hc3370-68.iphmx.com [216.71.145.142]) by groups.io with SMTP; Thu, 04 Jul 2019 07:57:48 -0700 Authentication-Results: esa1.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 (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: PmNVexK4rwGJS1TZWljA+1KCdOrkSdgMhD54Y4NVusjWbAoUt7xp6ly+Q5GYsQONws2W00lplz ia+7QpyoTx4AiEVvjX/w2FRkomCT5O3Hu7Rxmt2nt9xsFNMFm3gXMHK5kgBksUm2ItwNCwNPth BwWz/WmLZmVCF3HkD18wuYnj9R5sASmdZ3rZbE97dHSrtb8KFi0ksApSUps97YtEAbAJqokNnq OcQOU9jA12dkVIdX3+Xa73yqeyReVCa+1HiCr4Aqt2rewvTG/r6ZnWnuAmftvckKXD6XHCA7me IDE= X-SBRS: 2.7 X-MesageID: 2617751 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.63,451,1557201600"; d="scan'208";a="2617751" From: "Anthony PERARD" To: CC: , Ard Biesheuvel , Jordan Justen , Laszlo Ersek , Julien Grall , Anthony PERARD Subject: [PATCH v3 20/35] OvmfPkg/XenPlatformPei: Setup HyperPages earlier Date: Thu, 4 Jul 2019 15:42:18 +0100 Message-ID: <20190704144233.27968-21-anthony.perard@citrix.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190704144233.27968-1-anthony.perard@citrix.com> References: <20190704144233.27968-1-anthony.perard@citrix.com> MIME-Version: 1.0 Return-Path: anthony.perard@citrix.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain 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=0D );=0D =0D +EFI_STATUS=0D +XenConnect (=0D + VOID=0D + );=0D +=0D EFI_STATUS=0D InitializeXen (=0D VOID=0D diff --git a/OvmfPkg/XenPlatformPei/Platform.c b/OvmfPkg/XenPlatformPei/Pla= tform.c index c97a2fb6c1..52f6048ca4 100644 --- a/OvmfPkg/XenPlatformPei/Platform.c +++ b/OvmfPkg/XenPlatformPei/Platform.c @@ -416,6 +416,8 @@ InitializeXenPlatform ( CpuDeadLoop ();=0D }=0D =0D + XenConnect ();=0D +=0D BootModeInitialization ();=0D AddressWidthInitialization ();=0D =0D diff --git a/OvmfPkg/XenPlatformPei/Xen.c b/OvmfPkg/XenPlatformPei/Xen.c index 37e9cff4b4..7d1696bb22 100644 --- a/OvmfPkg/XenPlatformPei/Xen.c +++ b/OvmfPkg/XenPlatformPei/Xen.c @@ -72,14 +72,11 @@ XenGetE820Map ( /**=0D Connects to the Hypervisor.=0D =0D - @param XenLeaf CPUID index used to connect.=0D -=0D @return EFI_STATUS=0D =0D **/=0D EFI_STATUS=0D XenConnect (=0D - UINT32 XenLeaf=0D )=0D {=0D UINT32 Index;=0D @@ -91,7 +88,13 @@ XenConnect ( UINT32 *PVHResetVectorData;=0D RETURN_STATUS Status;=0D =0D - AsmCpuid (XenLeaf + 2, &TransferPages, &TransferReg, NULL, NULL);=0D + ASSERT (mXenLeaf !=3D 0);=0D +=0D + //=0D + // Prepare HyperPages to be able to make hypercalls=0D + //=0D +=0D + AsmCpuid (mXenLeaf + 2, &TransferPages, &TransferReg, NULL, NULL);=0D mXenInfo.HyperPages =3D AllocatePages (TransferPages);=0D if (!mXenInfo.HyperPages) {=0D return EFI_OUT_OF_RESOURCES;=0D @@ -103,7 +106,11 @@ XenConnect ( (Index << EFI_PAGE_SHIFT) + Index);=0D }=0D =0D - AsmCpuid (XenLeaf + 1, &XenVersion, NULL, NULL, NULL);=0D + //=0D + // Find out the Xen version=0D + //=0D +=0D + AsmCpuid (mXenLeaf + 1, &XenVersion, NULL, NULL, NULL);=0D DEBUG ((EFI_D_ERROR, "Detected Xen version %d.%d\n",=0D XenVersion >> 16, XenVersion & 0xFFFF));=0D mXenInfo.VersionMajor =3D (UINT16)(XenVersion >> 16);=0D @@ -262,12 +269,6 @@ InitializeXen ( {=0D RETURN_STATUS PcdStatus;=0D =0D - if (mXenLeaf =3D=3D 0) {=0D - return EFI_NOT_FOUND;=0D - }=0D -=0D - XenConnect (mXenLeaf);=0D -=0D //=0D // Reserve away HVMLOADER reserved memory [0xFC000000,0xFD000000).=0D // This needs to match HVMLOADER RESERVED_MEMBASE/RESERVED_MEMSIZE.=0D --=20 Anthony PERARD