From: Bjorn Helgaas <helgaas@kernel.org>
To: Siddharth Vadapalli <s-vadapalli@ti.com>
Cc: lpieralisi@kernel.org, robh@kernel.org, kw@linux.com,
bhelgaas@google.com, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, r-gunasekaran@ti.com,
srk@ti.com
Subject: Re: [PATCH] PCI: keystone: Don't enable BAR0 if link is not detected
Date: Thu, 12 Oct 2023 11:43:36 -0500 [thread overview]
Message-ID: <20231012164336.GA1072823@bhelgaas> (raw)
In-Reply-To: <4e1f574c-6b36-c6e1-9153-90d599e2aaa7@ti.com>
On Thu, Oct 12, 2023 at 10:15:09AM +0530, Siddharth Vadapalli wrote:
> Hello Bjorn,
>
> Thank you for reviewing the patch.
>
> On 11/10/23 19:16, Bjorn Helgaas wrote:
> > Hi Siddharth,
> >
> > On Wed, Oct 11, 2023 at 06:04:51PM +0530, Siddharth Vadapalli wrote:
> >> Since the function dw_pcie_host_init() ignores the absence of link under
> >> the assumption that link can come up later, it is possible that the
> >> pci_host_probe(bridge) function is invoked even when no endpoint device
> >> is connected. In such a situation, the ks_pcie_v3_65_add_bus() function
> >> configures BAR0 when the link is not up, resulting in Completion Timeouts
> >> during the MSI configuration performed later by the PCI Express Port driver
> >> to setup AER, PME and other services. Thus, leave BAR0 disabled if link is
> >> not yet detected when the ks_pcie_v3_65_add_bus() function is invoked.
> >
> > I'm trying to make sense of this. In this path:
> >
> > pci_host_probe
> > pci_scan_root_bus_bridge
> > pci_register_host_bridge
> > bus = pci_alloc_bus(NULL) # root bus
> > bus->ops->add_bus(bus)
> > ks_pcie_v3_65_add_bus
> >
> > The BAR0 in question must belong to a Root Port. And it sounds like
> > the issue must be related to MSI-X, since the original MSI doesn't
> > involve any BARs.
>
> Yes, the issue is related to MSI-X. I will list down the exact set of function
> calls below as well as the place where the completion timeout first occurs:
> ks_pcie_probe
> dw_pcie_host_init
> pci_host_probe
> pci_bus_add_devices
> pci_bus_add_device
> device_attach
> __device_attach
> bus_for_each_drv
> __device_attach_driver (invoked using fn(drv, data))
> driver_probe_device
> __driver_probe_device
> really_probe
> pci_device_probe
> pcie_portdrv_probe
> pcie_port_device_register
> pcie_init_service_irqs
> pcie_port_enable_irq_vec
> pci_alloc_irq_vectors
> pci_alloc_irq_vectors_affinity
> __pci_enable_msix_range
> msix_capability_init
> msix_setup_interrupts
> msix_setup_msi_descs
> msix_prepare_msi_desc
> In this function: msix_prepare_msi_desc, the following readl()
> causes completion timeout:
> desc->pci.msix_ctrl = readl(addr + PCI_MSIX_ENTRY_VECTOR_CTRL);
> The completion timeout with the readl is only observed when the link
> is down (No Endpoint device is actually connected to the PCIe
> connector slot).
Do you know the address ("addr")? From pci_msix_desc_addr(), it looks
like it should be:
desc->pci.mask_base + desc->msi_index * PCI_MSIX_ENTRY_SIZE
and desc->pci.mask_base should be dev->msix_base, which we got from
msix_map_region(), which ioremaps part of the BAR indicated by the
MSI-X Table Offset/Table BIR register.
I wonder if this readl() is being handled as an MMIO access to a
downstream device instead of a Root Port BAR access because it's
inside the Root Port's MMIO window.
Could you dump out these values just before the readl()?
phys_addr inside msix_map_region()
dev->msix_base
desc->pci.mask_base
desc->msi_index
addr
call early_dump_pci_device() on the Root Port
Bjorn
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-10-12 16:44 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-11 12:34 [PATCH] PCI: keystone: Don't enable BAR0 if link is not detected Siddharth Vadapalli
2023-10-11 13:46 ` Bjorn Helgaas
2023-10-12 4:45 ` Siddharth Vadapalli
2023-10-12 16:43 ` Bjorn Helgaas [this message]
2023-10-13 5:03 ` Siddharth Vadapalli
2023-10-13 5:06 ` Siddharth Vadapalli
2023-10-13 18:49 ` Bjorn Helgaas
2023-10-14 5:52 ` Siddharth Vadapalli
2023-10-16 21:29 ` Serge Semin
2023-10-17 4:14 ` Siddharth Vadapalli
2023-10-18 10:42 ` Serge Semin
2023-10-18 10:49 ` Siddharth Vadapalli
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-all 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=20231012164336.GA1072823@bhelgaas \
--to=helgaas@kernel.org \
--cc=bhelgaas@google.com \
--cc=kw@linux.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=r-gunasekaran@ti.com \
--cc=robh@kernel.org \
--cc=s-vadapalli@ti.com \
--cc=srk@ti.com \
/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