Subject: [x86 VIA] Identify number of cores of nano X2 and Quad Core E chips
From: Carsten Emde <C.Emde@osadl.org>
Date: Fri, Aug 31 2012 14:53:51 +0100

The VIA nano X2 and Quad Core E chips have two and four cores on chip,
respectively. This patch is needed to let the kernel correctly
recognize them. The related CPUID definitions were obtained from VIA
Tech Support.

VIA C7 Processor 1000MHz:
Centaur 1 core found on chip

VIA Nano X2 L4050 @ 1.4 GHz:
Centaur 2 cores found on chip

VIA QuadCore L4700 @ 1.2+ GHz:
Centaur 4 cores found on chip

Signed-off-by: Carsten Emde <C.Emde@osadl.org>
CC: Markus Krämer <mkraemer@via-tech.de>
CC: Jörg Erkel <jerkel@hrt.de>
CC: Jessie Wu <JessieWu@via.com.tw>

---
 arch/x86/kernel/cpu/centaur.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Index: linux-3.18.11-rt7/arch/x86/kernel/cpu/centaur.c
===================================================================
@ linux-3.18.11-rt7/arch/x86/kernel/cpu/centaur.c:65 @ static void init_c3(struct cpuinfo_x86 *
 		c->x86_cache_alignment = c->x86_clflush_size * 2;
 		set_cpu_cap(c, X86_FEATURE_REP_GOOD);
 	}
-
+#ifdef CONFIG_SMP
+	c->x86_max_cores = (cpuid_ebx(0x00000001) >> 16) & 0xff;
+	printk(KERN_INFO "Centaur %d logical processor%s on chip\n",
+	    c->x86_max_cores, c->x86_max_cores == 1 ? "" : "s");
+#endif
 	cpu_detect_cache_sizes(c);
 }