From nobody Thu Nov 14 05:52:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=1562252362; cv=none; d=zoho.com; s=zohoarc; b=MaE6Rkl6vraXicFZAaRxhCKFO9w5wVW9XZDDRd6JwaD1hnfNmpml2uH3vee0U1VE9iyCoQfirmvIO0IarZ1Z7VI582caKGc7Qzd7v8qrLgoNWLVDUeR2VgrfTgKbWhKP5XqwlNCmgS7OcIU+O4+8NjJrcruj5PRNKRYTto9Khw8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562252362; 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=TRnf93FCLCt8+ZFc/Jm6aKwPUiRsd5uSEkC26tQJ67I=; b=aJOMRFVu9MmNpJv2Y+iWHpKdIbfXEVFSeSr93FRqIYSgg1e+a+qBTayvSBFQwbhqHxmtLV8slM+0x8H2sYa5MOK8OXvIsCt4jj9NIFuHRsI47G8zYkKEUeB465Nr0Lcs+fVp3ON5OhXHuOXKnON9Rnbz90iBA4mgQm2/sFhcNNw= ARC-Authentication-Results: i=1; mx.zoho.com; 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 1562252362783842.793722955232; Thu, 4 Jul 2019 07:59:22 -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 1hj3Bk-0006DD-9j; Thu, 04 Jul 2019 14:58:20 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hj3Bi-0006BK-Fb for xen-devel@lists.xenproject.org; Thu, 04 Jul 2019 14:58:18 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 26a309d2-9e6c-11e9-a2e2-3f9453bbc94b; Thu, 04 Jul 2019 14:58:15 +0000 (UTC) X-Inumbo-ID: 26a309d2-9e6c-11e9-a2e2-3f9453bbc94b 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: 8mx8ozuIJMQI/wlv4Ud0vpLKaFr9r267d1IJ43XJoxoGC84KkG8gKcPMOOgcvWK9aVXnGe7X4a 48In/9K61OnMFuROEKlR8vWxDM4UY9iShvfx31V8nBA2dT82d34M4LfNdyRz0VkoS01768wie/ Z/KNrvAizqeZScFfXJc2gAHiL41Y56v8vYZbySyBJ4nKgP0B2sXtR8hYIjWiFXFLW867QVX9Um OLTdRiuS7EdioUK0DSL+0cDwSz1sv5SkB3Ihx7kShoNiFT0q5XTgS2yZousLwlpQ/dRNn7I9HU WYE= X-SBRS: 2.7 X-MesageID: 2626064 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.63,451,1557201600"; d="scan'208";a="2626064" From: Anthony PERARD To: Date: Thu, 4 Jul 2019 15:42:14 +0100 Message-ID: <20190704144233.27968-17-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 Subject: [Xen-devel] [PATCH v3 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" 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