From nobody Thu Nov 14 17:28:58 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