[PATCH] i386: Retrieve CLFLUSH size from CPUID
authorAndi Kleen <ak@suse.de>
Thu, 7 Dec 2006 01:14:05 +0000 (02:14 +0100)
committerAndi Kleen <andi@basil.nowhere.org>
Thu, 7 Dec 2006 01:14:05 +0000 (02:14 +0100)
Also report it in /proc/cpuinfo similar to x86-64.

Needed for followon patch

Signed-off-by: Andi Kleen <ak@suse.de>
arch/i386/kernel/cpu/common.c
arch/i386/kernel/cpu/proc.c
include/asm-i386/processor.h

index 6958ae5e2fa5e3e931125bb0c9d09486e5acd95f..cda41aef79addd18f0fd9a05eff8c39f2356b0e1 100644 (file)
@@ -309,6 +309,8 @@ static void __cpuinit generic_identify(struct cpuinfo_x86 * c)
 #else
                        c->apicid = (ebx >> 24) & 0xFF;
 #endif
+                       if (c->x86_capability[0] & (1<<19))
+                               c->x86_clflush_size = ((ebx >> 8) & 0xff) * 8;
                } else {
                        /* Have CPUID level 0 only - unheard of */
                        c->x86 = 4;
@@ -373,6 +375,7 @@ void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
        c->x86_vendor_id[0] = '\0'; /* Unset */
        c->x86_model_id[0] = '\0';  /* Unset */
        c->x86_max_cores = 1;
+       c->x86_clflush_size = 32;
        memset(&c->x86_capability, 0, sizeof c->x86_capability);
 
        if (!have_cpuid_p()) {
index 76aac088a323de6962de5aeb82ffa7911c8d8265..6624d8583c428a20694641aabba7f0ec6ce9308c 100644 (file)
@@ -152,9 +152,10 @@ static int show_cpuinfo(struct seq_file *m, void *v)
                                seq_printf(m, " [%d]", i);
                }
 
-       seq_printf(m, "\nbogomips\t: %lu.%02lu\n\n",
+       seq_printf(m, "\nbogomips\t: %lu.%02lu\n",
                     c->loops_per_jiffy/(500000/HZ),
                     (c->loops_per_jiffy/(5000/HZ)) % 100);
+       seq_printf(m, "clflush size\t: %u\n\n", c->x86_clflush_size);
 
        return 0;
 }
index f73cf836e6491f951dca57451954c23852005ac7..98fa73b71760e9a4ee972b78060c68d0388cd5b0 100644 (file)
@@ -72,6 +72,7 @@ struct cpuinfo_x86 {
 #endif
        unsigned char x86_max_cores;    /* cpuid returned max cores value */
        unsigned char apicid;
+       unsigned short x86_clflush_size;
 #ifdef CONFIG_SMP
        unsigned char booted_cores;     /* number of cores as seen by OS */
        __u8 phys_proc_id;              /* Physical processor id. */