1 #ifndef __ASM_SMP_H
2 #define __ASM_SMP_H
3 
4 /*
5  * We need the APIC definitions automatically as part of 'smp.h'
6  */
7 #ifndef __ASSEMBLY__
8 #include <xen/bitops.h>
9 #include <xen/kernel.h>
10 #include <xen/cpumask.h>
11 #include <asm/current.h>
12 #include <asm/mpspec.h>
13 #endif
14 
15 #define BAD_APICID   (-1U)
16 #define INVALID_CUID (~0U)   /* AMD Compute Unit ID */
17 #ifndef __ASSEMBLY__
18 
19 /*
20  * Private routines/data
21  */
22 DECLARE_PER_CPU(cpumask_var_t, cpu_sibling_mask);
23 DECLARE_PER_CPU(cpumask_var_t, cpu_core_mask);
24 DECLARE_PER_CPU(cpumask_var_t, scratch_cpumask);
25 DECLARE_PER_CPU(cpumask_var_t, send_ipi_cpumask);
26 
27 /*
28  * Do we, for platform reasons, need to actually keep CPUs online when we
29  * would otherwise prefer them to be off?
30  */
31 extern bool park_offline_cpus;
32 
33 void smp_send_nmi_allbutself(void);
34 
35 void send_IPI_mask(const cpumask_t *mask, int vector);
36 void send_IPI_self(int vector);
37 
38 extern void (*mtrr_hook) (void);
39 
40 extern void zap_low_mappings(void);
41 
42 extern u32 x86_cpu_to_apicid[];
43 
44 #define cpu_physical_id(cpu)	x86_cpu_to_apicid[cpu]
45 
46 extern void cpu_exit_clear(unsigned int cpu);
47 extern void cpu_uninit(unsigned int cpu);
48 int cpu_add(uint32_t apic_id, uint32_t acpi_id, uint32_t pxm);
49 
50 void __stop_this_cpu(void);
51 
52 long cf_check cpu_up_helper(void *data);
53 long cf_check cpu_down_helper(void *data);
54 
55 long cf_check core_parking_helper(void *data);
56 bool core_parking_remove(unsigned int cpu);
57 uint32_t get_cur_idle_nums(void);
58 
59 /*
60  * The value may be greater than the actual socket number in the system and
61  * is required not to change from the initial startup.
62  */
63 extern unsigned int nr_sockets;
64 
65 void set_nr_sockets(void);
66 
67 /* Representing HT and core siblings in each socket. */
68 extern cpumask_t **socket_cpumask;
69 
70 /*
71  * To be used only while no context switch can occur on the cpu, i.e.
72  * by certain scheduling code only.
73  */
74 #define get_cpu_current(cpu) \
75     (get_cpu_info_from_stack((unsigned long)stack_base[cpu])->current_vcpu)
76 
77 extern unsigned int disabled_cpus;
78 extern bool unaccounted_cpus;
79 
80 void *cpu_alloc_stack(unsigned int cpu);
81 
82 #endif /* !__ASSEMBLY__ */
83 
84 #endif
85