public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Bassa, Damian" <damian.bassa@intel.com>
To: "Wu, Hao A" <hao.a.wu@intel.com>,
	"devel@edk2.groups.io" <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
Date: Tue, 31 Aug 2021 17:44:48 +0000	[thread overview]
Message-ID: <CO1PR11MB51877027E16AADD3E5D065118DCC9@CO1PR11MB5187.namprd11.prod.outlook.com> (raw)
In-Reply-To: <BN8PR11MB3666034205FC39E8FF5632CCCACC9@BN8PR11MB3666.namprd11.prod.outlook.com>

[-- Attachment #1: Type: text/plain, Size: 5102 bytes --]

It refers to access to the root port device that doesn't exist in case we are dealing with RCiEP device.
There can be specific case where RCiEP device has ARI extended capability ID (even though it's unsupported in this case).
In such a case PciSearchDevice goes to CreatePciIoDevice through GatherDeviceInfo. And in this case parent is PCI_IO_DEVICE instance 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 read 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.bassa@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<mailto:devel@edk2.groups.io> <devel@edk2.groups.io<mailto:devel@edk2.groups.io>> On Behalf Of Wu, Hao A
Sent: Tuesday, August 31, 2021 12:25 PM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Bassa, Damian <damian.bassa@intel.com<mailto: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 below statement?
"undefined parent register accesses"

Thanks in advance.

Best Regards,
Hao Wu

From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> <devel@edk2.groups.io<mailto:devel@edk2.groups.io>> On Behalf Of Bassa, Damian
Sent: Tuesday, August 24, 2021 11:15 PM
To: devel@edk2.groups.io<mailto: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 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<mailto: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/MdeModulePkg/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 = AllocateZeroPool (sizeof (PCI_IO_DEVICE));
   if (PciIoDevice == NULL) {
@@ -2229,7 +2230,16 @@ CreatePciIoDevice (
     return NULL;
   }

-  if (PcdGetBool (PcdAriSupport)) {
+  PciIo->Pci.Read (
+                PciIo,
+                EfiPciIoWidthUint16,
+                PciIoDevice->PciExpressCapabilityOffset + OFFSET_OF (PCI_CAPABILITY_PCIEXP, Capability),
+                1,
+                &Capability.Uint16
+                );
+
+  if (PcdGetBool (PcdAriSupport) &&
+    Capability.Bits.DevicePortType != 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łowackiego 173 | 80-298 Gdańsk | Sąd Rejonowy Gdańsk Północ | VII Wydział Gospodarczy Krajowego Rejestru Sądowego - KRS 101882 | NIP 957-07-52-316 | Kapitał zakładowy 200.000 PLN.

Ta wiadomość wraz z załącznikami jest przeznaczona dla określonego adresata i może zawierać informacje poufne. W razie przypadkowego otrzymania tej wiadomości, prosimy o powiadomienie nadawcy oraz trwałe jej usunięcie; jakiekolwiek przeglądanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended 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. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | 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 wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended 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.

[-- Attachment #2: Type: text/html, Size: 12506 bytes --]

  reply	other threads:[~2021-08-31 17:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-24 15:15 [PATCH] MdeModulePkg/PciBusDxe: Enumerator to check for RCiEP before looking for RP Bassa, Damian
2021-08-31  4:24 ` Wu, Hao A
2021-08-31  4:28   ` [edk2-devel] " Wu, Hao A
2021-08-31 17:44     ` Bassa, Damian [this message]
2021-09-08  7:16       ` Wu, Hao A
2021-09-15 11:53         ` Bassa, Damian
2021-09-15 13:21           ` Ni, Ray
2021-09-16 16:02             ` Bassa, Damian
2021-09-17 16:31               ` Ni, Ray
2021-09-20 16:24                 ` Bassa, Damian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CO1PR11MB51877027E16AADD3E5D065118DCC9@CO1PR11MB5187.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox