i386: mark cpu identify functions as __cpuinit
PATCH 1/6 i386: mark cpu identify functions as __cpuinit
i386: mark cpu identify functions as __cpuinit
Mark i386-specific cpu identification functions as __cpuinit. They are all only called from arch/i386/common.c:identify_cpu() that already is marked as __cpuinit.
---
cyrix.c | 4 ++-- nexgen.c | 4 ++-- transmeta.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)
arch/i386/kernel/cpu/cyrix.c +2 -2
@@ -12,7 +12,7 @@/* * Read NSC/Cyrix DEVID registers (DIR) to get more detailed info. about the CPU */ -static void __init do_cyrix_devid (unsigned char *dir0,unsigned char *dir1) +static void __cpuinit do_cyrix_devid (unsigned char *dir0,unsigned char *dir1) {unsigned char ccr2, ccr3;unsigned long flags;
@@ -394,7 +394,7 @@ static inline int test_cyrix_52div(void)return (unsigned char ) (test >>8 ) ==0x02 ; } -static void cyrix_identify (struct cpuinfo_x86 * c) +static void __cpuinit cyrix_identify (struct cpuinfo_x86 * c) {/* Detect Cyrix with disabled CPUID */ if ( c->x86 ==4 &&test_cyrix_52div () ) {
arch/i386/kernel/cpu/nexgen.c +2 -2
@@ -10,7 +10,7 @@* to have CPUID. (Thanks to Herbert Oppmann) */ -static int __init deep_magic_nexgen_probe (void ) +static int __cpuinit deep_magic_nexgen_probe (void ) {int ret;
@@ -32,7 +32,7 @@ static void __init init_nexgen(struct cp c->x86_cache_size =256 ;/* A few had 1 MB... */ } -static void __init nexgen_identify (struct cpuinfo_x86 * c) +static void __cpuinit nexgen_identify (struct cpuinfo_x86 * c) {/* Detect NexGen with old hypercode */ if (deep_magic_nexgen_probe () ) {
arch/i386/kernel/cpu/transmeta.c +1 -1
@@ -85,7 +85,7 @@ static void __init init_transmeta(struct#endif } -static void __init transmeta_identify (struct cpuinfo_x86 * c) +static void __cpuinit transmeta_identify (struct cpuinfo_x86 * c) {u32 xlvl;generic_identify (c);
PATCH 2/6 i386: remove redundant generic_identify() calls when identifying cpus
i386: remove redundant generic_identify() calls when identifying cpus
cpu_dev->c_identify is only called from arch/i386/common.c:identify_cpu(), and this after generic_identify() already has been called. There is no need to call this function twice and hook it in c_identify - but I may be wrong, please double check before applying.
This patch also removes generic_identify() from cpu.h to avoid unnecessary future nesting.
---
amd.c | 1 - common.c | 2 +- cpu.h | 2 -- cyrix.c | 2 -- intel.c | 1 - nexgen.c | 1 - transmeta.c | 1 - 7 files changed, 1 insertion(+), 9 deletions(-)
arch/i386/kernel/cpu/amd.c +0 -1
@@ -275,7 +275,6 @@ static struct cpu_dev amd_cpu_dev __init }, }, .c_init = init_amd, - .c_identify = generic_identify, .c_size_cache = amd_size_cache, };
arch/i386/kernel/cpu/common.c +1 -1
@@ -265,7 +265,7 @@ static void __init early_cpu_detect(void } } -void __cpuinit generic_identify (struct cpuinfo_x86 * c) +static void __cpuinit generic_identify (struct cpuinfo_x86 * c) {u32 tfms, xlvl;int ebx;
arch/i386/kernel/cpu/cpu.h +0 -2
@@ -24,7 +24,5 @@ extern struct cpu_dev * cpu_devs [X86_VEextern int get_model_name (struct cpuinfo_x86 *c);extern void display_cacheinfo (struct cpuinfo_x86 *c); -extern void generic_identify (struct cpuinfo_x86 * c); -extern void early_intel_workaround (struct cpuinfo_x86 *c);
arch/i386/kernel/cpu/cyrix.c +0 -2
@@ -427,7 +427,6 @@ static void __cpuinit cyrix_identify(strlocal_irq_restore (flags); } } -generic_identify (c); }static struct cpu_dev cyrix_cpu_dev__initdata = {
@@ -457,7 +456,6 @@ static struct cpu_dev nsc_cpu_dev __init .c_vendor = "NSC", .c_ident = { "Geode by NSC" }, .c_init = init_nsc, - .c_identify = generic_identify, };int __init nsc_init_cpu (void )
arch/i386/kernel/cpu/intel.c +0 -1
@@ -263,7 +263,6 @@ static struct cpu_dev intel_cpu_dev __cp }, }, .c_init = init_intel, - .c_identify = generic_identify, .c_size_cache = intel_size_cache, };
arch/i386/kernel/cpu/nexgen.c +0 -1
@@ -38,7 +38,6 @@ static void __cpuinit nexgen_identify(stif (deep_magic_nexgen_probe () ) {strcpy (c->x86_vendor_id,"NexGenDriven" ); } -generic_identify (c); }static struct cpu_dev nexgen_cpu_dev__initdata = {
arch/i386/kernel/cpu/transmeta.c +0 -1
@@ -88,7 +88,6 @@ static void __init init_transmeta(structstatic void __cpuinit transmeta_identify (struct cpuinfo_x86 * c) {u32 xlvl; -generic_identify (c);/* Transmeta-defined flags: level 0x80860001 */ xlvl =cpuid_eax (0x80860000 );
Re: [PATCH 02/06] i386: remove redundant generic_identify() calls when identifying cpus
Quoted 9 lines · Magnus Damm
i386: remove redundant
generic_identify()calls when identifying cpus
cpu_dev->c_identifyis only called from arch/i386/common.c:identify_cpu(), and this aftergeneric_identify()already has been called. There is no need to call this function twice and hook it inc_identify- but I may be wrong, please double check before applying.This patch also removes
generic_identify()fromcpu.hto avoid unnecessary future nesting.
There are sometimes subtle interactions with this (e.g. with parameters changing flags and then someone else overwriting them again)
But agreed it seems bogus to call it twice.
I guess the only way to find out how much it breaks is to merge it.
-Andi
PATCH 3/6 i386: mark cpu init functions as __cpuinit, data as __cpuinitdata
In reply to Magnus Dammi386: mark cpu init functions as __cpuinit, data as __cpuinitdata
Mark i386-specific cpu init functions as __cpuinit. They are all only called from arch/i386/common.c:identify_cpu() that already is marked as __cpuinit. This patch also removes the empty function init_umc().
---
amd.c | 2 +- centaur.c | 20 ++++++++++---------- common.c | 2 +- cyrix.c | 32 ++++++++++++++++---------------- nexgen.c | 2 +- rise.c | 2 +- transmeta.c | 2 +- umc.c | 6 ------ 8 files changed, 31 insertions(+), 37 deletions(-)
arch/i386/kernel/cpu/amd.c +1 -1
@@ -22,7 +22,7 @@extern void vide (void ); __asm__(".align 4\nvide: ret" ); -static void __init init_amd (struct cpuinfo_x86 *c) +static void __cpuinit init_amd (struct cpuinfo_x86 *c) {u32 l, h;int mbytes = num_physpages >> (20 -PAGE_SHIFT );
arch/i386/kernel/cpu/centaur.c +10 -10
@@ -9,7 +9,7 @@#ifdef CONFIG_X86_OOSTORE -static u32 __init power2 (u32 x) +static u32 __cpuinit power2 (u32 x) {u32 s=1 ;while (s<=x)
@@ -22,7 +22,7 @@ static u32 __init power2(u32 x)* Set up an actual MCR */ -static void __init centaur_mcr_insert (int reg,u32 base,u32 size,int key) +static void __cpuinit centaur_mcr_insert (int reg,u32 base,u32 size,int key) {u32 lo, hi;
@@ -40,7 +40,7 @@ static void __init centaur_mcr_insert(in* Shortcut: We know you can't put 4Gig of RAM on a winchip */ -static u32 __init ramtop (void )/* 16388 */ +static u32 __cpuinit ramtop (void )/* 16388 */ {int i;u32 top =0 ;
@@ -91,7 +91,7 @@ static u32 __init ramtop(void) /* 16388* Compute a set of MCR's to give maximum coverage */ -static int __init centaur_mcr_compute (int nr,int key) +static int __cpuinit centaur_mcr_compute (int nr,int key) {u32 mem =ramtop ();u32 root =power2 (mem);
@@ -166,7 +166,7 @@ static int __init centaur_mcr_compute(inreturn ct; } -static void __init centaur_create_optimal_mcr (void ) +static void __cpuinit centaur_create_optimal_mcr (void ) {int i;/*
@@ -189,7 +189,7 @@ static void __init centaur_create_optimawrmsr (MSR_IDT_MCR0 +i,0 ,0 ); } -static void __init winchip2_create_optimal_mcr (void ) +static void __cpuinit winchip2_create_optimal_mcr (void ) {u32 lo, hi;int i;
@@ -227,7 +227,7 @@ static void __init winchip2_create_optim* Handle the MCR key on the Winchip 2. */ -static void __init winchip2_unprotect_mcr (void ) +static void __cpuinit winchip2_unprotect_mcr (void ) {u32 lo, hi;u32 key;
@@ -239,7 +239,7 @@ static void __init winchip2_unprotect_mcwrmsr (MSR_IDT_MCR_CTRL , lo, hi); } -static void __init winchip2_protect_mcr (void ) +static void __cpuinit winchip2_protect_mcr (void ) {u32 lo, hi;
@@ -257,7 +257,7 @@ static void __init winchip2_protect_mcr(#define RNG_ENABLED (1 << 3)#define RNG_ENABLE (1 << 6)/* MSR_VIA_RNG */ -static void __init init_c3 (struct cpuinfo_x86 *c) +static void __cpuinit init_c3 (struct cpuinfo_x86 *c) {u32 lo, hi;
@@ -303,7 +303,7 @@ static void __init init_c3(struct cpuinfdisplay_cacheinfo (c); } -static void __init init_centaur (struct cpuinfo_x86 *c) +static void __cpuinit init_centaur (struct cpuinfo_x86 *c) {enum {ECX8 =1 <<1 ,
arch/i386/kernel/cpu/common.c +1 -1
@@ -36,7 +36,7 @@ struct cpu_dev * cpu_devs[X86_VENDOR_NUMextern int disable_pse; -static void default_init (struct cpuinfo_x86 * c) +static void __cpuinit default_init (struct cpuinfo_x86 * c) {/* Not much we can do here... */ /* Check if at least it has cpuid */
arch/i386/kernel/cpu/cyrix.c +16 -16
@@ -52,25 +52,25 @@ static void __cpuinit do_cyrix_devid(uns* Actually since bugs.h doesn't even reference this perhaps someone should * fix the documentation ??? */ -static unsigned char Cx86_dir0_msb__initdata =0 ; +static unsigned char Cx86_dir0_msb__cpuinitdata =0 ; -static char Cx86_model[][9 ]__initdata = { +static char Cx86_model[][9 ]__cpuinitdata = {"Cx486" ,"Cx486" ,"5x86 " ,"6x86" ,"MediaGX " ,"6x86MX " ,"M II " ,"Unknown" }; -static char Cx486_name[][5 ]__initdata = { +static char Cx486_name[][5 ]__cpuinitdata = {"SLC" ,"DLC" ,"SLC2" ,"DLC2" ,"SRx" ,"DRx" ,"SRx2" ,"DRx2" }; -static char Cx486S_name[][4 ]__initdata = { +static char Cx486S_name[][4 ]__cpuinitdata = {"S" ,"S2" ,"Se" ,"S2e" }; -static char Cx486D_name[][4 ]__initdata = { +static char Cx486D_name[][4 ]__cpuinitdata = {"DX" ,"DX2" ,"?" ,"?" ,"?" ,"DX4" }; -static char Cx86_cb[]__initdata ="?.5x Core/Bus Clock" ; -static char cyrix_model_mult1[]__initdata ="12??43" ; -static char cyrix_model_mult2[]__initdata ="12233445" ; +static char Cx86_cb[]__cpuinitdata ="?.5x Core/Bus Clock" ; +static char cyrix_model_mult1[]__cpuinitdata ="12??43" ; +static char cyrix_model_mult2[]__cpuinitdata ="12233445" ;/* * Reset the slow-loop (SLOP) bit on the 686(L) which is set by some old
@@ -82,7 +82,7 @@ static char cyrix_model_mult2[] __initdaextern void calibrate_delay (void )__init ; -static void __init check_cx686_slop (struct cpuinfo_x86 *c) +static void __cpuinit check_cx686_slop (struct cpuinfo_x86 *c) {unsigned long flags;
@@ -107,7 +107,7 @@ static void __init check_cx686_slop(stru } -static void __init set_cx86_reorder (void ) +static void __cpuinit set_cx86_reorder (void ) {u8 ccr3;
@@ -122,7 +122,7 @@ static void __init set_cx86_reorder(voidsetCx86 (CX86_CCR3 , ccr3); } -static void __init set_cx86_memwb (void ) +static void __cpuinit set_cx86_memwb (void ) {u32 cr0;
@@ -137,7 +137,7 @@ static void __init set_cx86_memwb(void)setCx86 (CX86_CCR2 ,getCx86 (CX86_CCR2 ) |0x14 ); } -static void __init set_cx86_inc (void ) +static void __cpuinit set_cx86_inc (void ) {unsigned char ccr3;
@@ -158,7 +158,7 @@ static void __init set_cx86_inc(void)* Configure later MediaGX and/or Geode processor. */ -static void __init geode_configure (void ) +static void __cpuinit geode_configure (void ) {unsigned long flags;u8 ccr3, ccr4;
@@ -184,14 +184,14 @@ static void __init geode_configure(void)#ifdef CONFIG_PCI -static struct pci_device_id __initdata cyrix_55x0[] = { +static struct pci_device_id __cpuinitdata cyrix_55x0[] = { {PCI_DEVICE (PCI_VENDOR_ID_CYRIX ,PCI_DEVICE_ID_CYRIX_5510 ) }, {PCI_DEVICE (PCI_VENDOR_ID_CYRIX ,PCI_DEVICE_ID_CYRIX_5520 ) }, { }, };#endif -static void __init init_cyrix (struct cpuinfo_x86 *c) +static void __cpuinit init_cyrix (struct cpuinfo_x86 *c) {unsigned char dir0, dir0_msn, dir0_lsn, dir1 =0 ;char *buf = c->x86_model_id;
@@ -346,7 +346,7 @@ static void __init init_cyrix(struct cpu/* * Handle National Semiconductor branded processors */ -static void __init init_nsc (struct cpuinfo_x86 *c) +static void __cpuinit init_nsc (struct cpuinfo_x86 *c) {/* There may be GX1 processors in the wild that are branded * NSC and not Cyrix.
arch/i386/kernel/cpu/nexgen.c +1 -1
@@ -27,7 +27,7 @@ static int __cpuinit deep_magic_nexgen_preturn ret; } -static void __init init_nexgen (struct cpuinfo_x86 * c) +static void __cpuinit init_nexgen (struct cpuinfo_x86 * c) { c->x86_cache_size =256 ;/* A few had 1 MB... */ }
arch/i386/kernel/cpu/rise.c +1 -1
@@ -5,7 +5,7 @@#include "cpu.h" -static void __init init_rise (struct cpuinfo_x86 *c) +static void __cpuinit init_rise (struct cpuinfo_x86 *c) {printk ("CPU: Rise iDragon" );if (c->x86_model >2 )
arch/i386/kernel/cpu/transmeta.c +1 -1
@@ -5,7 +5,7 @@#include <asm/msr.h> #include "cpu.h" -static void __init init_transmeta (struct cpuinfo_x86 *c) +static void __cpuinit init_transmeta (struct cpuinfo_x86 *c) {unsigned int cap_mask, uk, max, dummy;unsigned int cms_rev1, cms_rev2;
arch/i386/kernel/cpu/umc.c +0 -6
@@ -5,11 +5,6 @@/* UMC chips appear to be only either 386 or 486, so no special init takes place. */ -static void __init init_umc (struct cpuinfo_x86 * c) -{ - -} -static struct cpu_dev umc_cpu_dev__initdata = { .c_vendor ="UMC" , .c_ident = {"UMC UMC UMC" },
@@ -21,7 +16,6 @@ static struct cpu_dev umc_cpu_dev __init } }, }, - .c_init = init_umc, };int __init umc_init_cpu (void )
PATCH 4/6 i386: mark cpu cache functions as __cpuinit
In reply to Magnus Dammi386: mark cpu cache functions as __cpuinit
Mark i386-specific cpu cache functions as __cpuinit. They are all only called from arch/i386/common.c:display_cache_info() that already is marked as __cpuinit.
---
amd.c | 2 +- centaur.c | 2 +- intel.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
arch/i386/kernel/cpu/amd.c +1 -1
@@ -246,7 +246,7 @@ static void __cpuinit init_amd(struct cp num_cache_leaves =3 ; } -static unsigned int amd_size_cache (struct cpuinfo_x86 * c,unsigned int size) +static unsigned int __cpuinit amd_size_cache (struct cpuinfo_x86 * c,unsigned int size) {/* AMD errata T13 (order #21922) */ if ((c->x86 ==6 )) {
arch/i386/kernel/cpu/centaur.c +1 -1
@@ -442,7 +442,7 @@ static void __cpuinit init_centaur(struc } } -static unsigned int centaur_size_cache (struct cpuinfo_x86 * c,unsigned int size) +static unsigned int __cpuinit centaur_size_cache (struct cpuinfo_x86 * c,unsigned int size) {/* VIA C3 CPUs (670-68F) need further shifting. */ if ((c->x86 ==6 ) && ((c->x86_model ==7 ) || (c->x86_model ==8 )))
arch/i386/kernel/cpu/intel.c +1 -1
@@ -198,7 +198,7 @@ static void __cpuinit init_intel(struct } -static unsigned int intel_size_cache (struct cpuinfo_x86 * c,unsigned int size) +static unsigned int __cpuinit intel_size_cache (struct cpuinfo_x86 * c,unsigned int size) {/* Intel PIII Tualatin. This comes in two flavours. * One has 256kb of cache, the other 512. We have no way
PATCH 5/6 i386: mark cpu_dev structures as __cpuinitdata
In reply to Magnus Dammi386: mark cpu_dev structures as __cpuinitdata
The different cpu_dev structures are all used from __cpuinit callers what I can tell. So mark them as __cpuinitdata instead of __initdata. I am a little bit unsure about arch/i386/common.c:default_cpu, especially when it comes to the purpose of this_cpu.
---
amd.c | 2 +- centaur.c | 2 +- common.c | 2 +- cyrix.c | 4 ++-- nexgen.c | 2 +- rise.c | 2 +- transmeta.c | 2 +- umc.c | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-)
arch/i386/kernel/cpu/amd.c +1 -1
@@ -259,7 +259,7 @@ static unsigned int __cpuinit amd_size_creturn size; } -static struct cpu_dev amd_cpu_dev__initdata = { +static struct cpu_dev amd_cpu_dev__cpuinitdata = { .c_vendor ="AMD" , .c_ident = {"AuthenticAMD" }, .c_models = {
arch/i386/kernel/cpu/centaur.c +1 -1
@@ -457,7 +457,7 @@ static unsigned int __cpuinit centaur_sireturn size; } -static struct cpu_dev centaur_cpu_dev__initdata = { +static struct cpu_dev centaur_cpu_dev__cpuinitdata = { .c_vendor ="Centaur" , .c_ident = {"CentaurHauls" }, .c_init = init_centaur,
arch/i386/kernel/cpu/common.c +1 -1
@@ -49,7 +49,7 @@ static void __cpuinit default_init(struc } } -static struct cpu_dev default_cpu = { +static struct cpu_dev __cpuinitdata default_cpu = { .c_init = default_init, .c_vendor ="Unknown" , };
arch/i386/kernel/cpu/cyrix.c +2 -2
@@ -429,7 +429,7 @@ static void __cpuinit cyrix_identify(str } } -static struct cpu_dev cyrix_cpu_dev__initdata = { +static struct cpu_dev cyrix_cpu_dev__cpuinitdata = { .c_vendor ="Cyrix" , .c_ident = {"CyrixInstead" }, .c_init = init_cyrix,
@@ -452,7 +452,7 @@ static int __init cyrix_exit_cpu(void)late_initcall (cyrix_exit_cpu); -static struct cpu_dev nsc_cpu_dev__initdata = { +static struct cpu_dev nsc_cpu_dev__cpuinitdata = { .c_vendor ="NSC" , .c_ident = {"Geode by NSC" }, .c_init = init_nsc,
arch/i386/kernel/cpu/nexgen.c +1 -1
@@ -40,7 +40,7 @@ static void __cpuinit nexgen_identify(st } } -static struct cpu_dev nexgen_cpu_dev__initdata = { +static struct cpu_dev nexgen_cpu_dev__cpuinitdata = { .c_vendor ="Nexgen" , .c_ident = {"NexGenDriven" }, .c_models = {
arch/i386/kernel/cpu/rise.c +1 -1
@@ -28,7 +28,7 @@ static void __cpuinit init_rise(struct cset_bit (X86_FEATURE_CX8 , c->x86_capability); } -static struct cpu_dev rise_cpu_dev__initdata = { +static struct cpu_dev rise_cpu_dev__cpuinitdata = { .c_vendor ="Rise" , .c_ident = {"RiseRiseRise" }, .c_models = {
arch/i386/kernel/cpu/transmeta.c +1 -1
@@ -97,7 +97,7 @@ static void __cpuinit transmeta_identify } } -static struct cpu_dev transmeta_cpu_dev__initdata = { +static struct cpu_dev transmeta_cpu_dev__cpuinitdata = { .c_vendor ="Transmeta" , .c_ident = {"GenuineTMx86" ,"TransmetaCPU" }, .c_init = init_transmeta,
arch/i386/kernel/cpu/umc.c +1 -1
@@ -5,7 +5,7 @@/* UMC chips appear to be only either 386 or 486, so no special init takes place. */ -static struct cpu_dev umc_cpu_dev__initdata = { +static struct cpu_dev umc_cpu_dev__cpuinitdata = { .c_vendor ="UMC" , .c_ident = {"UMC UMC UMC" }, .c_models = {
PATCH 6/6 x86_64: mark init_amd() as __cpuinit
In reply to Magnus Dammx86_64: mark init_amd() as __cpuinit
The init_amd() function is only called from identify_cpu() which is already marked as __cpuinit. So let's mark it as __cpuinit.
---
setup.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-)
arch/x86_64/kernel/setup.c +1 -1
@@ -833,7 +833,7 @@ static void __init amd_detect_cmp(struct#endif } -static void __init init_amd (struct cpuinfo_x86 *c) +static void __cpuinit init_amd (struct cpuinfo_x86 *c) {unsigned level;
Re: [PATCH 06/06] x86_64: mark init_amd() as __cpuinit
Quoted 4 lines · Magnus Damm
x86_64: markinit_amd()as__cpuinitThe
init_amd()function is only called fromidentify_cpu()which is already marked as__cpuinit. So let's mark it as__cpuinit.
I added all 6 patches. Thanks.
-Andi
PATCH 1/1 i386: mark tsc_init() as __init
In reply to Magnus Dammi386: mark tsc_init() as __init
tsc_init() is only called from setup_arch() which is marked as __init.
---
tsc.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-)
arch/i386/kernel/tsc.c +1 -1
@@ -192,7 +192,7 @@ int recalibrate_cpu_khz(void)EXPORT_SYMBOL (recalibrate_cpu_khz); -void tsc_init (void ) +void __init tsc_init (void ) {if (!cpu_has_tsc || tsc_disable)return ;