Commit 02dde8b4 authored by Jan Beulich's avatar Jan Beulich Committed by Ingo Molnar

x86: move various CPU initialization objects into .cpuinit.rodata

Impact: debuggability and micro-optimization

Putting whatever is possible into the (final) .rodata section increases
the likelihood of catching memory corruption bugs early, and reduces
false cache line sharing.
Signed-off-by: default avatarJan Beulich <jbeulich@novell.com>
LKML-Reference: <49B90961.76E4.0078.0@novell.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 821508d4
...@@ -29,7 +29,7 @@ void __cpuinit init_scattered_cpuid_features(struct cpuinfo_x86 *c) ...@@ -29,7 +29,7 @@ void __cpuinit init_scattered_cpuid_features(struct cpuinfo_x86 *c)
u32 regs[4]; u32 regs[4];
const struct cpuid_bit *cb; const struct cpuid_bit *cb;
static const struct cpuid_bit cpuid_bits[] = { static const struct cpuid_bit __cpuinitconst cpuid_bits[] = {
{ X86_FEATURE_IDA, CR_EAX, 1, 0x00000006 }, { X86_FEATURE_IDA, CR_EAX, 1, 0x00000006 },
{ 0, 0, 0, 0 } { 0, 0, 0, 0 }
}; };
......
...@@ -502,7 +502,7 @@ static unsigned int __cpuinit amd_size_cache(struct cpuinfo_x86 *c, unsigned int ...@@ -502,7 +502,7 @@ static unsigned int __cpuinit amd_size_cache(struct cpuinfo_x86 *c, unsigned int
} }
#endif #endif
static struct cpu_dev amd_cpu_dev __cpuinitdata = { static const struct cpu_dev __cpuinitconst amd_cpu_dev = {
.c_vendor = "AMD", .c_vendor = "AMD",
.c_ident = { "AuthenticAMD" }, .c_ident = { "AuthenticAMD" },
#ifdef CONFIG_X86_32 #ifdef CONFIG_X86_32
......
...@@ -468,7 +468,7 @@ centaur_size_cache(struct cpuinfo_x86 *c, unsigned int size) ...@@ -468,7 +468,7 @@ centaur_size_cache(struct cpuinfo_x86 *c, unsigned int size)
return size; return size;
} }
static struct cpu_dev centaur_cpu_dev __cpuinitdata = { static const struct cpu_dev __cpuinitconst centaur_cpu_dev = {
.c_vendor = "Centaur", .c_vendor = "Centaur",
.c_ident = { "CentaurHauls" }, .c_ident = { "CentaurHauls" },
.c_early_init = early_init_centaur, .c_early_init = early_init_centaur,
......
...@@ -25,7 +25,7 @@ static void __cpuinit init_centaur(struct cpuinfo_x86 *c) ...@@ -25,7 +25,7 @@ static void __cpuinit init_centaur(struct cpuinfo_x86 *c)
set_cpu_cap(c, X86_FEATURE_LFENCE_RDTSC); set_cpu_cap(c, X86_FEATURE_LFENCE_RDTSC);
} }
static struct cpu_dev centaur_cpu_dev __cpuinitdata = { static const struct cpu_dev centaur_cpu_dev __cpuinitconst = {
.c_vendor = "Centaur", .c_vendor = "Centaur",
.c_ident = { "CentaurHauls" }, .c_ident = { "CentaurHauls" },
.c_early_init = early_init_centaur, .c_early_init = early_init_centaur,
......
...@@ -70,7 +70,7 @@ cpumask_t cpu_sibling_setup_map; ...@@ -70,7 +70,7 @@ cpumask_t cpu_sibling_setup_map;
#endif /* CONFIG_X86_32 */ #endif /* CONFIG_X86_32 */
static struct cpu_dev *this_cpu __cpuinitdata; static const struct cpu_dev *this_cpu __cpuinitdata;
DEFINE_PER_CPU_PAGE_ALIGNED(struct gdt_page, gdt_page) = { .gdt = { DEFINE_PER_CPU_PAGE_ALIGNED(struct gdt_page, gdt_page) = { .gdt = {
#ifdef CONFIG_X86_64 #ifdef CONFIG_X86_64
...@@ -274,9 +274,9 @@ static void __cpuinit filter_cpuid_features(struct cpuinfo_x86 *c, bool warn) ...@@ -274,9 +274,9 @@ static void __cpuinit filter_cpuid_features(struct cpuinfo_x86 *c, bool warn)
*/ */
/* Look up CPU names by table lookup. */ /* Look up CPU names by table lookup. */
static char __cpuinit *table_lookup_model(struct cpuinfo_x86 *c) static const char *__cpuinit table_lookup_model(struct cpuinfo_x86 *c)
{ {
struct cpu_model_info *info; const struct cpu_model_info *info;
if (c->x86_model >= 16) if (c->x86_model >= 16)
return NULL; /* Range check */ return NULL; /* Range check */
...@@ -321,7 +321,7 @@ void switch_to_new_gdt(int cpu) ...@@ -321,7 +321,7 @@ void switch_to_new_gdt(int cpu)
load_percpu_segment(cpu); load_percpu_segment(cpu);
} }
static struct cpu_dev *cpu_devs[X86_VENDOR_NUM] = {}; static const struct cpu_dev *__cpuinitdata cpu_devs[X86_VENDOR_NUM] = {};
static void __cpuinit default_init(struct cpuinfo_x86 *c) static void __cpuinit default_init(struct cpuinfo_x86 *c)
{ {
...@@ -340,7 +340,7 @@ static void __cpuinit default_init(struct cpuinfo_x86 *c) ...@@ -340,7 +340,7 @@ static void __cpuinit default_init(struct cpuinfo_x86 *c)
#endif #endif
} }
static struct cpu_dev __cpuinitdata default_cpu = { static const struct cpu_dev __cpuinitconst default_cpu = {
.c_init = default_init, .c_init = default_init,
.c_vendor = "Unknown", .c_vendor = "Unknown",
.c_x86_vendor = X86_VENDOR_UNKNOWN, .c_x86_vendor = X86_VENDOR_UNKNOWN,
...@@ -634,12 +634,12 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c) ...@@ -634,12 +634,12 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)
void __init early_cpu_init(void) void __init early_cpu_init(void)
{ {
struct cpu_dev **cdev; const struct cpu_dev *const *cdev;
int count = 0; int count = 0;
printk("KERNEL supported cpus:\n"); printk("KERNEL supported cpus:\n");
for (cdev = __x86_cpu_dev_start; cdev < __x86_cpu_dev_end; cdev++) { for (cdev = __x86_cpu_dev_start; cdev < __x86_cpu_dev_end; cdev++) {
struct cpu_dev *cpudev = *cdev; const struct cpu_dev *cpudev = *cdev;
unsigned int j; unsigned int j;
if (count >= X86_VENDOR_NUM) if (count >= X86_VENDOR_NUM)
...@@ -768,7 +768,7 @@ static void __cpuinit identify_cpu(struct cpuinfo_x86 *c) ...@@ -768,7 +768,7 @@ static void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
/* If the model name is still unset, do table lookup. */ /* If the model name is still unset, do table lookup. */
if (!c->x86_model_id[0]) { if (!c->x86_model_id[0]) {
char *p; const char *p;
p = table_lookup_model(c); p = table_lookup_model(c);
if (p) if (p)
strcpy(c->x86_model_id, p); strcpy(c->x86_model_id, p);
...@@ -847,7 +847,7 @@ struct msr_range { ...@@ -847,7 +847,7 @@ struct msr_range {
unsigned max; unsigned max;
}; };
static struct msr_range msr_range_array[] __cpuinitdata = { static const struct msr_range msr_range_array[] __cpuinitconst = {
{ 0x00000000, 0x00000418}, { 0x00000000, 0x00000418},
{ 0xc0000000, 0xc000040b}, { 0xc0000000, 0xc000040b},
{ 0xc0010000, 0xc0010142}, { 0xc0010000, 0xc0010142},
...@@ -894,7 +894,7 @@ __setup("noclflush", setup_noclflush); ...@@ -894,7 +894,7 @@ __setup("noclflush", setup_noclflush);
void __cpuinit print_cpu_info(struct cpuinfo_x86 *c) void __cpuinit print_cpu_info(struct cpuinfo_x86 *c)
{ {
char *vendor = NULL; const char *vendor = NULL;
if (c->x86_vendor < X86_VENDOR_NUM) if (c->x86_vendor < X86_VENDOR_NUM)
vendor = this_cpu->c_vendor; vendor = this_cpu->c_vendor;
......
...@@ -5,15 +5,15 @@ ...@@ -5,15 +5,15 @@
struct cpu_model_info { struct cpu_model_info {
int vendor; int vendor;
int family; int family;
char *model_names[16]; const char *model_names[16];
}; };
/* attempt to consolidate cpu attributes */ /* attempt to consolidate cpu attributes */
struct cpu_dev { struct cpu_dev {
char * c_vendor; const char * c_vendor;
/* some have two possibilities for cpuid string */ /* some have two possibilities for cpuid string */
char * c_ident[2]; const char * c_ident[2];
struct cpu_model_info c_models[4]; struct cpu_model_info c_models[4];
...@@ -25,11 +25,12 @@ struct cpu_dev { ...@@ -25,11 +25,12 @@ struct cpu_dev {
}; };
#define cpu_dev_register(cpu_devX) \ #define cpu_dev_register(cpu_devX) \
static struct cpu_dev *__cpu_dev_##cpu_devX __used \ static const struct cpu_dev *const __cpu_dev_##cpu_devX __used \
__attribute__((__section__(".x86_cpu_dev.init"))) = \ __attribute__((__section__(".x86_cpu_dev.init"))) = \
&cpu_devX; &cpu_devX;
extern struct cpu_dev *__x86_cpu_dev_start[], *__x86_cpu_dev_end[]; extern const struct cpu_dev *const __x86_cpu_dev_start[],
*const __x86_cpu_dev_end[];
extern void display_cacheinfo(struct cpuinfo_x86 *c); extern void display_cacheinfo(struct cpuinfo_x86 *c);
......
...@@ -61,23 +61,23 @@ static void __cpuinit do_cyrix_devid(unsigned char *dir0, unsigned char *dir1) ...@@ -61,23 +61,23 @@ static void __cpuinit do_cyrix_devid(unsigned char *dir0, unsigned char *dir1)
*/ */
static unsigned char Cx86_dir0_msb __cpuinitdata = 0; static unsigned char Cx86_dir0_msb __cpuinitdata = 0;
static char Cx86_model[][9] __cpuinitdata = { static const char __cpuinitconst Cx86_model[][9] = {
"Cx486", "Cx486", "5x86 ", "6x86", "MediaGX ", "6x86MX ", "Cx486", "Cx486", "5x86 ", "6x86", "MediaGX ", "6x86MX ",
"M II ", "Unknown" "M II ", "Unknown"
}; };
static char Cx486_name[][5] __cpuinitdata = { static const char __cpuinitconst Cx486_name[][5] = {
"SLC", "DLC", "SLC2", "DLC2", "SRx", "DRx", "SLC", "DLC", "SLC2", "DLC2", "SRx", "DRx",
"SRx2", "DRx2" "SRx2", "DRx2"
}; };
static char Cx486S_name[][4] __cpuinitdata = { static const char __cpuinitconst Cx486S_name[][4] = {
"S", "S2", "Se", "S2e" "S", "S2", "Se", "S2e"
}; };
static char Cx486D_name[][4] __cpuinitdata = { static const char __cpuinitconst Cx486D_name[][4] = {
"DX", "DX2", "?", "?", "?", "DX4" "DX", "DX2", "?", "?", "?", "DX4"
}; };
static char Cx86_cb[] __cpuinitdata = "?.5x Core/Bus Clock"; static char Cx86_cb[] __cpuinitdata = "?.5x Core/Bus Clock";
static char cyrix_model_mult1[] __cpuinitdata = "12??43"; static const char __cpuinitconst cyrix_model_mult1[] = "12??43";
static char cyrix_model_mult2[] __cpuinitdata = "12233445"; static const char __cpuinitconst cyrix_model_mult2[] = "12233445";
/* /*
* Reset the slow-loop (SLOP) bit on the 686(L) which is set by some old * Reset the slow-loop (SLOP) bit on the 686(L) which is set by some old
...@@ -435,7 +435,7 @@ static void __cpuinit cyrix_identify(struct cpuinfo_x86 *c) ...@@ -435,7 +435,7 @@ static void __cpuinit cyrix_identify(struct cpuinfo_x86 *c)
} }
} }
static struct cpu_dev cyrix_cpu_dev __cpuinitdata = { static const struct cpu_dev __cpuinitconst cyrix_cpu_dev = {
.c_vendor = "Cyrix", .c_vendor = "Cyrix",
.c_ident = { "CyrixInstead" }, .c_ident = { "CyrixInstead" },
.c_early_init = early_init_cyrix, .c_early_init = early_init_cyrix,
...@@ -446,7 +446,7 @@ static struct cpu_dev cyrix_cpu_dev __cpuinitdata = { ...@@ -446,7 +446,7 @@ static struct cpu_dev cyrix_cpu_dev __cpuinitdata = {
cpu_dev_register(cyrix_cpu_dev); cpu_dev_register(cyrix_cpu_dev);
static struct cpu_dev nsc_cpu_dev __cpuinitdata = { static const struct cpu_dev __cpuinitconst nsc_cpu_dev = {
.c_vendor = "NSC", .c_vendor = "NSC",
.c_ident = { "Geode by NSC" }, .c_ident = { "Geode by NSC" },
.c_init = init_nsc, .c_init = init_nsc,
......
...@@ -410,7 +410,7 @@ static unsigned int __cpuinit intel_size_cache(struct cpuinfo_x86 *c, unsigned i ...@@ -410,7 +410,7 @@ static unsigned int __cpuinit intel_size_cache(struct cpuinfo_x86 *c, unsigned i
} }
#endif #endif
static struct cpu_dev intel_cpu_dev __cpuinitdata = { static const struct cpu_dev __cpuinitconst intel_cpu_dev = {
.c_vendor = "Intel", .c_vendor = "Intel",
.c_ident = { "GenuineIntel" }, .c_ident = { "GenuineIntel" },
#ifdef CONFIG_X86_32 #ifdef CONFIG_X86_32
......
...@@ -32,7 +32,7 @@ struct _cache_table ...@@ -32,7 +32,7 @@ struct _cache_table
}; };
/* all the cache descriptor types we care about (no TLB or trace cache entries) */ /* all the cache descriptor types we care about (no TLB or trace cache entries) */
static struct _cache_table cache_table[] __cpuinitdata = static const struct _cache_table __cpuinitconst cache_table[] =
{ {
{ 0x06, LVL_1_INST, 8 }, /* 4-way set assoc, 32 byte line size */ { 0x06, LVL_1_INST, 8 }, /* 4-way set assoc, 32 byte line size */
{ 0x08, LVL_1_INST, 16 }, /* 4-way set assoc, 32 byte line size */ { 0x08, LVL_1_INST, 16 }, /* 4-way set assoc, 32 byte line size */
...@@ -206,15 +206,15 @@ union l3_cache { ...@@ -206,15 +206,15 @@ union l3_cache {
unsigned val; unsigned val;
}; };
static unsigned short assocs[] __cpuinitdata = { static const unsigned short __cpuinitconst assocs[] = {
[1] = 1, [2] = 2, [4] = 4, [6] = 8, [1] = 1, [2] = 2, [4] = 4, [6] = 8,
[8] = 16, [0xa] = 32, [0xb] = 48, [8] = 16, [0xa] = 32, [0xb] = 48,
[0xc] = 64, [0xc] = 64,
[0xf] = 0xffff // ?? [0xf] = 0xffff // ??
}; };
static unsigned char levels[] __cpuinitdata = { 1, 1, 2, 3 }; static const unsigned char __cpuinitconst levels[] = { 1, 1, 2, 3 };
static unsigned char types[] __cpuinitdata = { 1, 2, 3, 3 }; static const unsigned char __cpuinitconst types[] = { 1, 2, 3, 3 };
static void __cpuinit static void __cpuinit
amd_cpuid4(int leaf, union _cpuid4_leaf_eax *eax, amd_cpuid4(int leaf, union _cpuid4_leaf_eax *eax,
......
...@@ -98,7 +98,7 @@ static void __cpuinit init_transmeta(struct cpuinfo_x86 *c) ...@@ -98,7 +98,7 @@ static void __cpuinit init_transmeta(struct cpuinfo_x86 *c)
#endif #endif
} }
static struct cpu_dev transmeta_cpu_dev __cpuinitdata = { static const struct cpu_dev __cpuinitconst transmeta_cpu_dev = {
.c_vendor = "Transmeta", .c_vendor = "Transmeta",
.c_ident = { "GenuineTMx86", "TransmetaCPU" }, .c_ident = { "GenuineTMx86", "TransmetaCPU" },
.c_early_init = early_init_transmeta, .c_early_init = early_init_transmeta,
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* so no special init takes place. * so no special init takes place.
*/ */
static struct cpu_dev umc_cpu_dev __cpuinitdata = { static const struct cpu_dev __cpuinitconst umc_cpu_dev = {
.c_vendor = "UMC", .c_vendor = "UMC",
.c_ident = { "UMC UMC UMC" }, .c_ident = { "UMC UMC UMC" },
.c_models = { .c_models = {
......
...@@ -226,7 +226,7 @@ static int __devinit set_check_enable_amd_mmconf(const struct dmi_system_id *d) ...@@ -226,7 +226,7 @@ static int __devinit set_check_enable_amd_mmconf(const struct dmi_system_id *d)
return 0; return 0;
} }
static struct dmi_system_id __devinitdata mmconf_dmi_table[] = { static const struct dmi_system_id __cpuinitconst mmconf_dmi_table[] = {
{ {
.callback = set_check_enable_amd_mmconf, .callback = set_check_enable_amd_mmconf,
.ident = "Sun Microsystems Machine", .ident = "Sun Microsystems Machine",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment