From nobody Mon Feb 9 00:30:46 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+88862+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+88862+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1649840924; cv=none; d=zohomail.com; s=zohoarc; b=bAAgWhc/byV2pzJ3/FgBUyTaXhUj5Qm4lWybqCWrQ/hx4oxu4locGJKWnJCGPQFYOOCDF0ChxJOmQwSKlahIku5vKY4VkaUdfSVpc59eHbwIiRciiuH7Wa6D4TsfMkmqckMGyc1STktLIXxlHceW0b9m8OpWXdJ8Mb7naZ7lE30= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1649840924; 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=HSc/kgqqnzpL+DTYYGHsKOmG+lujOYuiBGB4elTurnk=; b=V5WSv4pseRvk5xxREtzu3FmTwXXm0lHQFjuh0/M97MaHPdWssPP/XviZPclaptibU5+FLHg0vh2PjQww3Fpm2tkdhJRHVNldDioMJC+9kbkAdZchHhkZY4RoNTYMFK4yLIFYWNzgtrK8HrtXss7XfbX9TUYWnV/71IsqqSxVXPk= 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+88862+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 1649840924429497.89997405456313; Wed, 13 Apr 2022 02:08:44 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id FiygYY1788612xOHV6yNnOp2; Wed, 13 Apr 2022 02:08:43 -0700 X-Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web09.4082.1649840922150046074 for ; Wed, 13 Apr 2022 02:08:42 -0700 X-IronPort-AV: E=McAfee;i="6400,9594,10315"; a="242551910" X-IronPort-AV: E=Sophos;i="5.90,256,1643702400"; d="scan'208";a="242551910" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2022 02:08:41 -0700 X-IronPort-AV: E=Sophos;i="5.90,256,1643702400"; d="scan'208";a="573183410" X-Received: from mxu9-mobl1.ccr.corp.intel.com ([10.255.28.56]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2022 02:08:39 -0700 From: "Min Xu" To: devel@edk2.groups.io Cc: Min Xu , Michael D Kinney , Liming Gao , Zhiguang Liu , James Bottomley , Jiewen Yao , Gerd Hoffmann Subject: [edk2-devel] [PATCH 1/4] MdePkg: Add TdProbeLib Date: Wed, 13 Apr 2022 17:08:21 +0800 Message-Id: <3fcbbc0d9b2b82f3a6bdc132c01462d73bfc02bc.1649840073.git.min.m.xu@intel.com> In-Reply-To: References: 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: 9OCEdzysaGgpaSHGPIPQAtU4x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1649840923; bh=HvLBKlqqabzHXst63zg+7ua7Cvn9ohcNekFxNwWQMVg=; h=Cc:Date:From:Reply-To:Subject:To; b=bMd3aH9HsYKxua4S36/jBEHZYnhqL4HLy3r5f1w8L9Ud/m8obvBRDPvhRHD0V2mwqbx ihb95ZAsaTLAWurtLByAr1lqscBYA3/xETtvgqS6Hv6NTUQbKJd74aquvnHv45ygjR9Wp +UdDjTZutJBIoT2aQE9g/mX4LJALyP/I+4U= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1649840925822100006 Content-Type: text/plain; charset="utf-8" BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3902 TdProbeLib is used to probe if the working system is of Td guest. This library is designed to run on SEC / PEI / DXE phases. A null instance of the library returns Non-Td anyway. A platform specific TdProbeLib will be implemented, for example, in OvmfPkg. Cc: Michael D Kinney Cc: Liming Gao Cc: Zhiguang Liu Cc: James Bottomley Cc: Jiewen Yao Cc: Gerd Hoffmann Signed-off-by: Min Xu --- MdePkg/Include/Library/TdProbeLib.h | 26 +++++++++++++++++++ .../Library/TdProbeLibNull/TdProbeLibNull.c | 25 ++++++++++++++++++ .../Library/TdProbeLibNull/TdProbeLibNull.inf | 21 +++++++++++++++ MdePkg/MdePkg.dec | 5 ++++ MdePkg/MdePkg.dsc | 1 + 5 files changed, 78 insertions(+) create mode 100644 MdePkg/Include/Library/TdProbeLib.h create mode 100644 MdePkg/Library/TdProbeLibNull/TdProbeLibNull.c create mode 100644 MdePkg/Library/TdProbeLibNull/TdProbeLibNull.inf diff --git a/MdePkg/Include/Library/TdProbeLib.h b/MdePkg/Include/Library/T= dProbeLib.h new file mode 100644 index 000000000000..363a30fce649 --- /dev/null +++ b/MdePkg/Include/Library/TdProbeLib.h @@ -0,0 +1,26 @@ +/** @file + +Copyright (c) 2022, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef TD_PROBE_LIB_H_ +#define TD_PROBE_LIB_H_ + +#define TD_PROBE_NON 0 +#define TD_PROBE_TDX 1 + +/** + Probe if it is Tdx guest. + + @return TD_PROBE_TDX if it is Tdx guest. Otherwise return TD_PROBE_NON. + +**/ +UINTN +EFIAPI +TdProbe ( + VOID + ); + +#endif diff --git a/MdePkg/Library/TdProbeLibNull/TdProbeLibNull.c b/MdePkg/Librar= y/TdProbeLibNull/TdProbeLibNull.c new file mode 100644 index 000000000000..8aa2baf9053d --- /dev/null +++ b/MdePkg/Library/TdProbeLibNull/TdProbeLibNull.c @@ -0,0 +1,25 @@ +/** @file + + Null stub of TdProbeLib + + Copyright (c) 2022, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +/** + Probe if it is Tdx guest. + + @return TD_PROBE_TDX if it is Tdx guest. Otherwise return TD_PROBE_NON. + +**/ +UINTN +EFIAPI +TdProbe ( + VOID + ) +{ + return TD_PROBE_NON; +} diff --git a/MdePkg/Library/TdProbeLibNull/TdProbeLibNull.inf b/MdePkg/Libr= ary/TdProbeLibNull/TdProbeLibNull.inf new file mode 100644 index 000000000000..7db961e6ea2d --- /dev/null +++ b/MdePkg/Library/TdProbeLibNull/TdProbeLibNull.inf @@ -0,0 +1,21 @@ +## @file +# TdProbeLib null instance. +# +# Copyright (c) 2022, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D TdProbeLibNull + FILE_GUID =3D B15D67FE-0DAC-4316-8E26-8A6b85E43782 + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D TdProbeLib + +[Sources] + TdProbeLibNull.c + +[Packages] + MdePkg/MdePkg.dec diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index 1934c9840423..9cc713e3d5af 100644 --- a/MdePkg/MdePkg.dec +++ b/MdePkg/MdePkg.dec @@ -267,6 +267,11 @@ # RegisterFilterLib|Include/Library/RegisterFilterLib.h =20 + ## @libraryclass This library provides interfances to probe Td guest. + # + # + TdProbeLib|Include/Library/TdProbeLib.h + [LibraryClasses.IA32, LibraryClasses.X64, LibraryClasses.AARCH64] ## @libraryclass Provides services to generate random number. # diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc index d6a7af412be7..c2a68056f48a 100644 --- a/MdePkg/MdePkg.dsc +++ b/MdePkg/MdePkg.dsc @@ -130,6 +130,7 @@ MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib= .inf =20 MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf + MdePkg/Library/TdProbeLibNull/TdProbeLibNull.inf =20 [Components.IA32, Components.X64, Components.ARM, Components.AARCH64] # --=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 (#88862): https://edk2.groups.io/g/devel/message/88862 Mute This Topic: https://groups.io/mt/90436750/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-