linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* AMD64-AGP pb with AGP APERTURE on IWILL DK8N
@ 2004-12-28 20:49 Vincent ETIENNE
  2004-12-30 19:09 ` Andi Kleen
  0 siblings, 1 reply; 5+ messages in thread
From: Vincent ETIENNE @ 2004-12-28 20:49 UTC (permalink / raw)
  To: linux-kernel

Hello ALL,

I have some problem with AGP initialization with my board : IWLL DK8N (Bi 
opteron chipset NFORCE3 ). I use kernel 2.6.10-rc3-mm1, but i have try with 
different kernel always with the same result :

IOMMU reports a 128MB aperture for CPU0 ( that's the value i used in my bios) 
at F0000000 but only 32MB at 4000000 for CPU1 and declare i have no valid 
aperture as show in this dmesg extract. 

Checking aperture...
CPU 0: aperture @ f0000000 size 128 MB
CPU 1: aperture @ 4000000 size 32 MB
Aperture from northbridge cpu 1 too small (32 MB)
AGP bridge at 00:00:00
Aperture from AGP @ f0000000 size 4096 MB (APSIZE 0)
Aperture from AGP bridge too small (0 MB)
Your BIOS doesn't leave a aperture memory hole

So i have forced the value at CPU1 to be the same as CPU0 in 
arch/x86_64/kernel/aperture.c function iommu_hole_init with the following 
code. Don't asked me what i have done i have quite no idea of what is 
involved by this modification. 

I have add 2 var for memorizing value of aperture_size and base of the first 
cpu and set the value of the second one to the value of the first one on case 
they are diferent ( added line marked with a "+" sign ).

void __init iommu_hole_init(void)
{
 int fix, num;
 u32 aper_size, aper_alloc = 0, aper_order;
 u64 aper_base;
+ u32 last_aper_order = 0;
+ u64 last_aper_base = 0;
 int valid_agp = 0;

 if (iommu_aperture_disabled || !fix_aperture)
  return;
 printk("Checking aperture...\n");
 fix = 0;
 for (num = 24; num < 32; num++) {
  char name[30];
  if (read_pci_config(0, num, 3, 0x00) != NB_ID_3)
   continue;

  iommu_aperture = 1;
  aper_order = (read_pci_config(0, num, 3, 0x90) >> 1) & 7;
  aper_size = (32 * 1024 * 1024) << aper_order;
  aper_base = read_pci_config(0, num, 3, 0x94) & 0x7fff;
  aper_base <<= 25;
  printk("CPU %d: aperture @ %Lx size %u MB\n", num-24,
  aper_base, aper_size>>20);
+  if ( last_aper_order )
+ {
+   if ( aper_order != last_aper_order )
+   {
+    printk("Aperture size changed!! use old one (%x,%x)", last_aper_order, 
last_aper_base );
+    write_pci_config(0, num, 3, 0x90, last_aper_order<<1);
+    write_pci_config(0, num, 3, 0x94, last_aper_base>>25);
+    aper_order = last_aper_order;
+    aper_base = last_aper_base;
+    aper_size = (32 * 1024 * 1024) << aper_order;
+   }
+ }
+  last_aper_order = aper_order;
+  last_aper_base = aper_base;

Rest of the code unchanged.

Now agp is enabled 8x, SBA and fast write activated  (as seeen 
in /proc/driver/nvidia/agp/status ) and i'm very pleased but also frustated 
as i have no idea of that i have done.

Do you think it's more a bios problem (something not initialized correctly by 
the bios as it seem ) or could it be a kernel bug ?  Someone could explain 
what value sould be returned ? Is my modification secured (at least for my 
board ) i.e. is this modification could harm some hardware ?

I wish to be personally CC'ed the answers/comment as i'm not a subscriber of a 
list. 

Thanks for your time.

Vincent ETIENNE

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: AMD64-AGP pb with AGP APERTURE on IWILL DK8N
  2004-12-28 20:49 AMD64-AGP pb with AGP APERTURE on IWILL DK8N Vincent ETIENNE
@ 2004-12-30 19:09 ` Andi Kleen
  2005-01-02 14:36   ` Alan Cox
  2005-01-10 20:49   ` Vincent ETIENNE
  0 siblings, 2 replies; 5+ messages in thread
From: Andi Kleen @ 2004-12-30 19:09 UTC (permalink / raw)
  To: Vincent ETIENNE; +Cc: linux-kernel, discuss

Vincent ETIENNE <ve@vetienne.net> writes:


