Skip to content

Commit 286ae88

Browse files
committed
x86/pci: Add MCFG debug logging
MCFG handling is a frequent source of problems. Add more logging to aid in debugging. Enable the logging with CONFIG_DYNAMIC_DEBUG=y and the kernel boot parameter 'dyndbg="file arch/x86/pci +p"'. Link: https://lore.kernel.org/r/[email protected] Tested-by: Tomasz Pala <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]>
1 parent e1fad9d commit 286ae88

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

arch/x86/pci/acpi.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,9 @@ static int setup_mcfg_map(struct acpi_pci_root_info *ci)
283283
info->mcfg_added = false;
284284
seg = info->sd.domain;
285285

286+
dev_dbg(dev, "%s(%04x %pR ECAM %pa)\n", __func__, seg,
287+
&root->secondary, &root->mcfg_addr);
288+
286289
/* return success if MMCFG is not in use */
287290
if (raw_pci_ext_ops && raw_pci_ext_ops != &pci_mmcfg)
288291
return 0;

arch/x86/pci/mmconfig-shared.c

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,8 @@ static void __init pci_mmcfg_reject_broken(int early)
579579

580580
list_for_each_entry(cfg, &pci_mmcfg_list, list) {
581581
if (pci_mmcfg_check_reserved(NULL, cfg, early) == 0) {
582-
pr_info(PREFIX "not using MMCONFIG\n");
582+
pr_info(PREFIX "not using MMCONFIG (%pR not reserved)\n",
583+
&cfg->res);
583584
free_all_mmcfg();
584585
return;
585586
}
@@ -676,6 +677,8 @@ static int pci_mmcfg_for_each_region(int (*func)(__u64 start, __u64 size,
676677

677678
static void __init __pci_mmcfg_init(int early)
678679
{
680+
pr_debug(PREFIX "%s(%s)\n", __func__, early ? "early" : "late");
681+
679682
pci_mmcfg_reject_broken(early);
680683
if (list_empty(&pci_mmcfg_list))
681684
return;
@@ -702,6 +705,8 @@ static int __initdata known_bridge;
702705

703706
void __init pci_mmcfg_early_init(void)
704707
{
708+
pr_debug(PREFIX "%s() pci_probe %#x\n", __func__, pci_probe);
709+
705710
if (pci_probe & PCI_PROBE_MMCONF) {
706711
if (pci_mmcfg_check_hostbridge())
707712
known_bridge = 1;
@@ -715,6 +720,8 @@ void __init pci_mmcfg_early_init(void)
715720

716721
void __init pci_mmcfg_late_init(void)
717722
{
723+
pr_debug(PREFIX "%s() pci_probe %#x\n", __func__, pci_probe);
724+
718725
/* MMCONFIG disabled */
719726
if ((pci_probe & PCI_PROBE_MMCONF) == 0)
720727
return;
@@ -735,6 +742,8 @@ static int __init pci_mmcfg_late_insert_resources(void)
735742

736743
pci_mmcfg_running_state = true;
737744

745+
pr_debug(PREFIX "%s() pci_probe %#x\n", __func__, pci_probe);
746+
738747
/* If we are not using MMCONFIG, don't insert the resources. */
739748
if ((pci_probe & PCI_PROBE_MMCONF) == 0)
740749
return 1;
@@ -744,9 +753,12 @@ static int __init pci_mmcfg_late_insert_resources(void)
744753
* marked so it won't cause request errors when __request_region is
745754
* called.
746755
*/
747-
list_for_each_entry(cfg, &pci_mmcfg_list, list)
748-
if (!cfg->res.parent)
756+
list_for_each_entry(cfg, &pci_mmcfg_list, list) {
757+
if (!cfg->res.parent) {
758+
pr_debug(PREFIX "%s() insert %pR\n", __func__, &cfg->res);
749759
insert_resource(&iomem_resource, &cfg->res);
760+
}
761+
}
750762

751763
return 0;
752764
}
@@ -766,6 +778,8 @@ int pci_mmconfig_insert(struct device *dev, u16 seg, u8 start, u8 end,
766778
struct resource *tmp = NULL;
767779
struct pci_mmcfg_region *cfg;
768780

781+
dev_dbg(dev, "%s(%04x [bus %02x-%02x])\n", __func__, seg, start, end);
782+
769783
if (!(pci_probe & PCI_PROBE_MMCONF) || pci_mmcfg_arch_init_failed)
770784
return -ENODEV;
771785

@@ -810,8 +824,7 @@ int pci_mmconfig_insert(struct device *dev, u16 seg, u8 start, u8 end,
810824
"%s %pR\n",
811825
&cfg->res, tmp->name, tmp);
812826
} else if (pci_mmcfg_arch_map(cfg)) {
813-
dev_warn(dev, "fail to map MMCONFIG %pR.\n",
814-
&cfg->res);
827+
dev_warn(dev, "fail to map MMCONFIG %pR\n", &cfg->res);
815828
} else {
816829
list_add_sorted(cfg);
817830
dev_info(dev, "MMCONFIG at %pR (base %#lx)\n",

0 commit comments

Comments
 (0)