ia64/xen-unstable

view xen/include/asm-x86/smp.h @ 15812:86a154e1ef5d

[HVM] Shadow: don't shadow the p2m table.
For HVM vcpus with paging disabled, we used to shadow the p2m table,
and skip the p2m lookup to go from gfn to mfn. Instead, we now
provide a simple pagetable that gives a one-to-one mapping of 4GB, and
shadow that, making the translations from gfn to mfn via the p2m.
This removes the paging-disabled special-case code from the shadow
fault handler, and allows us to expand the p2m interface, since all HVM
translations now go through the same p2m lookups.
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
author Tim Deegan <Tim.Deegan@xensource.com>
date Fri Aug 31 11:06:22 2007 +0100 (2007-08-31)
parents 858b9bc8d0e6
children 4034317507de
line source
1 #ifndef __ASM_SMP_H
2 #define __ASM_SMP_H
4 /*
5 * We need the APIC definitions automatically as part of 'smp.h'
6 */
7 #ifndef __ASSEMBLY__
8 #include <xen/config.h>
9 #include <xen/kernel.h>
10 #include <xen/cpumask.h>
11 #include <asm/current.h>
12 #endif
14 #ifdef CONFIG_X86_LOCAL_APIC
15 #ifndef __ASSEMBLY__
16 #include <asm/fixmap.h>
17 #include <asm/bitops.h>
18 #include <asm/mpspec.h>
19 #ifdef CONFIG_X86_IO_APIC
20 #include <asm/io_apic.h>
21 #endif
22 #include <asm/apic.h>
23 #endif
24 #endif
26 #define BAD_APICID 0xFFu
27 #ifdef CONFIG_SMP
28 #ifndef __ASSEMBLY__
30 /*
31 * Private routines/data
32 */
34 extern void smp_alloc_memory(void);
35 extern int pic_mode;
36 extern int smp_num_siblings;
37 extern cpumask_t cpu_sibling_map[];
38 extern cpumask_t cpu_core_map[];
40 extern void (*mtrr_hook) (void);
42 #ifdef CONFIG_X86_64
43 extern void zap_low_mappings(void);
44 #else
45 extern void zap_low_mappings(l2_pgentry_t *base);
46 #endif
48 #define MAX_APICID 256
49 extern u8 x86_cpu_to_apicid[];
51 #define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu]
53 /* State of each CPU. */
54 #define CPU_ONLINE 0x0002 /* CPU is up */
55 #define CPU_DYING 0x0003 /* CPU is requested to die */
56 #define CPU_DEAD 0x0004 /* CPU is dead */
57 DECLARE_PER_CPU(int, cpu_state);
59 #ifdef CONFIG_HOTPLUG_CPU
60 #define cpu_is_offline(cpu) unlikely(per_cpu(cpu_state,cpu) == CPU_DYING)
61 extern int cpu_down(unsigned int cpu);
62 extern int cpu_up(unsigned int cpu);
63 extern void cpu_exit_clear(void);
64 extern void cpu_uninit(void);
65 extern void disable_nonboot_cpus(void);
66 extern void enable_nonboot_cpus(void);
67 #else
68 static inline int cpu_is_offline(int cpu) {return 0;}
69 static inline void disable_nonboot_cpus(void) {}
70 static inline void enable_nonboot_cpus(void) {}
71 #endif
73 /*
74 * This function is needed by all SMP systems. It must _always_ be valid
75 * from the initial startup. We map APIC_BASE very early in page_setup(),
76 * so this is correct in the x86 case.
77 */
78 #define raw_smp_processor_id() (get_processor_id())
80 extern cpumask_t cpu_callout_map;
81 extern cpumask_t cpu_callin_map;
82 extern cpumask_t cpu_possible_map;
84 /* We don't mark CPUs online until __cpu_up(), so we need another measure */
85 static inline int num_booting_cpus(void)
86 {
87 return cpus_weight(cpu_callout_map);
88 }
90 #ifdef CONFIG_X86_LOCAL_APIC
92 static inline int hard_smp_processor_id(void)
93 {
94 /* we don't want to mark this access volatile - bad code generation */
95 return GET_APIC_ID(*(unsigned int *)(APIC_BASE+APIC_ID));
96 }
98 static __inline int logical_smp_processor_id(void)
99 {
100 /* we don't want to mark this access volatile - bad code generation */
101 return GET_APIC_LOGICAL_ID(*(unsigned int *)(APIC_BASE+APIC_LDR));
102 }
104 #endif
106 extern int __cpu_disable(void);
107 extern void __cpu_die(unsigned int cpu);
108 #endif /* !__ASSEMBLY__ */
110 #else /* CONFIG_SMP */
112 #define cpu_physical_id(cpu) boot_cpu_physical_apicid
114 #define NO_PROC_ID 0xFF /* No processor magic marker */
116 #endif
117 #endif