From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web12.7467.1631712066149496307 for ; Wed, 15 Sep 2021 06:21:06 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=I7MDPllJ; spf=pass (domain: intel.com, ip: 192.55.52.43, mailfrom: ray.ni@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10107"; a="307866479" X-IronPort-AV: E=Sophos;i="5.85,295,1624345200"; d="scan'208,217";a="307866479" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2021 06:21:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,295,1624345200"; d="scan'208,217";a="452528444" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga002.jf.intel.com with ESMTP; 15 Sep 2021 06:21:03 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) 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; Wed, 15 Sep 2021 06:21:03 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Wed, 15 Sep 2021 06:21:03 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.100) 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.2242.12; Wed, 15 Sep 2021 06:21:03 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nKTyj1FZZFeQR6PQYEWHfa5/hZ/GaykzSGAGvJLGI8+GIWcBHXZABQXh+oGxZKRs54eR8gmS/mUMML50BmXc7M42HWjYP9TvcWTtSVx7yF4BKUopfhATgCIHNAr+JRAt0dno4e6lG3AAEeLnWVtZBXFWCuWYuoxsoWBK6LJL2xu0gcUWUoqr3m0lgd4G+eGLjaaKG62itST8WBDlrefILrpctD1vq9SVLlmo2UbUxW8GoKwKAMuMZ5K6HYHlskQydyPI4CVaCMiFVZQVHHI+Iq37IWf4hxI/81F2Ad7Wsl9NZJ0P3hGuYCla8TIfJlLbpt6LoMk4uhxZd1PIZY9y+g== 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=BoXmbxSQO8pYdQwVn0kOiRnc2eXHpJjcIbo87iXCJyw=; b=oBM+paRlOG2uWX+dVNcBlx/JLnnA8FgUIh9AQcfLtWinlUQ4vBwFB8McgWcyupkBDEeWQwo4PpVnGZqYRD59BwR1SYtfQe06b+GiQ0NWZS1hD6qvnnt3PRIZU/igkIboEo/zEMRmAfpEwRuaUy5NWV8ZT3JzPm7gi5cqoIs+8TmrCjZRedw0j54XOeHpJStsT1fR1x5JsxyDhHDrwQTU5ODwJnFOULW2MO6pZ7viYDO/qXpCm16iW/woMzkUvINa8DNJrvq2ZYsiZizwOugpgdQd/uqVr64esIRYBRC3ciJLKjxTx51kTwmUewUdVbnsli20zp3T7lepCqdWmMx1mQ== 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=BoXmbxSQO8pYdQwVn0kOiRnc2eXHpJjcIbo87iXCJyw=; b=I7MDPllJ/Dr3VyEdxl3gdyNvM5pXMKvz5VciLuZuC6znppGmSHlUbpV4KjWVO9cBAwOvUZWVGOsnjz6Lo7n+caYlBkAHq44cRSI/A0ursEgRdWshPPb4K5Lz+laxX5Z1SPTQ6dggWbooCkcMrwr97YJ2W5xKcyw3kXq2BB9/K2k= Received: from CO1PR11MB4930.namprd11.prod.outlook.com (2603:10b6:303:9b::11) by MWHPR11MB1662.namprd11.prod.outlook.com (2603:10b6:301:e::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14; Wed, 15 Sep 2021 13:21:02 +0000 Received: from CO1PR11MB4930.namprd11.prod.outlook.com ([fe80::50ce:c9a3:ab37:9fac]) by CO1PR11MB4930.namprd11.prod.outlook.com ([fe80::50ce:c9a3:ab37:9fac%9]) with mapi id 15.20.4500.019; Wed, 15 Sep 2021 13:21:02 +0000 From: "Ni, Ray" To: "Bassa, Damian" , "Wu, Hao A" , "devel@edk2.groups.io" Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Enumerator to check for RCiEP before looking for RP Thread-Topic: [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Enumerator to check for RCiEP before looking for RP Thread-Index: AdeY+paMpehWSOTWSAKEuG98y9jpqAFJPSagAABB0NAAEpzXsAGFIWvAAWn5jXAAAzNy4A== Date: Wed, 15 Sep 2021 13:21:01 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 1d58c219-738c-4a99-a0c7-08d9784baa21 x-ms-traffictypediagnostic: MWHPR11MB1662: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7219; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: h2nJkwREPSgpwHZpQJPrvgWka8O/blokveUSuO9NJBoEkqbV/+w2J7c7LgW5ni5L7uz0ReFfD1wBfPh6A2nIiOLWYa1I0DI9/Gbi6SACflqP8UQlgBv5ANmwqSAwKeQltHPAwhTp6HOJ+tdKPzO694Ea/w7f+ZL0B9mOaT14LgcVAIWREQTzCPxi6NJV3R4LdCo3I+rTrWScmUkB6PXNc/HMsTYzL5e4Y3N2c0+9vrnzn/QHgSi3KUaYybM1uzY2ba0XVO8rgE0tz+29y1Iv6VJBnZtbt6y5G79+i6pKR3MSWrftc3JT7qJK832rynaXJMevSZ2uhfSPLl5ZVCGaShXoxX4uQHuO5UIO9bvwODjMEdHodOcwuER7mrhiQUFon7XwNpTZS4nYq56Xbvm7DiHSDXFfBzuFCTDa+2gfPa/kzuYXAi5MObyDkWqEvZGP3XhR7jpHPDd9Ite9D5n84BzeX8NBLVjhCWUkkmP7qaFQfsbyp4XptqcFATrMBcApVSJq/SsJvG3zUCFaEUVFDW1o3xTw1D6g3O2KMaigZixGWunVMflIs/QTjV9GZP5gK3sKrwu1POLdIrnbQ1J64ytJVLHYWPUZ+nDbWg/OPvR2lqvuJjjfT+mV9+y13QdyePKRnBkga/ev0ecQAXnfIEkpYd96IWWMwtitvlyBloxANNP4fokgZzIWbJcyyiuTU0is/IjwPeuyzyeOK0vOZaI10QEK7ab3WPJfnQEfGT0S4qbbo/Y1sU5V3pXEp702hJzQPUAG1KkohvuXBMGPR5OyJXva4hoevSXj8eGlmUNKpFyWuSZMzZ6KlXVg3xgot33J+ToqbdmEQiX7rLa9Hw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CO1PR11MB4930.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(396003)(136003)(39860400002)(376002)(346002)(186003)(7696005)(38070700005)(55016002)(478600001)(9686003)(66574015)(6506007)(53546011)(166002)(110136005)(26005)(71200400001)(66476007)(66556008)(64756008)(66446008)(76236003)(83380400001)(8936002)(52536014)(86362001)(66946007)(76116006)(122000001)(38100700002)(8676002)(316002)(33656002)(5660300002)(2906002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-2?Q?jC2rODHhi8dEetmD5ZzSXHRQSGufYNDnG04qh0xWeQo7jlAWFkVpVEAnLg?= =?iso-8859-2?Q?DKLHwQIa/2lJXmgtoeU+ZPPrIpydDkkT09L9s6gXAXWKFIDBmbBKvkgAKx?= =?iso-8859-2?Q?Ngdt+hzsd5S416v/JhRekHBvEKSPSO8UQTxD7rwhmgALDOTwq0eTie3T3R?= =?iso-8859-2?Q?K8uygRAAJcWDmJ19JXMO/O7U0mHykZjtKf3zl/EuIE6KlZM2DWlDly06gw?= =?iso-8859-2?Q?e3AOoH7MlTxgF8ylcvk+fh+dGX5XL9yxbvs6F1N+SySmuDgcBg7X/aXYJM?= =?iso-8859-2?Q?3QWeoiM9LAVN2cCTUleYsgAaHtCmVGBaX8QePUsHblsX1ZicPFnIfgCmIC?= =?iso-8859-2?Q?znl5LxIcuPI6FFgWUwYEccVrYbSK7X2W6TaIuT2N5Lrd3CiQvQC6k91jpw?= =?iso-8859-2?Q?6UNDZi6vPgBSCMqKaKJhOG/To3LIRPNw2cOS21F4ySin0e+HWuU9od+MMK?= =?iso-8859-2?Q?gUiM6VMZGCeUzH+ivglv1pVrGjTFpziID8/T7KJNZUPH3jG3Gr5BMWBoId?= =?iso-8859-2?Q?18eD0GCwHIEmp8Y4fyR3R4tCxrdJhuVAR0ksgejJ4+E2Yj6HfIIMwtiqhB?= =?iso-8859-2?Q?baPZMGOa+e/XPaWdCiJNr/fxwDWBPgzCpZ7+OviK9/NjbNp+vSbjJiMd6s?= =?iso-8859-2?Q?rhIDm1ZN8rkwOlmWHgAsfaidKDB7WhW5BkDA+ElF2szfzVPz2OM9jlBdrS?= =?iso-8859-2?Q?ClznrGX5NgUQ9W5VsUSjjrrhfh16IN5IxhQsFvxmIbPy55eO2kCJIu+nYe?= =?iso-8859-2?Q?CChftN82FWmPhsq7KN1/q+XGiwxWg1c7maVSXUlhNSK9PlRgZ+QU9pd4i7?= =?iso-8859-2?Q?LKcNYi2ibeyKqPNKf3TFQEfLSn4D2QiHEo1MOyNNesxGAaFEHzcBZxMp3T?= =?iso-8859-2?Q?Jhx41pvnYCRH4Gqj7PlsgaS7/FT1MXD1LDlejeQlOXtFy/aeyV8cZKTo2i?= =?iso-8859-2?Q?f1xsaVzkSjTe/iO5RC7s7j+YlT0n6lvNbDgz1V0lGy9fgVyFSPsldE7esS?= =?iso-8859-2?Q?vVpKNcxiTd8X3/y+Lx+mMfOzHllkbFCY2idJ+O/kZQx/gKsW5LLo18VDX2?= =?iso-8859-2?Q?xtYkD+a6veJtwq+oMrH3Fm8pptpeTFyyKGE0j7rFpX8E5zqZ+3QuHSEZIY?= =?iso-8859-2?Q?OUEMwUxn+EmQBs01eIcmF3ZWcY/gCk8boHCfMf4S03osLh1sIhhUQPj3NR?= =?iso-8859-2?Q?NjwNzZiN+KjarohMKikDPOkAgeLmoB4N8YboTJSbcbkhMCRkPEOR+y1dox?= =?iso-8859-2?Q?rhKm+uz5Bxq2hZ9czd/gZ8aNCYnGK7J2ff/7Zjv7tGVeRX4EvMQI3R0Hlk?= =?iso-8859-2?Q?V9oK3/dA6lM17VpQbmkEWXfKwe6AqIIdXciM3YNgOUHUEhhKFS81wVHUqa?= =?iso-8859-2?Q?5u30CLcJSV?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO1PR11MB4930.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1d58c219-738c-4a99-a0c7-08d9784baa21 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Sep 2021 13:21:01.9875 (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: 2ZCxsL7c/BRykZwa+JzvReUgCl5Q/bqT3hk73CCiJVEeX6jUnsppSFTTMF5jVchqAADOUpGGx5n3v9HGX2j6YQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1662 Return-Path: ray.ni@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_CO1PR11MB4930A27248B4DF5480BA4C4E8CDB9CO1PR11MB4930namp_" --_000_CO1PR11MB4930A27248B4DF5480BA4C4E8CDB9CO1PR11MB4930namp_ Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable Extending PciBus to support such case is valid. But can you check if there is other pure software way to detect whether it'= s an ECiEP? From: Bassa, Damian Sent: Wednesday, September 15, 2021 7:54 PM To: Wu, Hao A ; devel@edk2.groups.io; Ni, Ray Subject: RE: [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Enumerator to che= ck for RCiEP before looking for RP Should we consider this workaround? I'm having issues interpreting this par= t of PCIe spec. My understanding of this quote is that this capability can exist in but it = shouldn't be considered. I would assume it's possible option that it needs to be considered? Is that= wrong? Damian From: Wu, Hao A > Sent: Wednesday, September 8, 2021 9:17 AM To: Bassa, Damian >; = devel@edk2.groups.io; Ni, Ray > Subject: RE: [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Enumerator to che= ck for RCiEP before looking for RP Really sorry for the late response. So this is a workaround for RCiEP device that is not compliant to the PCIe = spec: |> ARI is an optional capability. This capability must be implemented by e= ach |> Function in an ARI Device. It is not applicable to a Root Port, a Switc= h |> Downstream Port, an RCiEP, or a Root Complex Event Collector. If this the case, could you help to: * Add a comment that briefly describe this workaround before the newly adde= d code * Also mention this workaround information in the commit log message. * Send out a V2 version of the patch? Thanks in advance. Hello Ray, please help to raise if you have concern on this. Best Regards, Hao Wu From: Bassa, Damian > Sent: Wednesday, September 1, 2021 1:45 AM To: Wu, Hao A >; devel@edk2.g= roups.io; Ni, Ray > Subject: RE: [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Enumerator to che= ck for RCiEP before looking for RP It refers to access to the root port device that doesn't exist in case we a= re dealing with RCiEP device. There can be specific case where RCiEP device has ARI extended capability I= D (even though it's unsupported in this case). In such a case PciSearchDevice goes to CreatePciIoDevice through GatherDevi= ceInfo. And in this case parent is PCI_IO_DEVICE instance created from Crea= teRootBridge function, which isn't valid PCIe device and doesn't have speci= fic bus, only a range of buses. In that case enumerator tries to use this i= nstance to read operation using default 0 bus number, which isn't correct. Damian From: Wu, Hao A > Sent: Tuesday, August 31, 2021 6:28 AM To: devel@edk2.groups.io; Wu, Hao A >; Bassa, Damian >; Ni, Ray > Subject: RE: [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Enumerator to che= ck for RCiEP before looking for RP From: devel@edk2.groups.io > On Behalf Of Wu, Hao A Sent: Tuesday, August 31, 2021 12:25 PM To: devel@edk2.groups.io; Bassa, Damian > Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Enumerator to che= ck for RCiEP before looking for RP Really sorry, Could you help to provide more information on the below statement? "undefined parent register accesses" Thanks in advance. Best Regards, Hao Wu From: devel@edk2.groups.io > On Behalf Of Bassa, Damian Sent: Tuesday, August 24, 2021 11:15 PM To: devel@edk2.groups.io Subject: [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Enumerator to check f= or RCiEP before looking for RP Before trying to access parent root port to check ARI capabilities, enumerator should see if Endpoint device is not Root Complex integrated to avoid undefined parent register accesses in these cases. Signed-off-by: Damian Bassa damian.bassa@intel.com --- .../Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c b/MdeMod= ulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c index db1b35f8ef..6451fb8af9 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c @@ -2153,6 +2153,7 @@ CreatePciIoDevice ( PCI_IO_DEVICE *PciIoDevice; EFI_PCI_IO_PROTOCOL *PciIo; EFI_STATUS Status; + PCI_REG_PCIE_CAPABILITY Capability; PciIoDevice =3D AllocateZeroPool (sizeof (PCI_IO_DEVICE)); if (PciIoDevice =3D=3D NULL) { @@ -2229,7 +2230,16 @@ CreatePciIoDevice ( return NULL; } - if (PcdGetBool (PcdAriSupport)) { + PciIo->Pci.Read ( + PciIo, + EfiPciIoWidthUint16, + PciIoDevice->PciExpressCapabilityOffset + OFFSET_OF (PCI_C= APABILITY_PCIEXP, Capability), + 1, + &Capability.Uint16 + ); + + if (PcdGetBool (PcdAriSupport) && + Capability.Bits.DevicePortType !=3D PCIE_DEVICE_PORT_TYPE_ROOT_COMPLEX= _INTEGRATED_ENDPOINT) { // // Check if the device is an ARI device. // -- 2.27.0.windows.1 ________________________________ Intel Technology Poland sp. z o.o. ul. S=B3owackiego 173 | 80-298 Gda=F1sk | S=B1d Rejonowy Gda=F1sk P=F3=B3no= c | VII Wydzia=B3 Gospodarczy Krajowego Rejestru S=B1dowego - KRS 101882 | = NIP 957-07-52-316 | Kapita=B3 zak=B3adowy 200.000 PLN. Ta wiadomo=B6=E6 wraz z za=B3=B1cznikami jest przeznaczona dla okre=B6loneg= o adresata i mo=BFe zawiera=E6 informacje poufne. W razie przypadkowego otr= zymania tej wiadomo=B6ci, prosimy o powiadomienie nadawcy oraz trwa=B3e jej= usuni=EAcie; jakiekolwiek przegl=B1danie lub rozpowszechnianie jest zabron= ione. This e-mail and any attachments may contain confidential material for the s= ole use of the intended recipient(s). If you are not the intended recipient= , please contact the sender and delete all copies; any review or distributi= on by others is strictly prohibited. --_000_CO1PR11MB4930A27248B4DF5480BA4C4E8CDB9CO1PR11MB4930namp_ Content-Type: text/html; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable

Extending PciBus to support such case is valid.=

 

But can you check if there is other pure software wa= y to detect whether it’s an ECiEP?

 

From: Bassa, Damian <damian.bassa@intel.co= m>
Sent: Wednesday, September 15, 2021 7:54 PM
To: Wu, Hao A <hao.a.wu@intel.com>; devel@edk2.groups.io; Ni, = Ray <ray.ni@intel.com>
Subject: RE: [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Enumerator= to check for RCiEP before looking for RP

 

Should we consider this workaround? I’m having= issues interpreting this part of PCIe spec.

My understanding of this quote is that this capabili= ty can exist in but it shouldn’t be considered.

I would assume it’s possible option that it ne= eds to be considered? Is that wrong?

 

Damian

 

 

From: Wu, Hao A <hao.a.wu@intel.com>
Sent: Wednesday, September 8, 2021 9:17 AM
To: Bassa, Damian <dami= an.bassa@intel.com>; devel@edk2.groups.io; Ni, Ray &= lt;ray.ni@intel.com>
Subject: RE: [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Enumerator= to check for RCiEP before looking for RP

 

Really sorry for the late response.

 

So this is a workaround for RCiEP device that is not= compliant to the PCIe spec:

|>  ARI is an optional capability. This capa= bility must be implemented by each

|>  Function in an ARI Device. It is not app= licable to a Root Port, a Switch

|>  Downstream Port, an RCiEP, or a Root Com= plex Event Collector.

 

If this the case, could you help to:

* Add a comment that briefly describe this workaroun= d before the newly added code

* Also mention this workaround information in the co= mmit log message.

* Send out a V2 version of the patch?

Thanks in advance.

 

Hello Ray, please help to raise if you have concern = on this.

 

Best Regards,

Hao Wu

 

From: Bassa, Damian <damian.bassa@intel.com>
Sent: Wednesday, September 1, 2021 1:45 AM
To: Wu, Hao A <hao.a.wu@int= el.com>; devel@edk2.groups.io; Ni, Ray &= lt;ray.ni@intel.com>
Subject: RE: [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Enumerator= to check for RCiEP before looking for RP

 

It refers to access to the root port device that doe= sn’t exist in case we are dealing with RCiEP device.

There can be specific case where RCiEP device has AR= I extended capability ID (even though it’s unsupported in this case).

In such a case PciSearchDevice goes to CreatePciIoDe= vice through GatherDeviceInfo. And in this case parent is PCI_IO_DEVICE ins= tance created from CreateRootBridge function, which isn’t valid PCIe = device and doesn’t have specific bus, only a range of buses. In that case enumerator tries to use this instance to re= ad operation using default 0 bus number, which isn’t correct.

 

Damian

 

From: Wu, Hao A <hao.a.wu@intel.com>
Sent: Tuesday, August 31, 2021 6:28 AM
To: devel@edk2.groups.io= ; Wu, Hao A <hao.a.wu@intel.com>; Bassa, Damian <damian.b= assa@intel.com>; Ni, Ray <ray= .ni@intel.com>
Subject: RE: [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Enumerator= to check for RCiEP before looking for RP

 

From: devel@edk2.groups.io <devel= @edk2.groups.io> On Behalf Of Wu, Hao A
Sent: Tuesday, August 31, 2021 12:25 PM
To: devel@edk2.groups.io= ; Bassa, Damian <damian.bassa@= intel.com>
Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Enumerator= to check for RCiEP before looking for RP

 

Really sorry,

 

Could you help to provide more information on the be= low statement?

“undefined parent register accesses”

 

Thanks in advance.

 

Best Regards,

Hao Wu

 

From: devel@edk2.groups.io <devel= @edk2.groups.io> On Behalf Of Bassa, Damian
Sent: Tuesday, August 24, 2021 11:15 PM
To: devel@edk2.groups.io=
Subject: [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Enumerator to = check for RCiEP before looking for RP

 

Before trying to access parent root port to check AR= I capabilities,

enumerator should see if Endpoint device is not Root= Complex integrated

to avoid undefined parent register accesses in these= cases.

 

Signed-off-by: Damian Bassa damian.bassa@intel.com

 

---

.../Bus/Pci/PciBusDxe/PciEnumeratorSupport.c &n= bsp;       | 12 +++++++++++-

1 file changed, 11 insertions(+), 1 deletion(-)=

 

diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnume= ratorSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c=

index db1b35f8ef..6451fb8af9 100644

--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSu= pport.c

+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSu= pport.c

@@ -2153,6 +2153,7 @@ CreatePciIoDevice (=

   PCI_IO_DEVICE    &n= bsp;   *PciIoDevice;

   EFI_PCI_IO_PROTOCOL  *PciIo;<= /o:p>

   EFI_STATUS     &nbs= p;     Status;

+  PCI_REG_PCIE_CAPABILITY Capability;

 

   PciIoDevice =3D AllocateZeroPool (= sizeof (PCI_IO_DEVICE));

   if (PciIoDevice =3D=3D NULL) {

@@ -2229,7 +2230,16 @@ CreatePciIoDevice (

     return NULL;

   }

 

-  if (PcdGetBool (PcdAriSupport)) {=

+  PciIo->Pci.Read (

+        &nb= sp;       PciIo,

+        &nb= sp;       EfiPciIoWidthUint16,

+        &nb= sp;       PciIoDevice->PciExpressCapabilit= yOffset + OFFSET_OF (PCI_CAPABILITY_PCIEXP, Capability),

+        &nb= sp;       1,

+        &nb= sp;       &Capability.Uint16

+        &nb= sp;       );

+

+  if (PcdGetBool (PcdAriSupport) &&

+    Capability.Bits.DevicePortType != =3D PCIE_DEVICE_PORT_TYPE_ROOT_COMPLEX_INTEGRATED_ENDPOINT) {

     //

     // Check if the device is a= n ARI device.

     //

--

2.27.0.windows.1

 


Intel Technol= ogy Poland sp. z o.o.
ul. S=B3owackiego 173 | 80-298 Gd= a=F1sk | S=B1d Rejonowy Gda=F1sk P=F3=B3noc | VII Wydzia=B3 Gospodarczy Kra= jowego Rejestru S=B1dowego - KRS 101882 | NIP 957-07-52-316 | Kapita=B3 zak=B3adowy 200.000 PLN.

Ta wiadomo=B6= =E6 wraz z za=B3=B1cznikami jest przeznaczona dla okre=B6lonego adresata i = mo=BFe zawiera=E6 informacje poufne. W razie przypadkowego otrzymania tej wiadomo=B6ci, prosimy o powiadomienie nadawcy oraz trwa=B3e jej usuni= =EAcie; jakiekolwiek przegl=B1danie lub rozpowszechnianie jest zabronione.<= br> This e-mail and any at= tachments may contain confidential material for the sole use of the intende= d recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or = distribution by others is strictly prohibited.

 

--_000_CO1PR11MB4930A27248B4DF5480BA4C4E8CDB9CO1PR11MB4930namp_--