From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web10.38211.1629806828254463182 for ; Tue, 24 Aug 2021 05:07:08 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=C/vyRtUz; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: min.m.xu@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10085"; a="215453274" X-IronPort-AV: E=Sophos;i="5.84,347,1620716400"; d="scan'208";a="215453274" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Aug 2021 05:07:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,347,1620716400"; d="scan'208";a="426087939" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga003.jf.intel.com with ESMTP; 24 Aug 2021 05:07:06 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Tue, 24 Aug 2021 05:07:06 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Tue, 24 Aug 2021 05:07:06 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10 via Frontend Transport; Tue, 24 Aug 2021 05:07:06 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.175) 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.10; Tue, 24 Aug 2021 05:07:04 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B+BfQy0FViROrmh45j1twaq4DOtIPA+Rfh+rixoWyxCYAhkDc+2YNUk6hvixOw8LhU0EPuqDmVYC1uGILTI/hn8OomFeRSI0pIZ5o0xEC3qj89YrfG9VOKyGmzEdA9eRfmJzRTD8hFHlRAEnIQMfOZlcAvntAQCj0UzQBfTOtHEvN8T/WmFWAX75OH5lVhR1gsnjNJxNOkBwqoORvk5w69IlMTofJwo27D6bUlR4HrTd1/Qjv9ALZ1EXuF2Itd0GpgP4GEamDSzRnLp8KL+gcZJCLpdP+kk0/W9bwwBsFFyuMZrbJVJUjEeZ+xGSufQBrTsziFHKyq8loklIgq0/LQ== 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-SenderADCheck; bh=tSiB+RFMZzd3FtQHQ9IqlGCuX7HbfWx3S+Oo6UGXVR8=; b=a/SuqIu0DtygpQnLqpE248yyrejIL2fih+sW3MJIzApiyOGyxBZig22hBN1fA4+3E45kMFjWEfG/ZsJxfZmdg9hX+dt6CyeirGz+U4KMio/rFw7KYOdoend2V8LvTW2wROxD8szCDGkjQAjSNHqHnwOmywTPYTezbiL1Q3I8lgcvH8gTIV1aut3n3LEnvXee0OrgC/MPrTpnEaVh7iYxcSnvan0R7JRkI8mb2svZmCeHuU3PtXUxzbMKQmu0UUqyjSkQB/hlH21qpQEnmFrCwFsElI+w8xFjATlVaTkKI6W/0Fw7CMN9zsH81Gk4+JTmJ8jZFwyWGYI9HvOC70bjlg== 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=tSiB+RFMZzd3FtQHQ9IqlGCuX7HbfWx3S+Oo6UGXVR8=; b=C/vyRtUz0GQH/XHKVxqNTd88l5fJujm5alAtDSf5SmpD0gvuBibe83fJkZODAuNlOWjVcFkz+bUZG3Eh5YJ2ISPE40bFQ7J5pSm+GCg1TzBlSFPPIN+VlLEumSGFNKyw1gVpwXsgiHovE+Ryu5JIzt/fM01HH3CLVRgeVBVbdoA= Received: from PH0PR11MB5064.namprd11.prod.outlook.com (2603:10b6:510:3b::15) by PH0PR11MB5142.namprd11.prod.outlook.com (2603:10b6:510:39::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.21; Tue, 24 Aug 2021 12:07:02 +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.024; Tue, 24 Aug 2021 12:07:02 +0000 From: "Min Xu" To: Gerd Hoffmann , "devel@edk2.groups.io" CC: Ard Biesheuvel , "Justen, Jordan L" , Brijesh Singh , "Erdem Aktas" , James Bottomley , "Yao, Jiewen" , Tom Lendacky Subject: Re: [edk2-devel] [PATCH 18/23] OvmfPkg: Enable Tdx in SecMain.c Thread-Topic: [edk2-devel] [PATCH 18/23] OvmfPkg: Enable Tdx in SecMain.c Thread-Index: AQHXj3Fii54wK/y3kE6wC54pvhWksqt6bd2AgAB8vJCAAR7kgIAGjgIQ Date: Tue, 24 Aug 2021 12:07:02 +0000 Message-ID: References: <95f116893a4a17c7e0966e240a650f871c9f9392.1628767741.git.min.m.xu@intel.com> <20210819064937.o646vxjebwzgfgoz@sirius.home.kraxel.org> <20210820072253.plne3mudm3dj6777@sirius.home.kraxel.org> In-Reply-To: <20210820072253.plne3mudm3dj6777@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.5.1.3 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: b967e898-e68b-483a-c72b-08d966f7aeea x-ms-traffictypediagnostic: PH0PR11MB5142: 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:5797; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 5gIenkvNvFtwQ7fvmdWNIW6rjxqWe8TTLZGrlO6hAYSp3uA+SpxcvPAehLz+4PxEQvjt5dWeb4u34cDPNoWzZsR/ZhsGiIVfCSJFtXwkF+g0LlpgsCommNHEm1aesMqs+C30C9S4uus7hegqs4tijvp9DKBqJNioluwfUTWkvHB9V9/WZsiYYUXiG48LFYGbBeWFAjakwTX9kTokL3eiJyGnkVWzW/l02zwmvB2ivHNuK85IhP9PQQEl0KzlvJ7828C7958j3sCcKoZDpNL/I6R7VNOMp2nP+OPgGIYJGrUg7SseDHh7yOjEeiPRKoenEMjM/67cgt/bqdDWVCXhcEGsxM1LQF0uHEsC439RYcdZGm4RKyF6zBEEPFi8tX3tB+x6+5ESerUfusBEFV6AYKqmX1b7ni5UM485L4SpMRjLXtlReAyXMGZmvdsziv/cYZGsUh6xYERa8uXXjhEtr3SvmZ5hcz8A1aNSfDIYwURKLFntx+H2d3yiT/LC/64Bw8nq4a+Ghzja2boJYqu0hKMMGg+n4lLbtdaM9jaWOr2ZOTle71Nwv2XIa/0M4+uPM4STfQ1cqdu9HJ4zn4o+iXw3Zw2AsfIcZoyMbQH/23v++2ydkiqHT8x3vHLcTNvjN0Qyis63joDNe1rjIfr3O1mnatkrilVocwedQztp4qMQ9zK7hfvIdl22z297riVF5JTcpxiT77EUBKut9JgQMOVvQ6rBQJBTipd0DWzhLtMHjTK7SH8FWp7N/nWW+gGhfPo0KSSj/oLSiUsqQZMAYoRy6guuFP2oEE4VMdCck+SOEIoNVrUOBN6SEPHxc74QyYcvt9HdDIa3byP7zJuo6w== 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)(376002)(396003)(39860400002)(346002)(366004)(136003)(110136005)(54906003)(5660300002)(52536014)(4326008)(316002)(478600001)(38070700005)(86362001)(2906002)(7696005)(83380400001)(6506007)(33656002)(38100700002)(122000001)(186003)(8936002)(26005)(9686003)(71200400001)(64756008)(66446008)(66476007)(66556008)(8676002)(76116006)(66946007)(55016002)(966005);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?Mpg76TFqdVKobjyhhHx/wzpRflsoeWYhZCSrCP5JYji0iDB2QnM05s6DVPfp?= =?us-ascii?Q?Ane3UZl+bSubDB9uEcznMGAVu1LC+9qbN9RmOQrbqCensoQdmsRRMYFvgXY/?= =?us-ascii?Q?1FqZOPYYV41HQzZSFTPw608MDGRuJXEa+LXYlhLYAyksTg/x36nQMFJStOzt?= =?us-ascii?Q?aleq5rIm7wUA9MkXuEw4Slhi9GuJzf2xqryWVhCpHw+Eqe4qksbR+V5VWMsS?= =?us-ascii?Q?dW903bNrQ4tr00Aw4Lw9vkvUHJmQudNAPRG2GoVjRfYymFJ9rvcjb8c1Gxzu?= =?us-ascii?Q?VVJPYk/hkGHVJ1vTdAVrOEguaPdh8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=?us-ascii?Q?dPhddt9fQIOMMZ8cPnm1kYwSKxsHjHqlMV5hOHL/QrbVcOi85CmmUAvngHpY?= =?us-ascii?Q?XIbalGSyemRCtFuvsVsNe0yppReu9N0LUsgijRpnGwYD9mJud+5WbMMcDFam?= =?us-ascii?Q?3kFn+aWpmUL9I28IRHWf0/fd?= 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: b967e898-e68b-483a-c72b-08d966f7aeea X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Aug 2021 12:07:02.6068 (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: gUlOVWIbraaJUKqOwkIZF1ToppBW4hCfDTMNik2Rih1eRWvhY//AlffSTDFOlJj5IrjYV1mr0rWzyq8J6yRsuQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB5142 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 August 20, 2021 3:23 PM, Gerd Hoffmann wrote: > On Thu, Aug 19, 2021 at 02:27:16PM +0000, Min Xu wrote: > > On August 19, 2021 2:50 PM, Gerd Hoffmann wrote: > > > > +/** > > > > + In Tdx guest, some information need to be passed from host VMM > > > > +to > > > guest > > > > + firmware. For example, the memory resource, etc. These > > > > + information are prepared by host VMM and put in HobList which > > > > + is described in > > > TdxMetadata. > > > > > > What kind of information is passed to the guest here? > > Please see > > > https://software.intel.com/content/dam/develop/external/us/en/document > > s/tdx-virtual-firmware-design-guide-rev-1.pdf > > Section 4.2 TD Hand-Off Block (HOB) >=20 > So basically the physical memory map. > qemu has etc/e820 for that. >=20 > > > qemu has fw_cfg to pass information from the VMM to the guest > firmware. > > > What are the reasons to not use fw_cfg? > > Not all the VMM support fw_cfg. Cloud-Hypervisor is the example. >=20 > I can't see any support for Cloud-Hypervisor in OVMF. Right that currently OVMF is not supported by Cloud-Hypervisor in Td guest.= But we're planning to support Cloud-Hypervisor to launch OVMF in Td guest and have do= ne some POC. >=20 > Also FreeBSD's bhyve doesn't support fw_cfg either and has its own ways t= o > detect memory. Cloud-Hypervisor can surely do that too. >=20 > So, why does this matter? Yes, Cloud-Hypervisor has some POC to launch OVMF in Non-Td guest. In that = POC Cloud-Hypervisor leverage a 4k page in MEMFD and pass ACPI data to guest Firmware in that memory. https://github.com/cloud-hypervisor/edk2 "ch" branch https://github.com/cloud-hypervisor/edk2/commit/52cb72a748ef70833100ca664f6= c2a704c28a93f >=20 > > https://github.com/cloud-hypervisor/cloud-hypervisor > > TD Hob list gives Cloud-Hypervisor a chance to pass information to gues= t > firmware. > > For example, ACPI can be downloaded from QEMU via fw_cfg to firmware. > > But Cloud-Hypervisor cannot pass ACPI via fw_cfg. In this situation, > > TD Hob can resolve this problem. >=20 > Sure, but again, why does this matter? For qemu? I don't quite understand the question here(For qumu?). What I mean in my last answer is that TD Hob can resolve the problem when t= he host VMM doesn't support fw_cfg communication mechanism.=20 For the host VMMs which doesn't support fw_cfg, when ACPI data need to be p= assed to guest firmware, a 4k page (to hold ACPI data) is added in MEMFD. Then when SMBIOS= is needed, shall we add another page in MEMFD? If the ACPI data is too big to be held = in a 4k page, then the size of the reserved memory region in MEMFD is the restriction. >=20 > I don't like the idea to have TDX take a completely different code paths. > That increases the code complexity and makes testing harder for no good > reason. TD Hob is not a completely different code path. This is a useful supplement= to the fw_cfg which is not supported by some host VMM.=20 >>From another perspective TD Hob can be treated as a set of launch parameter= by host VMM.=20 It provides the flexibility for the host VMM to bring up the guest firmware= with more parameters. Another benefit is that TD Hob can be measured into some secure register (f= or example, in TD guest it is RTMR registers, like the TPM PCR) so that attestation can be done bas= ed on the measurement. Thanks Gerd for the comments. I am not sure if my explanation addressed you= r concern. Your comments is always welcomed. >=20 Thanks! Min