diff mbox

[4/4] x86/gart: Tidy messages and add bridge device info

Message ID 20140425171655.312.97511.stgit@bhelgaas-glaptop.roam.corp.google.com
State Changes Requested
Headers show

Commit Message

Bjorn Helgaas April 25, 2014, 5:16 p.m. UTC
Print the AGP bridge info the same way as the rest of the kernel, e.g.,
"0000:00:04.0" instead of "00:04:00".

Also print the AGP aperture address range the same way we print resources,
and label it explicitly as a bus address range.

No functional change.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 arch/x86/kernel/aperture_64.c |   20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)


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

Comments

Ingo Molnar April 26, 2014, 6:01 a.m. UTC | #1
* Bjorn Helgaas <bhelgaas@google.com> wrote:

> Print the AGP bridge info the same way as the rest of the kernel, e.g.,
> "0000:00:04.0" instead of "00:04:00".
> 
> Also print the AGP aperture address range the same way we print resources,
> and label it explicitly as a bus address range.
> 
> No functional change.
> 
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
>  arch/x86/kernel/aperture_64.c |   20 ++++++++++++--------
>  1 file changed, 12 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/x86/kernel/aperture_64.c b/arch/x86/kernel/aperture_64.c
> index 9fa8aa051f54..4dd76d3df056 100644
> --- a/arch/x86/kernel/aperture_64.c
> +++ b/arch/x86/kernel/aperture_64.c
> @@ -126,10 +126,12 @@ static u32 __init read_agp(int bus, int slot, int func, int cap, u32 *order)
>  	u64 aper;
>  	u32 old_order;
>  
> -	printk(KERN_INFO "AGP bridge at %02x:%02x:%02x\n", bus, slot, func);
> +	printk(KERN_INFO "pci 0000:%02x:%02x.%d: AGP bridge\n", bus, slot,
> +	       func);

Please leave it on a single line - checkpatch warning nonwithstanding. 
pr_info() is also useful.

>  	apsizereg = read_pci_config_16(bus, slot, func, cap + 0x14);
>  	if (apsizereg == 0xffffffff) {
> -		printk(KERN_ERR "APSIZE in AGP bridge unreadable\n");
> +		printk(KERN_ERR "pci 0000:%02x:%02x.%d: APSIZE unreadable\n",
> +		       bus, slot, func);

Here too you can also use pr_err() to shorten the line.

>  		return 0;
>  	}
>  
> @@ -153,16 +155,18 @@ static u32 __init read_agp(int bus, int slot, int func, int cap, u32 *order)
>  	 * On some sick chips, APSIZE is 0. It means it wants 4G
>  	 * so let double check that order, and lets trust AMD NB settings:
>  	 */
> -	printk(KERN_INFO "Aperture from AGP @ %Lx old size %u MB\n",
> -			aper, 32 << old_order);
> +	printk(KERN_INFO "pci 0000:%02x:%02x.%d: AGP aperture [bus %Lx-%Lx] old size %u MB\n",
> +	       bus, slot, func, aper, aper + (32 << old_order) - 1,
> +	       32 << old_order);
>  	if (aper + (32ULL<<(20 + *order)) > 0x100000000ULL) {
> -		printk(KERN_INFO "Aperture size %u MB (APSIZE %x) is not right, using settings from NB\n",
> -				32 << *order, apsizereg);
> +		printk(KERN_INFO "pci 0000:%02x:%02x.%d: AGP aperture size %u MB (APSIZE %x) is not right, using settings from NB\n",
> +		       bus, slot, func, 32 << *order, apsizereg);
>  		*order = old_order;
>  	}
>  
> -	printk(KERN_INFO "Aperture from AGP @ %Lx size %u MB (APSIZE %x)\n",
> -			aper, 32 << *order, apsizereg);
> +	printk(KERN_INFO "pci 0000:%02x:%02x.%d: AGP aperture [bus %Lx-%Lx] size %u MB (APSIZE %x)\n",
> +	       bus, slot, func, aper, aper + (32 << *order) - 1, 32 << *order,
> +	       apsizereg);
>  
>  	if (!aperture_valid(aper, (32*1024*1024) << *order, 32<<20))
>  		return 0;

