ia64/xen-unstable

view xen/include/asm-ia64/linux-xen/asm/smp.h @ 9770:ced37bea0647

[IA64] FPH enabling + cleanup

Move contents of switch_to macro from xensystem.h to context_switch function.
Initialize FPU on all processors. FPH is always enabled in Xen.
Speed up context-switch (a little bit!) by not enabling/disabling FPH.
Cleanup (unused function/variablesi/fields, debug printf...)
vmx_ia64_switch_to removed (was unused).

Signed-off-by: Tristan Gingold <tristan.gingold@bull.net>
author awilliam@xenbuild.aw
date Tue Apr 25 22:35:41 2006 -0600 (2006-04-25)
parents d44e8ace51a3
children 6583186e5989
line source
1 /*
2 * SMP Support
3 *
4 * Copyright (C) 1999 VA Linux Systems
5 * Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
6 * (c) Copyright 2001-2003, 2005 Hewlett-Packard Development Company, L.P.
7 * David Mosberger-Tang <davidm@hpl.hp.com>
8 * Bjorn Helgaas <bjorn.helgaas@hp.com>
9 */
10 #ifndef _ASM_IA64_SMP_H
11 #define _ASM_IA64_SMP_H
13 #include <linux/config.h>
14 #include <linux/init.h>
15 #include <linux/threads.h>
16 #include <linux/kernel.h>
17 #include <linux/cpumask.h>
19 #include <asm/bitops.h>
20 #include <asm/io.h>
21 #include <asm/param.h>
22 #include <asm/processor.h>
23 #include <asm/ptrace.h>
25 static inline unsigned int
26 ia64_get_lid (void)
27 {
28 union {
29 struct {
30 unsigned long reserved : 16;
31 unsigned long eid : 8;
32 unsigned long id : 8;
33 unsigned long ignored : 32;
34 } f;
35 unsigned long bits;
36 } lid;
38 lid.bits = ia64_getreg(_IA64_REG_CR_LID);
39 return lid.f.id << 8 | lid.f.eid;
40 }
42 #ifdef CONFIG_SMP
44 #define XTP_OFFSET 0x1e0008
46 #define SMP_IRQ_REDIRECTION (1 << 0)
47 #define SMP_IPI_REDIRECTION (1 << 1)
49 #ifdef XEN
50 #define raw_smp_processor_id() (current->processor)
51 #else
52 #define raw_smp_processor_id() (current_thread_info()->cpu)
53 #endif
55 extern struct smp_boot_data {
56 int cpu_count;
57 int cpu_phys_id[NR_CPUS];
58 } smp_boot_data __initdata;
60 extern char no_int_routing __devinitdata;
62 extern cpumask_t cpu_online_map;
63 extern cpumask_t cpu_core_map[NR_CPUS];
64 extern cpumask_t cpu_sibling_map[NR_CPUS];
65 extern int smp_num_siblings;
66 extern int smp_num_cpucores;
67 extern void __iomem *ipi_base_addr;
68 extern unsigned char smp_int_redirect;
70 extern volatile int ia64_cpu_to_sapicid[];
71 #define cpu_physical_id(i) ia64_cpu_to_sapicid[i]
73 extern unsigned long ap_wakeup_vector;
75 /*
76 * Function to map hard smp processor id to logical id. Slow, so don't use this in
77 * performance-critical code.
78 */
79 static inline int
80 cpu_logical_id (int cpuid)
81 {
82 int i;
84 for (i = 0; i < NR_CPUS; ++i)
85 if (cpu_physical_id(i) == cpuid)
86 break;
87 return i;
88 }
90 /*
91 * XTP control functions:
92 * min_xtp : route all interrupts to this CPU
93 * normal_xtp: nominal XTP value
94 * max_xtp : never deliver interrupts to this CPU.
95 */
97 static inline void
98 min_xtp (void)
99 {
100 if (smp_int_redirect & SMP_IRQ_REDIRECTION)
101 writeb(0x00, ipi_base_addr + XTP_OFFSET); /* XTP to min */
102 }
104 static inline void
105 normal_xtp (void)
106 {
107 if (smp_int_redirect & SMP_IRQ_REDIRECTION)
108 writeb(0x08, ipi_base_addr + XTP_OFFSET); /* XTP normal */
109 }
111 static inline void
112 max_xtp (void)
113 {
114 if (smp_int_redirect & SMP_IRQ_REDIRECTION)
115 writeb(0x0f, ipi_base_addr + XTP_OFFSET); /* Set XTP to max */
116 }
118 #define hard_smp_processor_id() ia64_get_lid()
120 /* Upping and downing of CPUs */
121 extern int __cpu_disable (void);
122 extern void __cpu_die (unsigned int cpu);
123 extern void cpu_die (void) __attribute__ ((noreturn));
124 extern int __cpu_up (unsigned int cpu);
125 extern void __init smp_build_cpu_map(void);
127 extern void __init init_smp_config (void);
128 extern void smp_do_timer (struct pt_regs *regs);
130 extern int smp_call_function_single (int cpuid, void (*func) (void *info), void *info,
131 int retry, int wait);
132 extern void smp_send_reschedule (int cpu);
133 extern void lock_ipi_calllock(void);
134 extern void unlock_ipi_calllock(void);
135 extern void identify_siblings (struct cpuinfo_ia64 *);
137 #else
139 #define cpu_logical_id(i) 0
140 #define cpu_physical_id(i) ia64_get_lid()
142 #endif /* CONFIG_SMP */
143 #endif /* _ASM_IA64_SMP_H */