diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2010-12-09 12:17:25 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2010-12-09 12:17:25 -0500 |
commit | d834a9dcecae834cd6b2bc5e50e1907738d9cf6a (patch) | |
tree | 0589d753465d3fe359ba451ba6cb7798df03aaa2 /arch/x86/include/asm | |
parent | a38c5380ef9f088be9f49b6e4c5d80af8b1b5cd4 (diff) | |
parent | f658bcfb2607bf0808966a69cf74135ce98e5c2d (diff) |
Merge branch 'x86/amd-nb' into x86/apic-cleanups
Reason: apic cleanup series depends on x86/apic, x86/amd-nb x86/platform
Conflicts:
arch/x86/include/asm/io_apic.h
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/include/asm')
35 files changed, 536 insertions, 255 deletions
diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h index 92091de1111..55d106b5e31 100644 --- a/arch/x86/include/asm/acpi.h +++ b/arch/x86/include/asm/acpi.h | |||
@@ -93,6 +93,9 @@ extern u8 acpi_sci_flags; | |||
93 | extern int acpi_sci_override_gsi; | 93 | extern int acpi_sci_override_gsi; |
94 | void acpi_pic_sci_set_trigger(unsigned int, u16); | 94 | void acpi_pic_sci_set_trigger(unsigned int, u16); |
95 | 95 | ||
96 | extern int (*__acpi_register_gsi)(struct device *dev, u32 gsi, | ||
97 | int trigger, int polarity); | ||
98 | |||
96 | static inline void disable_acpi(void) | 99 | static inline void disable_acpi(void) |
97 | { | 100 | { |
98 | acpi_disabled = 1; | 101 | acpi_disabled = 1; |
diff --git a/arch/x86/include/asm/amd_nb.h b/arch/x86/include/asm/amd_nb.h index c8517f81b21..6aee50d655d 100644 --- a/arch/x86/include/asm/amd_nb.h +++ b/arch/x86/include/asm/amd_nb.h | |||
@@ -3,36 +3,53 @@ | |||
3 | 3 | ||
4 | #include <linux/pci.h> | 4 | #include <linux/pci.h> |
5 | 5 | ||
6 | extern struct pci_device_id k8_nb_ids[]; | 6 | extern struct pci_device_id amd_nb_misc_ids[]; |
7 | struct bootnode; | 7 | struct bootnode; |
8 | 8 | ||
9 | extern int early_is_k8_nb(u32 value); | 9 | extern int early_is_amd_nb(u32 value); |
10 | extern int cache_k8_northbridges(void); | 10 | extern int amd_cache_northbridges(void); |
11 | extern void k8_flush_garts(void); | 11 | extern void amd_flush_garts(void); |
12 | extern int k8_get_nodes(struct bootnode *nodes); | 12 | extern int amd_get_nodes(struct bootnode *nodes); |
13 | extern int k8_numa_init(unsigned long start_pfn, unsigned long end_pfn); | 13 | extern int amd_numa_init(unsigned long start_pfn, unsigned long end_pfn); |
14 | extern int k8_scan_nodes(void); | 14 | extern int amd_scan_nodes(void); |
15 | 15 | ||
16 | struct k8_northbridge_info { | 16 | struct amd_northbridge { |
17 | struct pci_dev *misc; | ||
18 | }; | ||
19 | |||
20 | struct amd_northbridge_info { | ||
17 | u16 num; | 21 | u16 num; |
18 | u8 gart_supported; | 22 | u64 flags; |
19 | struct pci_dev **nb_misc; | 23 | struct amd_northbridge *nb; |
20 | }; | 24 | }; |
21 | extern struct k8_northbridge_info k8_northbridges; | 25 | extern struct amd_northbridge_info amd_northbridges; |
26 | |||
27 | #define AMD_NB_GART 0x1 | ||
28 | #define AMD_NB_L3_INDEX_DISABLE 0x2 | ||
22 | 29 | ||
23 | #ifdef CONFIG_AMD_NB | 30 | #ifdef CONFIG_AMD_NB |
24 | 31 | ||
25 | static inline struct pci_dev *node_to_k8_nb_misc(int node) | 32 | static inline int amd_nb_num(void) |
26 | { | 33 | { |
27 | return (node < k8_northbridges.num) ? k8_northbridges.nb_misc[node] : NULL; | 34 | return amd_northbridges.num; |
28 | } | 35 | } |
29 | 36 | ||
30 | #else | 37 | static inline int amd_nb_has_feature(int feature) |
38 | { | ||
39 | return ((amd_northbridges.flags & feature) == feature); | ||
40 | } | ||
31 | 41 | ||
32 | static inline struct pci_dev *node_to_k8_nb_misc(int node) | 42 | static inline struct amd_northbridge *node_to_amd_nb(int node) |
33 | { | 43 | { |
34 | return NULL; | 44 | return (node < amd_northbridges.num) ? &amd_northbridges.nb[node] : NULL; |
35 | } | 45 | } |
46 | |||
47 | #else | ||
48 | |||
49 | #define amd_nb_num(x) 0 | ||
50 | #define amd_nb_has_feature(x) false | ||
51 | #define node_to_amd_nb(x) NULL | ||
52 | |||
36 | #endif | 53 | #endif |
37 | 54 | ||
38 | 55 | ||
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h index ad50aaae396..cf12007796d 100644 --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h | |||
@@ -141,13 +141,13 @@ static inline void native_apic_msr_write(u32 reg, u32 v) | |||
141 | 141 | ||
142 | static inline u32 native_apic_msr_read(u32 reg) | 142 | static inline u32 native_apic_msr_read(u32 reg) |
143 | { | 143 | { |
144 | u32 low, high; | 144 | u64 msr; |
145 | 145 | ||
146 | if (reg == APIC_DFR) | 146 | if (reg == APIC_DFR) |
147 | return -1; | 147 | return -1; |
148 | 148 | ||
149 | rdmsr(APIC_BASE_MSR + (reg >> 4), low, high); | 149 | rdmsrl(APIC_BASE_MSR + (reg >> 4), msr); |
150 | return low; | 150 | return (u32)msr; |
151 | } | 151 | } |
152 | 152 | ||
153 | static inline void native_x2apic_wait_icr_idle(void) | 153 | static inline void native_x2apic_wait_icr_idle(void) |
@@ -181,12 +181,12 @@ extern void enable_x2apic(void); | |||
181 | extern void x2apic_icr_write(u32 low, u32 id); | 181 | extern void x2apic_icr_write(u32 low, u32 id); |
182 | static inline int x2apic_enabled(void) | 182 | static inline int x2apic_enabled(void) |
183 | { | 183 | { |
184 | int msr, msr2; | 184 | u64 msr; |
185 | 185 | ||
186 | if (!cpu_has_x2apic) | 186 | if (!cpu_has_x2apic) |
187 | return 0; | 187 | return 0; |
188 | 188 | ||
189 | rdmsr(MSR_IA32_APICBASE, msr, msr2); | 189 | rdmsrl(MSR_IA32_APICBASE, msr); |
190 | if (msr & X2APIC_ENABLE) | 190 | if (msr & X2APIC_ENABLE) |
191 | return 1; | 191 | return 1; |
192 | return 0; | 192 | return 0; |
diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h index bafd80defa4..903683b07e4 100644 --- a/arch/x86/include/asm/bitops.h +++ b/arch/x86/include/asm/bitops.h | |||
@@ -440,6 +440,8 @@ static inline int fls(int x) | |||
440 | 440 | ||
441 | #ifdef __KERNEL__ | 441 | #ifdef __KERNEL__ |
442 | 442 | ||
443 | #include <asm-generic/bitops/find.h> | ||
444 | |||
443 | #include <asm-generic/bitops/sched.h> | 445 | #include <asm-generic/bitops/sched.h> |
444 | 446 | ||
445 | #define ARCH_HAS_FAST_MULTIPLIER 1 | 447 | #define ARCH_HAS_FAST_MULTIPLIER 1 |
diff --git a/arch/x86/include/asm/calling.h b/arch/x86/include/asm/calling.h index 0e63c9a2a8d..30af5a83216 100644 --- a/arch/x86/include/asm/calling.h +++ b/arch/x86/include/asm/calling.h | |||
@@ -48,36 +48,38 @@ For 32-bit we have the following conventions - kernel is built with | |||
48 | 48 | ||
49 | 49 | ||
50 | /* | 50 | /* |
51 | * 64-bit system call stack frame layout defines and helpers, | 51 | * 64-bit system call stack frame layout defines and helpers, for |
52 | * for assembly code: | 52 | * assembly code (note that the seemingly unnecessary parentheses |
53 | * are to prevent cpp from inserting spaces in expressions that get | ||
54 | * passed to macros): | ||
53 | */ | 55 | */ |
54 | 56 | ||
55 | #define R15 0 | 57 | #define R15 (0) |
56 | #define R14 8 | 58 | #define R14 (8) |
57 | #define R13 16 | 59 | #define R13 (16) |
58 | #define R12 24 | 60 | #define R12 (24) |
59 | #define RBP 32 | 61 | #define RBP (32) |
60 | #define RBX 40 | 62 | #define RBX (40) |
61 | 63 | ||
62 | /* arguments: interrupts/non tracing syscalls only save up to here: */ | 64 | /* arguments: interrupts/non tracing syscalls only save up to here: */ |
63 | #define R11 48 | 65 | #define R11 (48) |
64 | #define R10 56 | 66 | #define R10 (56) |
65 | #define R9 64 | 67 | #define R9 (64) |
66 | #define R8 72 | 68 | #define R8 (72) |
67 | #define RAX 80 | 69 | #define RAX (80) |
68 | #define RCX 88 | 70 | #define RCX (88) |
69 | #define RDX 96 | 71 | #define RDX (96) |
70 | #define RSI 104 | 72 | #define RSI (104) |
71 | #define RDI 112 | 73 | #define RDI (112) |
72 | #define ORIG_RAX 120 /* + error_code */ | 74 | #define ORIG_RAX (120) /* + error_code */ |
73 | /* end of arguments */ | 75 | /* end of arguments */ |
74 | 76 | ||
75 | /* cpu exception frame or undefined in case of fast syscall: */ | 77 | /* cpu exception frame or undefined in case of fast syscall: */ |
76 | #define RIP 128 | 78 | #define RIP (128) |
77 | #define CS 136 | 79 | #define CS (136) |
78 | #define EFLAGS 144 | 80 | #define EFLAGS (144) |
79 | #define RSP 152 | 81 | #define RSP (152) |
80 | #define SS 160 | 82 | #define SS (160) |
81 | 83 | ||
82 | #define ARGOFFSET R11 | 84 | #define ARGOFFSET R11 |
83 | #define SWFRAME ORIG_RAX | 85 | #define SWFRAME ORIG_RAX |
@@ -111,7 +113,7 @@ For 32-bit we have the following conventions - kernel is built with | |||
111 | .endif | 113 | .endif |
112 | .endm | 114 | .endm |
113 | 115 | ||
114 | #define ARG_SKIP 9*8 | 116 | #define ARG_SKIP (9*8) |
115 | 117 | ||
116 | .macro RESTORE_ARGS skiprax=0, addskip=0, skiprcx=0, skipr11=0, \ | 118 | .macro RESTORE_ARGS skiprax=0, addskip=0, skiprcx=0, skipr11=0, \ |
117 | skipr8910=0, skiprdx=0 | 119 | skipr8910=0, skiprdx=0 |
@@ -169,7 +171,7 @@ For 32-bit we have the following conventions - kernel is built with | |||
169 | .endif | 171 | .endif |
170 | .endm | 172 | .endm |
171 | 173 | ||
172 | #define REST_SKIP 6*8 | 174 | #define REST_SKIP (6*8) |
173 | 175 | ||
174 | .macro SAVE_REST | 176 | .macro SAVE_REST |
175 | subq $REST_SKIP, %rsp | 177 | subq $REST_SKIP, %rsp |
diff --git a/arch/x86/include/asm/entry_arch.h b/arch/x86/include/asm/entry_arch.h index b8e96a18676..57650ab4a5f 100644 --- a/arch/x86/include/asm/entry_arch.h +++ b/arch/x86/include/asm/entry_arch.h | |||
@@ -16,22 +16,11 @@ BUILD_INTERRUPT(call_function_single_interrupt,CALL_FUNCTION_SINGLE_VECTOR) | |||
16 | BUILD_INTERRUPT(irq_move_cleanup_interrupt,IRQ_MOVE_CLEANUP_VECTOR) | 16 | BUILD_INTERRUPT(irq_move_cleanup_interrupt,IRQ_MOVE_CLEANUP_VECTOR) |
17 | BUILD_INTERRUPT(reboot_interrupt,REBOOT_VECTOR) | 17 | BUILD_INTERRUPT(reboot_interrupt,REBOOT_VECTOR) |
18 | 18 | ||
19 | BUILD_INTERRUPT3(invalidate_interrupt0,INVALIDATE_TLB_VECTOR_START+0, | 19 | .irpc idx, "01234567" |
20 | smp_invalidate_interrupt) | 20 | BUILD_INTERRUPT3(invalidate_interrupt\idx, |
21 | BUILD_INTERRUPT3(invalidate_interrupt1,INVALIDATE_TLB_VECTOR_START+1, | 21 | (INVALIDATE_TLB_VECTOR_START)+\idx, |
22 | smp_invalidate_interrupt) | ||
23 | BUILD_INTERRUPT3(invalidate_interrupt2,INVALIDATE_TLB_VECTOR_START+2, | ||
24 | smp_invalidate_interrupt) | ||
25 | BUILD_INTERRUPT3(invalidate_interrupt3,INVALIDATE_TLB_VECTOR_START+3, | ||
26 | smp_invalidate_interrupt) | ||
27 | BUILD_INTERRUPT3(invalidate_interrupt4,INVALIDATE_TLB_VECTOR_START+4, | ||
28 | smp_invalidate_interrupt) | ||
29 | BUILD_INTERRUPT3(invalidate_interrupt5,INVALIDATE_TLB_VECTOR_START+5, | ||
30 | smp_invalidate_interrupt) | ||
31 | BUILD_INTERRUPT3(invalidate_interrupt6,INVALIDATE_TLB_VECTOR_START+6, | ||
32 | smp_invalidate_interrupt) | ||
33 | BUILD_INTERRUPT3(invalidate_interrupt7,INVALIDATE_TLB_VECTOR_START+7, | ||
34 | smp_invalidate_interrupt) | 22 | smp_invalidate_interrupt) |
23 | .endr | ||
35 | #endif | 24 | #endif |
36 | 25 | ||
37 | BUILD_INTERRUPT(x86_platform_ipi, X86_PLATFORM_IPI_VECTOR) | 26 | BUILD_INTERRUPT(x86_platform_ipi, X86_PLATFORM_IPI_VECTOR) |
diff --git a/arch/x86/include/asm/highmem.h b/arch/x86/include/asm/highmem.h index 8caac76ac32..3bd04022fd0 100644 --- a/arch/x86/include/asm/highmem.h +++ b/arch/x86/include/asm/highmem.h | |||
@@ -59,11 +59,12 @@ extern void kunmap_high(struct page *page); | |||
59 | 59 | ||
60 | void *kmap(struct page *page); | 60 | void *kmap(struct page *page); |
61 | void kunmap(struct page *page); | 61 | void kunmap(struct page *page); |
62 | void *kmap_atomic_prot(struct page *page, enum km_type type, pgprot_t prot); | 62 | |
63 | void *kmap_atomic(struct page *page, enum km_type type); | 63 | void *kmap_atomic_prot(struct page *page, pgprot_t prot); |
64 | void kunmap_atomic_notypecheck(void *kvaddr, enum km_type type); | 64 | void *__kmap_atomic(struct page *page); |
65 | void *kmap_atomic_pfn(unsigned long pfn, enum km_type type); | 65 | void __kunmap_atomic(void *kvaddr); |
66 | void *kmap_atomic_prot_pfn(unsigned long pfn, enum km_type type, pgprot_t prot); | 66 | void *kmap_atomic_pfn(unsigned long pfn); |
67 | void *kmap_atomic_prot_pfn(unsigned long pfn, pgprot_t prot); | ||
67 | struct page *kmap_atomic_to_page(void *ptr); | 68 | struct page *kmap_atomic_to_page(void *ptr); |
68 | 69 | ||
69 | #define flush_cache_kmaps() do { } while (0) | 70 | #define flush_cache_kmaps() do { } while (0) |
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h index f0203f4791a..07227308252 100644 --- a/arch/x86/include/asm/io.h +++ b/arch/x86/include/asm/io.h | |||
@@ -41,6 +41,8 @@ | |||
41 | #include <asm-generic/int-ll64.h> | 41 | #include <asm-generic/int-ll64.h> |
42 | #include <asm/page.h> | 42 | #include <asm/page.h> |
43 | 43 | ||
44 | #include <xen/xen.h> | ||
45 | |||
44 | #define build_mmio_read(name, size, type, reg, barrier) \ | 46 | #define build_mmio_read(name, size, type, reg, barrier) \ |
45 | static inline type name(const volatile void __iomem *addr) \ | 47 | static inline type name(const volatile void __iomem *addr) \ |
46 | { type ret; asm volatile("mov" size " %1,%0":reg (ret) \ | 48 | { type ret; asm volatile("mov" size " %1,%0":reg (ret) \ |
@@ -351,6 +353,17 @@ extern void early_iounmap(void __iomem *addr, unsigned long size); | |||
351 | extern void fixup_early_ioremap(void); | 353 | extern void fixup_early_ioremap(void); |
352 | extern bool is_early_ioremap_ptep(pte_t *ptep); | 354 | extern bool is_early_ioremap_ptep(pte_t *ptep); |
353 | 355 | ||
356 | #ifdef CONFIG_XEN | ||
357 | struct bio_vec; | ||
358 | |||
359 | extern bool xen_biovec_phys_mergeable(const struct bio_vec *vec1, | ||
360 | const struct bio_vec *vec2); | ||
361 | |||
362 | #define BIOVEC_PHYS_MERGEABLE(vec1, vec2) \ | ||
363 | (__BIOVEC_PHYS_MERGEABLE(vec1, vec2) && \ | ||
364 | (!xen_domain() || xen_biovec_phys_mergeable(vec1, vec2))) | ||
365 | #endif /* CONFIG_XEN */ | ||
366 | |||
354 | #define IO_SPACE_LIMIT 0xffff | 367 | #define IO_SPACE_LIMIT 0xffff |
355 | 368 | ||
356 | #endif /* _ASM_X86_IO_H */ | 369 | #endif /* _ASM_X86_IO_H */ |
diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h index d7d46cb53e5..107f2d8c657 100644 --- a/arch/x86/include/asm/io_apic.h +++ b/arch/x86/include/asm/io_apic.h | |||
@@ -168,6 +168,8 @@ extern int save_IO_APIC_setup(struct IO_APIC_route_entry **ioapic_entries); | |||
168 | extern void mask_IO_APIC_setup(struct IO_APIC_route_entry **ioapic_entries); | 168 | extern void mask_IO_APIC_setup(struct IO_APIC_route_entry **ioapic_entries); |
169 | extern int restore_IO_APIC_setup(struct IO_APIC_route_entry **ioapic_entries); | 169 | extern int restore_IO_APIC_setup(struct IO_APIC_route_entry **ioapic_entries); |
170 | 170 | ||
171 | extern int get_nr_irqs_gsi(void); | ||
172 | |||
171 | extern void setup_ioapic_ids_from_mpc(void); | 173 | extern void setup_ioapic_ids_from_mpc(void); |
172 | extern void setup_ioapic_ids_from_mpc_nocheck(void); | 174 | extern void setup_ioapic_ids_from_mpc_nocheck(void); |
173 | 175 | ||
diff --git a/arch/x86/include/asm/iomap.h b/arch/x86/include/asm/iomap.h index c4191b3b705..363e33eb6ec 100644 --- a/arch/x86/include/asm/iomap.h +++ b/arch/x86/include/asm/iomap.h | |||
@@ -27,10 +27,10 @@ | |||
27 | #include <asm/tlbflush.h> | 27 | #include <asm/tlbflush.h> |
28 | 28 | ||
29 | void __iomem * | 29 | void __iomem * |
30 | iomap_atomic_prot_pfn(unsigned long pfn, enum km_type type, pgprot_t prot); | 30 | iomap_atomic_prot_pfn(unsigned long pfn, pgprot_t prot); |
31 | 31 | ||
32 | void | 32 | void |
33 | iounmap_atomic(void __iomem *kvaddr, enum km_type type); | 33 | iounmap_atomic(void __iomem *kvaddr); |
34 | 34 | ||
35 | int | 35 | int |
36 | iomap_create_wc(resource_size_t base, unsigned long size, pgprot_t *prot); | 36 | iomap_create_wc(resource_size_t base, unsigned long size, pgprot_t *prot); |
diff --git a/arch/x86/include/asm/irq.h b/arch/x86/include/asm/irq.h index 5458380b6ef..13b0ebaa512 100644 --- a/arch/x86/include/asm/irq.h +++ b/arch/x86/include/asm/irq.h | |||
@@ -19,18 +19,14 @@ static inline int irq_canonicalize(int irq) | |||
19 | # define ARCH_HAS_NMI_WATCHDOG | 19 | # define ARCH_HAS_NMI_WATCHDOG |
20 | #endif | 20 | #endif |
21 | 21 | ||
22 | #ifdef CONFIG_4KSTACKS | 22 | #ifdef CONFIG_X86_32 |
23 | extern void irq_ctx_init(int cpu); | 23 | extern void irq_ctx_init(int cpu); |
24 | extern void irq_ctx_exit(int cpu); | ||
25 | # define __ARCH_HAS_DO_SOFTIRQ | ||
26 | #else | 24 | #else |
27 | # define irq_ctx_init(cpu) do { } while (0) | 25 | # define irq_ctx_init(cpu) do { } while (0) |
28 | # define irq_ctx_exit(cpu) do { } while (0) | ||
29 | # ifdef CONFIG_X86_64 | ||
30 | # define __ARCH_HAS_DO_SOFTIRQ | ||
31 | # endif | ||
32 | #endif | 26 | #endif |
33 | 27 | ||
28 | #define __ARCH_HAS_DO_SOFTIRQ | ||
29 | |||
34 | #ifdef CONFIG_HOTPLUG_CPU | 30 | #ifdef CONFIG_HOTPLUG_CPU |
35 | #include <linux/cpumask.h> | 31 | #include <linux/cpumask.h> |
36 | extern void fixup_irqs(void); | 32 | extern void fixup_irqs(void); |
diff --git a/arch/x86/include/asm/kvm_emulate.h b/arch/x86/include/asm/kvm_emulate.h index 1f99ecfc48e..b36c6b3fe14 100644 --- a/arch/x86/include/asm/kvm_emulate.h +++ b/arch/x86/include/asm/kvm_emulate.h | |||
@@ -139,6 +139,7 @@ struct x86_emulate_ops { | |||
139 | void (*set_segment_selector)(u16 sel, int seg, struct kvm_vcpu *vcpu); | 139 | void (*set_segment_selector)(u16 sel, int seg, struct kvm_vcpu *vcpu); |
140 | unsigned long (*get_cached_segment_base)(int seg, struct kvm_vcpu *vcpu); | 140 | unsigned long (*get_cached_segment_base)(int seg, struct kvm_vcpu *vcpu); |
141 | void (*get_gdt)(struct desc_ptr *dt, struct kvm_vcpu *vcpu); | 141 | void (*get_gdt)(struct desc_ptr *dt, struct kvm_vcpu *vcpu); |
142 | void (*get_idt)(struct desc_ptr *dt, struct kvm_vcpu *vcpu); | ||
142 | ulong (*get_cr)(int cr, struct kvm_vcpu *vcpu); | 143 | ulong (*get_cr)(int cr, struct kvm_vcpu *vcpu); |
143 | int (*set_cr)(int cr, ulong val, struct kvm_vcpu *vcpu); | 144 | int (*set_cr)(int cr, ulong val, struct kvm_vcpu *vcpu); |
144 | int (*cpl)(struct kvm_vcpu *vcpu); | 145 | int (*cpl)(struct kvm_vcpu *vcpu); |
@@ -156,7 +157,10 @@ struct operand { | |||
156 | unsigned long orig_val; | 157 | unsigned long orig_val; |
157 | u64 orig_val64; | 158 | u64 orig_val64; |
158 | }; | 159 | }; |
159 | unsigned long *ptr; | 160 | union { |
161 | unsigned long *reg; | ||
162 | unsigned long mem; | ||
163 | } addr; | ||
160 | union { | 164 | union { |
161 | unsigned long val; | 165 | unsigned long val; |
162 | u64 val64; | 166 | u64 val64; |
@@ -190,6 +194,7 @@ struct decode_cache { | |||
190 | bool has_seg_override; | 194 | bool has_seg_override; |
191 | u8 seg_override; | 195 | u8 seg_override; |
192 | unsigned int d; | 196 | unsigned int d; |
197 | int (*execute)(struct x86_emulate_ctxt *ctxt); | ||
193 | unsigned long regs[NR_VCPU_REGS]; | 198 | unsigned long regs[NR_VCPU_REGS]; |
194 | unsigned long eip; | 199 | unsigned long eip; |
195 | /* modrm */ | 200 | /* modrm */ |
@@ -197,17 +202,16 @@ struct decode_cache { | |||
197 | u8 modrm_mod; | 202 | u8 modrm_mod; |
198 | u8 modrm_reg; | 203 | u8 modrm_reg; |
199 | u8 modrm_rm; | 204 | u8 modrm_rm; |
200 | u8 use_modrm_ea; | 205 | u8 modrm_seg; |
201 | bool rip_relative; | 206 | bool rip_relative; |
202 | unsigned long modrm_ea; | ||
203 | void *modrm_ptr; | ||
204 | unsigned long modrm_val; | ||
205 | struct fetch_cache fetch; | 207 | struct fetch_cache fetch; |
206 | struct read_cache io_read; | 208 | struct read_cache io_read; |
207 | struct read_cache mem_read; | 209 | struct read_cache mem_read; |
208 | }; | 210 | }; |
209 | 211 | ||
210 | struct x86_emulate_ctxt { | 212 | struct x86_emulate_ctxt { |
213 | struct x86_emulate_ops *ops; | ||
214 | |||
211 | /* Register state before/after emulation. */ | 215 | /* Register state before/after emulation. */ |
212 | struct kvm_vcpu *vcpu; | 216 | struct kvm_vcpu *vcpu; |
213 | 217 | ||
@@ -220,12 +224,11 @@ struct x86_emulate_ctxt { | |||
220 | /* interruptibility state, as a result of execution of STI or MOV SS */ | 224 | /* interruptibility state, as a result of execution of STI or MOV SS */ |
221 | int interruptibility; | 225 | int interruptibility; |
222 | 226 | ||
223 | bool restart; /* restart string instruction after writeback */ | 227 | bool perm_ok; /* do not check permissions if true */ |
224 | 228 | ||
225 | int exception; /* exception that happens during emulation or -1 */ | 229 | int exception; /* exception that happens during emulation or -1 */ |
226 | u32 error_code; /* error code for exception */ | 230 | u32 error_code; /* error code for exception */ |
227 | bool error_code_valid; | 231 | bool error_code_valid; |
228 | unsigned long cr2; /* faulted address in case of #PF */ | ||
229 | 232 | ||
230 | /* decode cache */ | 233 | /* decode cache */ |
231 | struct decode_cache decode; | 234 | struct decode_cache decode; |
@@ -249,13 +252,14 @@ struct x86_emulate_ctxt { | |||
249 | #define X86EMUL_MODE_HOST X86EMUL_MODE_PROT64 | 252 | #define X86EMUL_MODE_HOST X86EMUL_MODE_PROT64 |
250 | #endif | 253 | #endif |
251 | 254 | ||
252 | int x86_decode_insn(struct x86_emulate_ctxt *ctxt, | 255 | int x86_decode_insn(struct x86_emulate_ctxt *ctxt); |
253 | struct x86_emulate_ops *ops); | 256 | #define EMULATION_FAILED -1 |
254 | int x86_emulate_insn(struct x86_emulate_ctxt *ctxt, | 257 | #define EMULATION_OK 0 |
255 | struct x86_emulate_ops *ops); | 258 | #define EMULATION_RESTART 1 |
259 | int x86_emulate_insn(struct x86_emulate_ctxt *ctxt); | ||
256 | int emulator_task_switch(struct x86_emulate_ctxt *ctxt, | 260 | int emulator_task_switch(struct x86_emulate_ctxt *ctxt, |
257 | struct x86_emulate_ops *ops, | ||
258 | u16 tss_selector, int reason, | 261 | u16 tss_selector, int reason, |
259 | bool has_error_code, u32 error_code); | 262 | bool has_error_code, u32 error_code); |
260 | 263 | int emulate_int_real(struct x86_emulate_ctxt *ctxt, | |
264 | struct x86_emulate_ops *ops, int irq); | ||
261 | #endif /* _ASM_X86_KVM_X86_EMULATE_H */ | 265 | #endif /* _ASM_X86_KVM_X86_EMULATE_H */ |
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index c52e2eb40a1..9e6fe391094 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h | |||
@@ -236,10 +236,14 @@ struct kvm_pio_request { | |||
236 | */ | 236 | */ |
237 | struct kvm_mmu { | 237 | struct kvm_mmu { |
238 | void (*new_cr3)(struct kvm_vcpu *vcpu); | 238 | void (*new_cr3)(struct kvm_vcpu *vcpu); |
239 | void (*set_cr3)(struct kvm_vcpu *vcpu, unsigned long root); | ||
240 | unsigned long (*get_cr3)(struct kvm_vcpu *vcpu); | ||
239 | int (*page_fault)(struct kvm_vcpu *vcpu, gva_t gva, u32 err); | 241 | int (*page_fault)(struct kvm_vcpu *vcpu, gva_t gva, u32 err); |
242 | void (*inject_page_fault)(struct kvm_vcpu *vcpu); | ||
240 | void (*free)(struct kvm_vcpu *vcpu); | 243 | void (*free)(struct kvm_vcpu *vcpu); |
241 | gpa_t (*gva_to_gpa)(struct kvm_vcpu *vcpu, gva_t gva, u32 access, | 244 | gpa_t (*gva_to_gpa)(struct kvm_vcpu *vcpu, gva_t gva, u32 access, |
242 | u32 *error); | 245 | u32 *error); |
246 | gpa_t (*translate_gpa)(struct kvm_vcpu *vcpu, gpa_t gpa, u32 access); | ||
243 | void (*prefetch_page)(struct kvm_vcpu *vcpu, | 247 | void (*prefetch_page)(struct kvm_vcpu *vcpu, |
244 | struct kvm_mmu_page *page); | 248 | struct kvm_mmu_page *page); |
245 | int (*sync_page)(struct kvm_vcpu *vcpu, | 249 | int (*sync_page)(struct kvm_vcpu *vcpu, |
@@ -249,13 +253,18 @@ struct kvm_mmu { | |||
249 | int root_level; | 253 | int root_level; |
250 | int shadow_root_level; | 254 | int shadow_root_level; |
251 | union kvm_mmu_page_role base_role; | 255 | union kvm_mmu_page_role base_role; |
256 | bool direct_map; | ||
252 | 257 | ||
253 | u64 *pae_root; | 258 | u64 *pae_root; |
259 | u64 *lm_root; | ||
254 | u64 rsvd_bits_mask[2][4]; | 260 | u64 rsvd_bits_mask[2][4]; |
261 | |||
262 | bool nx; | ||
263 | |||
264 | u64 pdptrs[4]; /* pae */ | ||
255 | }; | 265 | }; |
256 | 266 | ||
257 | struct kvm_vcpu_arch { | 267 | struct kvm_vcpu_arch { |
258 | u64 host_tsc; | ||
259 | /* | 268 | /* |
260 | * rip and regs accesses must go through | 269 | * rip and regs accesses must go through |
261 | * kvm_{register,rip}_{read,write} functions. | 270 | * kvm_{register,rip}_{read,write} functions. |
@@ -272,7 +281,6 @@ struct kvm_vcpu_arch { | |||
272 | unsigned long cr4_guest_owned_bits; | 281 | unsigned long cr4_guest_owned_bits; |
273 | unsigned long cr8; | 282 | unsigned long cr8; |
274 | u32 hflags; | 283 | u32 hflags; |
275 | u64 pdptrs[4]; /* pae */ | ||
276 | u64 efer; | 284 | u64 efer; |
277 | u64 apic_base; | 285 | u64 apic_base; |
278 | struct kvm_lapic *apic; /* kernel irqchip context */ | 286 | struct kvm_lapic *apic; /* kernel irqchip context */ |
@@ -282,7 +290,41 @@ struct kvm_vcpu_arch { | |||
282 | u64 ia32_misc_enable_msr; | 290 | u64 ia32_misc_enable_msr; |
283 | bool tpr_access_reporting; | 291 | bool tpr_access_reporting; |
284 | 292 | ||
293 | /* | ||
294 | * Paging state of the vcpu | ||
295 | * | ||
296 | * If the vcpu runs in guest mode with two level paging this still saves | ||
297 | * the paging mode of the l1 guest. This context is always used to | ||
298 | * handle faults. | ||
299 | */ | ||
285 | struct kvm_mmu mmu; | 300 | struct kvm_mmu mmu; |
301 | |||
302 | /* | ||
303 | * Paging state of an L2 guest (used for nested npt) | ||
304 | * | ||
305 | * This context will save all necessary information to walk page tables | ||
306 | * of the an L2 guest. This context is only initialized for page table | ||
307 | * walking and not for faulting since we never handle l2 page faults on | ||
308 | * the host. | ||
309 | */ | ||
310 | struct kvm_mmu nested_mmu; | ||
311 | |||
312 | /* | ||
313 | * Pointer to the mmu context currently used for | ||
314 | * gva_to_gpa translations. | ||
315 | */ | ||
316 | struct kvm_mmu *walk_mmu; | ||
317 | |||
318 | /* | ||
319 | * This struct is filled with the necessary information to propagate a | ||
320 | * page fault into the guest | ||
321 | */ | ||
322 | struct { | ||
323 | u64 address; | ||
324 | unsigned error_code; | ||
325 | bool nested; | ||
326 | } fault; | ||
327 | |||
286 | /* only needed in kvm_pv_mmu_op() path, but it's hot so | 328 | /* only needed in kvm_pv_mmu_op() path, but it's hot so |
287 | * put it here to avoid allocation */ | 329 | * put it here to avoid allocation */ |
288 | struct kvm_pv_mmu_op_buffer mmu_op_buffer; | 330 | struct kvm_pv_mmu_op_buffer mmu_op_buffer; |
@@ -336,9 +378,15 @@ struct kvm_vcpu_arch { | |||
336 | 378 | ||
337 | gpa_t time; | 379 | gpa_t time; |
338 | struct pvclock_vcpu_time_info hv_clock; | 380 | struct pvclock_vcpu_time_info hv_clock; |
339 | unsigned int hv_clock_tsc_khz; | 381 | unsigned int hw_tsc_khz; |
340 | unsigned int time_offset; | 382 | unsigned int time_offset; |
341 | struct page *time_page; | 383 | struct page *time_page; |
384 | u64 last_host_tsc; | ||
385 | u64 last_guest_tsc; | ||
386 | u64 last_kernel_ns; | ||
387 | u64 last_tsc_nsec; | ||
388 | u64 last_tsc_write; | ||
389 | bool tsc_catchup; | ||
342 | 390 | ||
343 | bool nmi_pending; | 391 | bool nmi_pending; |
344 | bool nmi_injected; | 392 | bool nmi_injected; |
@@ -367,9 +415,9 @@ struct kvm_vcpu_arch { | |||
367 | }; | 415 | }; |
368 | 416 | ||
369 | struct kvm_arch { | 417 | struct kvm_arch { |
370 | unsigned int n_free_mmu_pages; | 418 | unsigned int n_used_mmu_pages; |
371 | unsigned int n_requested_mmu_pages; | 419 | unsigned int n_requested_mmu_pages; |
372 | unsigned int n_alloc_mmu_pages; | 420 | unsigned int n_max_mmu_pages; |
373 | atomic_t invlpg_counter; | 421 | atomic_t invlpg_counter; |
374 | struct hlist_head mmu_page_hash[KVM_NUM_MMU_PAGES]; | 422 | struct hlist_head mmu_page_hash[KVM_NUM_MMU_PAGES]; |
375 | /* | 423 | /* |
@@ -394,8 +442,14 @@ struct kvm_arch { | |||
394 | gpa_t ept_identity_map_addr; | 442 | gpa_t ept_identity_map_addr; |
395 | 443 | ||
396 | unsigned long irq_sources_bitmap; | 444 | unsigned long irq_sources_bitmap; |
397 | u64 vm_init_tsc; | ||
398 | s64 kvmclock_offset; | 445 | s64 kvmclock_offset; |
446 | spinlock_t tsc_write_lock; | ||
447 | u64 last_tsc_nsec; | ||
448 | u64 last_tsc_offset; | ||
449 | u64 last_tsc_write; | ||
450 | u32 virtual_tsc_khz; | ||
451 | u32 virtual_tsc_mult; | ||
452 | s8 virtual_tsc_shift; | ||
399 | 453 | ||
400 | struct kvm_xen_hvm_config xen_hvm_config; | 454 | struct kvm_xen_hvm_config xen_hvm_config; |
401 | 455 | ||
@@ -505,6 +559,7 @@ struct kvm_x86_ops { | |||
505 | void (*queue_exception)(struct kvm_vcpu *vcpu, unsigned nr, | 559 | void (*queue_exception)(struct kvm_vcpu *vcpu, unsigned nr, |
506 | bool has_error_code, u32 error_code, | 560 | bool has_error_code, u32 error_code, |
507 | bool reinject); | 561 | bool reinject); |
562 | void (*cancel_injection)(struct kvm_vcpu *vcpu); | ||
508 | int (*interrupt_allowed)(struct kvm_vcpu *vcpu); | 563 | int (*interrupt_allowed)(struct kvm_vcpu *vcpu); |
509 | int (*nmi_allowed)(struct kvm_vcpu *vcpu); | 564 | int (*nmi_allowed)(struct kvm_vcpu *vcpu); |
510 | bool (*get_nmi_mask)(struct kvm_vcpu *vcpu); | 565 | bool (*get_nmi_mask)(struct kvm_vcpu *vcpu); |
@@ -517,11 +572,16 @@ struct kvm_x86_ops { | |||
517 | u64 (*get_mt_mask)(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio); | 572 | u64 (*get_mt_mask)(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio); |
518 | int (*get_lpage_level)(void); | 573 | int (*get_lpage_level)(void); |
519 | bool (*rdtscp_supported)(void); | 574 | bool (*rdtscp_supported)(void); |
575 | void (*adjust_tsc_offset)(struct kvm_vcpu *vcpu, s64 adjustment); | ||
576 | |||
577 | void (*set_tdp_cr3)(struct kvm_vcpu *vcpu, unsigned long cr3); | ||
520 | 578 | ||
521 | void (*set_supported_cpuid)(u32 func, struct kvm_cpuid_entry2 *entry); | 579 | void (*set_supported_cpuid)(u32 func, struct kvm_cpuid_entry2 *entry); |
522 | 580 | ||
523 | bool (*has_wbinvd_exit)(void); | 581 | bool (*has_wbinvd_exit)(void); |
524 | 582 | ||
583 | void (*write_tsc_offset)(struct kvm_vcpu *vcpu, u64 offset); | ||
584 | |||
525 | const struct trace_print_flags *exit_reasons_str; | 585 | const struct trace_print_flags *exit_reasons_str; |
526 | }; | 586 | }; |
527 | 587 | ||
@@ -544,7 +604,7 @@ void kvm_mmu_zap_all(struct kvm *kvm); | |||
544 | unsigned int kvm_mmu_calculate_mmu_pages(struct kvm *kvm); | 604 | unsigned int kvm_mmu_calculate_mmu_pages(struct kvm *kvm); |
545 | void kvm_mmu_change_mmu_pages(struct kvm *kvm, unsigned int kvm_nr_mmu_pages); | 605 | void kvm_mmu_change_mmu_pages(struct kvm *kvm, unsigned int kvm_nr_mmu_pages); |
546 | 606 | ||
547 | int load_pdptrs(struct kvm_vcpu *vcpu, unsigned long cr3); | 607 | int load_pdptrs(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, unsigned long cr3); |
548 | 608 | ||
549 | int emulator_write_phys(struct kvm_vcpu *vcpu, gpa_t gpa, | 609 | int emulator_write_phys(struct kvm_vcpu *vcpu, gpa_t gpa, |
550 | const void *val, int bytes); | 610 | const void *val, int bytes); |
@@ -608,8 +668,11 @@ void kvm_queue_exception(struct kvm_vcpu *vcpu, unsigned nr); | |||
608 | void kvm_queue_exception_e(struct kvm_vcpu *vcpu, unsigned nr, u32 error_code); | 668 | void kvm_queue_exception_e(struct kvm_vcpu *vcpu, unsigned nr, u32 error_code); |
609 | void kvm_requeue_exception(struct kvm_vcpu *vcpu, unsigned nr); | 669 | void kvm_requeue_exception(struct kvm_vcpu *vcpu, unsigned nr); |
610 | void kvm_requeue_exception_e(struct kvm_vcpu *vcpu, unsigned nr, u32 error_code); | 670 | void kvm_requeue_exception_e(struct kvm_vcpu *vcpu, unsigned nr, u32 error_code); |
611 | void kvm_inject_page_fault(struct kvm_vcpu *vcpu, unsigned long cr2, | 671 | void kvm_inject_page_fault(struct kvm_vcpu *vcpu); |
612 | u32 error_code); | 672 | int kvm_read_guest_page_mmu(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, |
673 | gfn_t gfn, void *data, int offset, int len, | ||
674 | u32 access); | ||
675 | void kvm_propagate_fault(struct kvm_vcpu *vcpu); | ||
613 | bool kvm_require_cpl(struct kvm_vcpu *vcpu, int required_cpl); | 676 | bool kvm_require_cpl(struct kvm_vcpu *vcpu, int required_cpl); |
614 | 677 | ||
615 | int kvm_pic_set_irq(void *opaque, int irq, int level); | 678 | int kvm_pic_set_irq(void *opaque, int irq, int level); |
diff --git a/arch/x86/include/asm/kvm_para.h b/arch/x86/include/asm/kvm_para.h index 05eba5e9a8e..7b562b6184b 100644 --- a/arch/x86/include/asm/kvm_para.h +++ b/arch/x86/include/asm/kvm_para.h | |||
@@ -158,6 +158,12 @@ static inline unsigned int kvm_arch_para_features(void) | |||
158 | return cpuid_eax(KVM_CPUID_FEATURES); | 158 | return cpuid_eax(KVM_CPUID_FEATURES); |
159 | } | 159 | } |
160 | 160 | ||
161 | #ifdef CONFIG_KVM_GUEST | ||
162 | void __init kvm_guest_init(void); | ||
163 | #else | ||
164 | #define kvm_guest_init() do { } while (0) | ||
161 | #endif | 165 | #endif |
162 | 166 | ||
167 | #endif /* __KERNEL__ */ | ||
168 | |||
163 | #endif /* _ASM_X86_KVM_PARA_H */ | 169 | #endif /* _ASM_X86_KVM_PARA_H */ |
diff --git a/arch/x86/include/asm/module.h b/arch/x86/include/asm/module.h index 3e2ce58a31a..67763c5d8b4 100644 --- a/arch/x86/include/asm/module.h +++ b/arch/x86/include/asm/module.h | |||
@@ -60,12 +60,7 @@ | |||
60 | #endif | 60 | #endif |
61 | 61 | ||
62 | #ifdef CONFIG_X86_32 | 62 | #ifdef CONFIG_X86_32 |
63 | # ifdef CONFIG_4KSTACKS | 63 | # define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY |
64 | # define MODULE_STACKSIZE "4KSTACKS " | ||
65 | # else | ||
66 | # define MODULE_STACKSIZE "" | ||
67 | # endif | ||
68 | # define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY MODULE_STACKSIZE | ||
69 | #endif | 64 | #endif |
70 | 65 | ||
71 | #endif /* _ASM_X86_MODULE_H */ | 66 | #endif /* _ASM_X86_MODULE_H */ |
diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h index 986f7790fdb..3ea3dc48704 100644 --- a/arch/x86/include/asm/msr-index.h +++ b/arch/x86/include/asm/msr-index.h | |||
@@ -121,6 +121,7 @@ | |||
121 | #define MSR_AMD64_IBSDCLINAD 0xc0011038 | 121 | #define MSR_AMD64_IBSDCLINAD 0xc0011038 |
122 | #define MSR_AMD64_IBSDCPHYSAD 0xc0011039 | 122 | #define MSR_AMD64_IBSDCPHYSAD 0xc0011039 |
123 | #define MSR_AMD64_IBSCTL 0xc001103a | 123 | #define MSR_AMD64_IBSCTL 0xc001103a |
124 | #define MSR_AMD64_IBSBRTARGET 0xc001103b | ||
124 | 125 | ||
125 | /* Fam 10h MSRs */ | 126 | /* Fam 10h MSRs */ |
126 | #define MSR_FAM10H_MMIO_CONF_BASE 0xc0010058 | 127 | #define MSR_FAM10H_MMIO_CONF_BASE 0xc0010058 |
@@ -198,6 +199,7 @@ | |||
198 | #define MSR_IA32_TSC 0x00000010 | 199 | #define MSR_IA32_TSC 0x00000010 |
199 | #define MSR_IA32_PLATFORM_ID 0x00000017 | 200 | #define MSR_IA32_PLATFORM_ID 0x00000017 |
200 | #define MSR_IA32_EBL_CR_POWERON 0x0000002a | 201 | #define MSR_IA32_EBL_CR_POWERON 0x0000002a |
202 | #define MSR_EBC_FREQUENCY_ID 0x0000002c | ||
201 | #define MSR_IA32_FEATURE_CONTROL 0x0000003a | 203 | #define MSR_IA32_FEATURE_CONTROL 0x0000003a |
202 | 204 | ||
203 | #define FEATURE_CONTROL_LOCKED (1<<0) | 205 | #define FEATURE_CONTROL_LOCKED (1<<0) |
diff --git a/arch/x86/include/asm/olpc.h b/arch/x86/include/asm/olpc.h index 101229b0d8e..42a978c0c1b 100644 --- a/arch/x86/include/asm/olpc.h +++ b/arch/x86/include/asm/olpc.h | |||
@@ -89,6 +89,8 @@ extern int olpc_ec_mask_unset(uint8_t bits); | |||
89 | /* EC commands */ | 89 | /* EC commands */ |
90 | 90 | ||
91 | #define EC_FIRMWARE_REV 0x08 | 91 | #define EC_FIRMWARE_REV 0x08 |
92 | #define EC_WLAN_ENTER_RESET 0x35 | ||
93 | #define EC_WLAN_LEAVE_RESET 0x25 | ||
92 | 94 | ||
93 | /* SCI source values */ | 95 | /* SCI source values */ |
94 | 96 | ||
diff --git a/arch/x86/include/asm/page_32_types.h b/arch/x86/include/asm/page_32_types.h index 6f1b7331313..ade619ff9e2 100644 --- a/arch/x86/include/asm/page_32_types.h +++ b/arch/x86/include/asm/page_32_types.h | |||
@@ -15,11 +15,7 @@ | |||
15 | */ | 15 | */ |
16 | #define __PAGE_OFFSET _AC(CONFIG_PAGE_OFFSET, UL) | 16 | #define __PAGE_OFFSET _AC(CONFIG_PAGE_OFFSET, UL) |
17 | 17 | ||
18 | #ifdef CONFIG_4KSTACKS | ||
19 | #define THREAD_ORDER 0 | ||
20 | #else | ||
21 | #define THREAD_ORDER 1 | 18 | #define THREAD_ORDER 1 |
22 | #endif | ||
23 | #define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER) | 19 | #define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER) |
24 | 20 | ||
25 | #define STACKFAULT_STACK 0 | 21 | #define STACKFAULT_STACK 0 |
diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h index d395540ff89..ca0437c714b 100644 --- a/arch/x86/include/asm/pci.h +++ b/arch/x86/include/asm/pci.h | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/string.h> | 7 | #include <linux/string.h> |
8 | #include <asm/scatterlist.h> | 8 | #include <asm/scatterlist.h> |
9 | #include <asm/io.h> | 9 | #include <asm/io.h> |
10 | #include <asm/x86_init.h> | ||
10 | 11 | ||
11 | #ifdef __KERNEL__ | 12 | #ifdef __KERNEL__ |
12 | 13 | ||
@@ -94,8 +95,36 @@ static inline void early_quirks(void) { } | |||
94 | 95 | ||
95 | extern void pci_iommu_alloc(void); | 96 | extern void pci_iommu_alloc(void); |
96 | 97 | ||
97 | /* MSI arch hook */ | 98 | #ifdef CONFIG_PCI_MSI |
98 | #define arch_setup_msi_irqs arch_setup_msi_irqs | 99 | /* MSI arch specific hooks */ |
100 | static inline int x86_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) | ||
101 | { | ||
102 | return x86_msi.setup_msi_irqs(dev, nvec, type); | ||
103 | } | ||
104 | |||
105 | static inline void x86_teardown_msi_irqs(struct pci_dev *dev) | ||
106 | { | ||
107 | x86_msi.teardown_msi_irqs(dev); | ||
108 | } | ||
109 | |||
110 | static inline void x86_teardown_msi_irq(unsigned int irq) | ||
111 | { | ||
112 | x86_msi.teardown_msi_irq(irq); | ||
113 | } | ||
114 | #define arch_setup_msi_irqs x86_setup_msi_irqs | ||
115 | #define arch_teardown_msi_irqs x86_teardown_msi_irqs | ||
116 | #define arch_teardown_msi_irq x86_teardown_msi_irq | ||
117 | /* implemented in arch/x86/kernel/apic/io_apic. */ | ||
118 | int native_setup_msi_irqs(struct pci_dev *dev, int nvec, int type); | ||
119 | void native_teardown_msi_irq(unsigned int irq); | ||
120 | /* default to the implementation in drivers/lib/msi.c */ | ||
121 | #define HAVE_DEFAULT_MSI_TEARDOWN_IRQS | ||
122 | void default_teardown_msi_irqs(struct pci_dev *dev); | ||
123 | #else | ||
124 | #define native_setup_msi_irqs NULL | ||
125 | #define native_teardown_msi_irq NULL | ||
126 | #define default_teardown_msi_irqs NULL | ||
127 | #endif | ||
99 | 128 | ||
100 | #define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys) | 129 | #define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys) |
101 | 130 | ||
diff --git a/arch/x86/include/asm/pci_x86.h b/arch/x86/include/asm/pci_x86.h index 49c7219826f..704526734be 100644 --- a/arch/x86/include/asm/pci_x86.h +++ b/arch/x86/include/asm/pci_x86.h | |||
@@ -47,6 +47,7 @@ enum pci_bf_sort_state { | |||
47 | extern unsigned int pcibios_max_latency; | 47 | extern unsigned int pcibios_max_latency; |
48 | 48 | ||
49 | void pcibios_resource_survey(void); | 49 | void pcibios_resource_survey(void); |
50 | void pcibios_set_cache_line_size(void); | ||
50 | 51 | ||
51 | /* pci-pc.c */ | 52 | /* pci-pc.c */ |
52 | 53 | ||
diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h index cd28f9ad910..f899e01a8ac 100644 --- a/arch/x86/include/asm/percpu.h +++ b/arch/x86/include/asm/percpu.h | |||
@@ -47,6 +47,20 @@ | |||
47 | #ifdef CONFIG_SMP | 47 | #ifdef CONFIG_SMP |
48 | #define __percpu_arg(x) "%%"__stringify(__percpu_seg)":%P" #x | 48 | #define __percpu_arg(x) "%%"__stringify(__percpu_seg)":%P" #x |
49 | #define __my_cpu_offset percpu_read(this_cpu_off) | 49 | #define __my_cpu_offset percpu_read(this_cpu_off) |
50 | |||
51 | /* | ||
52 | * Compared to the generic __my_cpu_offset version, the following | ||
53 | * saves one instruction and avoids clobbering a temp register. | ||
54 | */ | ||
55 | #define __this_cpu_ptr(ptr) \ | ||
56 | ({ \ | ||
57 | unsigned long tcp_ptr__; \ | ||
58 | __verify_pcpu_ptr(ptr); \ | ||
59 | asm volatile("add " __percpu_arg(1) ", %0" \ | ||
60 | : "=r" (tcp_ptr__) \ | ||
61 | : "m" (this_cpu_off), "0" (ptr)); \ | ||
62 | (typeof(*(ptr)) __kernel __force *)tcp_ptr__; \ | ||
63 | }) | ||
50 | #else | 64 | #else |
51 | #define __percpu_arg(x) "%P" #x | 65 | #define __percpu_arg(x) "%P" #x |
52 | #endif | 66 | #endif |
diff --git a/arch/x86/include/asm/perf_event.h b/arch/x86/include/asm/perf_event.h index 6e742cc4251..550e26b1dbb 100644 --- a/arch/x86/include/asm/perf_event.h +++ b/arch/x86/include/asm/perf_event.h | |||
@@ -111,17 +111,18 @@ union cpuid10_edx { | |||
111 | #define X86_PMC_IDX_FIXED_BTS (X86_PMC_IDX_FIXED + 16) | 111 | #define X86_PMC_IDX_FIXED_BTS (X86_PMC_IDX_FIXED + 16) |
112 | 112 | ||
113 | /* IbsFetchCtl bits/masks */ | 113 | /* IbsFetchCtl bits/masks */ |
114 | #define IBS_FETCH_RAND_EN (1ULL<<57) | 114 | #define IBS_FETCH_RAND_EN (1ULL<<57) |
115 | #define IBS_FETCH_VAL (1ULL<<49) | 115 | #define IBS_FETCH_VAL (1ULL<<49) |
116 | #define IBS_FETCH_ENABLE (1ULL<<48) | 116 | #define IBS_FETCH_ENABLE (1ULL<<48) |
117 | #define IBS_FETCH_CNT 0xFFFF0000ULL | 117 | #define IBS_FETCH_CNT 0xFFFF0000ULL |
118 | #define IBS_FETCH_MAX_CNT 0x0000FFFFULL | 118 | #define IBS_FETCH_MAX_CNT 0x0000FFFFULL |
119 | 119 | ||
120 | /* IbsOpCtl bits */ | 120 | /* IbsOpCtl bits */ |
121 | #define IBS_OP_CNT_CTL (1ULL<<19) | 121 | #define IBS_OP_CNT_CTL (1ULL<<19) |
122 | #define IBS_OP_VAL (1ULL<<18) | 122 | #define IBS_OP_VAL (1ULL<<18) |
123 | #define IBS_OP_ENABLE (1ULL<<17) | 123 | #define IBS_OP_ENABLE (1ULL<<17) |
124 | #define IBS_OP_MAX_CNT 0x0000FFFFULL | 124 | #define IBS_OP_MAX_CNT 0x0000FFFFULL |
125 | #define IBS_OP_MAX_CNT_EXT 0x007FFFFFULL /* not a register bit mask */ | ||
125 | 126 | ||
126 | #ifdef CONFIG_PERF_EVENTS | 127 | #ifdef CONFIG_PERF_EVENTS |
127 | extern void init_hw_perf_events(void); | 128 | extern void init_hw_perf_events(void); |
diff --git a/arch/x86/include/asm/pgtable_32.h b/arch/x86/include/asm/pgtable_32.h index f686f49e8b7..0c92113c4cb 100644 --- a/arch/x86/include/asm/pgtable_32.h +++ b/arch/x86/include/asm/pgtable_32.h | |||
@@ -26,7 +26,7 @@ struct mm_struct; | |||
26 | struct vm_area_struct; | 26 | struct vm_area_struct; |
27 | 27 | ||
28 | extern pgd_t swapper_pg_dir[1024]; | 28 | extern pgd_t swapper_pg_dir[1024]; |
29 | extern pgd_t trampoline_pg_dir[1024]; | 29 | extern pgd_t initial_page_table[1024]; |
30 | 30 | ||
31 | static inline void pgtable_cache_init(void) { } | 31 | static inline void pgtable_cache_init(void) { } |
32 | static inline void check_pgt_cache(void) { } | 32 | static inline void check_pgt_cache(void) { } |
@@ -49,24 +49,14 @@ extern void set_pmd_pfn(unsigned long, unsigned long, pgprot_t); | |||
49 | #endif | 49 | #endif |
50 | 50 | ||
51 | #if defined(CONFIG_HIGHPTE) | 51 | #if defined(CONFIG_HIGHPTE) |
52 | #define __KM_PTE \ | ||
53 | (in_nmi() ? KM_NMI_PTE : \ | ||
54 | in_irq() ? KM_IRQ_PTE : \ | ||
55 | KM_PTE0) | ||
56 | #define pte_offset_map(dir, address) \ | 52 | #define pte_offset_map(dir, address) \ |
57 | ((pte_t *)kmap_atomic(pmd_page(*(dir)), __KM_PTE) + \ | 53 | ((pte_t *)kmap_atomic(pmd_page(*(dir))) + \ |
58 | pte_index((address))) | 54 | pte_index((address))) |
59 | #define pte_offset_map_nested(dir, address) \ | 55 | #define pte_unmap(pte) kunmap_atomic((pte)) |
60 | ((pte_t *)kmap_atomic(pmd_page(*(dir)), KM_PTE1) + \ | ||
61 | pte_index((address))) | ||
62 | #define pte_unmap(pte) kunmap_atomic((pte), __KM_PTE) | ||
63 | #define pte_unmap_nested(pte) kunmap_atomic((pte), KM_PTE1) | ||
64 | #else | 56 | #else |
65 | #define pte_offset_map(dir, address) \ | 57 | #define pte_offset_map(dir, address) \ |
66 | ((pte_t *)page_address(pmd_page(*(dir))) + pte_index((address))) | 58 | ((pte_t *)page_address(pmd_page(*(dir))) + pte_index((address))) |
67 | #define pte_offset_map_nested(dir, address) pte_offset_map((dir), (address)) | ||
68 | #define pte_unmap(pte) do { } while (0) | 59 | #define pte_unmap(pte) do { } while (0) |
69 | #define pte_unmap_nested(pte) do { } while (0) | ||
70 | #endif | 60 | #endif |
71 | 61 | ||
72 | /* Clear a kernel PTE and flush it from the TLB */ | 62 | /* Clear a kernel PTE and flush it from the TLB */ |
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h index f96ac9bedf7..f86da20347f 100644 --- a/arch/x86/include/asm/pgtable_64.h +++ b/arch/x86/include/asm/pgtable_64.h | |||
@@ -127,9 +127,7 @@ static inline int pgd_large(pgd_t pgd) { return 0; } | |||
127 | 127 | ||
128 | /* x86-64 always has all page tables mapped. */ | 128 | /* x86-64 always has all page tables mapped. */ |
129 | #define pte_offset_map(dir, address) pte_offset_kernel((dir), (address)) | 129 | #define pte_offset_map(dir, address) pte_offset_kernel((dir), (address)) |
130 | #define pte_offset_map_nested(dir, address) pte_offset_kernel((dir), (address)) | ||
131 | #define pte_unmap(pte) ((void)(pte))/* NOP */ | 130 | #define pte_unmap(pte) ((void)(pte))/* NOP */ |
132 | #define pte_unmap_nested(pte) ((void)(pte)) /* NOP */ | ||
133 | 131 | ||
134 | #define update_mmu_cache(vma, address, ptep) do { } while (0) | 132 | #define update_mmu_cache(vma, address, ptep) do { } while (0) |
135 | 133 | ||
diff --git a/arch/x86/include/asm/pvclock.h b/arch/x86/include/asm/pvclock.h index cd02f324aa6..7f7e577a0e3 100644 --- a/arch/x86/include/asm/pvclock.h +++ b/arch/x86/include/asm/pvclock.h | |||
@@ -12,4 +12,42 @@ void pvclock_read_wallclock(struct pvclock_wall_clock *wall, | |||
12 | struct pvclock_vcpu_time_info *vcpu, | 12 | struct pvclock_vcpu_time_info *vcpu, |
13 | struct timespec *ts); | 13 | struct timespec *ts); |
14 | 14 | ||
15 | /* | ||
16 | * Scale a 64-bit delta by scaling and multiplying by a 32-bit fraction, | ||
17 | * yielding a 64-bit result. | ||
18 | */ | ||
19 | static inline u64 pvclock_scale_delta(u64 delta, u32 mul_frac, int shift) | ||
20 | { | ||
21 | u64 product; | ||
22 | #ifdef __i386__ | ||
23 | u32 tmp1, tmp2; | ||
24 | #endif | ||
25 | |||
26 | if (shift < 0) | ||
27 | delta >>= -shift; | ||
28 | else | ||
29 | delta <<= shift; | ||
30 | |||
31 | #ifdef __i386__ | ||
32 | __asm__ ( | ||
33 | "mul %5 ; " | ||
34 | "mov %4,%%eax ; " | ||
35 | "mov %%edx,%4 ; " | ||
36 | "mul %5 ; " | ||
37 | "xor %5,%5 ; " | ||
38 | "add %4,%%eax ; " | ||
39 | "adc %5,%%edx ; " | ||
40 | : "=A" (product), "=r" (tmp1), "=r" (tmp2) | ||
41 | : "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" (mul_frac) ); | ||
42 | #elif defined(__x86_64__) | ||
43 | __asm__ ( | ||
44 | "mul %%rdx ; shrd $32,%%rdx,%%rax" | ||
45 | : "=a" (product) : "0" (delta), "d" ((u64)mul_frac) ); | ||
46 | #else | ||
47 | #error implement me! | ||
48 | #endif | ||
49 | |||
50 | return product; | ||
51 | } | ||
52 | |||
15 | #endif /* _ASM_X86_PVCLOCK_H */ | 53 | #endif /* _ASM_X86_PVCLOCK_H */ |
diff --git a/arch/x86/include/asm/segment.h b/arch/x86/include/asm/segment.h index 14e0ed86a6f..231f1c1d660 100644 --- a/arch/x86/include/asm/segment.h +++ b/arch/x86/include/asm/segment.h | |||
@@ -73,31 +73,31 @@ | |||
73 | 73 | ||
74 | #define GDT_ENTRY_DEFAULT_USER_DS 15 | 74 | #define GDT_ENTRY_DEFAULT_USER_DS 15 |
75 | 75 | ||
76 | #define GDT_ENTRY_KERNEL_BASE 12 | 76 | #define GDT_ENTRY_KERNEL_BASE (12) |
77 | 77 | ||
78 | #define GDT_ENTRY_KERNEL_CS (GDT_ENTRY_KERNEL_BASE + 0) | 78 | #define GDT_ENTRY_KERNEL_CS (GDT_ENTRY_KERNEL_BASE+0) |
79 | 79 | ||
80 | #define GDT_ENTRY_KERNEL_DS (GDT_ENTRY_KERNEL_BASE + 1) | 80 | #define GDT_ENTRY_KERNEL_DS (GDT_ENTRY_KERNEL_BASE+1) |
81 | 81 | ||
82 | #define GDT_ENTRY_TSS (GDT_ENTRY_KERNEL_BASE + 4) | 82 | #define GDT_ENTRY_TSS (GDT_ENTRY_KERNEL_BASE+4) |
83 | #define GDT_ENTRY_LDT (GDT_ENTRY_KERNEL_BASE + 5) | 83 | #define GDT_ENTRY_LDT (GDT_ENTRY_KERNEL_BASE+5) |
84 | 84 | ||
85 | #define GDT_ENTRY_PNPBIOS_BASE (GDT_ENTRY_KERNEL_BASE + 6) | 85 | #define GDT_ENTRY_PNPBIOS_BASE (GDT_ENTRY_KERNEL_BASE+6) |
86 | #define GDT_ENTRY_APMBIOS_BASE (GDT_ENTRY_KERNEL_BASE + 11) | 86 | #define GDT_ENTRY_APMBIOS_BASE (GDT_ENTRY_KERNEL_BASE+11) |
87 | 87 | ||
88 | #define GDT_ENTRY_ESPFIX_SS (GDT_ENTRY_KERNEL_BASE + 14) | 88 | #define GDT_ENTRY_ESPFIX_SS (GDT_ENTRY_KERNEL_BASE+14) |
89 | #define __ESPFIX_SS (GDT_ENTRY_ESPFIX_SS * 8) | 89 | #define __ESPFIX_SS (GDT_ENTRY_ESPFIX_SS*8) |
90 | 90 | ||
91 | #define GDT_ENTRY_PERCPU (GDT_ENTRY_KERNEL_BASE + 15) | 91 | #define GDT_ENTRY_PERCPU (GDT_ENTRY_KERNEL_BASE+15) |
92 | #ifdef CONFIG_SMP | 92 | #ifdef CONFIG_SMP |
93 | #define __KERNEL_PERCPU (GDT_ENTRY_PERCPU * 8) | 93 | #define __KERNEL_PERCPU (GDT_ENTRY_PERCPU * 8) |
94 | #else | 94 | #else |
95 | #define __KERNEL_PERCPU 0 | 95 | #define __KERNEL_PERCPU 0 |
96 | #endif | 96 | #endif |
97 | 97 | ||
98 | #define GDT_ENTRY_STACK_CANARY (GDT_ENTRY_KERNEL_BASE + 16) | 98 | #define GDT_ENTRY_STACK_CANARY (GDT_ENTRY_KERNEL_BASE+16) |
99 | #ifdef CONFIG_CC_STACKPROTECTOR | 99 | #ifdef CONFIG_CC_STACKPROTECTOR |
100 | #define __KERNEL_STACK_CANARY (GDT_ENTRY_STACK_CANARY * 8) | 100 | #define __KERNEL_STACK_CANARY (GDT_ENTRY_STACK_CANARY*8) |
101 | #else | 101 | #else |
102 | #define __KERNEL_STACK_CANARY 0 | 102 | #define __KERNEL_STACK_CANARY 0 |
103 | #endif | 103 | #endif |
@@ -182,10 +182,10 @@ | |||
182 | 182 | ||
183 | #endif | 183 | #endif |
184 | 184 | ||
185 | #define __KERNEL_CS (GDT_ENTRY_KERNEL_CS * 8) | 185 | #define __KERNEL_CS (GDT_ENTRY_KERNEL_CS*8) |
186 | #define __KERNEL_DS (GDT_ENTRY_KERNEL_DS * 8) | 186 | #define __KERNEL_DS (GDT_ENTRY_KERNEL_DS*8) |
187 | #define __USER_DS (GDT_ENTRY_DEFAULT_USER_DS* 8 + 3) | 187 | #define __USER_DS (GDT_ENTRY_DEFAULT_USER_DS*8+3) |
188 | #define __USER_CS (GDT_ENTRY_DEFAULT_USER_CS* 8 + 3) | 188 | #define __USER_CS (GDT_ENTRY_DEFAULT_USER_CS*8+3) |
189 | #ifndef CONFIG_PARAVIRT | 189 | #ifndef CONFIG_PARAVIRT |
190 | #define get_kernel_rpl() 0 | 190 | #define get_kernel_rpl() 0 |
191 | #endif | 191 | #endif |
diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h index 4cfc9082406..4c2f63c7fc1 100644 --- a/arch/x86/include/asm/smp.h +++ b/arch/x86/include/asm/smp.h | |||
@@ -50,7 +50,7 @@ struct smp_ops { | |||
50 | void (*smp_prepare_cpus)(unsigned max_cpus); | 50 | void (*smp_prepare_cpus)(unsigned max_cpus); |
51 | void (*smp_cpus_done)(unsigned max_cpus); | 51 | void (*smp_cpus_done)(unsigned max_cpus); |
52 | 52 | ||
53 | void (*smp_send_stop)(void); | 53 | void (*stop_other_cpus)(int wait); |
54 | void (*smp_send_reschedule)(int cpu); | 54 | void (*smp_send_reschedule)(int cpu); |
55 | 55 | ||
56 | int (*cpu_up)(unsigned cpu); | 56 | int (*cpu_up)(unsigned cpu); |
@@ -73,7 +73,12 @@ extern struct smp_ops smp_ops; | |||
73 | 73 | ||
74 | static inline void smp_send_stop(void) | 74 | static inline void smp_send_stop(void) |
75 | { | 75 | { |
76 | smp_ops.smp_send_stop(); | 76 | smp_ops.stop_other_cpus(0); |
77 | } | ||
78 | |||
79 | static inline void stop_other_cpus(void) | ||
80 | { | ||
81 | smp_ops.stop_other_cpus(1); | ||
77 | } | 82 | } |
78 | 83 | ||
79 | static inline void smp_prepare_boot_cpu(void) | 84 | static inline void smp_prepare_boot_cpu(void) |
diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h index 7f3eba08e7d..169be8938b9 100644 --- a/arch/x86/include/asm/tlbflush.h +++ b/arch/x86/include/asm/tlbflush.h | |||
@@ -172,6 +172,4 @@ static inline void flush_tlb_kernel_range(unsigned long start, | |||
172 | flush_tlb_all(); | 172 | flush_tlb_all(); |
173 | } | 173 | } |
174 | 174 | ||
175 | extern void zap_low_mappings(bool early); | ||
176 | |||
177 | #endif /* _ASM_X86_TLBFLUSH_H */ | 175 | #endif /* _ASM_X86_TLBFLUSH_H */ |
diff --git a/arch/x86/include/asm/trampoline.h b/arch/x86/include/asm/trampoline.h index 4dde797c057..f4500fb3b48 100644 --- a/arch/x86/include/asm/trampoline.h +++ b/arch/x86/include/asm/trampoline.h | |||
@@ -13,16 +13,13 @@ extern unsigned char *trampoline_base; | |||
13 | 13 | ||
14 | extern unsigned long init_rsp; | 14 | extern unsigned long init_rsp; |
15 | extern unsigned long initial_code; | 15 | extern unsigned long initial_code; |
16 | extern unsigned long initial_page_table; | ||
17 | extern unsigned long initial_gs; | 16 | extern unsigned long initial_gs; |
18 | 17 | ||
19 | #define TRAMPOLINE_SIZE roundup(trampoline_end - trampoline_data, PAGE_SIZE) | 18 | #define TRAMPOLINE_SIZE roundup(trampoline_end - trampoline_data, PAGE_SIZE) |
20 | 19 | ||
21 | extern unsigned long setup_trampoline(void); | 20 | extern unsigned long setup_trampoline(void); |
22 | extern void __init setup_trampoline_page_table(void); | ||
23 | extern void __init reserve_trampoline_memory(void); | 21 | extern void __init reserve_trampoline_memory(void); |
24 | #else | 22 | #else |
25 | static inline void setup_trampoline_page_table(void) {} | ||
26 | static inline void reserve_trampoline_memory(void) {} | 23 | static inline void reserve_trampoline_memory(void) {} |
27 | #endif /* CONFIG_X86_TRAMPOLINE */ | 24 | #endif /* CONFIG_X86_TRAMPOLINE */ |
28 | 25 | ||
diff --git a/arch/x86/include/asm/uv/uv_hub.h b/arch/x86/include/asm/uv/uv_hub.h index bf6b88ef8ee..e969f691cbf 100644 --- a/arch/x86/include/asm/uv/uv_hub.h +++ b/arch/x86/include/asm/uv/uv_hub.h | |||
@@ -5,7 +5,7 @@ | |||
5 | * | 5 | * |
6 | * SGI UV architectural definitions | 6 | * SGI UV architectural definitions |
7 | * | 7 | * |
8 | * Copyright (C) 2007-2008 Silicon Graphics, Inc. All rights reserved. | 8 | * Copyright (C) 2007-2010 Silicon Graphics, Inc. All rights reserved. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #ifndef _ASM_X86_UV_UV_HUB_H | 11 | #ifndef _ASM_X86_UV_UV_HUB_H |
@@ -77,7 +77,8 @@ | |||
77 | * | 77 | * |
78 | * 1111110000000000 | 78 | * 1111110000000000 |
79 | * 5432109876543210 | 79 | * 5432109876543210 |
80 | * pppppppppplc0cch | 80 | * pppppppppplc0cch Nehalem-EX |
81 | * ppppppppplcc0cch Westmere-EX | ||
81 | * sssssssssss | 82 | * sssssssssss |
82 | * | 83 | * |
83 | * p = pnode bits | 84 | * p = pnode bits |
@@ -148,12 +149,25 @@ struct uv_hub_info_s { | |||
148 | unsigned char m_val; | 149 | unsigned char m_val; |
149 | unsigned char n_val; | 150 | unsigned char n_val; |
150 | struct uv_scir_s scir; | 151 | struct uv_scir_s scir; |
152 | unsigned char apic_pnode_shift; | ||
151 | }; | 153 | }; |
152 | 154 | ||
153 | DECLARE_PER_CPU(struct uv_hub_info_s, __uv_hub_info); | 155 | DECLARE_PER_CPU(struct uv_hub_info_s, __uv_hub_info); |
154 | #define uv_hub_info (&__get_cpu_var(__uv_hub_info)) | 156 | #define uv_hub_info (&__get_cpu_var(__uv_hub_info)) |
155 | #define uv_cpu_hub_info(cpu) (&per_cpu(__uv_hub_info, cpu)) | 157 | #define uv_cpu_hub_info(cpu) (&per_cpu(__uv_hub_info, cpu)) |
156 | 158 | ||
159 | union uvh_apicid { | ||
160 | unsigned long v; | ||
161 | struct uvh_apicid_s { | ||
162 | unsigned long local_apic_mask : 24; | ||
163 | unsigned long local_apic_shift : 5; | ||
164 | unsigned long unused1 : 3; | ||
165 | unsigned long pnode_mask : 24; | ||
166 | unsigned long pnode_shift : 5; | ||
167 | unsigned long unused2 : 3; | ||
168 | } s; | ||
169 | }; | ||
170 | |||
157 | /* | 171 | /* |
158 | * Local & Global MMR space macros. | 172 | * Local & Global MMR space macros. |
159 | * Note: macros are intended to be used ONLY by inline functions | 173 | * Note: macros are intended to be used ONLY by inline functions |
@@ -182,6 +196,7 @@ DECLARE_PER_CPU(struct uv_hub_info_s, __uv_hub_info); | |||
182 | #define UV_GLOBAL_MMR64_PNODE_BITS(p) \ | 196 | #define UV_GLOBAL_MMR64_PNODE_BITS(p) \ |
183 | (((unsigned long)(p)) << UV_GLOBAL_MMR64_PNODE_SHIFT) | 197 | (((unsigned long)(p)) << UV_GLOBAL_MMR64_PNODE_SHIFT) |
184 | 198 | ||
199 | #define UVH_APICID 0x002D0E00L | ||
185 | #define UV_APIC_PNODE_SHIFT 6 | 200 | #define UV_APIC_PNODE_SHIFT 6 |
186 | 201 | ||
187 | /* Local Bus from cpu's perspective */ | 202 | /* Local Bus from cpu's perspective */ |
@@ -280,7 +295,7 @@ static inline void *uv_pnode_offset_to_vaddr(int pnode, unsigned long offset) | |||
280 | */ | 295 | */ |
281 | static inline int uv_apicid_to_pnode(int apicid) | 296 | static inline int uv_apicid_to_pnode(int apicid) |
282 | { | 297 | { |
283 | return (apicid >> UV_APIC_PNODE_SHIFT); | 298 | return (apicid >> uv_hub_info->apic_pnode_shift); |
284 | } | 299 | } |
285 | 300 | ||
286 | /* | 301 | /* |
diff --git a/arch/x86/include/asm/uv/uv_mmrs.h b/arch/x86/include/asm/uv/uv_mmrs.h index b2f2d2e05ce..6d90adf4428 100644 --- a/arch/x86/include/asm/uv/uv_mmrs.h +++ b/arch/x86/include/asm/uv/uv_mmrs.h | |||
@@ -806,6 +806,78 @@ union uvh_node_present_table_u { | |||
806 | }; | 806 | }; |
807 | 807 | ||
808 | /* ========================================================================= */ | 808 | /* ========================================================================= */ |
809 | /* UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_0_MMR */ | ||
810 | /* ========================================================================= */ | ||
811 | #define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_0_MMR 0x16000c8UL | ||
812 | |||
813 | #define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_0_MMR_BASE_SHFT 24 | ||
814 | #define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_0_MMR_BASE_MASK 0x00000000ff000000UL | ||
815 | #define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_0_MMR_M_ALIAS_SHFT 48 | ||
816 | #define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_0_MMR_M_ALIAS_MASK 0x001f000000000000UL | ||
817 | #define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_0_MMR_ENABLE_SHFT 63 | ||
818 | #define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_0_MMR_ENABLE_MASK 0x8000000000000000UL | ||
819 | |||
820 | union uvh_rh_gam_alias210_overlay_config_0_mmr_u { | ||
821 | unsigned long v; | ||
822 | struct uvh_rh_gam_alias210_overlay_config_0_mmr_s { | ||
823 | unsigned long rsvd_0_23: 24; /* */ | ||
824 | unsigned long base : 8; /* RW */ | ||
825 | unsigned long rsvd_32_47: 16; /* */ | ||
826 | unsigned long m_alias : 5; /* RW */ | ||
827 | unsigned long rsvd_53_62: 10; /* */ | ||
828 | unsigned long enable : 1; /* RW */ | ||
829 | } s; | ||
830 | }; | ||
831 | |||
832 | /* ========================================================================= */ | ||
833 | /* UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_1_MMR */ | ||
834 | /* ========================================================================= */ | ||
835 | #define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_1_MMR 0x16000d8UL | ||
836 | |||
837 | #define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_1_MMR_BASE_SHFT 24 | ||
838 | #define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_1_MMR_BASE_MASK 0x00000000ff000000UL | ||
839 | #define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_1_MMR_M_ALIAS_SHFT 48 | ||
840 | #define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_1_MMR_M_ALIAS_MASK 0x001f000000000000UL | ||
841 | #define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_1_MMR_ENABLE_SHFT 63 | ||
842 | #define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_1_MMR_ENABLE_MASK 0x8000000000000000UL | ||
843 | |||
844 | union uvh_rh_gam_alias210_overlay_config_1_mmr_u { | ||
845 | unsigned long v; | ||
846 | struct uvh_rh_gam_alias210_overlay_config_1_mmr_s { | ||
847 | unsigned long rsvd_0_23: 24; /* */ | ||
848 | unsigned long base : 8; /* RW */ | ||
849 | unsigned long rsvd_32_47: 16; /* */ | ||
850 | unsigned long m_alias : 5; /* RW */ | ||
851 | unsigned long rsvd_53_62: 10; /* */ | ||
852 | unsigned long enable : 1; /* RW */ | ||
853 | } s; | ||
854 | }; | ||
855 | |||
856 | /* ========================================================================= */ | ||
857 | /* UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_2_MMR */ | ||
858 | /* ========================================================================= */ | ||
859 | #define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_2_MMR 0x16000e8UL | ||
860 | |||
861 | #define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_2_MMR_BASE_SHFT 24 | ||
862 | #define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_2_MMR_BASE_MASK 0x00000000ff000000UL | ||
863 | #define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_2_MMR_M_ALIAS_SHFT 48 | ||
864 | #define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_2_MMR_M_ALIAS_MASK 0x001f000000000000UL | ||
865 | #define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_2_MMR_ENABLE_SHFT 63 | ||
866 | #define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_2_MMR_ENABLE_MASK 0x8000000000000000UL | ||
867 | |||
868 | union uvh_rh_gam_alias210_overlay_config_2_mmr_u { | ||
869 | unsigned long v; | ||
870 | struct uvh_rh_gam_alias210_overlay_config_2_mmr_s { | ||
871 | unsigned long rsvd_0_23: 24; /* */ | ||
872 | unsigned long base : 8; /* RW */ | ||
873 | unsigned long rsvd_32_47: 16; /* */ | ||
874 | unsigned long m_alias : 5; /* RW */ | ||
875 | unsigned long rsvd_53_62: 10; /* */ | ||
876 | unsigned long enable : 1; /* RW */ | ||
877 | } s; | ||
878 | }; | ||
879 | |||
880 | /* ========================================================================= */ | ||
809 | /* UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_0_MMR */ | 881 | /* UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_0_MMR */ |
810 | /* ========================================================================= */ | 882 | /* ========================================================================= */ |
811 | #define UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_0_MMR 0x16000d0UL | 883 | #define UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_0_MMR 0x16000d0UL |
@@ -857,6 +929,29 @@ union uvh_rh_gam_alias210_redirect_config_2_mmr_u { | |||
857 | }; | 929 | }; |
858 | 930 | ||
859 | /* ========================================================================= */ | 931 | /* ========================================================================= */ |
932 | /* UVH_RH_GAM_CONFIG_MMR */ | ||
933 | /* ========================================================================= */ | ||
934 | #define UVH_RH_GAM_CONFIG_MMR 0x1600000UL | ||
935 | |||
936 | #define UVH_RH_GAM_CONFIG_MMR_M_SKT_SHFT 0 | ||
937 | #define UVH_RH_GAM_CONFIG_MMR_M_SKT_MASK 0x000000000000003fUL | ||
938 | #define UVH_RH_GAM_CONFIG_MMR_N_SKT_SHFT 6 | ||
939 | #define UVH_RH_GAM_CONFIG_MMR_N_SKT_MASK 0x00000000000003c0UL | ||
940 | #define UVH_RH_GAM_CONFIG_MMR_MMIOL_CFG_SHFT 12 | ||
941 | #define UVH_RH_GAM_CONFIG_MMR_MMIOL_CFG_MASK 0x0000000000001000UL | ||
942 | |||
943 | union uvh_rh_gam_config_mmr_u { | ||
944 | unsigned long v; | ||
945 | struct uvh_rh_gam_config_mmr_s { | ||
946 | unsigned long m_skt : 6; /* RW */ | ||
947 | unsigned long n_skt : 4; /* RW */ | ||
948 | unsigned long rsvd_10_11: 2; /* */ | ||
949 | unsigned long mmiol_cfg : 1; /* RW */ | ||
950 | unsigned long rsvd_13_63: 51; /* */ | ||
951 | } s; | ||
952 | }; | ||
953 | |||
954 | /* ========================================================================= */ | ||
860 | /* UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR */ | 955 | /* UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR */ |
861 | /* ========================================================================= */ | 956 | /* ========================================================================= */ |
862 | #define UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR 0x1600010UL | 957 | #define UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR 0x1600010UL |
@@ -987,97 +1082,5 @@ union uvh_rtc1_int_config_u { | |||
987 | } s; | 1082 | } s; |
988 | }; | 1083 | }; |
989 | 1084 | ||
990 | /* ========================================================================= */ | ||
991 | /* UVH_SI_ADDR_MAP_CONFIG */ | ||
992 | /* ========================================================================= */ | ||
993 | #define UVH_SI_ADDR_MAP_CONFIG 0xc80000UL | ||
994 | |||
995 | #define UVH_SI_ADDR_MAP_CONFIG_M_SKT_SHFT 0 | ||
996 | #define UVH_SI_ADDR_MAP_CONFIG_M_SKT_MASK 0x000000000000003fUL | ||
997 | #define UVH_SI_ADDR_MAP_CONFIG_N_SKT_SHFT 8 | ||
998 | #define UVH_SI_ADDR_MAP_CONFIG_N_SKT_MASK 0x0000000000000f00UL | ||
999 | |||
1000 | union uvh_si_addr_map_config_u { | ||
1001 | unsigned long v; | ||
1002 | struct uvh_si_addr_map_config_s { | ||
1003 | unsigned long m_skt : 6; /* RW */ | ||
1004 | unsigned long rsvd_6_7: 2; /* */ | ||
1005 | unsigned long n_skt : 4; /* RW */ | ||
1006 | unsigned long rsvd_12_63: 52; /* */ | ||
1007 | } s; | ||
1008 | }; | ||
1009 | |||
1010 | /* ========================================================================= */ | ||
1011 | /* UVH_SI_ALIAS0_OVERLAY_CONFIG */ | ||
1012 | /* ========================================================================= */ | ||
1013 | #define UVH_SI_ALIAS0_OVERLAY_CONFIG 0xc80008UL | ||
1014 | |||
1015 | #define UVH_SI_ALIAS0_OVERLAY_CONFIG_BASE_SHFT 24 | ||
1016 | #define UVH_SI_ALIAS0_OVERLAY_CONFIG_BASE_MASK 0x00000000ff000000UL | ||
1017 | #define UVH_SI_ALIAS0_OVERLAY_CONFIG_M_ALIAS_SHFT 48 | ||
1018 | #define UVH_SI_ALIAS0_OVERLAY_CONFIG_M_ALIAS_MASK 0x001f000000000000UL | ||
1019 | #define UVH_SI_ALIAS0_OVERLAY_CONFIG_ENABLE_SHFT 63 | ||
1020 | #define UVH_SI_ALIAS0_OVERLAY_CONFIG_ENABLE_MASK 0x8000000000000000UL | ||
1021 | |||
1022 | union uvh_si_alias0_overlay_config_u { | ||
1023 | unsigned long v; | ||
1024 | struct uvh_si_alias0_overlay_config_s { | ||
1025 | unsigned long rsvd_0_23: 24; /* */ | ||
1026 | unsigned long base : 8; /* RW */ | ||
1027 | unsigned long rsvd_32_47: 16; /* */ | ||
1028 | unsigned long m_alias : 5; /* RW */ | ||
1029 | unsigned long rsvd_53_62: 10; /* */ | ||
1030 | unsigned long enable : 1; /* RW */ | ||
1031 | } s; | ||
1032 | }; | ||
1033 | |||
1034 | /* ========================================================================= */ | ||
1035 | /* UVH_SI_ALIAS1_OVERLAY_CONFIG */ | ||
1036 | /* ========================================================================= */ | ||
1037 | #define UVH_SI_ALIAS1_OVERLAY_CONFIG 0xc80010UL | ||
1038 | |||
1039 | #define UVH_SI_ALIAS1_OVERLAY_CONFIG_BASE_SHFT 24 | ||
1040 | #define UVH_SI_ALIAS1_OVERLAY_CONFIG_BASE_MASK 0x00000000ff000000UL | ||
1041 | #define UVH_SI_ALIAS1_OVERLAY_CONFIG_M_ALIAS_SHFT 48 | ||
1042 | #define UVH_SI_ALIAS1_OVERLAY_CONFIG_M_ALIAS_MASK 0x001f000000000000UL | ||
1043 | #define UVH_SI_ALIAS1_OVERLAY_CONFIG_ENABLE_SHFT 63 | ||
1044 | #define UVH_SI_ALIAS1_OVERLAY_CONFIG_ENABLE_MASK 0x8000000000000000UL | ||
1045 | |||
1046 | union uvh_si_alias1_overlay_config_u { | ||
1047 | unsigned long v; | ||
1048 | struct uvh_si_alias1_overlay_config_s { | ||
1049 | unsigned long rsvd_0_23: 24; /* */ | ||
1050 | unsigned long base : 8; /* RW */ | ||
1051 | unsigned long rsvd_32_47: 16; /* */ | ||
1052 | unsigned long m_alias : 5; /* RW */ | ||
1053 | unsigned long rsvd_53_62: 10; /* */ | ||
1054 | unsigned long enable : 1; /* RW */ | ||
1055 | } s; | ||
1056 | }; | ||
1057 | |||
1058 | /* ========================================================================= */ | ||
1059 | /* UVH_SI_ALIAS2_OVERLAY_CONFIG */ | ||
1060 | /* ========================================================================= */ | ||
1061 | #define UVH_SI_ALIAS2_OVERLAY_CONFIG 0xc80018UL | ||
1062 | |||
1063 | #define UVH_SI_ALIAS2_OVERLAY_CONFIG_BASE_SHFT 24 | ||
1064 | #define UVH_SI_ALIAS2_OVERLAY_CONFIG_BASE_MASK 0x00000000ff000000UL | ||
1065 | #define UVH_SI_ALIAS2_OVERLAY_CONFIG_M_ALIAS_SHFT 48 | ||
1066 | #define UVH_SI_ALIAS2_OVERLAY_CONFIG_M_ALIAS_MASK 0x001f000000000000UL | ||
1067 | #define UVH_SI_ALIAS2_OVERLAY_CONFIG_ENABLE_SHFT 63 | ||
1068 | #define UVH_SI_ALIAS2_OVERLAY_CONFIG_ENABLE_MASK 0x8000000000000000UL | ||
1069 | |||
1070 | union uvh_si_alias2_overlay_config_u { | ||
1071 | unsigned long v; | ||
1072 | struct uvh_si_alias2_overlay_config_s { | ||
1073 | unsigned long rsvd_0_23: 24; /* */ | ||
1074 | unsigned long base : 8; /* RW */ | ||
1075 | unsigned long rsvd_32_47: 16; /* */ | ||
1076 | unsigned long m_alias : 5; /* RW */ | ||
1077 | unsigned long rsvd_53_62: 10; /* */ | ||
1078 | unsigned long enable : 1; /* RW */ | ||
1079 | } s; | ||
1080 | }; | ||
1081 | |||
1082 | 1085 | ||
1083 | #endif /* _ASM_X86_UV_UV_MMRS_H */ | 1086 | #endif /* __ASM_UV_MMRS_X86_H__ */ |
diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_init.h index baa579c8e03..64642ad019f 100644 --- a/arch/x86/include/asm/x86_init.h +++ b/arch/x86/include/asm/x86_init.h | |||
@@ -154,9 +154,18 @@ struct x86_platform_ops { | |||
154 | int (*i8042_detect)(void); | 154 | int (*i8042_detect)(void); |
155 | }; | 155 | }; |
156 | 156 | ||
157 | struct pci_dev; | ||
158 | |||
159 | struct x86_msi_ops { | ||
160 | int (*setup_msi_irqs)(struct pci_dev *dev, int nvec, int type); | ||
161 | void (*teardown_msi_irq)(unsigned int irq); | ||
162 | void (*teardown_msi_irqs)(struct pci_dev *dev); | ||
163 | }; | ||
164 | |||
157 | extern struct x86_init_ops x86_init; | 165 | extern struct x86_init_ops x86_init; |
158 | extern struct x86_cpuinit_ops x86_cpuinit; | 166 | extern struct x86_cpuinit_ops x86_cpuinit; |
159 | extern struct x86_platform_ops x86_platform; | 167 | extern struct x86_platform_ops x86_platform; |
168 | extern struct x86_msi_ops x86_msi; | ||
160 | 169 | ||
161 | extern void x86_init_noop(void); | 170 | extern void x86_init_noop(void); |
162 | extern void x86_init_uint_noop(unsigned int unused); | 171 | extern void x86_init_uint_noop(unsigned int unused); |
diff --git a/arch/x86/include/asm/xen/hypercall.h b/arch/x86/include/asm/xen/hypercall.h index 7fda040a76c..a3c28ae4025 100644 --- a/arch/x86/include/asm/xen/hypercall.h +++ b/arch/x86/include/asm/xen/hypercall.h | |||
@@ -200,6 +200,23 @@ extern struct { char _entry[32]; } hypercall_page[]; | |||
200 | (type)__res; \ | 200 | (type)__res; \ |
201 | }) | 201 | }) |
202 | 202 | ||
203 | static inline long | ||
204 | privcmd_call(unsigned call, | ||
205 | unsigned long a1, unsigned long a2, | ||
206 | unsigned long a3, unsigned long a4, | ||
207 | unsigned long a5) | ||
208 | { | ||
209 | __HYPERCALL_DECLS; | ||
210 | __HYPERCALL_5ARG(a1, a2, a3, a4, a5); | ||
211 | |||
212 | asm volatile("call *%[call]" | ||
213 | : __HYPERCALL_5PARAM | ||
214 | : [call] "a" (&hypercall_page[call]) | ||
215 | : __HYPERCALL_CLOBBER5); | ||
216 | |||
217 | return (long)__res; | ||
218 | } | ||
219 | |||
203 | static inline int | 220 | static inline int |
204 | HYPERVISOR_set_trap_table(struct trap_info *table) | 221 | HYPERVISOR_set_trap_table(struct trap_info *table) |
205 | { | 222 | { |
diff --git a/arch/x86/include/asm/xen/page.h b/arch/x86/include/asm/xen/page.h index bf5f7d32bd0..dd8c1414b3d 100644 --- a/arch/x86/include/asm/xen/page.h +++ b/arch/x86/include/asm/xen/page.h | |||
@@ -37,14 +37,21 @@ typedef struct xpaddr { | |||
37 | 37 | ||
38 | 38 | ||
39 | extern unsigned long get_phys_to_machine(unsigned long pfn); | 39 | extern unsigned long get_phys_to_machine(unsigned long pfn); |
40 | extern void set_phys_to_machine(unsigned long pfn, unsigned long mfn); | 40 | extern bool set_phys_to_machine(unsigned long pfn, unsigned long mfn); |
41 | 41 | ||
42 | static inline unsigned long pfn_to_mfn(unsigned long pfn) | 42 | static inline unsigned long pfn_to_mfn(unsigned long pfn) |
43 | { | 43 | { |
44 | unsigned long mfn; | ||
45 | |||
44 | if (xen_feature(XENFEAT_auto_translated_physmap)) | 46 | if (xen_feature(XENFEAT_auto_translated_physmap)) |
45 | return pfn; | 47 | return pfn; |
46 | 48 | ||
47 | return get_phys_to_machine(pfn) & ~FOREIGN_FRAME_BIT; | 49 | mfn = get_phys_to_machine(pfn); |
50 | |||
51 | if (mfn != INVALID_P2M_ENTRY) | ||
52 | mfn &= ~FOREIGN_FRAME_BIT; | ||
53 | |||
54 | return mfn; | ||
48 | } | 55 | } |
49 | 56 | ||
50 | static inline int phys_to_machine_mapping_valid(unsigned long pfn) | 57 | static inline int phys_to_machine_mapping_valid(unsigned long pfn) |
@@ -159,6 +166,7 @@ static inline pte_t __pte_ma(pteval_t x) | |||
159 | 166 | ||
160 | #define pgd_val_ma(x) ((x).pgd) | 167 | #define pgd_val_ma(x) ((x).pgd) |
161 | 168 | ||
169 | void xen_set_domain_pte(pte_t *ptep, pte_t pteval, unsigned domid); | ||
162 | 170 | ||
163 | xmaddr_t arbitrary_virt_to_machine(void *address); | 171 | xmaddr_t arbitrary_virt_to_machine(void *address); |
164 | unsigned long arbitrary_virt_to_mfn(void *vaddr); | 172 | unsigned long arbitrary_virt_to_mfn(void *vaddr); |
diff --git a/arch/x86/include/asm/xen/pci.h b/arch/x86/include/asm/xen/pci.h new file mode 100644 index 00000000000..2329b3eaf8d --- /dev/null +++ b/arch/x86/include/asm/xen/pci.h | |||
@@ -0,0 +1,65 @@ | |||
1 | #ifndef _ASM_X86_XEN_PCI_H | ||
2 | #define _ASM_X86_XEN_PCI_H | ||
3 | |||
4 | #if defined(CONFIG_PCI_XEN) | ||
5 | extern int __init pci_xen_init(void); | ||
6 | extern int __init pci_xen_hvm_init(void); | ||
7 | #define pci_xen 1 | ||
8 | #else | ||
9 | #define pci_xen 0 | ||
10 | #define pci_xen_init (0) | ||
11 | static inline int pci_xen_hvm_init(void) | ||
12 | { | ||
13 | return -1; | ||
14 | } | ||
15 | #endif | ||
16 | #if defined(CONFIG_XEN_DOM0) | ||
17 | void __init xen_setup_pirqs(void); | ||
18 | #else | ||
19 | static inline void __init xen_setup_pirqs(void) | ||
20 | { | ||
21 | } | ||
22 | #endif | ||
23 | |||
24 | #if defined(CONFIG_PCI_MSI) | ||
25 | #if defined(CONFIG_PCI_XEN) | ||
26 | /* The drivers/pci/xen-pcifront.c sets this structure to | ||
27 | * its own functions. | ||
28 | */ | ||
29 | struct xen_pci_frontend_ops { | ||
30 | int (*enable_msi)(struct pci_dev *dev, int **vectors); | ||
31 | void (*disable_msi)(struct pci_dev *dev); | ||
32 | int (*enable_msix)(struct pci_dev *dev, int **vectors, int nvec); | ||
33 | void (*disable_msix)(struct pci_dev *dev); | ||
34 | }; | ||
35 | |||
36 | extern struct xen_pci_frontend_ops *xen_pci_frontend; | ||
37 | |||
38 | static inline int xen_pci_frontend_enable_msi(struct pci_dev *dev, | ||
39 | int **vectors) | ||
40 | { | ||
41 | if (xen_pci_frontend && xen_pci_frontend->enable_msi) | ||
42 | return xen_pci_frontend->enable_msi(dev, vectors); | ||
43 | return -ENODEV; | ||
44 | } | ||
45 | static inline void xen_pci_frontend_disable_msi(struct pci_dev *dev) | ||
46 | { | ||
47 | if (xen_pci_frontend && xen_pci_frontend->disable_msi) | ||
48 | xen_pci_frontend->disable_msi(dev); | ||
49 | } | ||
50 | static inline int xen_pci_frontend_enable_msix(struct pci_dev *dev, | ||
51 | int **vectors, int nvec) | ||
52 | { | ||
53 | if (xen_pci_frontend && xen_pci_frontend->enable_msix) | ||
54 | return xen_pci_frontend->enable_msix(dev, vectors, nvec); | ||
55 | return -ENODEV; | ||
56 | } | ||
57 | static inline void xen_pci_frontend_disable_msix(struct pci_dev *dev) | ||
58 | { | ||
59 | if (xen_pci_frontend && xen_pci_frontend->disable_msix) | ||
60 | xen_pci_frontend->disable_msix(dev); | ||
61 | } | ||
62 | #endif /* CONFIG_PCI_XEN */ | ||
63 | #endif /* CONFIG_PCI_MSI */ | ||
64 | |||
65 | #endif /* _ASM_X86_XEN_PCI_H */ | ||