From nobody Thu Nov 14 16:49:50 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-