diff options
author | Cyrill Gorcunov <gorcunov@openvz.org> | 2011-05-19 19:45:50 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-05-20 07:41:11 -0400 |
commit | 79deb8e511bd6fc8e40add4da75b19df085d9453 (patch) | |
tree | 6deaa403173d0501ee497237bea2e6e3f6e7cfe5 /arch/x86/include/asm/x2apic.h | |
parent | 9d0fa6c5f43f2d9c6966dcab7af96a717682fdec (diff) |
x86, x2apic: Move the common bits to x2apic.h
To eliminate code duplication.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: steiner@sgi.com
Cc: yinghai@kernel.org
Link: http://lkml.kernel.org/r/20110519234637.591426753@sbsiddha-MOBL3.sc.intel.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/include/asm/x2apic.h')
-rw-r--r-- | arch/x86/include/asm/x2apic.h | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/arch/x86/include/asm/x2apic.h b/arch/x86/include/asm/x2apic.h new file mode 100644 index 000000000000..6bf5b8e478c0 --- /dev/null +++ b/arch/x86/include/asm/x2apic.h | |||
@@ -0,0 +1,62 @@ | |||
1 | /* | ||
2 | * Common bits for X2APIC cluster/physical modes. | ||
3 | */ | ||
4 | |||
5 | #ifndef _ASM_X86_X2APIC_H | ||
6 | #define _ASM_X86_X2APIC_H | ||
7 | |||
8 | #include <asm/apic.h> | ||
9 | #include <asm/ipi.h> | ||
10 | #include <linux/cpumask.h> | ||
11 | |||
12 | /* | ||
13 | * Need to use more than cpu 0, because we need more vectors | ||
14 | * when MSI-X are used. | ||
15 | */ | ||
16 | static const struct cpumask *x2apic_target_cpus(void) | ||
17 | { | ||
18 | return cpu_online_mask; | ||
19 | } | ||
20 | |||
21 | static int x2apic_apic_id_registered(void) | ||
22 | { | ||
23 | return 1; | ||
24 | } | ||
25 | |||
26 | /* | ||
27 | * For now each logical cpu is in its own vector allocation domain. | ||
28 | */ | ||
29 | static void x2apic_vector_allocation_domain(int cpu, struct cpumask *retmask) | ||
30 | { | ||
31 | cpumask_clear(retmask); | ||
32 | cpumask_set_cpu(cpu, retmask); | ||
33 | } | ||
34 | |||
35 | static void | ||
36 | __x2apic_send_IPI_dest(unsigned int apicid, int vector, unsigned int dest) | ||
37 | { | ||
38 | unsigned long cfg = __prepare_ICR(0, vector, dest); | ||
39 | native_x2apic_icr_write(cfg, apicid); | ||
40 | } | ||
41 | |||
42 | static unsigned int x2apic_get_apic_id(unsigned long id) | ||
43 | { | ||
44 | return id; | ||
45 | } | ||
46 | |||
47 | static unsigned long x2apic_set_apic_id(unsigned int id) | ||
48 | { | ||
49 | return id; | ||
50 | } | ||
51 | |||
52 | static int x2apic_phys_pkg_id(int initial_apicid, int index_msb) | ||
53 | { | ||
54 | return initial_apicid >> index_msb; | ||
55 | } | ||
56 | |||
57 | static void x2apic_send_IPI_self(int vector) | ||
58 | { | ||
59 | apic_write(APIC_SELF_IPI, vector); | ||
60 | } | ||
61 | |||
62 | #endif /* _ASM_X86_X2APIC_H */ | ||