From nobody Mon Feb 9 23:38:56 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+87090+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+87090+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1646036235; cv=none; d=zohomail.com; s=zohoarc; b=lCJW0azXx1rEnAaFy50I0e/+/0U3fxb11j0/6iyTkl3dY+C12BCCevNkiqYeKDYuuK/o3k7gViGNz6I+gQEw7C2Lb3hGATKcJx23nhg+kgpqX9sC2Cbx1rQIEsKvfU8E7rkuSdbXjetrCPkSWD8Z6EGgX89WcT2qaUQ+w8nKR2M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646036235; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=KIZJqFSiEP7mBrlkiDOfV9qUpWfeaWlN9Al16aMkgvE=; b=KJLsVC3ZsGf2E7+DMGMrvz6RT2vymp5DHhRfdlzzaHhXivvxLZVsuMw0rWgHmyrbGF4/X0e8OBTW8YltLVvdeWkmtHy/0WccOwYIhmblfvx80/+e/oMjf3gCLzVB5DiloF8CTiVE0bcLknruGMFUbtZHHH6p5YfnsSL694GOZFc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+87090+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1646036235296332.3957885141908; Mon, 28 Feb 2022 00:17:15 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 2TGrYY1788612xI5uKyklQed; Mon, 28 Feb 2022 00:17:14 -0800 X-Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web11.17832.1646036233560530576 for ; Mon, 28 Feb 2022 00:17:14 -0800 X-IronPort-AV: E=McAfee;i="6200,9189,10271"; a="252758098" X-IronPort-AV: E=Sophos;i="5.90,142,1643702400"; d="scan'208";a="252758098" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Feb 2022 00:17:08 -0800 X-IronPort-AV: E=Sophos;i="5.90,142,1643702400"; d="scan'208";a="550140057" X-Received: from mxu9-mobl1.ccr.corp.intel.com ([10.238.2.184]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Feb 2022 00:17:05 -0800 From: "Min Xu" To: devel@edk2.groups.io Cc: Min Xu , Michael D Kinney , Brijesh Singh , Erdem Aktas , James Bottomley , Jiewen Yao , Tom Lendacky , Gerd Hoffmann Subject: [edk2-devel] [PATCH V4 02/10] OvmfPkg: Add PrePiHobListPointerLibTdx Date: Mon, 28 Feb 2022 16:16:23 +0800 Message-Id: <20220228081631.681-3-min.m.xu@intel.com> In-Reply-To: <20220228081631.681-1-min.m.xu@intel.com> References: <20220228081631.681-1-min.m.xu@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,min.m.xu@intel.com X-Gm-Message-State: Y149ePg4isI6Q3DgCRGURnFRx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1646036234; bh=hzfblM7QkVei/V7V4+009JFzDoE5/yrfICQGMpgiVig=; h=Cc:Date:From:Reply-To:Subject:To; b=nlxgFJxwgkB14yHBlp7nMXzk51NFN/dc/iQXMyjnyzyfG0qmfjVTEp74WsDfF9dx6kw pnhXm3Msfj/j/+XhP0z1FCafQqUiyxiGonHFlUOvNwwlgoNueQxJusgn5yUoSARmdlqLy q4ZUeee+VRuW07F6Ub6X7Bqi2m2DpyzbiM0= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1646037137675100002 Content-Type: text/plain; charset="utf-8" RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3429 This library sets / gets the Hob list pointer in TDX_WORK_AREA. This is because it is designed to be used in SEC where the value of global variable cannot be saved, so the Hob list pointer is saved in TDX_WORK_AREA. TDX_WORK_AREA shares the same base address as SEV_WORK_AREA which is pointed by PcdSevEsWorkAreaBase. This PCD will be renamed to PcdCcWorkAreaBase as Gerd suggested. See https://edk2.groups.io/g/devel/message/86642 Cc: Michael D Kinney Cc: Brijesh Singh Cc: Erdem Aktas Cc: James Bottomley Cc: Jiewen Yao Cc: Tom Lendacky Cc: Gerd Hoffmann Acked-by: Gerd Hoffmann Signed-off-by: Min Xu --- .../PrePiHobListPointer.c | 57 +++++++++++++++++++ .../PrePiHobListPointerLibTdx.inf | 29 ++++++++++ 2 files changed, 86 insertions(+) create mode 100644 OvmfPkg/IntelTdx/PrePiHobListPointerLibTdx/PrePiHobList= Pointer.c create mode 100644 OvmfPkg/IntelTdx/PrePiHobListPointerLibTdx/PrePiHobList= PointerLibTdx.inf diff --git a/OvmfPkg/IntelTdx/PrePiHobListPointerLibTdx/PrePiHobListPointer= .c b/OvmfPkg/IntelTdx/PrePiHobListPointerLibTdx/PrePiHobListPointer.c new file mode 100644 index 000000000000..1b41a3983c99 --- /dev/null +++ b/OvmfPkg/IntelTdx/PrePiHobListPointerLibTdx/PrePiHobListPointer.c @@ -0,0 +1,57 @@ +/** @file +* +* Copyright (c) 2021, Intel Corporation. All rights reserved.
+* SPDX-License-Identifier: BSD-2-Clause-Patent +* +**/ + +#include +#include +#include +#include +#include + +/** + Returns the pointer to the HOB list. + + This function returns the pointer to first HOB in the list. + + @return The pointer to the HOB list. + +**/ +VOID * +EFIAPI +PrePeiGetHobList ( + VOID + ) +{ + TDX_WORK_AREA *TdxWorkArea; + + TdxWorkArea =3D (TDX_WORK_AREA *)(UINTN)FixedPcdGet32 (PcdSevEsWorkAreaB= ase); + ASSERT (TdxWorkArea !=3D NULL); + ASSERT (TdxWorkArea->SecTdxWorkArea.HobList !=3D 0); + + return (VOID *)(UINTN)TdxWorkArea->SecTdxWorkArea.HobList; +} + +/** + Updates the pointer to the HOB list. + + @param HobList Hob list pointer to store + +**/ +EFI_STATUS +EFIAPI +PrePeiSetHobList ( + IN VOID *HobList + ) +{ + TDX_WORK_AREA *TdxWorkArea; + + TdxWorkArea =3D (TDX_WORK_AREA *)(UINTN)FixedPcdGet32 (PcdSevEsWorkAreaB= ase); + ASSERT (TdxWorkArea !=3D NULL); + + TdxWorkArea->SecTdxWorkArea.HobList =3D (UINTN)HobList; + + return EFI_SUCCESS; +} diff --git a/OvmfPkg/IntelTdx/PrePiHobListPointerLibTdx/PrePiHobListPointer= LibTdx.inf b/OvmfPkg/IntelTdx/PrePiHobListPointerLibTdx/PrePiHobListPointer= LibTdx.inf new file mode 100644 index 000000000000..2667f841cea2 --- /dev/null +++ b/OvmfPkg/IntelTdx/PrePiHobListPointerLibTdx/PrePiHobListPointerLibTdx.= inf @@ -0,0 +1,29 @@ +#/** @file +# +# Copyright (c) 2021, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D PrePiHobListPointerLibTdx + FILE_GUID =3D 28297DB9-4CE7-4679-80E6-0270B215A2F2 + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D PrePiHobListPointerLib + +[Sources] + PrePiHobListPointer.c + +[Packages] + MdePkg/MdePkg.dec + OvmfPkg/OvmfPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + UefiCpuPkg/UefiCpuPkg.dec + +[Pcd] + gUefiCpuPkgTokenSpaceGuid.PcdSevEsWorkAreaBase + +[LibraryClasses] + PcdLib --=20 2.29.2.windows.2 -=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 (#87090): https://edk2.groups.io/g/devel/message/87090 Mute This Topic: https://groups.io/mt/89446687/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-