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.714.1650343634095177197 for ; Mon, 18 Apr 2022 21:47:14 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=ZwsWBcqU; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: jiewen.yao@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1650343634; x=1681879634; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=Yyn8orT4MI4SKj1MpgEyTvY1gMfaFGXcFfcMxWJCds0=; b=ZwsWBcqUsamwE83lk/4NADD2lpOoUxjqnDL1XM01kgyqsJJOK4bVVUcn 1rFF3TcYk1fYEDhtIwVPjbz+k/pZ9oyr+6olJWJXErL/E3HFtYkFwm0EP ILuC0II5kgAtt7Kn1H+m9PjZ1/sXoKLYB/Z5FiUd4TKdyZdu7/XBNz6b5 D8Nu1gs7VIrhFeUQuLgXpuolAnNfgEchXC6hUyGusA/VaIq5ZijeNGEZS LjLgjBOxT2nK9RFboVLSCHKRcs6+l/V/xQDA4VgulAqRT1TT0cQKIPEZC vao66G4OiPLKZU69djRuDMS5Ljs7SZ2uVIwtoCrEaH5ZobM1VsMBBOLle A==; X-IronPort-AV: E=McAfee;i="6400,9594,10321"; a="262533934" X-IronPort-AV: E=Sophos;i="5.90,271,1643702400"; d="scan'208";a="262533934" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Apr 2022 21:47:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,271,1643702400"; d="scan'208";a="575905186" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga008.jf.intel.com with ESMTP; 18 Apr 2022 21:47:05 -0700 Received: from fmsmsx607.amr.corp.intel.com (10.18.126.87) 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.2308.27; Mon, 18 Apr 2022 21:47:04 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx607.amr.corp.intel.com (10.18.126.87) 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:47:04 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) 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.2308.27 via Frontend Transport; Mon, 18 Apr 2022 21:47:04 -0700 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (104.47.56.41) by edgegateway.intel.com (192.55.55.68) 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:47:04 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LG47ru/GT2eENcsNfM36oZDWvhBJRnVpjCrgXW8iV/vKh5qsXPK4Yz2O9y7qgHn7O85zSrTh4ksdeTPrwHLsa62MLN74jfjutAsPevlLL7jWiLIqX2/AL35cGrCZc0wb3ioIHhJ2zpqGyec8vBDHP6O1zkY59OjLg5fBAEAvxGrBWK0rk0kQN6yVELq+BvTCMX2BSJq5K3YocYw4REQPNl5O3Xz6+fUmuo4NtJx639/WU5fK6Aeytf84Iwcoz3RlgkthR/0/XPUYHkBMmQbAPzs26W4xh5b7oGE5zhbtNpfqbc+uXJmI+96KQusX00/Xbfwf4z009Gp9Bgg0clYH4w== 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=Yyn8orT4MI4SKj1MpgEyTvY1gMfaFGXcFfcMxWJCds0=; b=FMn7iKjGw7m1ZIKFid2UX9BdUmRAq/6/H9tvktmOwFusOM+Cxd0DMufGn1oa79TJyu/bpbg9o06lFNx2uRRk/j51zxKQ5FMZPypxbLPostOb2vWU/B6S3d7hrnwNHIiWhaBaNPVWDxyxg/yULW6+kWvFgFeIMFGuWG57GK3XdqzARc6KzP5eNQKTXvvLBm6zFBrtXPDvoY04FWw2SEvTTwQO5GdYsw9OZc+q1r95wvB1YDJ3LcKYSuVqBqPFMyRMEY59ExfWVouaOwFdy4JnTxhVmzB+mkGcqR/lyVI4Y+EwMn8iO5cH4+WJpyQvTbXiDT95ZkdOb8LMm4ODnCJW5w== 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 MW4PR11MB5872.namprd11.prod.outlook.com (2603:10b6:303:169::14) by MN2PR11MB3613.namprd11.prod.outlook.com (2603:10b6:208:ee::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Tue, 19 Apr 2022 04:47:01 +0000 Received: from MW4PR11MB5872.namprd11.prod.outlook.com ([fe80::198e:ea23:c83b:b93a]) by MW4PR11MB5872.namprd11.prod.outlook.com ([fe80::198e:ea23:c83b:b93a%4]) with mapi id 15.20.5164.025; Tue, 19 Apr 2022 04:47:01 +0000 From: "Yao, Jiewen" 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 Thread-Topic: [edk2-devel] [PATCH] OvmfPkg: Set PciLib for TdxDxe driver Thread-Index: AQHYU5EF52tkA5TcwEGoABwxC84FI6z2fNawgAAKJwCAAAIdkIAABGCAgAASSICAAAgCgIAAAZKg Date: Tue, 19 Apr 2022 04:47:01 +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-version: 11.6.401.20 dlp-product: dlpe-windows dlp-reaction: no-action 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: 63a06bf9-5fac-4756-cd0b-08da21bfa51d x-ms-traffictypediagnostic: MN2PR11MB3613: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: HgG9aNLJ8bMeAOx2LFrCRl1vGwSNjMqWI6o/hAsNn+AwbihF0FwlmKS5gO97qQ8UuEk74qiPdeHThVv6BVc9xbKyYQG3fKgHU+V0e6z6u52+vCgPi1uHXDY8ivTrPf/rJES0WgEIUSKjfjVw1ppRW7+P4+H+cTF0kMUG7me+5HvsJTYcaxKEaW3bbBjshP/N2enCIQY2B/0bA7cu5M1pPzWG/lg8esNPoHL0x0HvbExZDbwW8crhjmCjIMAkwJ1nk2+Apps1NQVXaYr275FIuXz70WKts/EUzz74NGXp3zrbThhRI9b7uVYpUCDDzna+0FYZKhEo0yDAyGx5xBWItyKreX05lyTERR7a9glvvjlC5sO39EYjjZDNIsvcFK+T6WglG1HMY9SCy8P81qVP+d4TqQP6BAx0/EXYPlUfBV64ETO1D9FEjzF/fX+5LP8plueV98ebpyb9CSKekVymSlSt4cU5YOQm7PbPgNZ5711Y2NMhO1etOlD24VclxuzHMqm0g4wDjls/0Hm2Belm5iMlVi8nPkhRCexZiVDmMPAW/i8Bkop+9kaEZ8GDQ5La9XGjfhcjRgg0ftoVVtnxljmBw8+w5tqCaZ6HhH0RX0uxxW3mLKLqOd7PpGwE3ZfOySrr3Wlyl1uniq7kQfUJV2rqNXS5r0sZ/8saeLyY7PDrEbOMEeG5+S7cIi/yIlDRroWlBDll+ToXHYermdk/TbXwEHzWa0rAZiMP6uAVgQk4c1XVZe+hplgAFGTNTawTjiYqbRlfOWuXczBWtwK2vgCvKRD692pNPxV9ZDra9QQ= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW4PR11MB5872.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(26005)(64756008)(86362001)(66476007)(8676002)(66446008)(4326008)(2906002)(7696005)(38100700002)(9686003)(38070700005)(6506007)(8936002)(33656002)(53546011)(966005)(71200400001)(19627235002)(122000001)(54906003)(316002)(110136005)(66946007)(76116006)(66556008)(508600001)(52536014)(186003)(82960400001)(83380400001)(55016003)(5660300002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?cq8dPCPJ+tOm7SQDoTzNuRwseNAcFRE1MEQg0wctP6vdTt+//hEfb5VlBGIJ?= =?us-ascii?Q?RiIEOAGPmET9VB58mmCH1t9vTtohp47kVKwYIYM4QF3xO++JKgR6x4Gpo43P?= =?us-ascii?Q?USO09k1zrpLVK3xYOGzzt40NrJPJ6NOh/eYIY+i93aHkpLTfThxwXGgKd/EZ?= =?us-ascii?Q?l/VbMEy9U9NRcVqCOdZFTW+OSF6z9dlbYHVCuJFjpQJKyp/XlNmq7fN2tLfe?= =?us-ascii?Q?7q8KDF3zxEXbE7KMGfkBXNfKcm+ItAwwPEbh3I5h1flBC62XuBzelZbKESkM?= =?us-ascii?Q?sc4Dpda6t84pLUs22xcr3nBLTMFDQLHaoh5vONRt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cZslLDQ2FxW6jindtlCY9oa+nXIOB3fKdQr1rHu9Xf8Jjv?= =?us-ascii?Q?OkKtTifnZ3X6pXQ5ehOVdWOpA6XoXrc5yxncXov09TIhs0XAFkB3NSZUbv7O?= =?us-ascii?Q?6H4mVjF8oII6sOEU45DgyZBBhvvkbEcKqSNC1+flLkHuikUpyjLDxAelzkeV?= =?us-ascii?Q?U8/YSNzNoIiELafgPoIBssnvKUSLm/8zdCBOWmVXRB+DEGDcoEH1cMgab1S/?= =?us-ascii?Q?LcuTaNeG/qpJ5aBvhLX4e7jnxq0NN0UFznTTt0K4jTTqm+fqS8uRotYP+7q4?= =?us-ascii?Q?iNaxPUtbp3H81oTg6ppJQ2qrfmrnVWYClJbd9na1tX+1aMnZD3zqqPHWYg0x?= =?us-ascii?Q?/XCBAPoWkifBpmDAV2ZnXxtbU3eHroG6SgsLeps/Vnw104kB86wkrqIccx6W?= =?us-ascii?Q?bQJv+0BhSr221WwPeaNtoqwnVnqWVPfZEO7aABAJxaY7LAmupV3QVex6BOD1?= =?us-ascii?Q?HQnvqpwEKTevsFYJIbpf2g5R/pabr+8lUob+434ZPbkc8ykvO76H2OJaQs0C?= =?us-ascii?Q?3l/mENwmGw=3D=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW4PR11MB5872.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 63a06bf9-5fac-4756-cd0b-08da21bfa51d X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Apr 2022 04:47:01.8229 (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: f5Ose8DvIILOgFVIwiINlQoMMBfZcucJEzYbNRuuvdB/RzvxTyXaxK5JUx9KxHftACQsuSArXoS4n6mo0E4xVA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB3613 Return-Path: jiewen.yao@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Can SEV clear the C-bit in SEC phase? I think that is right way to ensure PCI Express can always be accessed by a= nyone. > -----Original Message----- > From: Xu, Min M > Sent: Tuesday, April 19, 2022 12:39 PM > 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 >=20 > In AmdSevDxe's entry point it clears the C-bit from PcdPciExpressBaseAddr= ess > and other memory spaces if needed. Please see > https://github.com/tianocore/edk2/blob/master/OvmfPkg/AmdSevDxe/AmdSev > Dxe.c#L81-L95. After that OVMF can use PCI express. >=20 > This broken is caused by the call sequence of TdxDxe driver and AmdSevDxe > driver. Currently TdxDxe driver is loaded before AmdSevDxe, so in SEV-ES = guest > the C-bit of PcdPciExpressBaseAddress hasn't been cleared. In this situat= ion the > access to PciExpressBaseAddress trigger exceptions (lib constructor in Td= xDxe). >=20 > There are 2 options to fix this issue. > 1. Adjust the load sequence of AmdSevDxe and TdxDxe (Load AmdSevDxe befor= e > TdxDxe) > 2. Make TdxDxe to import BasePciLibCf8.inf instead of DxePciLibI440FxQ35.= inf > (just like AmdSevDxe) >=20 > Tom and I tested above 2 options in SEV and TDX and all work. >=20 > > -----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 > > > > Do you mean, with SEV introduced, OVMF cannot use PCI express any more? > > > > Thank you > > Yao Jiewen > > > > > > > -----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= even 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