Also, you could add:

#define PREFIX "PCI/gart: "

or something like that, to define a standard prefix for these 
messages.

Btw., this file could be moved to arch/x86/pci/?

Otherwise:

  Acked-by: Ingo Molnar <mingo@kernel.org>

Thanks,

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Bjorn Helgaas April 28, 2014, 11:22 p.m. UTC | #2
On Sat, Apr 26, 2014 at 12:01 AM, Ingo Molnar <mingo@kernel.org> wrote:
>
> * Bjorn Helgaas <bhelgaas@google.com> wrote:
>
>> Print the AGP bridge info the same way as the rest of the kernel, e.g.,
>> "0000:00:04.0" instead of "00:04:00".
>>
>> Also print the AGP aperture address range the same way we print resources,
>> and label it explicitly as a bus address range.
>>
>> No functional change.
>>
>> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
>> ---
>>  arch/x86/kernel/aperture_64.c |   20 ++++++++++++--------
>>  1 file changed, 12 insertions(+), 8 deletions(-)
>>
>> diff --git a/arch/x86/kernel/aperture_64.c b/arch/x86/kernel/aperture_64.c
>> index 9fa8aa051f54..4dd76d3df056 100644
>> --- a/arch/x86/kernel/aperture_64.c
>> +++ b/arch/x86/kernel/aperture_64.c
>> @@ -126,10 +126,12 @@ static u32 __init read_agp(int bus, int slot, int func, int cap, u32 *order)
>>       u64 aper;
>>       u32 old_order;
>>
>> -     printk(KERN_INFO "AGP bridge at %02x:%02x:%02x\n", bus, slot, func);
>> +     printk(KERN_INFO "pci 0000:%02x:%02x.%d: AGP bridge\n", bus, slot,
>> +            func);
>
> Please leave it on a single line - checkpatch warning nonwithstanding.
> pr_info() is also useful.
> ...

> Also, you could add:
>
> #define PREFIX "PCI/gart: "
>
> or something like that, to define a standard prefix for these
> messages.

I converted to pr_info(), etc. and added pr_fmt for an "AGP: " prefix.

> Btw., this file could be moved to arch/x86/pci/?

Yes, I'd be glad to do this.  It looks like all the following files
might be candidates:

  amd_gart_64.c  (CONFIG_GART_IOMMU)
  aperture_64.c  (CONFIG_GART_IOMMU)
  pci-calgary_64.c  (CONFIG_CALGARY_IOMMU)
  tce_64.c  (CONFIG_CALGARY_IOMMU)
  mmconf-fam10h_64.c  (CONFIG_PCI_MMCONFIG)

What do you think?  Move all, move none, move only aperture_64.c?

Thanks for your comments!

Bjorn
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ingo Molnar May 7, 2014, 6 p.m. UTC | #3
* Bjorn Helgaas <bhelgaas@google.com> wrote:

> On Sat, Apr 26, 2014 at 12:01 AM, Ingo Molnar <mingo@kernel.org> wrote:
> >
> > * Bjorn Helgaas <bhelgaas@google.com> wrote:
> >
> >> Print the AGP bridge info the same way as the rest of the kernel, e.g.,
> >> "0000:00:04.0" instead of "00:04:00".
> >>
> >> Also print the AGP aperture address range the same way we print resources,
> >> and label it explicitly as a bus address range.
> >>
> >> No functional change.
> >>
> >> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> >> ---
> >>  arch/x86/kernel/aperture_64.c |   20 ++++++++++++--------
> >>  1 file changed, 12 insertions(+), 8 deletions(-)
> >>
> >> diff --git a/arch/x86/kernel/aperture_64.c b/arch/x86/kernel/aperture_64.c
> >> index 9fa8aa051f54..4dd76d3df056 100644
> >> --- a/arch/x86/kernel/aperture_64.c
> >> +++ b/arch/x86/kernel/aperture_64.c
> >> @@ -126,10 +126,12 @@ static u32 __init read_agp(int bus, int slot, int func, int cap, u32 *order)
> >>       u64 aper;
> >>       u32 old_order;
> >>
> >> -     printk(KERN_INFO "AGP bridge at %02x:%02x:%02x\n", bus, slot, func);
> >> +     printk(KERN_INFO "pci 0000:%02x:%02x.%d: AGP bridge\n", bus, slot,
> >> +            func);
> >
> > Please leave it on a single line - checkpatch warning nonwithstanding.
> > pr_info() is also useful.
> > ...
> 
> > Also, you could add:
> >
> > #define PREFIX "PCI/gart: "
> >
> > or something like that, to define a standard prefix for these
> > messages.
> 
> I converted to pr_info(), etc. and added pr_fmt for an "AGP: " prefix.
> 
> > Btw., this file could be moved to arch/x86/pci/?
> 
> Yes, I'd be glad to do this.  It looks like all the following files
> might be candidates:
> 
>   amd_gart_64.c  (CONFIG_GART_IOMMU)
>   aperture_64.c  (CONFIG_GART_IOMMU)
>   pci-calgary_64.c  (CONFIG_CALGARY_IOMMU)
>   tce_64.c  (CONFIG_CALGARY_IOMMU)
>   mmconf-fam10h_64.c  (CONFIG_PCI_MMCONFIG)
> 
> What do you think?  Move all, move none, move only aperture_64.c?
> 
> Thanks for your comments!

