From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web12.183.1631808310809956110 for ; Thu, 16 Sep 2021 09:05:12 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=k4YfcXpQ; spf=pass (domain: intel.com, ip: 134.134.136.20, mailfrom: damian.bassa@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10109"; a="209828909" X-IronPort-AV: E=Sophos;i="5.85,298,1624345200"; d="scan'208,217";a="209828909" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Sep 2021 09:02:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,298,1624345200"; d="scan'208,217";a="482760760" Received: from fmsmsx606.amr.corp.intel.com ([10.18.126.86]) by orsmga008.jf.intel.com with ESMTP; 16 Sep 2021 09:02:10 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Thu, 16 Sep 2021 09:02:07 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) 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; Thu, 16 Sep 2021 09:02:07 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.107) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Thu, 16 Sep 2021 09:02:07 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NAVZfPzwsTMoTz/HPu66q4VzvtxoaIPjQJte/DsoddMNkUdV01/hHx5hvnXo1sN8fAkCkaWhBvbGUGvDFx1KFc/1NVdHd/ZfZm1QUxURb7UkcPWybTh+1D6FZuqWVBm5ikWfXG5ztRuYHVpvl2mwz1FcWfq92+MvwrZAR5REZauUDzF8m9CGUad5EK0Pr/WV3Myx/slP/t6zB/GSTq3nb8BdMEOpqfkxdmnz1dlst1JtjgcA3REu+PboHqF1+hpLMx9FhGgfWoC43pSRbeQ2Ai0pGcXjdQMoOkF98rTUHvZM3G8xVOl5pgvdL1wOLLlTpUVgqIoPmTD/TSubJCVt1Q== 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=UeMbSKF02+0ApZ0IEPw3fENy9eAavNKKqkX4AHraIng=; b=fZugBD0WzMgF1qiivx98ARTxkZIoPZfmz4BhSjG2AFZymLRCOsrWE5+Qd/JYkM9ZWjw/5QpbBJtcK+OhZqd7mNAiohcMx3lYbBqgL/g4IZSR16cT42ZkPwRhD28kptKEGNMMe+cnGTkfWQ953Y41GhylgU9eBC5zcnP/Rph+GAkGcABrUUiC4M2VzPQdlEJolNdhZsbpOdhPCZ267mLRZPc63qd4K6KONIHWn0I/OKxVqWXpqiaPYU0jYjikJHMmIWsg/bkl7dUk/br6xTIzyTYY7A6cJaHzjXlgNi/YP9EZOfxnHs6RdNlrH8X/ixTHP7Qg6EjuX/K8hYnxlyg/+Q== 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=UeMbSKF02+0ApZ0IEPw3fENy9eAavNKKqkX4AHraIng=; b=k4YfcXpQL7+BsLVlx9yCFtmyU7ufyrUxoFyBM8YdyUMzeFWKt7Eb4JCilO4zNtRnbTGkivcjIDn+4Lpze0UFXbR3OjB6MFKeXnO2pyhA6EUjuJDqpc6nGEUhfq/mPiL5eiXkYaJJM/nBoM0n3EUzWsOGbDKPDgaN4cNRMgrWbcg= Received: from CO1PR11MB5187.namprd11.prod.outlook.com (2603:10b6:303:95::15) by MW3PR11MB4667.namprd11.prod.outlook.com (2603:10b6:303:53::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14; Thu, 16 Sep 2021 16:02:05 +0000 Received: from CO1PR11MB5187.namprd11.prod.outlook.com ([fe80::60d4:c5c8:b43c:f940]) by CO1PR11MB5187.namprd11.prod.outlook.com ([fe80::60d4:c5c8:b43c:f940%6]) with mapi id 15.20.4523.014; Thu, 16 Sep 2021 16:02:05 +0000 From: "Bassa, Damian" To: "Ni, Ray" , "Wu, Hao A" , "devel@edk2.groups.io" CC: "Kolakowski, Jacek" 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+paMpehWSOTWSAKEuG98y9jpqAFJPSagAABB0NAAEpzXsAGFIWvAAWn5jXAAAzNy4AA3hnLA Date: Thu, 16 Sep 2021 16:02:04 +0000 Message-ID: References: In-Reply-To: Accept-Language: pl-PL, 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: 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: a8195ed2-093e-471c-dc4d-08d9792b543f x-ms-traffictypediagnostic: MW3PR11MB4667: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: KjfnPOjnWg+cvOwURgCMgQvuTpHyVab27mTceGXKbQ7FlBTnQ8a5JQX4b/+92LsVJk0kpnhE8UFyH6Enf0Tyt7a1SOitj7OLDpiAlEgsB430FoadirQ04TBusypmsNTWKraBCXMCncaBMLpzuUdgBW6C51ozzngNJgaKup+60r1RWSLtPP/GvYZHUB8M0PLVwOEdKTIvypdj6ik7QXv/bE3iaTC6+nY+VOBNz8CruQQy5eVAn6oRTof5GK8tlm7whA0Fj28q1zJJuHWcfv4kX5Vx0U8TkLzU3Wx8S39oNNbmdLJlfEOIMq38aojhMmS+ez10hzzaDvs9Mt6lEebEGygh2GVqjmOWcN6nAxkTOtFzQdcQ6z+dw3/oyjTHqfeemfF+rKkmpCIwhE7xL23/qhXH7z0Zr0LvZuCZBLHO60N6X0omgVm/UZcxMFC3oiPqEyyGUdjw0nJgP5Yu+pM4Iqy5p4o2EDFN2gZAvo5LRoSOrgGQegtHBQOVudC+Z/VU40HEdRevXVSJhQuXvfTgZBRQEG8pNzo2rp4CMI4tS3HQy49DNPjAtd0mVG6HFeNPxAxy0zkA36dXK8ss+YVFhHu8wMF2lsVvoHCP+oD6aaV4/Uca0GXxw83kSdl+RWT96N7K6RyqiM4FbfhyjSnSFfQwGNWu1eLzLlADTgG5KHyrDqHMHDjFI1u7sQTV8kvjUPa3otd8vRZfP1r5i4LGkhEhowZkD4ozaYd5PYGkBnTOy8uwoWm6PvrwtsOP7x9KmIigeOHOQeIBIMoEqg0bu8sd+NFg5FG/LPj1Ido0DOmsqIKaXsIFqbOkQrNGen0XhFKazYbR9sY4KO9rRD5d6g== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CO1PR11MB5187.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(346002)(396003)(39860400002)(366004)(376002)(136003)(316002)(8936002)(66946007)(66556008)(9686003)(55016002)(7696005)(64756008)(38070700005)(478600001)(76116006)(110136005)(86362001)(33656002)(2906002)(71200400001)(107886003)(8676002)(166002)(186003)(66476007)(122000001)(26005)(6506007)(53546011)(83380400001)(5660300002)(4326008)(52536014)(66574015)(38100700002)(66446008)(76236003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-2?Q?9wxv7XVJAjJ9p2wIDm3G+E+PAELapI24pvNEVSjZZ3PEW+wMh72xx3c1ig?= =?iso-8859-2?Q?ehIXO+gQYf/r4PHsMxeSQVOVxDyaU+wZIO5n9PSwnKy+Itg35UbpKW2+th?= =?iso-8859-2?Q?rFd/7+kXCR9KjoyHn2D+JbdC0zuSIz/cI9me8n+s0Bqx/Q+7ruX44unPbv?= =?iso-8859-2?Q?RgnHL6uR6eR1vz1AMiFYRaz2IXlyDgdNTl/ofFzzTs4rKu7n92kujvwR4+?= =?iso-8859-2?Q?VRFh7UFJ1m3EdEtcaEZZGR6h+VKBpkslsuAXUnm9zF+NtHZPUADBXTYSQF?= =?iso-8859-2?Q?+Xc6Ks8oGaRBhfvsnuWNq8ejg9IcsLjaon9gCl/2sMaiAPpWDHASkaUvJB?= =?iso-8859-2?Q?KeDqnuubkL12hVhNO7zoQZfb20UtGzKYbpeZ14fZSTURmzizIS+z6c5+N5?= =?iso-8859-2?Q?l2hKr4hmE0LmOVbJ0NyNpmVICtPUBEmBXv8xGTrTxEP98nsOaYaqbsuXvw?= =?iso-8859-2?Q?6jNtnzJMst+Tp9RcDApwN6A0EcHG3KcNYfSNbLfawlWGuockA440L3dEda?= =?iso-8859-2?Q?c1yQlhW5qRlS4o4egfjabb2pX73W7BYozM/y+Re8BHS7D5qnhuN89B68vX?= =?iso-8859-2?Q?ERx1vCkXgVqo4GnfR+UbmKgyRNhjc3IaP8MhwYWPDZEAvcUF+j2z+zNhnb?= =?iso-8859-2?Q?aSTf7XBHe9H8OW4jKso7L+i6Gzahw1K+1gpXNB882SxZBjUTfJn3zwQpVw?= =?iso-8859-2?Q?sUTORxQ6rpNlvKQ4gUaeocra7b8F84pbdQNtvvf6mRQtEwlbA1MW8XFivM?= =?iso-8859-2?Q?ArdzocuTWNlD+C7EdhUQZ/O4cADDuWhIAgid2sxQ7cHQu3QE4Xsc2IZpBJ?= =?iso-8859-2?Q?tYi2Pz/U5OAohIABWAkqe2v3IEGL3bssNgezKTDXaNqH1gdjaXj2tEAx4Z?= =?iso-8859-2?Q?ZWCVocmL+noHK/PNXGRmtrhKjEQzS9qpejH2dieBJkgK86VnrWU1xU2zXQ?= =?iso-8859-2?Q?UVnefQA7lxAH/uh6s4M4vJYo8lGQiBda7iCR6MvflBEhYIRafGIlELNsAV?= =?iso-8859-2?Q?brHGS3eG8eiogcbaJJrYK33V789nrSUNSOYolHUUOfEHigwtzNfNF4hpZO?= =?iso-8859-2?Q?CEXgEjsae5TTOKUhIEYOLTDbT7x1c42NhwrBQIsAQmPypmdH69kcBjVUap?= =?iso-8859-2?Q?jraWmU6BS6BgOlwErlaqv6dQAckGF8+JradkHLjxe0jTHgaDLihdeSh/ls?= =?iso-8859-2?Q?I1bqCqGt2E0ivh41XwnXB6oMPAf+Ii/cgN7B0qQ+u3aET09DW8vTrcMpew?= =?iso-8859-2?Q?KRTwSukyTSHIMWdYWMwVsVjnOhY9jEsQOjK8S9GLNZFlUNB5tIVkJVrbHk?= =?iso-8859-2?Q?ejk1NZYxaHjtiLmmzB+otg+lrnX5YjC4cM1EHyLgiKPKhkZWC4TxLweGqa?= =?iso-8859-2?Q?hFoE4hTf5q?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO1PR11MB5187.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a8195ed2-093e-471c-dc4d-08d9792b543f X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Sep 2021 16:02:04.9888 (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: eLjw+Ob+P60ILqSKK2CLxlCk+PEtgwXPOWwXwMvk6+Jwjym937XtzTir3hUFROr8JnJjAypoYTaXuALDPmjZfg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR11MB4667 Return-Path: damian.bassa@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_CO1PR11MB518795679DEAA72642EFF18A8DDC9CO1PR11MB5187namp_" --_000_CO1PR11MB518795679DEAA72642EFF18A8DDC9CO1PR11MB5187namp_ Content-Type: text/plain; charset="iso-8859-2" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable I was looking for anything that wouldn't include reading register but only = thing that distinguish device PCI_IO_DEVICE instances with root bridge inst= ances is population of BusNumberRanges structure. This technically could be used since this is populated only for root bridge= s and not devices but using this would be just confusing since there is no = self-explanatory field there. For my knowledge this is best way to tackle this issue. Please let me know = if there are have some other worth exploring ideas. Damian From: Ni, Ray Sent: Wednesday, September 15, 2021 3:21 PM To: Bassa, Damian ; Wu, Hao A ;= devel@edk2.groups.io Subject: RE: [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Enumerator to che= ck for RCiEP before looking for RP 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.g= roups.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. --------------------------------------------------------------------- Intel Technology Poland sp. z o.o. ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydz= ial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-31= 6 | Kapital zakladowy 200.000 PLN. Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata= i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wi= adomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiek= olwiek przegladanie lub rozpowszechnianie jest zabronione. 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_CO1PR11MB518795679DEAA72642EFF18A8DDC9CO1PR11MB5187namp_ Content-Type: text/html; charset="iso-8859-2" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable

I was looking for anything that wouldn’t inclu= de reading register but only thing that distinguish device PCI_IO_DEVICE in= stances with root bridge instances is population of BusNumberRanges structu= re.

This technically could be used since this is populat= ed only for root bridges and not devices but using this would be just confu= sing since there is no self-explanatory field there.

For my knowledge this is best way to tackle this iss= ue. Please let me know if there are have some other worth exploring ideas.<= o:p>

 

Damian

 

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

 

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.com>
Sent: Wednesday, September 15, 2021 7:54 PM
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

 

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.

 


Intel = Technology Poland sp. z o.o.
ul. Słowackiego 173 | 80-298 Gdańsk | Sąd Rejonowy G= dańsk Północ | VII Wydział Gospodarczy Krajowego Rejest= ru Sądowego - KRS 101882 | NIP 957-07-52-316 | Kapitał zakła= dowy 200.000 PLN.

Ta wiadomość wraz z załącznikami jest przeznacz= ona dla określonego adresata i może zawierać informacje pouf= ne. W razie przypadkowego otrzymania tej wiadomości, prosimy o powiado= mienie nadawcy oraz trwałe jej usunięcie; jakiekolwiek przegl= 1;danie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material f= or the sole use of the intended recipient(s). If you are not the intended r= ecipient, please contact the sender and delete all copies; any review or di= stribution by others is strictly prohibited.

--_000_CO1PR11MB518795679DEAA72642EFF18A8DDC9CO1PR11MB5187namp_--