> IOMMU reports a 128MB aperture for CPU0 ( that's the value i used in my bios) 
> at F0000000 but only 32MB at 4000000 for CPU1 and declare i have no valid 
> aperture as show in this dmesg extract. 


First you should complain to your BIOS vendor because it is just another
kind of BIOS bug (of which there seems to be an infinite supply ...) 

> +  if ( last_aper_order )
> + {
> +   if ( aper_order != last_aper_order )
> +   {

> +    printk("Aperture size changed!! use old one (%x,%x)", last_aper_order, 
> last_aper_base );
> +    write_pci_config(0, num, 3, 0x90, last_aper_order<<1);
> +    write_pci_config(0, num, 3, 0x94, last_aper_base>>25);
> +    aper_order = last_aper_order;
> +    aper_base = last_aper_base;
> +    aper_size = (32 * 1024 * 1024) << aper_order;
> +   }

There is already code to do this at the end of the function. A better
patch would be the attached one.

This would also handle the case of a wrong aper_base.

Untested, uncompiled right now.

Can you test if that works on your board? If yes I can add it.

-Andi

Based on debugging&code from Vincent ETIENNE <ve@vetienne.net>

>>
I have some problem with AGP initialization with my board : IWILL DK8N (Bi
opteron chipset NFORCE3 ). I use kernel 2.6.10-rc3-mm1, but i have try with
different kernel always with the same result :

IOMMU reports a 128MB aperture for CPU0 ( that's the value i used in my bios)
at F0000000 but only 32MB at 4000000 for CPU1
<<

This patch checks for this condition and fixes the other CPUs up.

Signed-off-by: Andi Kleen <ak@suse.de>

diff -u linux-2.6.10/arch/x86_64/kernel/aperture.c-o linux-2.6.10/arch/x86_64/kernel/aperture.c
--- linux-2.6.10/arch/x86_64/kernel/aperture.c-o	2004-12-24 22:35:23.000000000 +0100
+++ linux-2.6.10/arch/x86_64/kernel/aperture.c	2004-12-30 19:56:22.000000000 +0100
@@ -200,8 +200,8 @@
 void __init iommu_hole_init(void) 
 { 
 	int fix, num; 
-	u32 aper_size, aper_alloc = 0, aper_order;
-	u64 aper_base; 
+	u32 aper_size, aper_alloc = 0, aper_order, last_aper_order = 0;
+	u64 aper_base, last_aper_base = 0; 
 	int valid_agp = 0;
 
 	if (iommu_aperture_disabled || !fix_aperture)
@@ -230,7 +230,15 @@
 		if (!aperture_valid(name, aper_base, aper_size)) { 
 			fix = 1; 
 			break; 
-		} 
+		}
+
+		if ((last_aper_order && aper_order != last_aper_order) ||
+		    (last_aper_base && aper_base != last_aper_base)) {
+			fix = 1; 
+			break;
+		}
+		last_aper_order = aper_order;
+		last_aper_base = aper_base;
 	} 
 
 	if (!fix && !fallback_aper_force) 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: AMD64-AGP pb with AGP APERTURE on IWILL DK8N
  2004-12-30 19:09 ` Andi Kleen
@ 2005-01-02 14:36   ` Alan Cox
  2005-01-02 20:25     ` Andi Kleen
  2005-01-10 20:49   ` Vincent ETIENNE
  1 sibling, 1 reply; 5+ messages in thread
From: Alan Cox @ 2005-01-02 14:36 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Vincent ETIENNE, Linux Kernel Mailing List, discuss

On Iau, 2004-12-30 at 19:09, Andi Kleen wrote:
> Vincent ETIENNE <ve@vetienne.net> writes:
> There is already code to do this at the end of the function. A better
> patch would be the attached one.
> 
> This would also handle the case of a wrong aper_base.
> 
> Untested, uncompiled right now.

Please make the final version complain in printk as well. That helps
motivate vendors to fix BIOS problems.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: AMD64-AGP pb with AGP APERTURE on IWILL DK8N
  2005-01-02 14:36   ` Alan Cox
@ 2005-01-02 20:25     ` Andi Kleen
  0 siblings, 0 replies; 5+ messages in thread
From: Andi Kleen @ 2005-01-02 20:25 UTC (permalink / raw)
  To: Alan Cox; +Cc: Vincent ETIENNE, Linux Kernel Mailing List, discuss

Alan Cox <alan@lxorguk.ukuu.org.uk> writes:

> On Iau, 2004-12-30 at 19:09, Andi Kleen wrote:
>> Vincent ETIENNE <ve@vetienne.net> writes:
>> There is already code to do this at the end of the function. A better
>> patch would be the attached one.
>> 
>> This would also handle the case of a wrong aper_base.
>> 
>> Untested, uncompiled right now.
>
> Please make the final version complain in printk as well. That helps
> motivate vendors to fix BIOS problems.

The code below complains loudly anyways about a broken aperture.

-Andi

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: AMD64-AGP pb with AGP APERTURE on IWILL DK8N
  2004-12-30 19:09 ` Andi Kleen
  2005-01-02 14:36   ` Alan Cox
@ 2005-01-10 20:49   ` Vincent ETIENNE
  1 sibling, 0 replies; 5+ messages in thread
From: Vincent ETIENNE @ 2005-01-10 20:49 UTC (permalink / raw)
  To: linux-kernel

Le Jeudi 30 Décembre 2004 19:09, vous avez écrit :
> Vincent ETIENNE <ve@vetienne.net> writes:
> > IOMMU reports a 128MB aperture for CPU0 ( that's the value i used in my
> > bios) at F0000000 but only 32MB at 4000000 for CPU1 and declare i have no
> > valid aperture as show in this dmesg extract.
>
> First you should complain to your BIOS vendor because it is just another
> kind of BIOS bug (of which there seems to be an infinite supply ...)
>
> > +  if ( last_aper_order )
> > + {
> > +   if ( aper_order != last_aper_order )
> > +   {
> >
> > +    printk("Aperture size changed!! use old one (%x,%x)",
> > last_aper_order, last_aper_base );
> > +    write_pci_config(0, num, 3, 0x90, last_aper_order<<1);
> > +    write_pci_config(0, num, 3, 0x94, last_aper_base>>25);
> > +    aper_order = last_aper_order;
> > +    aper_base = last_aper_base;
> > +    aper_size = (32 * 1024 * 1024) << aper_order;
> > +   }
>
> There is already code to do this at the end of the function. A better
> patch would be the attached one.
>
> This would also handle the case of a wrong aper_base.
>
> Untested, uncompiled right now.
>
> Can you test if that works on your board? If yes I can add it.
>
> -Andi
>
> Based on debugging&code from Vincent ETIENNE <ve@vetienne.net>
>
>
> I have some problem with AGP initialization with my board : IWILL DK8N (Bi
> opteron chipset NFORCE3 ). I use kernel 2.6.10-rc3-mm1, but i have try with
> different kernel always with the same result :
>
> IOMMU reports a 128MB aperture for CPU0 ( that's the value i used in my
> bios) at F0000000 but only 32MB at 4000000 for CPU1
> <<
>
> This patch checks for this condition and fixes the other CPUs up.
>
> Signed-off-by: Andi Kleen <ak@suse.de>
>
> diff -u linux-2.6.10/arch/x86_64/kernel/aperture.c-o
> linux-2.6.10/arch/x86_64/kernel/aperture.c ---
> linux-2.6.10/arch/x86_64/kernel/aperture.c-o 2004-12-24 22:35:23.000000000
> +0100 +++ linux-2.6.10/arch/x86_64/kernel/aperture.c 2004-12-30
> 19:56:22.000000000 +0100 @@ -200,8 +200,8 @@
>  void __init iommu_hole_init(void)
>  {
>   int fix, num;
> - u32 aper_size, aper_alloc = 0, aper_order;
> - u64 aper_base;
> + u32 aper_size, aper_alloc = 0, aper_order, last_aper_order = 0;
> + u64 aper_base, last_aper_base = 0;
>   int valid_agp = 0;
>
>   if (iommu_aperture_disabled || !fix_aperture)
> @@ -230,7 +230,15 @@
>    if (!aperture_valid(name, aper_base, aper_size)) {
>     fix = 1;
>     break;
> -  }
> +  }
> +
> +  if ((last_aper_order && aper_order != last_aper_order) ||
> +      (last_aper_base && aper_base != last_aper_base)) {
> +   fix = 1;
> +   break;
> +  }
> +  last_aper_order = aper_order;
> +  last_aper_base = aper_base;
>   }
>
>   if (!fix && !fallback_aper_force) )

Many thanks for your time and your effort. As i have replied to 
fa.linux.kernel list, i'm not sure you receive it. Your patch has greatly 
simplify my problem. And it's incorporated in the last mm release 
(2.6.10-mm2). The fallback to AGP works (but the BIOS doesn't initalized AGP 
bridge correctly as well so..). I have sent some information to IWILL 
technician as well as a a link to our discussion and i'm waiting information.

Best regards,

Vincent




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-01-10 20:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-28 20:49 AMD64-AGP pb with AGP APERTURE on IWILL DK8N Vincent ETIENNE
2004-12-30 19:09 ` Andi Kleen
2005-01-02 14:36   ` Alan Cox
2005-01-02 20:25     ` Andi Kleen
2005-01-10 20:49   ` Vincent ETIENNE

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).