Please move all of them, they are really 95% PCI bits:

  Acked-by: Ingo Molnar <mingo@kernel.org>

Thanks,

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

Patch

diff --git a/arch/x86/kernel/aperture_64.c b/arch/x86/kernel/aperture_64.c
index 9fa8aa051f54..4dd76d3df056 100644
--- a/arch/x86/kernel/aperture_64.c
+++ b/arch/x86/kernel/aperture_64.c
@@ -126,10 +126,12 @@  static u32 __init read_agp(int bus, int slot, int func, int cap, u32 *order)
 	u64 aper;
 	u32 old_order;
 
-	printk(KERN_INFO "AGP bridge at %02x:%02x:%02x\n", bus, slot, func);
+	printk(KERN_INFO "pci 0000:%02x:%02x.%d: AGP bridge\n", bus, slot,
+	       func);
 	apsizereg = read_pci_config_16(bus, slot, func, cap + 0x14);
 	if (apsizereg == 0xffffffff) {
-		printk(KERN_ERR "APSIZE in AGP bridge unreadable\n");
+		printk(KERN_ERR "pci 0000:%02x:%02x.%d: APSIZE unreadable\n",
+		       bus, slot, func);
 		return 0;
 	}
 
@@ -153,16 +155,18 @@  static u32 __init read_agp(int bus, int slot, int func, int cap, u32 *order)
 	 * On some sick chips, APSIZE is 0. It means it wants 4G
 	 * so let double check that order, and lets trust AMD NB settings:
 	 */
-	printk(KERN_INFO "Aperture from AGP @ %Lx old size %u MB\n",
-			aper, 32 << old_order);
+	printk(KERN_INFO "pci 0000:%02x:%02x.%d: AGP aperture [bus %Lx-%Lx] old size %u MB\n",
+	       bus, slot, func, aper, aper + (32 << old_order) - 1,
+	       32 << old_order);
 	if (aper + (32ULL<<(20 + *order)) > 0x100000000ULL) {
-		printk(KERN_INFO "Aperture size %u MB (APSIZE %x) is not right, using settings from NB\n",
-				32 << *order, apsizereg);
+		printk(KERN_INFO "pci 0000:%02x:%02x.%d: AGP aperture size %u MB (APSIZE %x) is not right, using settings from NB\n",
+		       bus, slot, func, 32 << *order, apsizereg);
 		*order = old_order;
 	}
 
-	printk(KERN_INFO "Aperture from AGP @ %Lx size %u MB (APSIZE %x)\n",
-			aper, 32 << *order, apsizereg);
+	printk(KERN_INFO "pci 0000:%02x:%02x.%d: AGP aperture [bus %Lx-%Lx] size %u MB (APSIZE %x)\n",
+	       bus, slot, func, aper, aper + (32 << *order) - 1, 32 << *order,
+	       apsizereg);
 
 	if (!aperture_valid(aper, (32*1024*1024) << *order, 32<<20))
 		return 0;