arch: x86: Introduce new config for CPU legacy model names
Add a new config X86_MODEL_TABLE to compile out the legacy model tables
for 32bit systems in order to save space. The new config depends on
X86_32 and PROC_FS.
Model names tables for CPUs that do not have the brand-string CPUIDs
(0x80000002-0x80000004) are kept in field legacy_model in struct
cpu_dev. Previously, this field was wrapped inside ifdef CONFIG_X86_32.
This patch moves this field inside ifdef CONFIG_X86_MODEL_TABLE so that
it can be compiled out on x86-32 systems too.
bloat-o-meter output:
add/remove: 0/0 grow/shrink: 0/9 up/down: 0/-2780 (-2780)
function old new delta
identify_cpu 777 717 -60
umc_cpu_dev 380 40 -340
transmeta_cpu_dev 380 40 -340
nsc_cpu_dev 380 40 -340
intel_cpu_dev 380 40 -340
default_cpu 380 40 -340
cyrix_cpu_dev 380 40 -340
centaur_cpu_dev 380 40 -340
amd_cpu_dev 380 40 -340
Signed-off-by: Catalina Mocanu <catalina.mocanu@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Josh Triplett <josh@joshtriplett.org>
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index f2327e8..72ed8c2 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -314,6 +314,16 @@
If you don't know what to do here, say N.
+config X86_MODEL_TABLE
+ bool "Enable X86 CPU model names table for 32bit systems"
+ depends on X86_32 && PROC_FS
+ default y
+ help
+ This option provides tables of model names for CPUs that do
+ not have the brand-string CPUIDs (0x80000002 through 0x80000004).
+
+ If you want to save space on a 32bit system, set this option to n.
+
config X86_FEATURE_NAMES
bool "Processor feature human-readable names" if EMBEDDED
default y
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 813d29d..1e8f9ab 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -783,7 +783,7 @@
static const struct cpu_dev amd_cpu_dev = {
.c_vendor = "AMD",
.c_ident = { "AuthenticAMD" },
-#ifdef CONFIG_X86_32
+#ifdef CONFIG_X86_MODEL_TABLE
.legacy_models = {
{ .family = 4, .model_names =
{
@@ -796,6 +796,8 @@
}
},
},
+#endif
+#ifdef CONFIG_X86_32
.legacy_cache_size = amd_size_cache,
#endif
.c_early_init = early_init_amd,
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 4b4f78c..b770c54 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -361,7 +361,7 @@
/* Look up CPU names by table lookup. */
static const char *table_lookup_model(struct cpuinfo_x86 *c)
{
-#ifdef CONFIG_X86_32
+#ifdef CONFIG_X86_MODEL_TABLE
const struct legacy_cpu_model_info *info;
if (c->x86_model >= 16)
diff --git a/arch/x86/kernel/cpu/cpu.h b/arch/x86/kernel/cpu/cpu.h
index c37dc37..ff2a55e 100644
--- a/arch/x86/kernel/cpu/cpu.h
+++ b/arch/x86/kernel/cpu/cpu.h
@@ -18,7 +18,8 @@
/* Optional vendor specific routine to obtain the cache size. */
unsigned int (*legacy_cache_size)(struct cpuinfo_x86 *,
unsigned int);
-
+#endif
+#ifdef CONFIG_X86_MODEL_TABLE
/* Family/stepping-based lookup table for model names. */
struct legacy_cpu_model_info {
int family;
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index 1ef4562..06d90ef 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -692,7 +692,7 @@
static const struct cpu_dev intel_cpu_dev = {
.c_vendor = "Intel",
.c_ident = { "GenuineIntel" },
-#ifdef CONFIG_X86_32
+#ifdef CONFIG_X86_MODEL_TABLE
.legacy_models = {
{ .family = 4, .model_names =
{
@@ -743,6 +743,8 @@
}
},
},
+#endif
+#ifdef CONFIG_X86_32
.legacy_cache_size = intel_size_cache,
#endif
.c_detect_tlb = intel_detect_tlb,
diff --git a/arch/x86/kernel/cpu/umc.c b/arch/x86/kernel/cpu/umc.c
index ef9c2a0..b9ecbbf 100644
--- a/arch/x86/kernel/cpu/umc.c
+++ b/arch/x86/kernel/cpu/umc.c
@@ -10,6 +10,7 @@
static const struct cpu_dev umc_cpu_dev = {
.c_vendor = "UMC",
.c_ident = { "UMC UMC UMC" },
+#ifdef CONFIG_X86_MODEL_TABLE
.legacy_models = {
{ .family = 4, .model_names =
{
@@ -18,6 +19,7 @@
}
},
},
+#endif
.c_x86_vendor = X86_VENDOR_UMC,
};