diff options
author | Jeremy Fitzhardinge <jeremy@goop.org> | 2007-05-02 13:27:11 -0400 |
---|---|---|
committer | Andi Kleen <andi@basil.nowhere.org> | 2007-05-02 13:27:11 -0400 |
commit | 01a2f435564b4baab61328b4018d36464468f57b (patch) | |
tree | 991f6a1604a203736131b855262d78fb75711f9b /arch | |
parent | 4fbb5968810b237e81977f131986b9efd5245368 (diff) |
[PATCH] i386: Add smp_ops interface
Add a smp_ops interface. This abstracts the API defined by
<linux/smp.h> for use within arch/i386. The primary intent is that it
be used by a paravirtualizing hypervisor to implement SMP, but it
could also be used by non-APIC-using sub-architectures.
This is related to CONFIG_PARAVIRT, but is implemented unconditionally
since it is simpler that way and not a highly performance-sensitive
interface.
Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Cc: Andi Kleen <ak@suse.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/i386/kernel/smp.c | 21 | ||||
-rw-r--r-- | arch/i386/kernel/smpboot.c | 8 |
2 files changed, 20 insertions, 9 deletions
diff --git a/arch/i386/kernel/smp.c b/arch/i386/kernel/smp.c index b90bebeb1c79..fe38b49a1223 100644 --- a/arch/i386/kernel/smp.c +++ b/arch/i386/kernel/smp.c | |||
@@ -483,7 +483,7 @@ void flush_tlb_all(void) | |||
483 | * it goes straight through and wastes no time serializing | 483 | * it goes straight through and wastes no time serializing |
484 | * anything. Worst case is that we lose a reschedule ... | 484 | * anything. Worst case is that we lose a reschedule ... |
485 | */ | 485 | */ |
486 | void smp_send_reschedule(int cpu) | 486 | void native_smp_send_reschedule(int cpu) |
487 | { | 487 | { |
488 | WARN_ON(cpu_is_offline(cpu)); | 488 | WARN_ON(cpu_is_offline(cpu)); |
489 | send_IPI_mask(cpumask_of_cpu(cpu), RESCHEDULE_VECTOR); | 489 | send_IPI_mask(cpumask_of_cpu(cpu), RESCHEDULE_VECTOR); |
@@ -560,9 +560,9 @@ static void __smp_call_function(void (*func) (void *info), void *info, | |||
560 | * You must not call this function with disabled interrupts or from a | 560 | * You must not call this function with disabled interrupts or from a |
561 | * hardware interrupt handler or from a bottom half handler. | 561 | * hardware interrupt handler or from a bottom half handler. |
562 | */ | 562 | */ |
563 | int smp_call_function_mask(cpumask_t mask, | 563 | int native_smp_call_function_mask(cpumask_t mask, |
564 | void (*func)(void *), void *info, | 564 | void (*func)(void *), void *info, |
565 | int wait) | 565 | int wait) |
566 | { | 566 | { |
567 | struct call_data_struct data; | 567 | struct call_data_struct data; |
568 | cpumask_t allbutself; | 568 | cpumask_t allbutself; |
@@ -681,7 +681,7 @@ static void stop_this_cpu (void * dummy) | |||
681 | * this function calls the 'stop' function on all other CPUs in the system. | 681 | * this function calls the 'stop' function on all other CPUs in the system. |
682 | */ | 682 | */ |
683 | 683 | ||
684 | void smp_send_stop(void) | 684 | void native_smp_send_stop(void) |
685 | { | 685 | { |
686 | /* Don't deadlock on the call lock in panic */ | 686 | /* Don't deadlock on the call lock in panic */ |
687 | int nolock = !spin_trylock(&call_lock); | 687 | int nolock = !spin_trylock(&call_lock); |
@@ -757,3 +757,14 @@ int safe_smp_processor_id(void) | |||
757 | 757 | ||
758 | return cpuid >= 0 ? cpuid : 0; | 758 | return cpuid >= 0 ? cpuid : 0; |
759 | } | 759 | } |
760 | |||
761 | struct smp_ops smp_ops = { | ||
762 | .smp_prepare_boot_cpu = native_smp_prepare_boot_cpu, | ||
763 | .smp_prepare_cpus = native_smp_prepare_cpus, | ||
764 | .cpu_up = native_cpu_up, | ||
765 | .smp_cpus_done = native_smp_cpus_done, | ||
766 | |||
767 | .smp_send_stop = native_smp_send_stop, | ||
768 | .smp_send_reschedule = native_smp_send_reschedule, | ||
769 | .smp_call_function_mask = native_smp_call_function_mask, | ||
770 | }; | ||
diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c index b0ad04d9ef21..1c3ad9b406ca 100644 --- a/arch/i386/kernel/smpboot.c +++ b/arch/i386/kernel/smpboot.c | |||
@@ -1171,7 +1171,7 @@ static void __init smp_boot_cpus(unsigned int max_cpus) | |||
1171 | 1171 | ||
1172 | /* These are wrappers to interface to the new boot process. Someone | 1172 | /* These are wrappers to interface to the new boot process. Someone |
1173 | who understands all this stuff should rewrite it properly. --RR 15/Jul/02 */ | 1173 | who understands all this stuff should rewrite it properly. --RR 15/Jul/02 */ |
1174 | void __init smp_prepare_cpus(unsigned int max_cpus) | 1174 | void __init native_smp_prepare_cpus(unsigned int max_cpus) |
1175 | { | 1175 | { |
1176 | smp_commenced_mask = cpumask_of_cpu(0); | 1176 | smp_commenced_mask = cpumask_of_cpu(0); |
1177 | cpu_callin_map = cpumask_of_cpu(0); | 1177 | cpu_callin_map = cpumask_of_cpu(0); |
@@ -1191,7 +1191,7 @@ static inline void switch_to_new_gdt(void) | |||
1191 | asm volatile ("mov %0, %%fs" : : "r" (__KERNEL_PDA) : "memory"); | 1191 | asm volatile ("mov %0, %%fs" : : "r" (__KERNEL_PDA) : "memory"); |
1192 | } | 1192 | } |
1193 | 1193 | ||
1194 | void __init smp_prepare_boot_cpu(void) | 1194 | void __init native_smp_prepare_boot_cpu(void) |
1195 | { | 1195 | { |
1196 | unsigned int cpu = smp_processor_id(); | 1196 | unsigned int cpu = smp_processor_id(); |
1197 | 1197 | ||
@@ -1292,7 +1292,7 @@ void __cpu_die(unsigned int cpu) | |||
1292 | } | 1292 | } |
1293 | #endif /* CONFIG_HOTPLUG_CPU */ | 1293 | #endif /* CONFIG_HOTPLUG_CPU */ |
1294 | 1294 | ||
1295 | int __cpuinit __cpu_up(unsigned int cpu) | 1295 | int __cpuinit native_cpu_up(unsigned int cpu) |
1296 | { | 1296 | { |
1297 | unsigned long flags; | 1297 | unsigned long flags; |
1298 | #ifdef CONFIG_HOTPLUG_CPU | 1298 | #ifdef CONFIG_HOTPLUG_CPU |
@@ -1337,7 +1337,7 @@ int __cpuinit __cpu_up(unsigned int cpu) | |||
1337 | return 0; | 1337 | return 0; |
1338 | } | 1338 | } |
1339 | 1339 | ||
1340 | void __init smp_cpus_done(unsigned int max_cpus) | 1340 | void __init native_smp_cpus_done(unsigned int max_cpus) |
1341 | { | 1341 | { |
1342 | #ifdef CONFIG_X86_IO_APIC | 1342 | #ifdef CONFIG_X86_IO_APIC |
1343 | setup_ioapic_dest(); | 1343 | setup_ioapic_dest(); |