From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web09.2745.1634868384314526130 for ; Thu, 21 Oct 2021 19:06:25 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=qNPteMl5; spf=pass (domain: intel.com, ip: 134.134.136.100, mailfrom: min.m.xu@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10144"; a="292664865" X-IronPort-AV: E=Sophos;i="5.87,171,1631602800"; d="scan'208";a="292664865" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2021 19:06:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,171,1631602800"; d="scan'208";a="445580583" Received: from fmsmsx604.amr.corp.intel.com ([10.18.126.84]) by orsmga003.jf.intel.com with ESMTP; 21 Oct 2021 19:06:23 -0700 Received: from fmsmsx605.amr.corp.intel.com (10.18.126.85) 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; Thu, 21 Oct 2021 19:06:22 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) 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 via Frontend Transport; Thu, 21 Oct 2021 19:06:22 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.177) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Thu, 21 Oct 2021 19:06:22 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mVa8TKnn+rkwICJvPpUPnAOA7HhhPRLUfJQeLMXBS6pHK1LbK9yHUbEfq6lHqc1o6LpGORxZkOPDa5RjBVkPUpslGd0HE/sEYAXjuwvxW+tpmCMKWHJkwiiLw0dZ6mkF8rWqoqCoyGQaFJ2gY8uTYsWruEoW4onaO5gWrf50968L7yTyF8BjfhUHSCMLgyhg2kcvkoOjMLbp9BzywJVg5PL+082ngrcZu2eDbQXqwGl84fuUY6vgW9LIMDFprkbIpR34zTuRgYD/pGbGkcD5whaGTGrB6Ex8glNzHTe+/mWNaLwd4kv746yYLDn2lEYwyDvGafn+uUahAZngXV3Olw== 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=g804/LGD6tUb91+pC3yUm7mUKZhmPk+Wommz1o2G5qM=; b=irNKOHAeID3GLjKXjA3v7c3yaCI3QiRHOy8rA87JWhEllLbFwrvcj+JZufyKLMFcR6ss+gn7+OrVsNaYiKaQW/X5qRViwE4sGzCcz6gby/84dl4ZALS0rtrXZo5t85giz1u8EPR1plgp58pKB5u4T2fG6lzi5nn5Hd+U3Gbk9GVNAMIpwPFM5hZkYBBdo0sCPj0qMANiXr3DEyZp9U9QwGPGx46QJiEnsw+dO4PkIIS5cRloqVfxgtB20wAo1/AKu76NLmVviymiAwFl2uYg83pRkSROrLgYVKYKy9MEK8CQzim8xLCiecLZiHgONEb9TvmT+VGvlNDhkuFIV0OMiw== 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=g804/LGD6tUb91+pC3yUm7mUKZhmPk+Wommz1o2G5qM=; b=qNPteMl53TBaH6tN56TdJhekzzywJqKIX/6+RV6LqwexxgF8Bkj3AfLgIMn6e+jrut/OvXogu5Kb2zKh3G3uEqTF3vhm7EvIJ6Cej0vzdsyh+9Zx21UB8QZy2wjErgnjdRQNkm9spl4roRrxVJ6IWDJEYfEvJR7Nhz+sO+/u+So= Received: from PH0PR11MB5064.namprd11.prod.outlook.com (2603:10b6:510:3b::15) by PH7PR11MB5914.namprd11.prod.outlook.com (2603:10b6:510:138::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.18; Fri, 22 Oct 2021 02:06:21 +0000 Received: from PH0PR11MB5064.namprd11.prod.outlook.com ([fe80::7deb:6c36:73c2:f0d4]) by PH0PR11MB5064.namprd11.prod.outlook.com ([fe80::7deb:6c36:73c2:f0d4%3]) with mapi id 15.20.4628.016; Fri, 22 Oct 2021 02:06:21 +0000 From: "Min Xu" To: Gerd Hoffmann CC: "devel@edk2.groups.io" , "Kinney, Michael D" , Liming Gao , "Liu, Zhiguang" , Brijesh Singh , Erdem Aktas , James Bottomley , "Yao, Jiewen" , Tom Lendacky Subject: Re: [edk2-devel] [PATCH V2 05/28] MdePkg: Add TdxLib to wrap Tdx operations Thread-Topic: [edk2-devel] [PATCH V2 05/28] MdePkg: Add TdxLib to wrap Tdx operations Thread-Index: AQHXuZq6srPDpOieLkegdvwUHsVUx6vPEUYAgAFyZkCAAYI7gIAMWXRw Date: Fri, 22 Oct 2021 02:06:21 +0000 Message-ID: References: <20211012082206.2j5eptadquhf3pmg@sirius.home.kraxel.org> <20211014053011.sgzov5q3bym7x2pf@sirius.home.kraxel.org> In-Reply-To: <20211014053011.sgzov5q3bym7x2pf@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: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 7b61333b-e65f-4c0a-7654-08d995008b2f x-ms-traffictypediagnostic: PH7PR11MB5914: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6108; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: vq4qTGB2wJuDxgt3B8VYmTlQ3WShh+CD5hoAo4V/XGlswK2HPLA5ZOPFXa/X1ZaUr+KsXhV0F8B9uKJWpv413YgiiiVw8M9fec4SM4PnoMNKF8+aUY5u8z4DzHFKG9u165cK9C2TKoAMLRF6x+GXE3agud6FAFGgJQaljUAk9/KJS9iw6EZaAOhxDyO73oMdQLeyzDhIpjVjTQ+6K723sm+ka8uU2CEo+s+qo7acYz0C7zolRuLbWoZe38vdZ/m8mKtLaxa6asv3EHK4DbxLV3d4TNi9YP3x2uZvYlG4chnGc1aXLtH1+gHc/Jdw3AmXt/gBUw3K2x3PtO9k795oCpI9+X3nPy4BHExi6gjSTwzxKmaN1EjkFNfDb1ainmkqOqghBkB9bUNg81u3ZpDk+RJ9f/k0ep2DOuYPkWx4jQ7EiSWjJ9Sl1U7qLKzAcA6iTqb+jTAwldec1b1GgnBfy2M6lBEBlhY5Yykp9hU1X8Gpcha/yDPREIfIJgdHFAd8xMLQi15+IppnCKvduA3Wd1VGwgkn0aChWDgt2Z57IjhG6CrAFoAO1nKg8j1YM9vtOJc8jipLNCvgQamLcXw02CClvuOZ1tN1vIsHNBdDTSXet9fp3/jCuNYqK91pp+WcEEV/X6TYQsG9uufUFst3N2w0I7QA4nr3p6Sj+68ghQcknZ2o15RsFSUrtXYJJ0jaPlvXu35JQoKlZCWSVXTNRQ== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR11MB5064.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(66556008)(66476007)(66446008)(64756008)(4326008)(86362001)(66946007)(76116006)(82960400001)(2906002)(26005)(33656002)(71200400001)(316002)(9686003)(55016002)(122000001)(38100700002)(508600001)(6916009)(52536014)(83380400001)(8936002)(54906003)(7696005)(186003)(38070700005)(5660300002)(8676002)(6506007);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?yrBSQnCI6sFt6ubYQ5VlFykQ/rYTZ4TGKjtYYdZ9IyLcPEvPXUGHIO1AQDoi?= =?us-ascii?Q?JsAWgqXKfBcCivvDWswkN1oJdTyGW8l27aefO1Gnx8yc+ithiPK1n/VrMdnC?= =?us-ascii?Q?Ou42vLJP/DeQGAApNav/jD3WBzRcsOKs509eRMRkYYy3TOri5y4FAKHyK6HI?= =?us-ascii?Q?hWguk5wLms38+ZzrQzVGCR+Bytrlvd7Qx7Ky47C6duYlBAIroLS9eKyX9Ou0?= =?us-ascii?Q?vKya33p3qAEs41XS4ezV1dC6dTaaigPLQM5UkheeM65hmEvKtllXWwh/YJn3?= =?us-ascii?Q?LYKB6/o1YGoTqygMXmbJw2EU/m4T0m7zO7pMqc4nk52OZgPPqODep2oq96Wq?= =?us-ascii?Q?GH6c0gste4c9DQ7QkvO0H1Bx+2gWqHWyUAl70eHWvx+ezXWCAGocL1H0GUbg?= =?us-ascii?Q?KaeFXcGxSHy4Sb/+9AvsBB/wFsUJ2HufNGUlMynN4EQ1H8abkJMtiPXJ5vZ5?= =?us-ascii?Q?/oiKbIjmtaTfH2NAfH2xBXHcN53mIPgJ/+SDOqh1eDFg7z1MGGe747IGId9A?= =?us-ascii?Q?uPM8aex20QMsvulK3+t+QP9hIxUgLuF86HITO/OEpngeaYcx+NUWmf53TxNW?= =?us-ascii?Q?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 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5064.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7b61333b-e65f-4c0a-7654-08d995008b2f X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Oct 2021 02:06:21.6402 (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: min.m.xu@intel.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB5914 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 October 14, 2021 1:30 PM, Gerd Hoffmann wrote: > > > > +UINT8 *mExtendBufferAddress =3D NULL; > > > > +TDX_EXTEND_BUFFER mExtendBuffer; > > > > + > > > > +/** > > > > + TD.RTMR.EXTEND requires 64B-aligned guest physical address of > > > > + 48B-extension data. In runtime we walk thru the Buffer to find > > > > + out a 64B-aligned start address. > > > > > > Can't you just use __attribute__((aligned(64))) for that? > > > > > In the PoC of TDVF I had thought about it. But at last I gave up such s= olution. > The reasons are: > > 1) OVMF/TDVF supports both GCC and VS2019 tool chain. > __attribute__((aligned(64))) is for GCC. Its counterpart of VS2019 Tool c= hain > is __declspec(align(x)). > > 2) There is the limitation of /ALIGN:32 in the build scripts which mean= s > aligned 64 exceeds the /ALIGN 32, unless /ALIGN is updated to 64. > > That's why the current solution is used. >=20 > MdePkg/Include/Base.h has a bunch of ALIGN_* macros to do the math for > you, which should simplify this alot. I'd suggest to also drop the > mExtendBufferAddress and the function calculating it. Just use the macro > instead when needed. Thanks for reminder. It will be updated in the next version. Thanks. Min