From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web11.4861.1632466533597315536 for ; Thu, 23 Sep 2021 23:55:33 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=VrvhSs3E; spf=pass (domain: intel.com, ip: 192.55.52.136, mailfrom: min.m.xu@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10116"; a="203510709" X-IronPort-AV: E=Sophos;i="5.85,319,1624345200"; d="scan'208";a="203510709" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Sep 2021 23:55:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,319,1624345200"; d="scan'208";a="475889367" Received: from fmsmsx605.amr.corp.intel.com ([10.18.126.85]) by fmsmga007.fm.intel.com with ESMTP; 23 Sep 2021 23:55:32 -0700 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) 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; Thu, 23 Sep 2021 23:55:32 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx601.amr.corp.intel.com (10.18.126.81) 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, 23 Sep 2021 23:55:31 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.169) 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, 23 Sep 2021 23:55:31 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FieIeZl+TCdTYZOHMh0vwXqqR2j4FS5Wgc/ns7IkpcuSzhBbVRYRXf2b7OakuN718a6ZBHoTSUslUlk+G1BskZnDsSTiz27ruibmKess+jfLffoplUHxMHsvlYnAvy9IhUvFrw1tAS4XHbX3PE/eYos1rxNJwu6YGxvhJPtgN7xAv0AHe5MQuAMADU2k8YQhtH0hcEslhKOrHZAKjbtv25WNfAELoQsPDEmG81KxQqXZdoovzzUgyAIYLaFPmnM8Jh9RmhUxIXMJkooYzf/eUzV3BHoqP4wDMUwGwdhbdrdfUkO4ikFi3+/DfHhkCALQhEir754OJI9YFZwZTR5dYw== 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; bh=sNoY0izEuD3CwCk8JjuMB210wKmcVEfTgrOC7mMyUls=; b=j7QSasQScQsIVYF41dfJfbhNIpXaKhHsH0idInQ/wa1nA6EroNTNnVDyuvjIcz47CIJBhkJ6lYWvgQXEuy0YwmLdgtNLbKvwHTA8f8JVnkuxxyrQH/Mlm11T2KCxFK9nqxcYCFqEbxtoyiyTHrEXbuxACaPpcjE7LYvfm82J30MFWM3JhaKsNqxuvd+rN0XQf2UTOyIzaDuYlRygLVrAT/HZtGUqxO5ykXp1yohAwTuG7KKAtg1IUIk2W7o6zzFqBf2p2yO3kWPd1L60COblJ+i5Qdbqrrc+5JfDlVfeIwii+GHHF1SUTNLomkQxpYo1T95b6GkSsDku9n3/Co2Fxg== 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=sNoY0izEuD3CwCk8JjuMB210wKmcVEfTgrOC7mMyUls=; b=VrvhSs3Eba+zP1XYtEzfqrsKQAaFTawGHUu3/6vV4BZqrhqYA9Qv87Y6wWR+t5UF663wEblgmnWmoRIav2Z5nb2WmH4coxQgwioMrShtw5XgEmt/K8maVFJFGi9mEifGpVnXx7jRAwpeuTD3R6gOfZBtwxgKIrikpgmiMWGL/hI= Received: from PH0PR11MB5064.namprd11.prod.outlook.com (2603:10b6:510:3b::15) by PH0PR11MB5062.namprd11.prod.outlook.com (2603:10b6:510:3e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13; Fri, 24 Sep 2021 06:55:29 +0000 Received: from PH0PR11MB5064.namprd11.prod.outlook.com ([fe80::c93:200e:5aeb:e11b]) by PH0PR11MB5064.namprd11.prod.outlook.com ([fe80::c93:200e:5aeb:e11b%3]) with mapi id 15.20.4415.029; Fri, 24 Sep 2021 06:55:29 +0000 From: "Min Xu" To: Gerd Hoffmann CC: Brijesh Singh , "Yao, Jiewen" , "devel@edk2.groups.io" , "Ard Biesheuvel" , "Justen, Jordan L" , Erdem Aktas , "James Bottomley" , Tom Lendacky Subject: Re: [edk2-devel] [PATCH V7 1/1] OvmfPkg: Enable TDX in ResetVector Thread-Topic: [edk2-devel] [PATCH V7 1/1] OvmfPkg: Enable TDX in ResetVector Thread-Index: AQHXrsfvMPrievJgoEGG0tDgpJPsrauvry6AgAAIPYCAAZqLgIAAL+cAgAAU7QCAAAKEQIAACdMAgAAG74CAAAJkoIAA//qAgAAJNpA= Date: Fri, 24 Sep 2021 06:55:29 +0000 Message-ID: References: <12721dade1f2f9905cc34271d9abec24650442ff.1632214561.git.min.m.xu@intel.com> <20210922074929.e5iwf24t6wyndgbu@sirius.home.kraxel.org> <20210923084821.yxizus3loa2p6hms@sirius.home.kraxel.org> <7c9aeb95-5c33-bd8d-4f0c-40133f4c7c3d@amd.com> <20210924052825.2qljhtvweonbov5q@sirius.home.kraxel.org> In-Reply-To: <20210924052825.2qljhtvweonbov5q@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: e60f2bae-2d01-4cd2-9a80-08d97f284bfa x-ms-traffictypediagnostic: PH0PR11MB5062: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: xXwwQL5JlXtDC3hk8eyOCzGB0ApvAzeECEz0A3e7uwdtbTxguvFW6cIaPPqgL8j7sQ61NO0oUX7oYVvJmE3IPQ17nuHiIcv7AR2r2NCgd5j0vlFnSgHu0GvvIIqMhio0KpLC8vtQ07xNuU0BDwpwJZ84utgWVyBmApHvQt3cTC1JYJgwZYy6K3AIc/qbI6EXKoIUwHgnzAuBmngFcUt478LqUutpIdDuQUOWJDYOJTJu4JSguGN+RrinschjUbBGuMlL8LoSADnHCB2y8xqQrGkouaS6wQ00qnSOnYq65BA02YlXAHhIFmqQhuBkhmeBrcbL8hOnKzvOOOIw8/S1prwZYykej0PWADikNeLE4hbVL4VjkE0Prz4LUJm9zuHL5kQiO4XfwG3cawBCrPUdDdnYfBJWhAYOp2S67B8cwRFdMqUfZcQKColpOQj5aXRNbFbhqM2biut48Ttpgvorek7A2+oZnZAxe4HNbz4EIKq28mbbYTmDm4MrWNJxqMU2+F9X+ExR+VrsLCjGimABFqx7nK0r36VZEM/GElodNBxKPR2VdsMzp8MZ/+4fKqtKMWoIeaRkTOOzkx/LxWSoCBUGRfPc9j77IURsh0cwU40Yte9oWBrinm1Ld32P/H3878ADX2B6agtIzDobtleBUEbsvkXzAzItb03Catm13umDWz+Zmc3w7yv+SPEgG11hgHDfQp2SWG3Y19tAEDYy4EgCBVePBR/wz8ltxsllK/NalTYd5xwX5t563NVY/yHVUE+T8b0pcbmvIFhtb2gE0c7tpfeu+ybcze3L/EejXSOyl3d5gBqHjTAZj3D6yki/KyM0Wru/BADC83Zyr+GI/w== 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:(4636009)(366004)(8936002)(7696005)(33656002)(508600001)(6506007)(55016002)(5660300002)(52536014)(186003)(9686003)(122000001)(38070700005)(26005)(38100700002)(4326008)(71200400001)(6916009)(2906002)(8676002)(66446008)(86362001)(966005)(66556008)(66946007)(316002)(66476007)(64756008)(54906003)(76116006)(83380400001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?dgvA/Gr7Y/Zmlx4AroEcLm8VqHkLoTEH8PdjS/CtYF2dxwGdMWM/+IH/F8CF?= =?us-ascii?Q?4wWr0pP/dCIAlK7evRf9yTbOf70xynyg0qz3GvCbG1BpjQa2TIqO6KdSu35M?= =?us-ascii?Q?e0cbC98Wq87BrXIKgsM8jidiUZVh42tlJgb5u8R5k0b9/LY2Hs+dnwjMj8s9?= =?us-ascii?Q?5bKS4I0MkpVzyo94JhRbG6yuXEaL74AUO6rd+2uZSVKQzD/lAGz8CnX+OhjA?= =?us-ascii?Q?scyvzE+s9hAew7nxguZ4l6jVAu3Dy/ijN8Q5uxu0a0a7Lw7Css0PdLTuVirQ?= =?us-ascii?Q?fGtxCwUM2JUcsxNu3hG7a6X96ge6rhQWmOErQ96YGvwqVgYTM4BpucGYKFX/?= =?us-ascii?Q?J3ckhRhUzjBZyPKgzBPzA4lxWXZOy2/m1DSlGnVEyF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TJtMpdEFqEXhbL4iEogc+ybjl9cBQHFPjJ0J?= =?us-ascii?Q?soqkkxuTQiK9Q1EwyuVRxGhg?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5064.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e60f2bae-2d01-4cd2-9a80-08d97f284bfa X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Sep 2021 06:55:29.8266 (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: 5bb/HDv9UFGGkVMLze6U/IvS1dIrTDXyGzUcWWC7iXOi4bOlZURYPncxmIs2SpRDWtan3z45u4K/Mtn9j8Glqg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB5062 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 September 24, 2021 1:28 PM, Gerd Hoffmann wrote: > Hi, >=20 > > > SEV hardware does not have a concept of the metadata. To boot SEV > > > guest we need to pass some information to VMM and in past those > > > information were passed through SNP_BOOT_BLOCK (GUIDed structure) > > > but Gerd recommended that it will be good idea if both SEV and TDX > > > uses a common metadata approach to pass these information. I > > > personally think it was a good suggestion. So, in SNP series I went > > > ahead and created a generic metadata structure and hope that TDX > > > will build on it. The user of the metadata structure is VMM (qemu, > > > etc); while launching the guest the VMM knows whether its creating th= e > SEV or TDX guest and will process the entries accordingly. > > > > > > As per the number of fields in the metadata is concerns, I felt 3 > > > fields (start, size and type) should be good enough for all the > > > cases. There was a question from Gerd to Min asking why do you need > > > the dataoffset/rawdatasize etc and I don't remember seeing the answer > for it. > > > > The discussion is in this link. > > https://edk2.groups.io/g/devel/message/80289 >=20 > The question why TDX_BFV_RAW_DATA_OFFSET and > TDX_BFV_RAW_DATA_SIZE are needed and why TDX_BFV_MEMORY_BASE + > TDX_BFV_MEMORY_SIZE can't be used is still open. Here is a BFV metadata. 37 <1> _Bfv: 38 00000140 00400800 <1> DD TDX_BFV_RAW_DATA_OFFS= ET 39 00000144 00C03700 <1> DD TDX_BFV_RAW_DATA_SIZE 40 00000148 0040C8FF00000000 <1> DQ TDX_BFV_MEMORY_BASE 41 00000150 00C0370000000000 <1> DQ TDX_BFV_MEMORY_SIZE 42 00000158 00000000 <1> DD TDX_METADATA_SECTION= _TYPE_BFV 43 0000015C 01000000 <1> DD TDX_METADATA_ATTRIBU= TES_EXTENDMR TDX_BFV_RAW_DATA_OFFSET/TDX_BFV_RAW_DATA_SIZE indicates the offset/size of = BFV in Ovmf.fd. TDX_BFV_MEMORY_BASE/ TDX_BFV_MEMORY_SIZE is the physical memory address whi= ch is to be mapped. TDX-QEMU use these information to 1) do the measurement of the BFV 2) map t= he BFV to the physical memory >=20 > While being at it: The question why "config-b" with a completely differen= t > initialization code path is needed is still open too. The tdvf design gu= ide is > not helpful here. Although explains what is different in "config-a" vs. = "config- > b" it does not explain the background, i.e. why some features are support= ed > by "config-b" only. The solution of Config-A and Config-B is to address the concerns of One-Bin= ary requirement. See Erdem Aktas's comments in this link https://edk2.groups.io/g/devel/mess= age/76339 Quote: "What we are asking with "one binary" is: Simply enabling OVMF + a g= uest OS to boot in a TDX domain without breaking any existing functionality= . Intel should put everything else (specifically related to remote attesta= tion) in a separate platform configuration." *Config-A* enables a minimum functionality in OvmfPkgX64.dsc without breaki= ng existing functionality. *Config-B* is a separate platform configuration file can be used to provid= e all the security guarantees that TDX provides. >=20 > And I guess these two questions are related. With "config-a" there is a = fixed > offset between TDX_BFV_RAW_DATA_OFFSET + TDX_BFV_MEMORY_BASE, > so if you know one of them you can easily calculate the other. With "con= fig- > b" this is possibly not the case. >=20 > So, can you please shed some light on this? As I explained above how BFV metadata is used by TDX-QEMU, there is no diff= erent in Config-A and Config-B. Below are some links discussing the Config-A and Config-B. Hope it is helpf= ul. Config-A and Config-B: https://edk2.groups.io/g/devel/message/76367 Erdem Aktas's comments: https://edk2.groups.io/g/devel/message/76339 Laszlo's comments https://edk2.groups.io/g/devel/message/76836 https://edk2.groups.io/g/devel/message/76837 Thanks! Min