x86: cpu/common*.c, merge display_cacheinfo()
authorYinghai Lu <yhlu.kernel@gmail.com>
Fri, 5 Sep 2008 03:09:07 +0000 (20:09 -0700)
committerIngo Molnar <mingo@elte.hu>
Fri, 5 Sep 2008 07:40:51 +0000 (09:40 +0200)
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/cpu/common.c
arch/x86/kernel/cpu/common_64.c

index 2c4bfa2e56ad3bec21fb93fe0e46d464b50e51b3..f9191207718b7112e5b24ce588af13d4d9d1dd8d 100644 (file)
@@ -285,6 +285,10 @@ void __cpuinit display_cacheinfo(struct cpuinfo_x86 *c)
                printk(KERN_INFO "CPU: L1 I Cache: %dK (%d bytes/line), D cache %dK (%d bytes/line)\n",
                                edx>>24, edx&0xFF, ecx>>24, ecx&0xFF);
                c->x86_cache_size = (ecx>>24) + (edx>>24);
+#ifdef CONFIG_X86_64
+               /* On K8 L1 TLB is inclusive, so don't count it */
+               c->x86_tlbsize = 0;
+#endif
        }
 
        if (n < 0x80000006)     /* Some chips just has a large L1. */
@@ -293,6 +297,9 @@ void __cpuinit display_cacheinfo(struct cpuinfo_x86 *c)
        cpuid(0x80000006, &dummy, &ebx, &ecx, &edx);
        l2size = ecx >> 16;
 
+#ifdef CONFIG_X86_64
+       c->x86_tlbsize += ((ebx >> 16) & 0xfff) + (ebx & 0xfff);
+#else
        /* do processor-specific cache resizing */
        if (this_cpu->c_size_cache)
                l2size = this_cpu->c_size_cache(c, l2size);
@@ -303,6 +310,7 @@ void __cpuinit display_cacheinfo(struct cpuinfo_x86 *c)
 
        if (l2size == 0)
                return;         /* Again, no L2 cache is possible */
+#endif
 
        c->x86_cache_size = l2size;
 
index 2fda10974813e0cf49da6fe232f8ac2101bdb3c1..f7a2d524b1e701b41b23e2ab4308abe04b94b4e4 100644 (file)
@@ -285,8 +285,10 @@ void __cpuinit display_cacheinfo(struct cpuinfo_x86 *c)
                printk(KERN_INFO "CPU: L1 I Cache: %dK (%d bytes/line), D cache %dK (%d bytes/line)\n",
                                edx>>24, edx&0xFF, ecx>>24, ecx&0xFF);
                c->x86_cache_size = (ecx>>24) + (edx>>24);
+#ifdef CONFIG_X86_64
                /* On K8 L1 TLB is inclusive, so don't count it */
                c->x86_tlbsize = 0;
+#endif
        }
 
        if (n < 0x80000006)     /* Some chips just has a large L1. */
@@ -294,7 +296,22 @@ void __cpuinit display_cacheinfo(struct cpuinfo_x86 *c)
 
        cpuid(0x80000006, &dummy, &ebx, &ecx, &edx);
        l2size = ecx >> 16;
+
+#ifdef CONFIG_X86_64
        c->x86_tlbsize += ((ebx >> 16) & 0xfff) + (ebx & 0xfff);
+#else
+
+       /* do processor-specific cache resizing */
+       if (this_cpu->c_size_cache)
+               l2size = this_cpu->c_size_cache(c, l2size);
+
+       /* Allow user to override all this if necessary. */
+       if (cachesize_override != -1)
+               l2size = cachesize_override;
+
+       if (l2size == 0)
+               return;         /* Again, no L2 cache is possible */
+#endif
 
        c->x86_cache_size = l2size;
 
This page took 0.026913 seconds and 5 git commands to generate.