Re: PCI: hotplug_event: PCIe PLDA Device BAR Reset
Naveen Kumar P <[email protected]> Wed, 2 Apr 2025 10:54:52 +0530
| Newsgroups | gmane.linux.acpi.devel,gmane.linux.kernel.pci,gmane.linux.kernel,gmane.linux.kernel.kernelnewbies |
|---|---|
| Message-ID | <CAMciSVVZ6PMKsU=n8UmQi45ghe7KkzxhwJD0L6Yg9J4Yn9TnQQ@mail.gmail.com> |
On Thu, Mar 20, 2025 at 3:11 AM Bjorn Helgaas <[email protected]> wrote: > > On Wed, Mar 19, 2025 at 08:07:55PM +0530, Naveen Kumar P wrote: > > ... > > I am reaching out to follow up on the PCI BAR0 reset issue and its > > potential connection to the ACPI errors observed in my system running > > Linux kernel 6.13.0+. > > ... > > Trying to finish up the last bits for the upcoming v6.15 merge window, > will come back to this later. I hope you're doing well. I understand you're busy with the v6.15 merge window, and I appreciate your time. When you get a chance, I’d love to get your thoughts on this issue. Since my last message, I have done some additional debugging by adding debug prints in pci_conf1_read(), __pci_read_base(), pciehp_configure_device(), and pci_assign_unassigned_bridge_resources(). After building the kernel with these changes, I monitored the system for four days. Upon checking dmesg, this time no ACPI errors were observed. However, when running lspci, I noticed the following behavior: 01:00.0 RAM memory: PLDA Device 5555 (rev ff) [386370.935294] USER PCI READ: ret=0, bus=01 dev=00 func=0 pos=0x00 len=4 data=0xffffffff ... [386370.944394] USER PCI READ: ret=0, bus=01 dev=00 func=0 pos=0x3c len=4 data=0xffffffff [386371.048901] ACPI: \_SB_.PCI0.RP01: ACPI: ACPI_NOTIFY_BUS_CHECK event ... [386371.049944] KERNEL PCI READ: res=0, bus=01 dev=00 func=0 pos=0x00 len=4 data=0x55551556 [386371.049971] KERNEL PCI READ: res=0, bus=01 dev=00 func=0 pos=0x04 len=4 data=0x100000 [386371.049995] KERNEL PCI READ: res=0, bus=01 dev=00 func=0 pos=0x08 len=4 data=0x5000000 [386371.050018] KERNEL PCI READ: res=0, bus=01 dev=00 func=0 pos=0x0c len=4 data=0x0 [386371.050040] KERNEL PCI READ: res=0, bus=01 dev=00 func=0 pos=0x10 len=4 data=0x0 Initially, lspci triggered pci_user_read_config_dword(), returning 0xffffffff for device 01:00.0. Shortly after, the ACPI_NOTIFY_BUS_CHECK event was triggered. Following this, pci_bus_read_config_dword() was called, and the PCI config space recovered to normal values—except for BAR0, which remained reset to zero. Despite adding debug prints, none of them appeared in dmesg, which suggests that none of the instrumented functions were involved in this recovery process. The key question now is: Why does the PCIe device 01:00.0 silently return 0xffffffff for config space reads? If the device is powered down or reset, can we trace the related event in the kernel code? But /sys/bus/pci/devices/0000:01:00.0/power/runtime_status is showing as active only. After the ACPI_NOTIFY_BUS_CHECK event, how is the config space (except BAR0) recovered? Which function is responsible for handling this recovery? Any insights or pointers would be greatly appreciated. Looking forward to your thoughts. Thanks again for your time! > > Bjorn
dmesg_april2nd_log.txt
(text/plain, 155 KB) - not displayed
0006-added-debug-prints-in-pci_conf1_read-and-__pci_read_.patch
(application/octet-stream, 3.6 KB)
From 1387e69e69c0805c9b98b9fb28a6f75d3b27cf35 Mon Sep 17 00:00:00 2001 From: Naveen Kumar Parna <[email protected]> Date: Thu, 27 Mar 2025 18:17:34 +0530 Subject: [PATCH 6/6] added debug prints in pci_conf1_read() and __pci_read_base() and pciehp_configure_device() and pci_assign_unassigned_bridge_resources()\n --- arch/x86/pci/direct.c | 1 + drivers/pci/hotplug/pciehp_pci.c | 6 +++++- drivers/pci/probe.c | 1 + drivers/pci/setup-bus.c | 4 ++++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/x86/pci/direct.c b/arch/x86/pci/direct.c index a51074c55..f632c7ff3 100644 --- a/arch/x86/pci/direct.c +++ b/arch/x86/pci/direct.c @@ -25,6 +25,7 @@ static int pci_conf1_read(unsigned int seg, unsigned int bus, if (seg || (bus > 255) || (devfn > 255) || (reg > 4095)) { *value = -1; + pr_debug("pci_conf1_read: invalid parameters seg=%u, bus=%u dev=%02x func=%02x, devfn=%u, reg=%d\n", seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), devfn, reg); return -EINVAL; } diff --git a/drivers/pci/hotplug/pciehp_pci.c b/drivers/pci/hotplug/pciehp_pci.c index 65e50bee1..2db69b5a3 100644 --- a/drivers/pci/hotplug/pciehp_pci.c +++ b/drivers/pci/hotplug/pciehp_pci.c @@ -36,6 +36,7 @@ int pciehp_configure_device(struct controller *ctrl) struct pci_bus *parent = bridge->subordinate; int num, ret = 0; + pr_debug("pciehp_configure_device: start, ctrl=%p\n", ctrl); pci_lock_rescan_remove(); dev = pci_get_slot(parent, PCI_DEVFN(0, 0)); @@ -58,8 +59,10 @@ int pciehp_configure_device(struct controller *ctrl) goto out; } - for_each_pci_bridge(dev, parent) + for_each_pci_bridge(dev, parent) { + pr_debug("pciehp_configure_device: Adding bridge %s\n", pci_name(dev)); pci_hp_add_bridge(dev); + } pci_assign_unassigned_bridge_resources(bridge); pcie_bus_configure_settings(parent); @@ -78,6 +81,7 @@ int pciehp_configure_device(struct controller *ctrl) out: pci_unlock_rescan_remove(); + pr_debug("pciehp_configure_device: end, ret=%d\n", ret); return ret; } diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 5eff497b4..e631e748d 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -184,6 +184,7 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, mask = type ? PCI_ROM_ADDRESS_MASK : ~0; + pr_info("%s() - entry\n",__func__); /* No printks while decoding is disabled! */ if (!dev->mmio_always_on) { pci_read_config_word(dev, PCI_COMMAND, &orig_cmd); diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 5e00cecf1..db3282252 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c @@ -2235,7 +2235,9 @@ void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge) struct pci_dev_resource *fail_res; int retval; + pr_debug("pci_assign_unassigned_bridge_resources: start, bridge=%s\n", pci_name(bridge)); again: + pr_debug("pci_assign_unassigned_bridge_resources: sizing bridges\n"); __pci_bus_size_bridges(parent, &add_list); /* @@ -2253,6 +2255,7 @@ void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge) goto enable_all; if (tried_times >= 2) { + pr_debug("pci_assign_unassigned_bridge_resources: failed after %d tries\n", tried_times); /* Still fail, don't need to try more */ free_list(&fail_head); goto enable_all; @@ -2295,6 +2298,7 @@ void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge) if (retval) pci_err(bridge, "Error reenabling bridge (%d)\n", retval); pci_set_master(bridge); + pr_debug("pci_assign_unassigned_bridge_resources: end\n"); } EXPORT_SYMBOL_GPL(pci_assign_unassigned_bridge_resources); -- 2.25.1