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.web12.3967.1634102246029657760 for ; Tue, 12 Oct 2021 22:17:26 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=lHw/ZZP1; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: min.m.xu@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10135"; a="226124263" X-IronPort-AV: E=Sophos;i="5.85,369,1624345200"; d="scan'208";a="226124263" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2021 22:17:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,369,1624345200"; d="scan'208";a="715439665" Received: from orsmsx604.amr.corp.intel.com ([10.22.229.17]) by fmsmga006.fm.intel.com with ESMTP; 12 Oct 2021 22:17:24 -0700 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX604.amr.corp.intel.com (10.22.229.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Tue, 12 Oct 2021 22:17:24 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Tue, 12 Oct 2021 22:17:24 -0700 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (104.47.73.40) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Tue, 12 Oct 2021 22:16:47 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hdM1Tdcg3CQz2XRxa07rgwbztye3giNmnHBvV5qtNXAP4Dm+sbFerxF2kY8m0Rwo79XGYeMbNLGh/GXFkOY2T4UH64GHNy13V7+7yUnph/H8RIYTZAKVt8LKbDq06FGIPo6gVMbfyejLXj+PRjgDK0zruyCJ3CbibGGfzAXnaxZakx/B55AOrWGE8fOoCmXgxSuBZ7mnNTwBfOuzj8xPWPGAFoa6/igXfc4ZkUAhg/fUSqoKoltFXBGgUSDElrvigm/pKB2BMaAcSt2uUJl6Gg7wrBNfva1++Xd4NZWQzPLE6u62QxxPnaNLi8wJsXhp9Cf+377dPjjpJpTJLh91qw== 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=iwlj1r+jy8Yi7YxQvrSVjfKF8AQLVaKlXq/CUtsSkEU=; b=Ixlz+/Zrz83brdj4WMqFRLoRypXa6eRHr3zrq4lVW+8f7ImHQRcz0OYOZ95s6wDWEarMzYtLN0F3/wTh6cHL7K3y0pAPIJL2HkxKPtKwigcKz1+AaWoL95aSgmmIU8W/RHfBFdWyzQ1d2KS0ToVOP/uvQQPrB/IqQbMks5/u1TLJcxjiAs6eF3786pJF6wdqH/vAN7AbFjb5RPdIM+ouT3jSU0xhuuSyxhf/8+tdjRsQKjBvEfunpoKNnBipTZ42j16oDLMzmDOBK+k6YRuYxwZAQKm5tXTxtQ/G2icRkMXAM7ehKh7KYqkeP2yCxdShKBEurmQ99CLJFKaZ5uHtRg== 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=iwlj1r+jy8Yi7YxQvrSVjfKF8AQLVaKlXq/CUtsSkEU=; b=lHw/ZZP1y0JGydILA6P3XEiHx+YGqMSuNJHR8Cu0ymP7sFi9LPcL3SRYdLB3R4Ijm1zGLEMGjAIdg69pUllp5ZwPy1GIe8JqL+5TbL0HXj0XOCB5jlFJZosZBuXxqIikDKsP+0lXtJsf77qlMifUV2H598PG75VEgsjlIN4GJ0Q= Received: from PH0PR11MB5064.namprd11.prod.outlook.com (2603:10b6:510:3b::15) by PH0PR11MB5160.namprd11.prod.outlook.com (2603:10b6:510:3e::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.20; Wed, 13 Oct 2021 05:16:15 +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.4587.027; Wed, 13 Oct 2021 05:16:15 +0000 From: "Min Xu" To: "devel@edk2.groups.io" , "kraxel@redhat.com" CC: Ard Biesheuvel , "Justen, Jordan L" , Brijesh Singh , "Erdem Aktas" , James Bottomley , "Yao, Jiewen" , Tom Lendacky Subject: Re: [edk2-devel] [PATCH V9 4/4] OvmfPkg: Enable TDX in ResetVector Thread-Topic: [edk2-devel] [PATCH V9 4/4] OvmfPkg: Enable TDX in ResetVector Thread-Index: AQHXvxJ8FjkBVZzCEUa/Q1XvBwZNV6vO+38AgAFBIhA= Date: Wed, 13 Oct 2021 05:16:15 +0000 Message-ID: References: <20211012074318.evyxxk67jbbauv57@sirius.home.kraxel.org> In-Reply-To: <20211012074318.evyxxk67jbbauv57@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: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 9d7f7d1e-b694-4e9e-dadc-08d98e0894e5 x-ms-traffictypediagnostic: PH0PR11MB5160: 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:3383; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: WwQkHMtUZ6VmoAcnqALhrviGshq+3tTZb70wS+smShdIYXIc2tcXYkwba4UiIp99k43uq7rK5sMtmU1q875TltPbDEWIYMTLei8Dra0m3l9jnXAwHGzOpdX6gNny3d5gzitZJCBrQ+J13nRVtT+V1LbWSEfEQNacJP4RzUllCIjcF28wZLHl55e0NTKnAwdvv4GWlezWTz8ljukXL4Bq2p8RmEgGadjwcUYUhwULDkQh4RyOR5PV2cdoXAdUDFi1Lq3dcAr26WLND/He4JrJ/vJuxC81DYeIxDcEehthpA4KiY8Sq7LTH/UqPUZ0jv7GSQkFlK2//N8bngpQbmq/dfSCbpS9phR0NbZv1t7oE+or8yalcUMND5vS7uY7f7spr2NnTwkbBNFyNV2n98EdJ1iaWHwFprqP98VZQYhogEV4Ih23AVIvP1p7jXwnc4Ctlxr+DZSUqvz/nRPduInLIMFObCekoK6+tNlx3jjuhXBQLaT/55+Gobt9J2ceZIiAgJwcvUeBatJ47D1hoGwQNdBTRGtslqrnhDmswMR+IYDwJFN9jvdeR6iim/PnU0QHA5/yHCo3tJIcuA7K/8nezg7s1rDFRo1gnSwgqb85MAsv4k4XXsOQJGvehZaGf6AeY5tgqpGRe23hmtk3pMx33RERhw7w8mRZ1vOUXLiAh55yH3Q6vIZxIgWtPwFLPNPFscRSYBFRIWEbhX/EOUDsk3G9Adob6kV58qAJN4WO2Fnv9e12lzstwPA3ufofFy7uid9EekHqgSHTpzVhcfBkDP5bn1hyMpu5vxW7pXCTnPM= 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)(9686003)(8676002)(33656002)(110136005)(76116006)(38100700002)(83380400001)(55016002)(966005)(26005)(38070700005)(54906003)(4326008)(186003)(7696005)(122000001)(5660300002)(71200400001)(52536014)(86362001)(66446008)(316002)(8936002)(64756008)(66556008)(508600001)(82960400001)(66946007)(6506007)(2906002)(66476007);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?2YlmOaOnGdiMXeYGfo9l8cl6m9ARIawKne2ryUtqAIWYsi5ayeugit6FRUq7?= =?us-ascii?Q?Au8pZRdcNC5lI9XnyTj6r7dxFNBx5udMH/fB/gS7vM7wTzXg5ss+dXXoyLw+?= =?us-ascii?Q?qx4DCCTeFBqkMV4fafYpI1xAR39qAEH3Chvtdk8olqVVSsk2dHOvob1EUFQR?= =?us-ascii?Q?KdL/G+C+N6ujYVNu9isKCINZYcWZdE90ODWy2VY8NT8gdJ4ChmheXSREm2rh?= =?us-ascii?Q?ggw66U4e+QKhSRZTkfDAhYesLP9O5hEQzGA1DIDl0T8sg+uN3d2GHtUr+h+8?= =?us-ascii?Q?3QOd4EcInW/gqN304oiDht8afyzhReg45+mjOJMXnKLV6PYcCysPzyPni/MD?= =?us-ascii?Q?xwC6kDjFnl+z40QCHdZzviNot6FtUk4Il0LSoYEsvduepFWaFlDt9liQ9YDN?= =?us-ascii?Q?zQjvZxi4ukQXOUu5LLbGp+cDDyRLNWBeZepQdl8RePVMFZYaUZQmbeHAHYsr?= =?us-ascii?Q?jP4lOaSg7NwKBtVAYFGIdBbpLSrGmBEhRKctu3vt3+Hf2tOcq6q6183+kwFk?= =?us-ascii?Q?p0anAXOjUqcC2oDo9DyjAgJeT+99piH0wcqNgBaDlT8xy6aMY9dpSmmxQxWk?= =?us-ascii?Q?KvUnU37W9VPn2IQvEU5xZq9j5t4LS24kV/ZWNDPa+6iDgYmWfX4BNGJ88fEb?= =?us-ascii?Q?fZ1RyZeaFfwchevNXY/Istw3/QeumZxN0O/OVqHVURIEaIvFoUF8sAatbsUT?= =?us-ascii?Q?p1b/tJz0qTpm2/dLWqPn8i+N7tZ9OsmfKRWCn1FO+hYfMED6UA5pGBFtc9mn?= =?us-ascii?Q?kpQc71VtGqfJ2su7S/koI9WNVNHl7tmOGnoE8ChPdvupFUdW+DFMjfpeXkez?= =?us-ascii?Q?xDgAedOb9bogDRu7+mHU2T3HxGvJSsYwvY/hqiWf0cbUX5U/RbAkakOHeG09?= =?us-ascii?Q?8ieKX7aD3O66GNQ1SkfyRE7NXGBbAU6fKyCN7Qcq+e3CRvIpPin1Js5qe/jG?= =?us-ascii?Q?D+hDlUpiSDTk6ZbrPihyBkVoimU50QgynvwCcx1+3toe7q7Q2z1YNTAFgHj2?= =?us-ascii?Q?TGMkEi2NwwH/gtSC7nlL1F2V5i3iYoQbTd+o31Rn8rNXSOdofSyn+GJZk537?= =?us-ascii?Q?NQQrO3dM71l0DT4mgnPa3d9hfCzy1OmETnuD+3XtXesZBN1zN5OLxBNDUenY?= =?us-ascii?Q?f4Dui5bpTlYd0gfvCdIKpbgfR9xpfMa68yVv5r/y10vJBojp2DC6SeCTp2ZN?= =?us-ascii?Q?FZfpvcYFz/jXy0HDQJQvQcaZxKXtaLOXS3Qo7KYX8hb51VTX1GeTQUfFX3Ru?= =?us-ascii?Q?t13qlnUzjD0apX5DS3AE5UIsFK6YkcSMgegBTGMawQcdJsiF6L1csXtspjky?= =?us-ascii?Q?GKh+iyEeFpqAZVA10w3LnjXh?= 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: 9d7f7d1e-b694-4e9e-dadc-08d98e0894e5 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Oct 2021 05:16:15.7475 (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: SP8YcJxZK8tYO1uUQ0as8BluU5J5JWrGEa1llOj3kDkldTIVP5UuxO40dd87k7aLJu319vjOCUVwoqU/iGWIog== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB5160 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 12, 2021 3:43 PM, Gerd Hoffmann wrote: > Hi, >=20 > > +; Load the GDT and set the CR0. > > +; > > +; Modified: EAX, EBX, CR0, CR4, DS, ES, FS, GS, SS, CS ; > > +ReloadFlat32: > > + > > + cli > > + mov ebx, ADDR_OF(gdtr) > > + lgdt [ebx] >=20 > No need to modify ebx here, eax should do fine. You're right. It will be updated in next version. >=20 > > + mov eax, SEC_DEFAULT_CR0 > > + mov cr0, eax > > + > > + jmp LINEAR_CODE_SEL:dword ADDR_OF(jumpToFlat32BitAndLandHere) > > + > > +jumpToFlat32BitAndLandHere: >=20 > Strictly speaking this is not correct, you are already in Flat32 mode, so= this only > loads cs. TDX: https://software.intel.com/content/dam/develop/external/us/en/document= s/tdx-module-1.0-public-spec-v0.931.pdf In [TDX] Section 10.1.3 CR0 and CR4 are initialized when Tdx guest is creat= ed. So initialization of CR0 and CR4 are not needed. It will be updated in next version. >=20 > > +InitTdx: > > + ; > > + ; Save EBX in EBP because EBX will be changed in ReloadFlat32 > > + ; > > + mov ebp, ebx >=20 > See above, there is no need to modify ebx in ReloadFlat32. > Also: seems ebx is never restored ... In [TDX] Section 10.1.2 EBX[5:0] contains the GPAW. Since EBX is not change= d in ReloadFlat32, *mov ebp, ebx* is not needed. It will be removed in next version. >=20 Thanks! Min