From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web11.6736.1636425897946777407 for ; Mon, 08 Nov 2021 18:44:58 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=xnFQ8BJF; spf=pass (domain: intel.com, ip: 192.55.52.115, mailfrom: min.m.xu@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10162"; a="232612035" X-IronPort-AV: E=Sophos;i="5.87,219,1631602800"; d="scan'208";a="232612035" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Nov 2021 18:44:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,219,1631602800"; d="scan'208";a="601647956" Received: from fmsmsx605.amr.corp.intel.com ([10.18.126.85]) by orsmga004.jf.intel.com with ESMTP; 08 Nov 2021 18:44:56 -0800 Received: from fmsmsx604.amr.corp.intel.com (10.18.126.84) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Mon, 8 Nov 2021 18:44:56 -0800 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Mon, 8 Nov 2021 18:44:56 -0800 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.172) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Mon, 8 Nov 2021 18:44:56 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W2FzGiHVUAhc7xUE7Sgtl67a3Mk/dLCJgzkHkiY3nq6fMKQVg42oM1eKRGzwd6MKnUzlOZDFaqi9eyiSBu/RGG0fnm4CwRBLbsxKn4Xbk4yn6K4sDWJvFWLbaDid2uyldE3C2mmFkHloLU03DGfsUCZFoSFlJq99pyDEJmXcn1bxepPPcNh5rAcm6y980k/qiue7n6jI6STaj9Bl8xR8fTAAQUUokmxQmbQthShjZXX9xzTewdauez7HsW4elx1WeFjLC1t6HgqedVKDPSsdn+5PfiyM7rdjP7/12u8D61LoYXsa+FMuAyL2cR3OL9fnnPFisb2Q1p7ga3KZzM5MbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4XA8byY8xWlsKUP+vpXEJm0SpxPuR1eniADPxQbBGhk=; b=CfoOBHXTHXcvkm3RDkw4wmcw/6raGu+h2KWILRoY8MuBQD66y1eziRJJ20f8IH34TAPwbTyyHki7Ng7B0/FDZN41xCm7K+YEYNJn/2ji1iOZP2O7EvhhRTGNGR5J60Tq1ZTHLIX9zPHGa918iOAo+tgy1LygUvgBbsJxI/FA+SZj3J5x6WvD4uZIwwN5f4/Sxf6BG+mD83jmtjjDY7/C7IACZjfnFmDJDNrTkuIxJkSFawPSKZPwg0ciqIkKkejRechFcQHaG+OJ8yvqePkgIFohOqOUQdZN3U0m12wyCn8XkzWsRUODjqgoRH0TSbkFLT+Jj4ziNOqGOe/fC1RDVw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4XA8byY8xWlsKUP+vpXEJm0SpxPuR1eniADPxQbBGhk=; b=xnFQ8BJFsDyq8daxFLbiyX6bmw9GJGFR35K1BYURxRa52JDaUkD9QMcLKOlXv6HGk1DzJ9M/sKvogegBJOburHjSDWcQD6BWaoPJQn8c/wB5VTr16/I316BJU+gxwA6QPt8jhy+YS2wLhWXwIgPfFWuFJskIGWfQVnZTYEr53KA= Received: from CO1PR11MB5058.namprd11.prod.outlook.com (2603:10b6:303:99::17) by MWHPR11MB1855.namprd11.prod.outlook.com (2603:10b6:300:10e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.13; Tue, 9 Nov 2021 02:44:55 +0000 Received: from CO1PR11MB5058.namprd11.prod.outlook.com ([fe80::49d5:fe9f:6dd9:8f95]) by CO1PR11MB5058.namprd11.prod.outlook.com ([fe80::49d5:fe9f:6dd9:8f95%9]) with mapi id 15.20.4649.023; Tue, 9 Nov 2021 02:44:55 +0000 From: "Min Xu" To: Liming Gao , "Kinney, Michael D" CC: Tom Lendacky , Brijesh Singh , Erdem Aktas , James Bottomley , "Yao, Jiewen" , "Dong, Eric" , "Ni, Ray" , "Kumar, Rahul1" , Gerd Hoffmann , "devel@edk2.groups.io" Subject: Re: [edk2-devel] [PATCH V3 14/29] UefiCpuPkg: Enable Tdx support in MpInitLib Thread-Topic: [edk2-devel] [PATCH V3 14/29] UefiCpuPkg: Enable Tdx support in MpInitLib Thread-Index: AQHXzyL4/LyrZHH5q0iUxm90gqEiQ6vxVGAAgABucWCAAUWnAIAAeH8AgACFoxCAAHzEAIAGA9gg Date: Tue, 9 Nov 2021 02:44:55 +0000 Message-ID: References: <9d8a7f7da913a1062d3f01e24615bb8bdc958458.1635769996.git.min.m.xu@intel.com> <20211103060914.scktdnjbfzrtu4xk@sirius.home.kraxel.org> <20211104081004.4mhzk7hqozg3prrp@sirius.home.kraxel.org> <20211105064612.yxjrsxste3qyctqe@sirius.home.kraxel.org> In-Reply-To: <20211105064612.yxjrsxste3qyctqe@sirius.home.kraxel.org> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.200.16 authentication-results: byosoft.com.cn; dkim=none (message not signed) header.d=none;byosoft.com.cn; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: f9f87e4e-0879-4883-f565-08d9a32ae99c x-ms-traffictypediagnostic: MWHPR11MB1855: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4941; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: FApogOWBMlZgTwoOitWvz+th8TgMpXX+fzPvooUBSdivQFyUOnoTjw9vQnKTSM/cK4uV5gbak2uV85DErf4hb53YVey/u1gOzRHujlWEcIFLPoh+gzskAl6TgxcW3hhB8Bc7H6lkPm96uVKen4DGxIk11Nr3P4UCmnmYEn1GiOmx1tWdQ4gwxoTp/WCiFFt5KVrjuqy//uvbc+1AoHkyxUcjq1dlYyxS6vxldEDHrnwQbCfzvq3rCdxU/OBoCqUvBIb4SHnrgw7PM8oWAOZBK6YWPp96MDPgvvp/w0Iz4rmnjA7GUAF9DiZgMH2mbcsk0StCr5AwwGEeIIr6vw3dTvRfPydLS7LrL5VZT0rMzeD/McbYEbfMY4uOijnOzquMyo2VmoQQK3vndP2rcotlUxMBhsWVhqU79UG7sQcVGqsFVn3vBSqARH7vKv5T2OSxtjQm9rA2abv3+OPCWMpbbl2KgErRJ7W1ZU+Qx1CtlZL5Z7LX3Xj8ZsXDithOZtaCunx3g0klvpTU0W45UNxp7C5dxlh9IQi11q9tF97cqg3BeYjWXAmoTP5R9Z89rn9v3xpvnjKtehYJpBojQEKrtPiUKBUEyH8SUBBfxUh+g+s/RAviYZXOnQ5gvXFv11YaOstgIZ+n6goYbWz63Sdi/OjxTzbEKjZBZH9QY19k32NQ5L/EDkf0H6pegYWSgPFoLg7rxncxzA2V/Cpvrrsm25H9dxUmAqy7amsK4YsegWkh2BMhAVOYyuxM3PZTkW4ZfioyygzUayOw3BYRGW2C1oRwJCqseTFcGsXobbS+uUEsWGv5NNkefwSRZvx/XJZc0CPQzA3b+S4rjdTES3mprw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CO1PR11MB5058.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(6029001)(366004)(4326008)(508600001)(4744005)(82960400001)(2906002)(6506007)(33656002)(110136005)(966005)(38100700002)(26005)(5660300002)(38070700005)(86362001)(186003)(54906003)(8936002)(64756008)(66556008)(66946007)(9686003)(76116006)(316002)(66446008)(66476007)(7696005)(122000001)(71200400001)(8676002)(55016002)(6636002)(52536014);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?ihZsjB8nixAr9LvYHK+yCKQGcMBPUYy7EE3+M5xmLbWwpft7lDC3kjZtR3Y9?= =?us-ascii?Q?IZ4mUISQsXy7yelBUpWwg60uOUMJJY5Ny4HdyaZ4dntRex2Mtkpy4E0I/aWK?= =?us-ascii?Q?iqq8m6n1GkNpKG18B6fnWvFn5sTygXlRGWiAzV1A7MihDTWQZhMwzEo5XD/1?= =?us-ascii?Q?CWWmE/vVmkpXIfxrEN6B/Ql9NQ1045NoftVZcCCKwSPHHqoMCEn+9v3xmzYX?= =?us-ascii?Q?iM7n4FXjYT3xIBr9GVgMz71gN+Gk6csK5345iYZIHkCI9NRxCCCrIntU0XOo?= =?us-ascii?Q?Tg0xdFtLj2LsHQ0Bi8xpkkN1eQd/zwqtpWggfvmWiUIeCZ4qjVpdIZbgVR8B?= =?us-ascii?Q?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s6RHUpp+wzCU0u2Io?= =?us-ascii?Q?F5nQbFqDsYUrh59J4cY+WOeWA+387ZkwoinIAdBlvUV/5qKI9OCJXxcMFKtZ?= =?us-ascii?Q?E18oq3+m7SvdN6sVf/sfe35olsm4OfaXvXbT1wsr7JcQVu7p8uI++pk1mA57?= =?us-ascii?Q?yh1aPND4PiacftxV5U24AWcRVGh3doUwsxVYRi5gyz4SGUCWlJgGHGcl8O7z?= =?us-ascii?Q?CyJkNmwBA9XdYIbpjvILUs3ljnSmS9Yg9pNnwr6+gFrkv7Q1zRKTXwyxPStT?= =?us-ascii?Q?mWN7CvAvWnvry3x25zCCzDEuXkMNaXJLHKhLQnczZlXsFPAGUH86pG5Fi3A4?= =?us-ascii?Q?6pm30vHWfEHZdxrxKKkiz4yB5cpHYyTeVSGrNdJ02VXo+0eevmXrOgWq9YFo?= =?us-ascii?Q?fw=3D=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO1PR11MB5058.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f9f87e4e-0879-4883-f565-08d9a32ae99c X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Nov 2021 02:44:55.1125 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: LZZSbtAEwzzPMoyGIIPQrJM5TLJuqR+PzLacmUbvECdR7BCajHG5uD5aM7+tGGCnBgRapH9k4wsVQSHwpy3apw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1855 Return-Path: min.m.xu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable On November 5, 2021 2:46 PM, Gerd Hoffmann wrote: > > > Can't you create something in MdePkg/Library/Baselib and then use it > > > everywhere it's needed? > > > > > Do you mean put the basic Tdx functions in MdePkg/Library/BaseLib? If t= hat is > the case, then I would add below basic Tdx functions in BaseLib: > > - TdIsEnabled () > > - TdCall () > > - TdVmCall () >=20 > That is the cpuid-based check and the asm code for td calls, correct? >=20 > > Gerd, what's your thought? >=20 > Looks fine to me. >=20 Hi, Liming & Michael You're the MdePkg maintainers. What's your thoughts about adding these Tdx = functions in MdePkg/Library/BaseLib? - TdIsEnabled () <-- cpuid-based check if it is a TD guest - TdCall () <-- TD call - TdVmCall () <-- TD vmcall https://github.com/mxu9/edk2/blob/tdvf_wave2.v3/MdePkg/Library/TdxLib/X64/T= dcall.nasm https://github.com/mxu9/edk2/blob/tdvf_wave2.v3/MdePkg/Library/TdxLib/X64/T= dvmcall.nasm Thanks Min