From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web12.662.1650343173227270821 for ; Mon, 18 Apr 2022 21:39:33 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=DD/dv8pK; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: min.m.xu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1650343173; x=1681879173; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=tzrOlM57sDTaGPeKd3THzeA52G251xGZEMwmS+V/l1c=; b=DD/dv8pK+RllBcRAK9zvQTJP93+qWbdtwVinLFlHUPoVCBDU9jHPB+bC M1wdVJuCP7dfrf44rBROw+O/Cf1g7bpQjHljz7OylfRIG6L8h6qw7PS+J eRi5UCZUZR0Xls5f0TMeKDGoUaMz3CWTp2oA8SCCQ7uX7Fg9WH/r7Cjox MtIZYO2t/m7HEvLjEIU7OQOqjp5aosyDxXGMEImwA5is3/aMOTizMEGVI j8YgFOofwOcdqN6APAHfYjAeNGaIwIeUpT/b1bTcwfxoJjXf6zmck3e/c XqzSEbP8/zZ8Udde3YuDsaliSYLrJ4XFg0FHZkYUW1CxxKepykBjz0Xao g==; X-IronPort-AV: E=McAfee;i="6400,9594,10321"; a="263431690" X-IronPort-AV: E=Sophos;i="5.90,271,1643702400"; d="scan'208";a="263431690" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Apr 2022 21:39:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,271,1643702400"; d="scan'208";a="613860553" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by fmsmga008.fm.intel.com with ESMTP; 18 Apr 2022 21:39:31 -0700 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Mon, 18 Apr 2022 21:39:29 -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.2308.27 via Frontend Transport; Mon, 18 Apr 2022 21:39:29 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.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.2308.27; Mon, 18 Apr 2022 21:39:28 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Mq9zKYt4JkfaG4fnhJGKDQmO2EIDXYeqOH7GvAiorK0doSax8YeTr9Zeegesl2YsegEFVoX7CqDZNLt7yLqILglf/eOBkqXj/nrX4+LDnPUcaSLSUAvaV/g/P5QpN5IxD00tHkHuvdeDdepOMAcyKHzatiel/KaehOMq9Yh5QvszYGAbt1+ak1UILvJ1XpSLwnPYWIwKPQXpe5O2lhDODSDJP6et5RVmKe1ylzWUwjBFFNZclpAcSBtecwzvL4d4iMylCtxifVMkNOv8JPyVo23lNH8MNZwZnD88VjzlLoy6652TOHGUanMeG1c0xQ4+VXtiFdSeTa+EOgkQJ8EKlw== 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=tzrOlM57sDTaGPeKd3THzeA52G251xGZEMwmS+V/l1c=; b=D1ddTT4Viin82Pv907UlR3cJglLD4jn0bIkGiG2f7X/Lh4yKuDANnve0EOVAsKPsD9FsnUW3ZChdcACycBaIZhZcv5Twv172//nVXSOXUMw6ij9+Xb/fIkdmETRGwJly/hzrZ8TGTyjo3aef2jAqVJTVE1BagFRr+AQc1bJgYoTWZed5le2nLrkPyGzyMZWjAUiddaqfh0XQaHdutN5fQlvWelJA/ytqieeYC2h9PReKC3PzElQnJTaImlCcOE8D1yteinxU3dfE6v9NfyJ+rQLz2upb+UJslGIaR5hm9KwFxyfYm0Bp47oApwe1sSGsZ/zYWN+it5lGLpjUapQb0g== 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 Received: from PH0PR11MB5064.namprd11.prod.outlook.com (2603:10b6:510:3b::15) by SN6PR11MB3277.namprd11.prod.outlook.com (2603:10b6:805:c4::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.25; Tue, 19 Apr 2022 04:39:27 +0000 Received: from PH0PR11MB5064.namprd11.prod.outlook.com ([fe80::ece5:6170:a99a:480a]) by PH0PR11MB5064.namprd11.prod.outlook.com ([fe80::ece5:6170:a99a:480a%6]) with mapi id 15.20.5164.026; Tue, 19 Apr 2022 04:39:27 +0000 From: "Min Xu" To: "Yao, Jiewen" , "devel@edk2.groups.io" CC: Brijesh Singh , "Aktas, Erdem" , James Bottomley , Tom Lendacky Subject: Re: [edk2-devel] [PATCH] OvmfPkg: Set PciLib for TdxDxe driver Thread-Topic: [edk2-devel] [PATCH] OvmfPkg: Set PciLib for TdxDxe driver Thread-Index: AQHYU5EJ/TCeqpZZzU6llxkdYvlm4Kz2fW0AgAADE9CAAAnWgIAAAOqAgAAV8ACAAAKlcA== Date: Tue, 19 Apr 2022 04:39:27 +0000 Message-ID: References: <20220419015828.899-1-min.m.xu@intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.401.20 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 7d9da65e-ae0b-4ac5-ba48-08da21be9657 x-ms-traffictypediagnostic: SN6PR11MB3277:EE_ x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: D+S3GpmzqC2qjTTyN92ECnHT0H8LdyKqcXV8vdAJONaQeX44y4h6TLG4yAvGH75JljxviIgS0GTva/zDNN4TNw0pkCt4sRvmXFl//NKAW8AoWuFX8fLgLlWV/AeNdXcPbhPOwhbAVlWJfRupEJPHIlkBDEnaYQelFrBpzYxVXCE+GqcdsOY9IonJlo53Zk7A26IKZ/h9/RBzu/0zU2Aq8G3YIyGHiZ0q3IC3Pdt7nQMD9ZoZ92gvQWOJKrb2Erf4erRV27cBmCD1AhY4RmcVxBTOlV1Wf8/qI47Epev9SUoDERHgA49GbWAS8gAnfujDpjvfCSIjkemYkcr7JAPfP30OfWmOXG93um0fdNVS1npHY/AkSwkcJ8+w9WWzw4VQMa/uRRRmHT9kjpyFofE0rif7GRiUPsmh4cxgxaMYE3n/U1U0lyeuX10L44pAnnhQRlmXuYbjJWzug1Zv0GZ/G5W+PWsOiwG2aB9qwBeSRydqWG1L7WmHjYkxNuJZB//IYb7EoMLhgHHBtmT61ES7kRVz1ZzeuybS+kaLuVLT3pe/iuMVCEz48dS3a52aYfaMUMmDVGT+96oTxhn8pqWsKiHHGwI8CIw3xxGcHuE1P/RcUoMHD+i3HYLRjSTgLv6Y8SrT6ufj94kS77vUa514DcVmT0raTG/dJHdqllytrsXb4RJFE6/8kIiA2QjeBACtZZ8I2UxjwEuolrxr828mBPFL636GxjUR2THiC3QGJf5MGXBtI+qt0nnEnq74YCi+d7w2a5Aq3hUkIVyQLm623dj8TvuT28Zg8rmUnYZW+pE= 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:(13230001)(366004)(966005)(4326008)(66446008)(7696005)(53546011)(86362001)(83380400001)(9686003)(2906002)(26005)(82960400001)(66476007)(64756008)(76116006)(6506007)(8676002)(66946007)(66556008)(110136005)(508600001)(19627235002)(122000001)(54906003)(316002)(71200400001)(186003)(38100700002)(52536014)(38070700005)(55016003)(33656002)(8936002)(5660300002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?ZDnvE5VWV6pzJsGYlqBgIJyC3FMU3oNpOg4Lc9w6jsW6jYhBKm0tJyH1cwYC?= =?us-ascii?Q?spIKgIAqAjtgPdDDWEoJh8zDWYl3J6veZrr2Qw0c0378gbGZr3SwFGPXtW8v?= =?us-ascii?Q?zQiyuKM7tga0xydaJY5DzRNp5dzqG7J321sUhmp5RVUi8r8PxCx3A2Kv07jX?= =?us-ascii?Q?YPxxd4kti1X5oYME9j3PtPc4iK4ePianDWrAqLomMVwiaR3H0HZH6nzNPO2i?= =?us-ascii?Q?bL38qBs3ehQ/cC5RiAh420hQDpheeU0ib6lDKzj4fxCEFCJJYfOuEzJs/67t?= =?us-ascii?Q?55duVRFlXqX5tYhzW2LDv4A342j/jPZbSJHpg4xxtl1SO2wWt4DfYM2iavp5?= =?us-ascii?Q?mtdSZQH4we6bUauKTeNyyjQfAoTA9E0F8rp7p3LL9At/9QWlUAbzTAKL53lU?= =?us-ascii?Q?iCWpjHpBQvEmd9Gbq3GYuU6yMOZS5+lm4Zn5X4SWb+1Ag+Qe/F+OG3Ysk2Mw?= =?us-ascii?Q?ia6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BfUXGsinbEf?= =?us-ascii?Q?8Incqd2cOYfzrzfGpboYAEB7hpVh+o5+eKgPPqVKPkSVo0Vp71tGhRoryMh5?= =?us-ascii?Q?wBcJcxUkUs4iWtcyT2E5QZoKoXltQYJrYVZA8GsFO2B+nEFMpWbmIRqBRHZl?= =?us-ascii?Q?j6qOKtI02NxSPJBqgyVxeMXOT7Ao2A/EkK4fF0GdFET/YR4qJcSmXtmCaC8h?= =?us-ascii?Q?3EwzrTLpaVCDVpRQDu2d2h/UWpwIkrJ7TaHBcae57uBDrtSKC6jwlUZ6kz9J?= =?us-ascii?Q?GZQxuD5MS4Yqd8XFMm34kUaCaypo1hnpk1Uh6dqMv8jbLYQutBBQd1S4ZFKR?= =?us-ascii?Q?qAVg2RY8F2Q1JnSkneuOmXL1Izoh/C43jfFIYz3bH5A4+B2OsFWt62eFhB6b?= =?us-ascii?Q?kxoT4cit1g=3D=3D?= 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: 7d9da65e-ae0b-4ac5-ba48-08da21be9657 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Apr 2022 04:39:27.4931 (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: 6SCwZ7FOeDH2MpL9OiDJGVXjNyNtJw12tZJt0N+Ax0rWhvqheOprh2zBKq/hiS1wQXFdgjSwt6T9g021cxsj3Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB3277 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 In AmdSevDxe's entry point it clears the C-bit from PcdPciExpressBaseAddres= s and other memory spaces if needed. Please see https://github.com/tianocor= e/edk2/blob/master/OvmfPkg/AmdSevDxe/AmdSevDxe.c#L81-L95. After that OVMF c= an use PCI express. This broken is caused by the call sequence of TdxDxe driver and AmdSevDxe d= river. Currently TdxDxe driver is loaded before AmdSevDxe, so in SEV-ES gue= st the C-bit of PcdPciExpressBaseAddress hasn't been cleared. In this situa= tion the access to PciExpressBaseAddress trigger exceptions (lib constructo= r in TdxDxe). There are 2 options to fix this issue. 1. Adjust the load sequence of AmdSevDxe and TdxDxe (Load AmdSevDxe before = TdxDxe) 2. Make TdxDxe to import BasePciLibCf8.inf instead of DxePciLibI440FxQ35.in= f (just like AmdSevDxe) Tom and I tested above 2 options in SEV and TDX and all work. > -----Original Message----- > From: Yao, Jiewen > Sent: Tuesday, April 19, 2022 12:16 PM > To: Xu, Min M ; devel@edk2.groups.io > Cc: Brijesh Singh ; Aktas, Erdem > ; James Bottomley ; Tom > Lendacky > Subject: RE: [edk2-devel] [PATCH] OvmfPkg: Set PciLib for TdxDxe driver >=20 > Do you mean, with SEV introduced, OVMF cannot use PCI express any more? >=20 > Thank you > Yao Jiewen >=20 >=20 > > -----Original Message----- > > From: Xu, Min M > > Sent: Tuesday, April 19, 2022 11:05 AM > > To: Yao, Jiewen ; devel@edk2.groups.io > > Cc: Brijesh Singh ; Aktas, Erdem > > ; James Bottomley ; Tom > > Lendacky > > Subject: RE: [edk2-devel] [PATCH] OvmfPkg: Set PciLib for TdxDxe > > driver > > > > On April 19, 2022 10:54 AM, Yao Jiewen wrote: > > > > > > Why does TdxDxe call TdxMailbox in an SEV platform? > > > Or why does TdxMailbox call SynchronizationLib in an SEV platform? > > > > > TdxDxe will not call TdxMailbox/SynchronizationLib in SEV platform. > > The problem is in the lib constructor. When TdxDxe driver is loaded, > > before its entry point is called, the lib constructors will be called e= ven in a > SEV platform. > > > > > > There are many places we can do CcProbe to stop action. Why we need > > > do it in DSC? > > So we cannot stop the lib constructor with CcProbe in this case. > > > > Thanks > > Min