ia64/xen-unstable

annotate 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
rev   line source
kaf24@1452 1 #ifndef __ASM_SMP_H
kaf24@1452 2 #define __ASM_SMP_H
kaf24@1452 3
kaf24@4804 4 /*
kaf24@4804 5 * We need the APIC definitions automatically as part of 'smp.h'
kaf24@4804 6 */
kaf24@1452 7 #ifndef __ASSEMBLY__
kaf24@1452 8 #include <xen/config.h>
kaf24@4804 9 #include <xen/kernel.h>
kaf24@4804 10 #include <xen/cpumask.h>
kaf24@5509 11 #include <asm/current.h>
kaf24@4804 12 #endif
kaf24@4804 13
kaf24@4804 14 #ifdef CONFIG_X86_LOCAL_APIC
kaf24@4804 15 #ifndef __ASSEMBLY__
kaf24@1452 16 #include <asm/fixmap.h>
kaf24@4804 17 #include <asm/bitops.h>
kaf24@1452 18 #include <asm/mpspec.h>
kaf24@4804 19 #ifdef CONFIG_X86_IO_APIC
kaf24@1452 20 #include <asm/io_apic.h>
kaf24@4804 21 #endif
kaf24@1452 22 #include <asm/apic.h>
kaf24@1452 23 #endif
kaf24@4804 24 #endif
kaf24@1452 25
kaf24@4804 26 #define BAD_APICID 0xFFu
kaf24@1452 27 #ifdef CONFIG_SMP
kaf24@1452 28 #ifndef __ASSEMBLY__
kaf24@1452 29
kaf24@1452 30 /*
kaf24@1452 31 * Private routines/data
kaf24@1452 32 */
kaf24@1452 33
kaf24@1452 34 extern void smp_alloc_memory(void);
kaf24@1452 35 extern int pic_mode;
kaf24@1452 36 extern int smp_num_siblings;
kaf24@4804 37 extern cpumask_t cpu_sibling_map[];
kaf24@5509 38 extern cpumask_t cpu_core_map[];
kaf24@1452 39
kaf24@4804 40 extern void (*mtrr_hook) (void);
kaf24@5237 41
kaf24@5237 42 #ifdef CONFIG_X86_64
kaf24@5237 43 extern void zap_low_mappings(void);
kaf24@5237 44 #else
kaf24@5237 45 extern void zap_low_mappings(l2_pgentry_t *base);
kaf24@5237 46 #endif
kaf24@4804 47
kaf24@1452 48 #define MAX_APICID 256
kaf24@4804 49 extern u8 x86_cpu_to_apicid[];
kaf24@1452 50
kaf24@8865 51 #define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu]
kaf24@8865 52
kfraser@15585 53 /* State of each CPU. */
kfraser@15585 54 #define CPU_ONLINE 0x0002 /* CPU is up */
kfraser@15585 55 #define CPU_DYING 0x0003 /* CPU is requested to die */
kfraser@15585 56 #define CPU_DEAD 0x0004 /* CPU is dead */
kfraser@15585 57 DECLARE_PER_CPU(int, cpu_state);
kfraser@15585 58
kaf24@8865 59 #ifdef CONFIG_HOTPLUG_CPU
kfraser@15585 60 #define cpu_is_offline(cpu) unlikely(per_cpu(cpu_state,cpu) == CPU_DYING)
kfraser@15585 61 extern int cpu_down(unsigned int cpu);
kfraser@15585 62 extern int cpu_up(unsigned int cpu);
kaf24@8865 63 extern void cpu_exit_clear(void);
kaf24@8865 64 extern void cpu_uninit(void);
kfraser@15585 65 extern void disable_nonboot_cpus(void);
kfraser@15585 66 extern void enable_nonboot_cpus(void);
kfraser@15585 67 #else
kfraser@15585 68 static inline int cpu_is_offline(int cpu) {return 0;}
kfraser@15623 69 static inline void disable_nonboot_cpus(void) {}
kfraser@15623 70 static inline void enable_nonboot_cpus(void) {}
kaf24@8865 71 #endif
kaf24@8865 72
kaf24@1452 73 /*
kaf24@1452 74 * This function is needed by all SMP systems. It must _always_ be valid
kaf24@1452 75 * from the initial startup. We map APIC_BASE very early in page_setup(),
kaf24@1452 76 * so this is correct in the x86 case.
kaf24@1452 77 */
kaf24@8865 78 #define raw_smp_processor_id() (get_processor_id())
kaf24@1452 79
kaf24@4804 80 extern cpumask_t cpu_callout_map;
kaf24@4804 81 extern cpumask_t cpu_callin_map;
kaf24@8865 82 extern cpumask_t cpu_possible_map;
kaf24@4804 83
kaf24@4804 84 /* We don't mark CPUs online until __cpu_up(), so we need another measure */
kaf24@4804 85 static inline int num_booting_cpus(void)
kaf24@4804 86 {
kaf24@4804 87 return cpus_weight(cpu_callout_map);
kaf24@4804 88 }
kaf24@1452 89
kaf24@4804 90 #ifdef CONFIG_X86_LOCAL_APIC
kaf24@4804 91
kaf24@4804 92 static inline int hard_smp_processor_id(void)
kaf24@1452 93 {
kaf24@1452 94 /* we don't want to mark this access volatile - bad code generation */
kaf24@4804 95 return GET_APIC_ID(*(unsigned int *)(APIC_BASE+APIC_ID));
kaf24@1452 96 }
kaf24@1452 97
kaf24@1452 98 static __inline int logical_smp_processor_id(void)
kaf24@1452 99 {
kaf24@1452 100 /* we don't want to mark this access volatile - bad code generation */
kaf24@4804 101 return GET_APIC_LOGICAL_ID(*(unsigned int *)(APIC_BASE+APIC_LDR));
kaf24@1452 102 }
kaf24@1452 103
kaf24@4804 104 #endif
kaf24@8865 105
kaf24@8865 106 extern int __cpu_disable(void);
kaf24@8865 107 extern void __cpu_die(unsigned int cpu);
kaf24@1452 108 #endif /* !__ASSEMBLY__ */
kaf24@1452 109
kaf24@8865 110 #else /* CONFIG_SMP */
kaf24@8865 111
kaf24@8865 112 #define cpu_physical_id(cpu) boot_cpu_physical_apicid
kaf24@8865 113
kaf24@1452 114 #define NO_PROC_ID 0xFF /* No processor magic marker */
kaf24@1452 115
kaf24@1452 116 #endif
kaf24@1452 117 #endif