aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86_64
diff options
context:
space:
mode:
authorAshok Raj <ashok.raj@intel.com>2005-06-25 17:54:58 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-25 19:24:30 -0400
commite6982c671c560da4a0bc5c908cbcbec12bd5991d (patch)
tree38e317c28afbde68d431ae139e9e943e5a818b06 /arch/x86_64
parent52a119feaad92d44a0e97d01b22afbcbaf3fc079 (diff)
[PATCH] x86_64: Change init sections for CPU hotplug support
This patch adds __cpuinit and __cpuinitdata sections that need to exist past boot to support cpu hotplug. Caveat: This is done *only* for EM64T CPU Hotplug support, on request from Andi Kleen. Much of the generic hotplug code in kernel, and none of the other archs that support CPU hotplug today, i386, ia64, ppc64, s390 and parisc dont mark sections with __cpuinit, but only mark them as __devinit, and __devinitdata. If someone is motivated to change generic code, we need to make sure all existing hotplug code does not break, on other arch's that dont use __cpuinit, and __cpudevinit. Signed-off-by: Ashok Raj <ashok.raj@intel.com> Acked-by: Andi Kleen <ak@muc.de> Acked-by: Zwane Mwaikambo <zwane@arm.linux.org.uk> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/x86_64')
-rw-r--r--arch/x86_64/kernel/apic.c8
-rw-r--r--arch/x86_64/kernel/i387.c2
-rw-r--r--arch/x86_64/kernel/mce.c8
-rw-r--r--arch/x86_64/kernel/mce_intel.c4
-rw-r--r--arch/x86_64/kernel/nmi.c4
-rw-r--r--arch/x86_64/kernel/process.c2
-rw-r--r--arch/x86_64/kernel/setup.c18
-rw-r--r--arch/x86_64/kernel/setup64.c6
-rw-r--r--arch/x86_64/kernel/smpboot.c15
-rw-r--r--arch/x86_64/mm/numa.c2
10 files changed, 32 insertions, 37 deletions
diff --git a/arch/x86_64/kernel/apic.c b/arch/x86_64/kernel/apic.c
index f8e6cc4fecd4..2a6c893ccf60 100644
--- a/arch/x86_64/kernel/apic.c
+++ b/arch/x86_64/kernel/apic.c
@@ -285,7 +285,7 @@ void __init init_bsp_APIC(void)
285 apic_write_around(APIC_LVT1, value); 285 apic_write_around(APIC_LVT1, value);
286} 286}
287 287
288void __init setup_local_APIC (void) 288void __cpuinit setup_local_APIC (void)
289{ 289{
290 unsigned int value, ver, maxlvt; 290 unsigned int value, ver, maxlvt;
291 291
@@ -534,7 +534,7 @@ static struct sys_device device_lapic = {
534 .cls = &lapic_sysclass, 534 .cls = &lapic_sysclass,
535}; 535};
536 536
537static void __init apic_pm_activate(void) 537static void __cpuinit apic_pm_activate(void)
538{ 538{
539 apic_pm_state.active = 1; 539 apic_pm_state.active = 1;
540} 540}
@@ -774,14 +774,14 @@ void __init setup_boot_APIC_clock (void)
774 local_irq_enable(); 774 local_irq_enable();
775} 775}
776 776
777void __init setup_secondary_APIC_clock(void) 777void __cpuinit setup_secondary_APIC_clock(void)
778{ 778{
779 local_irq_disable(); /* FIXME: Do we need this? --RR */ 779 local_irq_disable(); /* FIXME: Do we need this? --RR */
780 setup_APIC_timer(calibration_result); 780 setup_APIC_timer(calibration_result);
781 local_irq_enable(); 781 local_irq_enable();
782} 782}
783 783
784void __init disable_APIC_timer(void) 784void __cpuinit disable_APIC_timer(void)
785{ 785{
786 if (using_apic_timer) { 786 if (using_apic_timer) {
787 unsigned long v; 787 unsigned long v;
diff --git a/arch/x86_64/kernel/i387.c b/arch/x86_64/kernel/i387.c
index ba139cac57ce..d9b22b633e39 100644
--- a/arch/x86_64/kernel/i387.c
+++ b/arch/x86_64/kernel/i387.c
@@ -42,7 +42,7 @@ void mxcsr_feature_mask_init(void)
42 * Called at bootup to set up the initial FPU state that is later cloned 42 * Called at bootup to set up the initial FPU state that is later cloned
43 * into all processes. 43 * into all processes.
44 */ 44 */
45void __init fpu_init(void) 45void __cpuinit fpu_init(void)
46{ 46{
47 unsigned long oldcr0 = read_cr0(); 47 unsigned long oldcr0 = read_cr0();
48 extern void __bad_fxsave_alignment(void); 48 extern void __bad_fxsave_alignment(void);
diff --git a/arch/x86_64/kernel/mce.c b/arch/x86_64/kernel/mce.c
index 3a89d735a4f6..7ab15c8ab95f 100644
--- a/arch/x86_64/kernel/mce.c
+++ b/arch/x86_64/kernel/mce.c
@@ -327,7 +327,7 @@ static void mce_init(void *dummy)
327} 327}
328 328
329/* Add per CPU specific workarounds here */ 329/* Add per CPU specific workarounds here */
330static void __init mce_cpu_quirks(struct cpuinfo_x86 *c) 330static void __cpuinit mce_cpu_quirks(struct cpuinfo_x86 *c)
331{ 331{
332 /* This should be disabled by the BIOS, but isn't always */ 332 /* This should be disabled by the BIOS, but isn't always */
333 if (c->x86_vendor == X86_VENDOR_AMD && c->x86 == 15) { 333 if (c->x86_vendor == X86_VENDOR_AMD && c->x86 == 15) {
@@ -337,7 +337,7 @@ static void __init mce_cpu_quirks(struct cpuinfo_x86 *c)
337 } 337 }
338} 338}
339 339
340static void __init mce_cpu_features(struct cpuinfo_x86 *c) 340static void __cpuinit mce_cpu_features(struct cpuinfo_x86 *c)
341{ 341{
342 switch (c->x86_vendor) { 342 switch (c->x86_vendor) {
343 case X86_VENDOR_INTEL: 343 case X86_VENDOR_INTEL:
@@ -352,7 +352,7 @@ static void __init mce_cpu_features(struct cpuinfo_x86 *c)
352 * Called for each booted CPU to set up machine checks. 352 * Called for each booted CPU to set up machine checks.
353 * Must be called with preempt off. 353 * Must be called with preempt off.
354 */ 354 */
355void __init mcheck_init(struct cpuinfo_x86 *c) 355void __cpuinit mcheck_init(struct cpuinfo_x86 *c)
356{ 356{
357 static cpumask_t mce_cpus __initdata = CPU_MASK_NONE; 357 static cpumask_t mce_cpus __initdata = CPU_MASK_NONE;
358 358
@@ -542,7 +542,7 @@ ACCESSOR(bank4ctl,bank[4],mce_restart())
542ACCESSOR(tolerant,tolerant,) 542ACCESSOR(tolerant,tolerant,)
543ACCESSOR(check_interval,check_interval,mce_restart()) 543ACCESSOR(check_interval,check_interval,mce_restart())
544 544
545static __init int mce_init_device(void) 545static __cpuinit int mce_init_device(void)
546{ 546{
547 int err; 547 int err;
548 if (!mce_available(&boot_cpu_data)) 548 if (!mce_available(&boot_cpu_data))
diff --git a/arch/x86_64/kernel/mce_intel.c b/arch/x86_64/kernel/mce_intel.c
index 4db9a640069f..0be0a7959814 100644
--- a/arch/x86_64/kernel/mce_intel.c
+++ b/arch/x86_64/kernel/mce_intel.c
@@ -42,7 +42,7 @@ done:
42 irq_exit(); 42 irq_exit();
43} 43}
44 44
45static void __init intel_init_thermal(struct cpuinfo_x86 *c) 45static void __cpuinit intel_init_thermal(struct cpuinfo_x86 *c)
46{ 46{
47 u32 l, h; 47 u32 l, h;
48 int tm2 = 0; 48 int tm2 = 0;
@@ -93,7 +93,7 @@ static void __init intel_init_thermal(struct cpuinfo_x86 *c)
93 return; 93 return;
94} 94}
95 95
96void __init mce_intel_feature_init(struct cpuinfo_x86 *c) 96void __cpuinit mce_intel_feature_init(struct cpuinfo_x86 *c)
97{ 97{
98 intel_init_thermal(c); 98 intel_init_thermal(c);
99} 99}
diff --git a/arch/x86_64/kernel/nmi.c b/arch/x86_64/kernel/nmi.c
index 31c0f2e6ac91..4e44d6e6b7e5 100644
--- a/arch/x86_64/kernel/nmi.c
+++ b/arch/x86_64/kernel/nmi.c
@@ -98,7 +98,7 @@ static unsigned int nmi_p4_cccr_val;
98 (P4_CCCR_OVF_PMI0|P4_CCCR_THRESHOLD(15)|P4_CCCR_COMPLEMENT| \ 98 (P4_CCCR_OVF_PMI0|P4_CCCR_THRESHOLD(15)|P4_CCCR_COMPLEMENT| \
99 P4_CCCR_COMPARE|P4_CCCR_REQUIRED|P4_CCCR_ESCR_SELECT(4)|P4_CCCR_ENABLE) 99 P4_CCCR_COMPARE|P4_CCCR_REQUIRED|P4_CCCR_ESCR_SELECT(4)|P4_CCCR_ENABLE)
100 100
101static __init inline int nmi_known_cpu(void) 101static __cpuinit inline int nmi_known_cpu(void)
102{ 102{
103 switch (boot_cpu_data.x86_vendor) { 103 switch (boot_cpu_data.x86_vendor) {
104 case X86_VENDOR_AMD: 104 case X86_VENDOR_AMD:
@@ -110,7 +110,7 @@ static __init inline int nmi_known_cpu(void)
110} 110}
111 111
112/* Run after command line and cpu_init init, but before all other checks */ 112/* Run after command line and cpu_init init, but before all other checks */
113void __init nmi_watchdog_default(void) 113void __cpuinit nmi_watchdog_default(void)
114{ 114{
115 if (nmi_watchdog != NMI_DEFAULT) 115 if (nmi_watchdog != NMI_DEFAULT)
116 return; 116 return;
diff --git a/arch/x86_64/kernel/process.c b/arch/x86_64/kernel/process.c
index e59d1f9d6163..15fa35a81a72 100644
--- a/arch/x86_64/kernel/process.c
+++ b/arch/x86_64/kernel/process.c
@@ -204,7 +204,7 @@ static void mwait_idle(void)
204 } 204 }
205} 205}
206 206
207void __init select_idle_routine(const struct cpuinfo_x86 *c) 207void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c)
208{ 208{
209 static int printed; 209 static int printed;
210 if (cpu_has(c, X86_FEATURE_MWAIT)) { 210 if (cpu_has(c, X86_FEATURE_MWAIT)) {
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c
index 000015dd5a8b..ca9a915a6d4a 100644
--- a/arch/x86_64/kernel/setup.c
+++ b/arch/x86_64/kernel/setup.c
@@ -676,7 +676,7 @@ void __init setup_arch(char **cmdline_p)
676#endif 676#endif
677} 677}
678 678
679static int __init get_model_name(struct cpuinfo_x86 *c) 679static int __cpuinit get_model_name(struct cpuinfo_x86 *c)
680{ 680{
681 unsigned int *v; 681 unsigned int *v;
682 682
@@ -692,7 +692,7 @@ static int __init get_model_name(struct cpuinfo_x86 *c)
692} 692}
693 693
694 694
695static void __init display_cacheinfo(struct cpuinfo_x86 *c) 695static void __cpuinit display_cacheinfo(struct cpuinfo_x86 *c)
696{ 696{
697 unsigned int n, dummy, eax, ebx, ecx, edx; 697 unsigned int n, dummy, eax, ebx, ecx, edx;
698 698
@@ -803,7 +803,7 @@ static int __init init_amd(struct cpuinfo_x86 *c)
803 return r; 803 return r;
804} 804}
805 805
806static void __init detect_ht(struct cpuinfo_x86 *c) 806static void __cpuinit detect_ht(struct cpuinfo_x86 *c)
807{ 807{
808#ifdef CONFIG_SMP 808#ifdef CONFIG_SMP
809 u32 eax, ebx, ecx, edx; 809 u32 eax, ebx, ecx, edx;
@@ -864,7 +864,7 @@ static void __init detect_ht(struct cpuinfo_x86 *c)
864/* 864/*
865 * find out the number of processor cores on the die 865 * find out the number of processor cores on the die
866 */ 866 */
867static int __init intel_num_cpu_cores(struct cpuinfo_x86 *c) 867static int __cpuinit intel_num_cpu_cores(struct cpuinfo_x86 *c)
868{ 868{
869 unsigned int eax; 869 unsigned int eax;
870 870
@@ -882,7 +882,7 @@ static int __init intel_num_cpu_cores(struct cpuinfo_x86 *c)
882 return 1; 882 return 1;
883} 883}
884 884
885static void __init init_intel(struct cpuinfo_x86 *c) 885static void __cpuinit init_intel(struct cpuinfo_x86 *c)
886{ 886{
887 /* Cache sizes */ 887 /* Cache sizes */
888 unsigned n; 888 unsigned n;
@@ -902,7 +902,7 @@ static void __init init_intel(struct cpuinfo_x86 *c)
902 c->x86_num_cores = intel_num_cpu_cores(c); 902 c->x86_num_cores = intel_num_cpu_cores(c);
903} 903}
904 904
905void __init get_cpu_vendor(struct cpuinfo_x86 *c) 905void __cpuinit get_cpu_vendor(struct cpuinfo_x86 *c)
906{ 906{
907 char *v = c->x86_vendor_id; 907 char *v = c->x86_vendor_id;
908 908
@@ -923,7 +923,7 @@ struct cpu_model_info {
923/* Do some early cpuid on the boot CPU to get some parameter that are 923/* Do some early cpuid on the boot CPU to get some parameter that are
924 needed before check_bugs. Everything advanced is in identify_cpu 924 needed before check_bugs. Everything advanced is in identify_cpu
925 below. */ 925 below. */
926void __init early_identify_cpu(struct cpuinfo_x86 *c) 926void __cpuinit early_identify_cpu(struct cpuinfo_x86 *c)
927{ 927{
928 u32 tfms; 928 u32 tfms;
929 929
@@ -977,7 +977,7 @@ void __init early_identify_cpu(struct cpuinfo_x86 *c)
977/* 977/*
978 * This does the hard work of actually picking apart the CPU stuff... 978 * This does the hard work of actually picking apart the CPU stuff...
979 */ 979 */
980void __init identify_cpu(struct cpuinfo_x86 *c) 980void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
981{ 981{
982 int i; 982 int i;
983 u32 xlvl; 983 u32 xlvl;
@@ -1054,7 +1054,7 @@ void __init identify_cpu(struct cpuinfo_x86 *c)
1054} 1054}
1055 1055
1056 1056
1057void __init print_cpu_info(struct cpuinfo_x86 *c) 1057void __cpuinit print_cpu_info(struct cpuinfo_x86 *c)
1058{ 1058{
1059 if (c->x86_model_id[0]) 1059 if (c->x86_model_id[0])
1060 printk("%s", c->x86_model_id); 1060 printk("%s", c->x86_model_id);
diff --git a/arch/x86_64/kernel/setup64.c b/arch/x86_64/kernel/setup64.c
index 678b7ac33b8b..f2b9c6bc999a 100644
--- a/arch/x86_64/kernel/setup64.c
+++ b/arch/x86_64/kernel/setup64.c
@@ -29,7 +29,7 @@
29 29
30char x86_boot_params[BOOT_PARAM_SIZE] __initdata = {0,}; 30char x86_boot_params[BOOT_PARAM_SIZE] __initdata = {0,};
31 31
32cpumask_t cpu_initialized __initdata = CPU_MASK_NONE; 32cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE;
33 33
34struct x8664_pda cpu_pda[NR_CPUS] __cacheline_aligned; 34struct x8664_pda cpu_pda[NR_CPUS] __cacheline_aligned;
35 35
@@ -171,7 +171,7 @@ void syscall_init(void)
171 wrmsrl(MSR_SYSCALL_MASK, EF_TF|EF_DF|EF_IE|0x3000); 171 wrmsrl(MSR_SYSCALL_MASK, EF_TF|EF_DF|EF_IE|0x3000);
172} 172}
173 173
174void __init check_efer(void) 174void __cpuinit check_efer(void)
175{ 175{
176 unsigned long efer; 176 unsigned long efer;
177 177
@@ -188,7 +188,7 @@ void __init check_efer(void)
188 * 'CPU state barrier', nothing should get across. 188 * 'CPU state barrier', nothing should get across.
189 * A lot of state is already set up in PDA init. 189 * A lot of state is already set up in PDA init.
190 */ 190 */
191void __init cpu_init (void) 191void __cpuinit cpu_init (void)
192{ 192{
193#ifdef CONFIG_SMP 193#ifdef CONFIG_SMP
194 int cpu = stack_smp_processor_id(); 194 int cpu = stack_smp_processor_id();
diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c
index f1ec0f345941..bc98a6722cba 100644
--- a/arch/x86_64/kernel/smpboot.c
+++ b/arch/x86_64/kernel/smpboot.c
@@ -58,11 +58,6 @@
58#include <asm/proto.h> 58#include <asm/proto.h>
59#include <asm/nmi.h> 59#include <asm/nmi.h>
60 60
61/* Change for real CPU hotplug. Note other files need to be fixed
62 first too. */
63#define __cpuinit __init
64#define __cpuinitdata __initdata
65
66/* Number of siblings per CPU package */ 61/* Number of siblings per CPU package */
67int smp_num_siblings = 1; 62int smp_num_siblings = 1;
68/* Package ID of each logical CPU */ 63/* Package ID of each logical CPU */
@@ -823,7 +818,7 @@ static __cpuinit void smp_cleanup_boot(void)
823 * 818 *
824 * RED-PEN audit/test this more. I bet there is more state messed up here. 819 * RED-PEN audit/test this more. I bet there is more state messed up here.
825 */ 820 */
826static __cpuinit void disable_smp(void) 821static __init void disable_smp(void)
827{ 822{
828 cpu_present_map = cpumask_of_cpu(0); 823 cpu_present_map = cpumask_of_cpu(0);
829 cpu_possible_map = cpumask_of_cpu(0); 824 cpu_possible_map = cpumask_of_cpu(0);
@@ -838,7 +833,7 @@ static __cpuinit void disable_smp(void)
838/* 833/*
839 * Handle user cpus=... parameter. 834 * Handle user cpus=... parameter.
840 */ 835 */
841static __cpuinit void enforce_max_cpus(unsigned max_cpus) 836static __init void enforce_max_cpus(unsigned max_cpus)
842{ 837{
843 int i, k; 838 int i, k;
844 k = 0; 839 k = 0;
@@ -855,7 +850,7 @@ static __cpuinit void enforce_max_cpus(unsigned max_cpus)
855/* 850/*
856 * Various sanity checks. 851 * Various sanity checks.
857 */ 852 */
858static int __cpuinit smp_sanity_check(unsigned max_cpus) 853static int __init smp_sanity_check(unsigned max_cpus)
859{ 854{
860 if (!physid_isset(hard_smp_processor_id(), phys_cpu_present_map)) { 855 if (!physid_isset(hard_smp_processor_id(), phys_cpu_present_map)) {
861 printk("weird, boot CPU (#%d) not listed by the BIOS.\n", 856 printk("weird, boot CPU (#%d) not listed by the BIOS.\n",
@@ -913,7 +908,7 @@ static int __cpuinit smp_sanity_check(unsigned max_cpus)
913 * Prepare for SMP bootup. The MP table or ACPI has been read 908 * Prepare for SMP bootup. The MP table or ACPI has been read
914 * earlier. Just do some sanity checking here and enable APIC mode. 909 * earlier. Just do some sanity checking here and enable APIC mode.
915 */ 910 */
916void __cpuinit smp_prepare_cpus(unsigned int max_cpus) 911void __init smp_prepare_cpus(unsigned int max_cpus)
917{ 912{
918 int i; 913 int i;
919 914
@@ -1019,7 +1014,7 @@ int __cpuinit __cpu_up(unsigned int cpu)
1019/* 1014/*
1020 * Finish the SMP boot. 1015 * Finish the SMP boot.
1021 */ 1016 */
1022void __cpuinit smp_cpus_done(unsigned int max_cpus) 1017void __init smp_cpus_done(unsigned int max_cpus)
1023{ 1018{
1024 zap_low_mappings(); 1019 zap_low_mappings();
1025 smp_cleanup_boot(); 1020 smp_cleanup_boot();
diff --git a/arch/x86_64/mm/numa.c b/arch/x86_64/mm/numa.c
index 84cde796ecb1..ac61c186eb02 100644
--- a/arch/x86_64/mm/numa.c
+++ b/arch/x86_64/mm/numa.c
@@ -251,7 +251,7 @@ void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
251 setup_node_bootmem(0, start_pfn << PAGE_SHIFT, end_pfn << PAGE_SHIFT); 251 setup_node_bootmem(0, start_pfn << PAGE_SHIFT, end_pfn << PAGE_SHIFT);
252} 252}
253 253
254__init void numa_add_cpu(int cpu) 254__cpuinit void numa_add_cpu(int cpu)
255{ 255{
256 /* BP is initialized elsewhere */ 256 /* BP is initialized elsewhere */
257 if (cpu) 257 if (cpu)