mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-03 18:20:25 +02:00 
			
		
		
		
	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/20231121183643.249006-4-helgaas@kernel.org Tested-by: Tomasz Pala <gotar@polanet.pl> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
This commit is contained in:
		
							parent
							
								
									e1fad9dd25
								
							
						
					
					
						commit
						286ae88c9e
					
				
					 2 changed files with 21 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -283,6 +283,9 @@ static int setup_mcfg_map(struct acpi_pci_root_info *ci)
 | 
			
		|||
	info->mcfg_added = false;
 | 
			
		||||
	seg = info->sd.domain;
 | 
			
		||||
 | 
			
		||||
	dev_dbg(dev, "%s(%04x %pR ECAM %pa)\n", __func__, seg,
 | 
			
		||||
		&root->secondary, &root->mcfg_addr);
 | 
			
		||||
 | 
			
		||||
	/* return success if MMCFG is not in use */
 | 
			
		||||
	if (raw_pci_ext_ops && raw_pci_ext_ops != &pci_mmcfg)
 | 
			
		||||
		return 0;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -579,7 +579,8 @@ static void __init pci_mmcfg_reject_broken(int early)
 | 
			
		|||
 | 
			
		||||
	list_for_each_entry(cfg, &pci_mmcfg_list, list) {
 | 
			
		||||
		if (pci_mmcfg_check_reserved(NULL, cfg, early) == 0) {
 | 
			
		||||
			pr_info(PREFIX "not using MMCONFIG\n");
 | 
			
		||||
			pr_info(PREFIX "not using MMCONFIG (%pR not reserved)\n",
 | 
			
		||||
				&cfg->res);
 | 
			
		||||
			free_all_mmcfg();
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			@ -676,6 +677,8 @@ static int pci_mmcfg_for_each_region(int (*func)(__u64 start, __u64 size,
 | 
			
		|||
 | 
			
		||||
static void __init __pci_mmcfg_init(int early)
 | 
			
		||||
{
 | 
			
		||||
	pr_debug(PREFIX "%s(%s)\n", __func__, early ? "early" : "late");
 | 
			
		||||
 | 
			
		||||
	pci_mmcfg_reject_broken(early);
 | 
			
		||||
	if (list_empty(&pci_mmcfg_list))
 | 
			
		||||
		return;
 | 
			
		||||
| 
						 | 
				
			
			@ -702,6 +705,8 @@ static int __initdata known_bridge;
 | 
			
		|||
 | 
			
		||||
void __init pci_mmcfg_early_init(void)
 | 
			
		||||
{
 | 
			
		||||
	pr_debug(PREFIX "%s() pci_probe %#x\n", __func__, pci_probe);
 | 
			
		||||
 | 
			
		||||
	if (pci_probe & PCI_PROBE_MMCONF) {
 | 
			
		||||
		if (pci_mmcfg_check_hostbridge())
 | 
			
		||||
			known_bridge = 1;
 | 
			
		||||
| 
						 | 
				
			
			@ -715,6 +720,8 @@ void __init pci_mmcfg_early_init(void)
 | 
			
		|||
 | 
			
		||||
void __init pci_mmcfg_late_init(void)
 | 
			
		||||
{
 | 
			
		||||
	pr_debug(PREFIX "%s() pci_probe %#x\n", __func__, pci_probe);
 | 
			
		||||
 | 
			
		||||
	/* MMCONFIG disabled */
 | 
			
		||||
	if ((pci_probe & PCI_PROBE_MMCONF) == 0)
 | 
			
		||||
		return;
 | 
			
		||||
| 
						 | 
				
			
			@ -735,6 +742,8 @@ static int __init pci_mmcfg_late_insert_resources(void)
 | 
			
		|||
 | 
			
		||||
	pci_mmcfg_running_state = true;
 | 
			
		||||
 | 
			
		||||
	pr_debug(PREFIX "%s() pci_probe %#x\n", __func__, pci_probe);
 | 
			
		||||
 | 
			
		||||
	/* If we are not using MMCONFIG, don't insert the resources. */
 | 
			
		||||
	if ((pci_probe & PCI_PROBE_MMCONF) == 0)
 | 
			
		||||
		return 1;
 | 
			
		||||
| 
						 | 
				
			
			@ -744,9 +753,12 @@ static int __init pci_mmcfg_late_insert_resources(void)
 | 
			
		|||
	 * marked so it won't cause request errors when __request_region is
 | 
			
		||||
	 * called.
 | 
			
		||||
	 */
 | 
			
		||||
	list_for_each_entry(cfg, &pci_mmcfg_list, list)
 | 
			
		||||
		if (!cfg->res.parent)
 | 
			
		||||
	list_for_each_entry(cfg, &pci_mmcfg_list, list) {
 | 
			
		||||
		if (!cfg->res.parent) {
 | 
			
		||||
			pr_debug(PREFIX "%s() insert %pR\n", __func__, &cfg->res);
 | 
			
		||||
			insert_resource(&iomem_resource, &cfg->res);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -766,6 +778,8 @@ int pci_mmconfig_insert(struct device *dev, u16 seg, u8 start, u8 end,
 | 
			
		|||
	struct resource *tmp = NULL;
 | 
			
		||||
	struct pci_mmcfg_region *cfg;
 | 
			
		||||
 | 
			
		||||
	dev_dbg(dev, "%s(%04x [bus %02x-%02x])\n", __func__, seg, start, end);
 | 
			
		||||
 | 
			
		||||
	if (!(pci_probe & PCI_PROBE_MMCONF) || pci_mmcfg_arch_init_failed)
 | 
			
		||||
		return -ENODEV;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -810,8 +824,7 @@ int pci_mmconfig_insert(struct device *dev, u16 seg, u8 start, u8 end,
 | 
			
		|||
				 "%s %pR\n",
 | 
			
		||||
				 &cfg->res, tmp->name, tmp);
 | 
			
		||||
		} else if (pci_mmcfg_arch_map(cfg)) {
 | 
			
		||||
			dev_warn(dev, "fail to map MMCONFIG %pR.\n",
 | 
			
		||||
				 &cfg->res);
 | 
			
		||||
			dev_warn(dev, "fail to map MMCONFIG %pR\n", &cfg->res);
 | 
			
		||||
		} else {
 | 
			
		||||
			list_add_sorted(cfg);
 | 
			
		||||
			dev_info(dev, "MMCONFIG at %pR (base %#lx)\n",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue