From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web11.817.1631896296870045618 for ; Fri, 17 Sep 2021 09:31:37 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=xKofrnra; spf=pass (domain: intel.com, ip: 192.55.52.115, mailfrom: ray.ni@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10110"; a="222489515" X-IronPort-AV: E=Sophos;i="5.85,301,1624345200"; d="scan'208,217";a="222489515" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Sep 2021 09:31:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,301,1624345200"; d="scan'208,217";a="546484524" Received: from orsmsx605.amr.corp.intel.com ([10.22.229.18]) by FMSMGA003.fm.intel.com with ESMTP; 17 Sep 2021 09:31:17 -0700 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX605.amr.corp.intel.com (10.22.229.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Fri, 17 Sep 2021 09:31:16 -0700 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Fri, 17 Sep 2021 09:31:16 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Fri, 17 Sep 2021 09:31:16 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.107) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Fri, 17 Sep 2021 09:31:10 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DJ1MPBhG6OkfXIf/NIxoRNMry4I+RzWKC/Jt2gYx77/7wHkCIG1E/jPchQFE1VR4MaP60P72e1CymDovy2HCjm59Ek5Bi1tIN4GRDvN8c9LkF8n7KmbULGBxJV9cBWrda1WRLKg0p4CNIllk/thk6yETCPr3SCS3IY1bgkRTyUlhgBiC4Y/5AVQLJjEqp4zItJdA1YcQ9nZnaGK21MGZh9tCJVTLnrRgzHDvk9CswPxqZJWnvnXZAei042qII9ILO7Sj+SACCzRBTup9qQOS1c5HcgThGIc6QI9X78bHBLprV2ygkOMT9HEpaFSwWytidqpyvgvby99Z8zHdcGsdGQ== 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=qqrTVRsQ6E1t444AbwCbJ94W4ndDnAmUT0ioBovjljA=; b=Qw+kKHBqjQ1lVvPcyNllwyWFEQ06Bo4Ncei6VEHrqRcXssLe3AZFetlVV+L2Z1zVeCOt23UfTrvKKeEc+DkzjIS1+EI7lh8Le4TUHsUIG7pvkVG4vcDVXgInNGDchffO3d7VXGuWWD/kltzq8UIyXMIFREZoNnArixmAAgMHEZYU4aY+DD5vkJNR+7USk7qNUq1tdJBc3iEA+JrplqXZvxbhmbAaXbVp6l6zesMp0oBpimS9iJUOoBPSbAeUPJ5Ui1Moo17a1fP6p8Y3ZNYMmzaqEQc+yP8MML7Br04EiDcDJiIo8sSD/hXiOlJc0G/X+fN0o0o2DsA3KZ9xX4kFzA== 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=qqrTVRsQ6E1t444AbwCbJ94W4ndDnAmUT0ioBovjljA=; b=xKofrnrajzV0JTxI/BlWRSPqp74nfSPhNBLgZ6yHmhkA+5jtD7nNbKFMACtWYIq6ds0cUhtPujal4xIpy6X1OnxovDJFYoCzL4vr1QSg5hwTJIGKXM0XP8uSEVoBITuRDP4CQ/31hdJz6YNs1JOaBzSMc6bigwgJvQrCKA/AZqI= Received: from CO1PR11MB4930.namprd11.prod.outlook.com (2603:10b6:303:9b::11) by MWHPR1101MB2302.namprd11.prod.outlook.com (2603:10b6:301:5a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.16; Fri, 17 Sep 2021 16:31:09 +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; Fri, 17 Sep 2021 16:31:09 +0000 From: "Ni, Ray" To: "Bassa, Damian" , "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+paMpehWSOTWSAKEuG98y9jpqAFJPSagAABB0NAAEpzXsAGFIWvAAWn5jXAAAzNy4AA3hnLAADOmjyA= Date: Fri, 17 Sep 2021 16:31:09 +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: fac22db5-0140-4dec-96b5-08d979f88e10 x-ms-traffictypediagnostic: MWHPR1101MB2302: 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: uz5w9BIwrJ/BLoXVSVzvW7cBvGIDXy9KimvO2oc3Jk+aB3JkRCLv26ppx6qGTJM0FNFC/riCUfkj7OTBP93SQTqo0FkOxvgg256U7AgsnrAmFJ6KT+hneXZiAAWNgCJS9Yhzu7cUJd01EY+DTJkXNsjEVX//ENvdBO/PHltWH8YGeCqPk5wgfXv+7856fMw2SNePiRm/4C631U7FeU9peYjciXNaLBZUbFPBb451FynsqOHxC+mrrQkeyft1CZBBhDMB0U4W5rNVj1bsnSgrH7f2puoe1wbKLw5uIZqBKxlhEiwN61TYUic7hQyWKTL8lFTChM3Drmbz13FBAn50uzLYQxDcZi0crm8efSYzO6r9rKnq0McVIrHn1fCIma8Vtb10xXkltEvyx146UH8Dg4DKbUDmagyVYm7G6YM8KBsxoXF/G46ilJX6/KBlyQb3f7pFHXnmgseovFnaEfjtBtWyP8KCzpApKZwtDS90kgPf/d8i+GmtuSY8jAGVQgiKgspHNUH4HG6DYI9yXPQ6GhyExb7P0BuE9PpHNlu+gU0C8+TwAuPg5x0SjR2mYkhCA4NReN2PHSD9lOeJL4c1kVKvu4cC3woDWkGbm2qvnwLG6GjlMEiMI4k7Yv+mSPD9P+ZVk9P3MDmv+zt+cP6mnSl+qLN1I0qDpnEixtrDKqZ+cNZGBTqueAs0muBw35f5EXVm2Z2KicTndWwvZb49I1GcPXkvpAOHc1YQvp+T9olbOZSqtdGy2jZ73i3z+j43c1K3s/HApa+4aDjU4C6jKKQn+pY/UnpiGyeWDSBdv0zoNQ8w7U2lgbAnh5DZvhG4dIiMOOCTuc5JSO99IOtaBw== 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)(2906002)(8936002)(8676002)(76236003)(6506007)(66476007)(26005)(107886003)(53546011)(55016002)(66574015)(66556008)(9686003)(186003)(71200400001)(66446008)(5660300002)(4326008)(316002)(64756008)(508600001)(83380400001)(166002)(52536014)(110136005)(38070700005)(38100700002)(86362001)(122000001)(66946007)(33656002)(76116006)(7696005);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-2?Q?8Tai43rxjVt8Luf0rqhRZlcVB/gPidIewCgQP4P+QxZON2KEKnbdywlFts?= =?iso-8859-2?Q?A/c7VOMT1PjQ8wo4FJs0H1556rSmDP2YBv0kVespCAhHmL1ZGUdoEK1G+b?= =?iso-8859-2?Q?sZ/V6VFOtOISL372q19NP7v/7euaNS7wuOj8hpxtEoItKxV3e2sx2NRaym?= =?iso-8859-2?Q?EDTVwf7zf6H7uaSueRUtQ4rNrjMvvAHOu6BURcuAa2XOEDDFyBxUlrfsHd?= =?iso-8859-2?Q?ueMbcQTFtO4cL8GitVzp0ZZETcalrt9roS4pukgumKvzmgQrYFaMtU9qG+?= =?iso-8859-2?Q?mOEEj7nLGBTWCAZEQL//7ULkt7wqT6t4wGm21lV0REUiiHlMJ84CG8DsH7?= =?iso-8859-2?Q?c0T5CwrNk4X+wDDz14yR/Tp9lvLfXFFs4MjuecnafkPYvHW6ZaGApzN8bG?= =?iso-8859-2?Q?3QaFxomKZczVbR+yCR0sZ6tezSnFhGPnSgjlhpmPBh8uXVG2AZxWsRBgpG?= =?iso-8859-2?Q?4bV+NWaLDcH2TQRCR8c2ZBq8Tq9UoPjpujVKj7JaEM3L4lo81dxdc/P0UX?= =?iso-8859-2?Q?OqaGO4jCN7oIbyhDrqNWBsW4tQplbBv1IywI56i11az4jMx3iiHgxoK65k?= =?iso-8859-2?Q?WyucyD2wk+o+mEHhRTDHZze8hjII9zgNyO79NADfwEaViaIOK2A59g20WM?= =?iso-8859-2?Q?l0DQJM6689lf5Zd05K+xfoQdI2txxbwhPZn8CrjVMlUzHWe03wE4DdJnAu?= =?iso-8859-2?Q?aqFiPEsT2TTy2ooiFiVO+MnQ1Gy89Y3tkZ2LrpWJTkUI6qWRryudV4E10T?= =?iso-8859-2?Q?Oc8nx+PSF8NWvOVuqyPbkY7snEa+k7aS2L4oAD0nV3MXboJlK/9MZv4Pth?= =?iso-8859-2?Q?PHgtCSPuzJ4jKoVlaSgpm01HGa9q8wl+2HqWWdq0bpcbtXjEB1E1YVlLi7?= =?iso-8859-2?Q?6UzYsu3xvNEH3lYiDX5pR7yNr92ofju+/Kl1kD5Rir9aOEwaz7EVv1th44?= =?iso-8859-2?Q?IJFXeMBLkwAEH+veSxt5parn3dfqPiWqDyY5R9Gv0Yyv22WoJPq9ouo0VY?= =?iso-8859-2?Q?3fpaeiOeYbgLJs2GWuvIUT++zwXu3v3c2ogQPvqLc3vi0AYZuhX8/J7N2W?= =?iso-8859-2?Q?i3paA0D7lZDnA1JhEPBPVi4KETR5z2pZNXEW8y3ebmBMdO8ajuRrqJb5ot?= =?iso-8859-2?Q?jzN1iHYPGkttd39JEDoS5631aXMkyt+Yzx1FdlouJywKFUDdOywKiOq8dN?= =?iso-8859-2?Q?6c5NvcQeLoy2B0kS/x3yVdP6FQhdBL7stG43/mqZFoBfKmUYNz42MrfRYS?= =?iso-8859-2?Q?QwCJPApoKNHqAD345mV6531m/6CAyFxMj/ETleIGz/P0H0BWfbQl86+8c9?= =?iso-8859-2?Q?ZdkFTmVmnE1t8mqGKHJDMewISPv5RI9UTtvvcl57LrJJ35r1mmV0hWWbyn?= =?iso-8859-2?Q?Mvprq+YC94?= 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: fac22db5-0140-4dec-96b5-08d979f88e10 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Sep 2021 16:31:09.1061 (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: XAQc+p2eyF97z06ZfAWeX4hfCeEFrNsBqbUbGsZwyEbJVwzQYWQgXJpXvfAI6CnKYHwWYf5bU6pNS/03Zlu/oQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1101MB2302 Return-Path: ray.ni@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_CO1PR11MB4930F4D2FC8AEC6BAED161C38CDD9CO1PR11MB4930namp_" --_000_CO1PR11MB4930F4D2FC8AEC6BAED161C38CDD9CO1PR11MB4930namp_ Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable If a device is a RCiEP, PciIoDev->Parent points to a virtual PCI_IO_DEVICE = for the RootComplex. The PCI_IO_EVICE.Parent equals to NULL for RootComplex. Which means, we can create a helper function BOOLEAN IsRootBridge(PciIo) { return (BOOLEAN) (PciIo->Parent =3D=3D NULL);= } your code can call this helper function. From: Bassa, Damian Sent: Friday, September 17, 2021 12:02 AM To: Ni, Ray ; Wu, Hao A ; devel@edk2.= groups.io Cc: Kolakowski, Jacek Subject: RE: [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Enumerator to che= ck for RCiEP before looking for RP 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.group= s.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. --_000_CO1PR11MB4930F4D2FC8AEC6BAED161C38CDD9CO1PR11MB4930namp_ Content-Type: text/html; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable

If a device is a RCiEP, PciIoDev->Parent points t= o a virtual PCI_IO_DEVICE for the RootComplex.

The PCI_IO_EVICE.Parent equals to NULL for RootCompl= ex.

 

Which means, we can create a helper function

BOOLEAN IsRootBridge(PciIo) { return (BOOLEAN) (PciI= o->Parent =3D=3D NULL); }

 

your code can call this helper function.<= /p>

 

From: Bassa, Damian <damian.bassa@intel.co= m>
Sent: Friday, September 17, 2021 12:02 AM
To: Ni, Ray <ray.ni@intel.com>; Wu, Hao A <hao.a.wu@intel.c= om>; devel@edk2.groups.io
Cc: Kolakowski, Jacek <Jacek.Kolakowski@intel.com>
Subject: RE: [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Enumerator= to check for RCiEP before looking for RP

 

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 <dami= an.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.

 

--_000_CO1PR11MB4930F4D2FC8AEC6BAED161C38CDD9CO1PR11MB4930namp_--