Re: [PATCH v1 1/2] x86/PCI: make printks more informative

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Bjorn Helgaas wrote:
> This updates printks so they have more context and look more like the
> usual PCI stuff.
> 
> Signed-off-by: Bjorn Helgaas <bjorn.helgaas@xxxxxx>
> ---
>  arch/x86/pci/amd_bus.c |   43 ++++++++++++++++++++++++++-----------------
>  1 files changed, 26 insertions(+), 17 deletions(-)
> 
> diff --git a/arch/x86/pci/amd_bus.c b/arch/x86/pci/amd_bus.c
> index 995f360..9462455 100644
> --- a/arch/x86/pci/amd_bus.c
> +++ b/arch/x86/pci/amd_bus.c
> @@ -49,14 +49,13 @@ void x86_pci_root_bus_res_quirks(struct pci_bus *b)
>  	if (i == pci_root_num)
>  		return;
>  
> -	printk(KERN_DEBUG "PCI: peer root bus %02x res updated from pci conf\n",
> -			b->number);
> -
>  	info = &pci_root_info[i];
>  	for (j = 0; j < info->res_num; j++) {
>  		struct resource *res;
>  		struct resource *root;
>  
> +		dev_printk(KERN_DEBUG, &b->dev,
> +			   "resource %d %pR (original)\n", j, b->resource[j]);

last time when i looked at %pR, it seems it can not handle all 0 (include flags) resource

here, old one could have two entries: io root, and mmio_root.

new value could have io port, mmio, mmio pref. aka res_num == 3,

so may have %pR to handle all 0 res, or skip the print when !b->resouce[i].flags ?

>  		res = &info->res[j];
>  		b->resource[j] = res;
>  		if (res->flags & IORESOURCE_IO)
> @@ -64,6 +63,8 @@ void x86_pci_root_bus_res_quirks(struct pci_bus *b)
>  		else
>  			root = &iomem_resource;
>  		insert_resource(root, res);
> +		dev_printk(KERN_DEBUG, &b->dev,
> +			   "resource %d %pR (updated from hardware)\n", j, res);
>  	}
>  }
>  
> @@ -234,6 +235,7 @@ static int __init early_fill_mp_bus_info(void)
>  	struct res_range range[RANGE_NUM];
>  	u64 val;
>  	u32 address;
> +	u16 vendor, device;
>  
>  	if (!early_pci_allowed())
>  		return -1;
> @@ -241,8 +243,6 @@ static int __init early_fill_mp_bus_info(void)
>  	found_all_numa_early = 0;
>  	for (i = 0; i < ARRAY_SIZE(pci_probes); i++) {
>  		u32 id;
> -		u16 device;
> -		u16 vendor;
>  
>  		bus = pci_probes[i].bus;
>  		slot = pci_probes[i].slot;
> @@ -260,6 +260,9 @@ static int __init early_fill_mp_bus_info(void)
>  	if (!found_all_numa_early)
>  		return 0;
>  
> +	printk(KERN_INFO "pci 0000:%02x:%02x.0: AMD Family 10h Northbridge "
> +	       "[%04x:%04x]\n", bus, slot, vendor, device);
> +

on amd system, it happens you can read all layout from one of host bridge pci conf.
that doesn't mean to that hostbridge only.
so should link to bus/slot here

>  	pci_root_num = 0;
>  	for (i = 0; i < 4; i++) {
>  		int min_bus;
> @@ -318,7 +321,8 @@ static int __init early_fill_mp_bus_info(void)
>  			continue; /* not found */
>  
>  		info = &pci_root_info[j];
> -		printk(KERN_DEBUG "node %d link %d: io port [%llx, %llx]\n",
> +		printk(KERN_DEBUG "pci 0000:%02x:%02x.1: node %d link %d: "
> +		       "[io  %#llx-%#llx]\n", bus, slot,
>  		       node, link, (u64)start, (u64)end);
not here
>  
>  		/* kernel only handle 16 bit only */
> @@ -353,7 +357,8 @@ static int __init early_fill_mp_bus_info(void)
>  	address = MSR_K8_TOP_MEM1;
>  	rdmsrl(address, val);
>  	end = (val & 0xffffff800000ULL);
> -	printk(KERN_INFO "TOM: %016lx aka %ldM\n", end, end>>20);
> +	printk(KERN_INFO "pci 0000:%02x:%02x:0: TOM: %#016lx (%ldM)\n",
> +	       bus, slot, end, end>>20);
not from TOM
>  	if (end < (1ULL<<32))
>  		update_range(range, 0, end - 1);
>  
> @@ -361,7 +366,9 @@ static int __init early_fill_mp_bus_info(void)
>  	get_pci_mmcfg_amd_fam10h_range();
>  	/* need to take out mmconf range */
>  	if (fam10h_mmconf_end) {
> -		printk(KERN_DEBUG "Fam 10h mmconf [%llx, %llx]\n", fam10h_mmconf_start, fam10h_mmconf_end);
> +		printk(KERN_DEBUG "pci 0000:%02x:%02x.0: MMCONFIG region "
> +		       "[mem %#llx-%#llx]\n", bus, slot,
> +		       fam10h_mmconf_start, fam10h_mmconf_end);
not for mmconf.
>  		update_range(range, fam10h_mmconf_start, fam10h_mmconf_end);
>  	}
>  
> @@ -391,7 +398,8 @@ static int __init early_fill_mp_bus_info(void)
>  
>  		info = &pci_root_info[j];
>  
> -		printk(KERN_DEBUG "node %d link %d: mmio [%llx, %llx]",
> +		printk(KERN_DEBUG "pci 0000:%02x:%02x.1: node %d link %d: "
> +		       "[mem %#llx-%#llx]", bus, slot,
>  		       node, link, (u64)start, (u64)end);
not here
>  		/*
>  		 * some sick allocation would have range overlap with fam10h
> @@ -418,13 +426,13 @@ static int __init early_fill_mp_bus_info(void)
>  				endx = fam10h_mmconf_start - 1;
>  				update_res(info, start, endx, IORESOURCE_MEM, 0);
>  				update_range(range, start, endx);
> -				printk(KERN_CONT " ==> [%llx, %llx]", (u64)start, endx);
> +				printk(KERN_CONT " ==> [%#llx-%#llx]", (u64)start, endx);
>  				start = fam10h_mmconf_end + 1;
>  				changed = 1;
>  			}
>  			if (changed) {
>  				if (start <= end) {
> -					printk(KERN_CONT " %s [%llx, %llx]", endx?"and":"==>", (u64)start, (u64)end);
> +					printk(KERN_CONT " %s [%#llx-%#llx]", endx?"and":"==>", (u64)start, (u64)end);
>  				} else {
>  					printk(KERN_CONT "%s\n", endx?"":" ==> none");
>  					continue;
> @@ -447,7 +455,8 @@ static int __init early_fill_mp_bus_info(void)
>  		address = MSR_K8_TOP_MEM2;
>  		rdmsrl(address, val);
>  		end = (val & 0xffffff800000ULL);
> -		printk(KERN_INFO "TOM2: %016lx aka %ldM\n", end, end>>20);
> +		printk(KERN_INFO "pci 0000:%02x:%02x.0: TOM2: %#016lx (%ldM)\n",
> +		       bus, slot, end, end>>20);
not here
>  		update_range(range, 1ULL<<32, end - 1);
>  	}
>  
> @@ -479,14 +488,14 @@ static int __init early_fill_mp_bus_info(void)
>  		info = &pci_root_info[i];
>  		res_num = info->res_num;
>  		busnum = info->bus_min;
> -		printk(KERN_DEBUG "bus: [%02x, %02x] on node %x link %x\n",
> +		printk(KERN_DEBUG "pci 0000:%02x:%02x.1: host bridge to "
> +		       "[bus %02x-%02x] on node %x link %x\n", bus, slot,
>  		       info->bus_min, info->bus_max, info->node, info->link);
not here
>  		for (j = 0; j < res_num; j++) {
>  			res = &info->res[j];
> -			printk(KERN_DEBUG "bus: %02x index %x %s: [%llx, %llx]\n",
> -			       busnum, j,
> -			       (res->flags & IORESOURCE_IO)?"io port":"mmio",
> -			       res->start, res->end);
> +			printk(KERN_DEBUG "pci 0000:%02x:%02x.1: "
> +			       "host bridge window %pR to [bus %02x-%02x]\n",
> +			       bus, slot, res, info->bus_min, info->bus_max);
not here
>  		}
>  	}
>  

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux