diff options
author | Ingo Molnar <mingo@kernel.org> | 2012-05-07 06:07:51 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2012-05-07 06:07:51 -0400 |
commit | 22042c086c1b6814b9f3ecf2720f6280bede9c47 (patch) | |
tree | 3bdb64f4537161dd87ce317d87ec7fd7f37ed0dd /arch | |
parent | febb72a6e4cc6c8cffcc1ea649a3fb364f1ea432 (diff) | |
parent | ab6ec39a191243b9968bb9ac7f26cc7ec30c618b (diff) |
Merge branch 'stable/for-ingo-v3.5' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen into x86/apic
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/include/asm/io_apic.h | 35 | ||||
-rw-r--r-- | arch/x86/include/asm/x86_init.h | 9 | ||||
-rw-r--r-- | arch/x86/kernel/apic/io_apic.c | 46 | ||||
-rw-r--r-- | arch/x86/kernel/setup.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/x86_init.c | 8 | ||||
-rw-r--r-- | arch/x86/xen/Makefile | 2 | ||||
-rw-r--r-- | arch/x86/xen/apic.c | 30 | ||||
-rw-r--r-- | arch/x86/xen/enlighten.c | 2 | ||||
-rw-r--r-- | arch/x86/xen/mmu.c | 4 | ||||
-rw-r--r-- | arch/x86/xen/xen-ops.h | 4 |
10 files changed, 82 insertions, 60 deletions
diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h index 2c4943de5150..73d8c5398ea9 100644 --- a/arch/x86/include/asm/io_apic.h +++ b/arch/x86/include/asm/io_apic.h | |||
@@ -5,7 +5,7 @@ | |||
5 | #include <asm/mpspec.h> | 5 | #include <asm/mpspec.h> |
6 | #include <asm/apicdef.h> | 6 | #include <asm/apicdef.h> |
7 | #include <asm/irq_vectors.h> | 7 | #include <asm/irq_vectors.h> |
8 | 8 | #include <asm/x86_init.h> | |
9 | /* | 9 | /* |
10 | * Intel IO-APIC support for SMP and UP systems. | 10 | * Intel IO-APIC support for SMP and UP systems. |
11 | * | 11 | * |
@@ -21,15 +21,6 @@ | |||
21 | #define IO_APIC_REDIR_LEVEL_TRIGGER (1 << 15) | 21 | #define IO_APIC_REDIR_LEVEL_TRIGGER (1 << 15) |
22 | #define IO_APIC_REDIR_MASKED (1 << 16) | 22 | #define IO_APIC_REDIR_MASKED (1 << 16) |
23 | 23 | ||
24 | struct io_apic_ops { | ||
25 | void (*init) (void); | ||
26 | unsigned int (*read) (unsigned int apic, unsigned int reg); | ||
27 | void (*write) (unsigned int apic, unsigned int reg, unsigned int value); | ||
28 | void (*modify)(unsigned int apic, unsigned int reg, unsigned int value); | ||
29 | }; | ||
30 | |||
31 | void __init set_io_apic_ops(const struct io_apic_ops *); | ||
32 | |||
33 | /* | 24 | /* |
34 | * The structure of the IO-APIC: | 25 | * The structure of the IO-APIC: |
35 | */ | 26 | */ |
@@ -156,7 +147,6 @@ struct io_apic_irq_attr; | |||
156 | extern int io_apic_set_pci_routing(struct device *dev, int irq, | 147 | extern int io_apic_set_pci_routing(struct device *dev, int irq, |
157 | struct io_apic_irq_attr *irq_attr); | 148 | struct io_apic_irq_attr *irq_attr); |
158 | void setup_IO_APIC_irq_extra(u32 gsi); | 149 | void setup_IO_APIC_irq_extra(u32 gsi); |
159 | extern void ioapic_and_gsi_init(void); | ||
160 | extern void ioapic_insert_resources(void); | 150 | extern void ioapic_insert_resources(void); |
161 | 151 | ||
162 | int io_apic_setup_irq_pin_once(unsigned int irq, int node, struct io_apic_irq_attr *attr); | 152 | int io_apic_setup_irq_pin_once(unsigned int irq, int node, struct io_apic_irq_attr *attr); |
@@ -185,12 +175,29 @@ extern void mp_save_irq(struct mpc_intsrc *m); | |||
185 | 175 | ||
186 | extern void disable_ioapic_support(void); | 176 | extern void disable_ioapic_support(void); |
187 | 177 | ||
178 | extern void __init native_io_apic_init_mappings(void); | ||
179 | extern unsigned int native_io_apic_read(unsigned int apic, unsigned int reg); | ||
180 | extern void native_io_apic_write(unsigned int apic, unsigned int reg, unsigned int val); | ||
181 | extern void native_io_apic_modify(unsigned int apic, unsigned int reg, unsigned int val); | ||
182 | |||
183 | static inline unsigned int io_apic_read(unsigned int apic, unsigned int reg) | ||
184 | { | ||
185 | return x86_io_apic_ops.read(apic, reg); | ||
186 | } | ||
187 | |||
188 | static inline void io_apic_write(unsigned int apic, unsigned int reg, unsigned int value) | ||
189 | { | ||
190 | x86_io_apic_ops.write(apic, reg, value); | ||
191 | } | ||
192 | static inline void io_apic_modify(unsigned int apic, unsigned int reg, unsigned int value) | ||
193 | { | ||
194 | x86_io_apic_ops.modify(apic, reg, value); | ||
195 | } | ||
188 | #else /* !CONFIG_X86_IO_APIC */ | 196 | #else /* !CONFIG_X86_IO_APIC */ |
189 | 197 | ||
190 | #define io_apic_assign_pci_irqs 0 | 198 | #define io_apic_assign_pci_irqs 0 |
191 | #define setup_ioapic_ids_from_mpc x86_init_noop | 199 | #define setup_ioapic_ids_from_mpc x86_init_noop |
192 | static const int timer_through_8259 = 0; | 200 | static const int timer_through_8259 = 0; |
193 | static inline void ioapic_and_gsi_init(void) { } | ||
194 | static inline void ioapic_insert_resources(void) { } | 201 | static inline void ioapic_insert_resources(void) { } |
195 | #define gsi_top (NR_IRQS_LEGACY) | 202 | #define gsi_top (NR_IRQS_LEGACY) |
196 | static inline int mp_find_ioapic(u32 gsi) { return 0; } | 203 | static inline int mp_find_ioapic(u32 gsi) { return 0; } |
@@ -212,6 +219,10 @@ static inline int restore_ioapic_entries(void) | |||
212 | 219 | ||
213 | static inline void mp_save_irq(struct mpc_intsrc *m) { }; | 220 | static inline void mp_save_irq(struct mpc_intsrc *m) { }; |
214 | static inline void disable_ioapic_support(void) { } | 221 | static inline void disable_ioapic_support(void) { } |
222 | #define native_io_apic_init_mappings NULL | ||
223 | #define native_io_apic_read NULL | ||
224 | #define native_io_apic_write NULL | ||
225 | #define native_io_apic_modify NULL | ||
215 | #endif | 226 | #endif |
216 | 227 | ||
217 | #endif /* _ASM_X86_IO_APIC_H */ | 228 | #endif /* _ASM_X86_IO_APIC_H */ |
diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_init.h index 764b66a4cf89..c090af10ac7d 100644 --- a/arch/x86/include/asm/x86_init.h +++ b/arch/x86/include/asm/x86_init.h | |||
@@ -188,11 +188,18 @@ struct x86_msi_ops { | |||
188 | void (*restore_msi_irqs)(struct pci_dev *dev, int irq); | 188 | void (*restore_msi_irqs)(struct pci_dev *dev, int irq); |
189 | }; | 189 | }; |
190 | 190 | ||
191 | struct x86_io_apic_ops { | ||
192 | void (*init) (void); | ||
193 | unsigned int (*read) (unsigned int apic, unsigned int reg); | ||
194 | void (*write) (unsigned int apic, unsigned int reg, unsigned int value); | ||
195 | void (*modify)(unsigned int apic, unsigned int reg, unsigned int value); | ||
196 | }; | ||
197 | |||
191 | extern struct x86_init_ops x86_init; | 198 | extern struct x86_init_ops x86_init; |
192 | extern struct x86_cpuinit_ops x86_cpuinit; | 199 | extern struct x86_cpuinit_ops x86_cpuinit; |
193 | extern struct x86_platform_ops x86_platform; | 200 | extern struct x86_platform_ops x86_platform; |
194 | extern struct x86_msi_ops x86_msi; | 201 | extern struct x86_msi_ops x86_msi; |
195 | 202 | extern struct x86_io_apic_ops x86_io_apic_ops; | |
196 | extern void x86_init_noop(void); | 203 | extern void x86_init_noop(void); |
197 | extern void x86_init_uint_noop(unsigned int unused); | 204 | extern void x86_init_uint_noop(unsigned int unused); |
198 | 205 | ||
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index e88300d8e80a..973539c128a4 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c | |||
@@ -68,24 +68,6 @@ | |||
68 | #define for_each_irq_pin(entry, head) \ | 68 | #define for_each_irq_pin(entry, head) \ |
69 | for (entry = head; entry; entry = entry->next) | 69 | for (entry = head; entry; entry = entry->next) |
70 | 70 | ||
71 | static void __init __ioapic_init_mappings(void); | ||
72 | |||
73 | static unsigned int __io_apic_read (unsigned int apic, unsigned int reg); | ||
74 | static void __io_apic_write (unsigned int apic, unsigned int reg, unsigned int val); | ||
75 | static void __io_apic_modify(unsigned int apic, unsigned int reg, unsigned int val); | ||
76 | |||
77 | static struct io_apic_ops io_apic_ops = { | ||
78 | .init = __ioapic_init_mappings, | ||
79 | .read = __io_apic_read, | ||
80 | .write = __io_apic_write, | ||
81 | .modify = __io_apic_modify, | ||
82 | }; | ||
83 | |||
84 | void __init set_io_apic_ops(const struct io_apic_ops *ops) | ||
85 | { | ||
86 | io_apic_ops = *ops; | ||
87 | } | ||
88 | |||
89 | /* | 71 | /* |
90 | * Is the SiS APIC rmw bug present ? | 72 | * Is the SiS APIC rmw bug present ? |
91 | * -1 = don't know, 0 = no, 1 = yes | 73 | * -1 = don't know, 0 = no, 1 = yes |
@@ -313,21 +295,6 @@ static void free_irq_at(unsigned int at, struct irq_cfg *cfg) | |||
313 | irq_free_desc(at); | 295 | irq_free_desc(at); |
314 | } | 296 | } |
315 | 297 | ||
316 | static inline unsigned int io_apic_read(unsigned int apic, unsigned int reg) | ||
317 | { | ||
318 | return io_apic_ops.read(apic, reg); | ||
319 | } | ||
320 | |||
321 | static inline void io_apic_write(unsigned int apic, unsigned int reg, unsigned int value) | ||
322 | { | ||
323 | io_apic_ops.write(apic, reg, value); | ||
324 | } | ||
325 | |||
326 | static inline void io_apic_modify(unsigned int apic, unsigned int reg, unsigned int value) | ||
327 | { | ||
328 | io_apic_ops.modify(apic, reg, value); | ||
329 | } | ||
330 | |||
331 | 298 | ||
332 | struct io_apic { | 299 | struct io_apic { |
333 | unsigned int index; | 300 | unsigned int index; |
@@ -349,14 +316,14 @@ static inline void io_apic_eoi(unsigned int apic, unsigned int vector) | |||
349 | writel(vector, &io_apic->eoi); | 316 | writel(vector, &io_apic->eoi); |
350 | } | 317 | } |
351 | 318 | ||
352 | static unsigned int __io_apic_read(unsigned int apic, unsigned int reg) | 319 | unsigned int native_io_apic_read(unsigned int apic, unsigned int reg) |
353 | { | 320 | { |
354 | struct io_apic __iomem *io_apic = io_apic_base(apic); | 321 | struct io_apic __iomem *io_apic = io_apic_base(apic); |
355 | writel(reg, &io_apic->index); | 322 | writel(reg, &io_apic->index); |
356 | return readl(&io_apic->data); | 323 | return readl(&io_apic->data); |
357 | } | 324 | } |
358 | 325 | ||
359 | static void __io_apic_write(unsigned int apic, unsigned int reg, unsigned int value) | 326 | void native_io_apic_write(unsigned int apic, unsigned int reg, unsigned int value) |
360 | { | 327 | { |
361 | struct io_apic __iomem *io_apic = io_apic_base(apic); | 328 | struct io_apic __iomem *io_apic = io_apic_base(apic); |
362 | 329 | ||
@@ -370,7 +337,7 @@ static void __io_apic_write(unsigned int apic, unsigned int reg, unsigned int va | |||
370 | * | 337 | * |
371 | * Older SiS APIC requires we rewrite the index register | 338 | * Older SiS APIC requires we rewrite the index register |
372 | */ | 339 | */ |
373 | static void __io_apic_modify(unsigned int apic, unsigned int reg, unsigned int value) | 340 | void native_io_apic_modify(unsigned int apic, unsigned int reg, unsigned int value) |
374 | { | 341 | { |
375 | struct io_apic __iomem *io_apic = io_apic_base(apic); | 342 | struct io_apic __iomem *io_apic = io_apic_base(apic); |
376 | 343 | ||
@@ -3931,12 +3898,7 @@ static struct resource * __init ioapic_setup_resources(int nr_ioapics) | |||
3931 | return res; | 3898 | return res; |
3932 | } | 3899 | } |
3933 | 3900 | ||
3934 | void __init ioapic_and_gsi_init(void) | 3901 | void __init native_io_apic_init_mappings(void) |
3935 | { | ||
3936 | io_apic_ops.init(); | ||
3937 | } | ||
3938 | |||
3939 | static void __init __ioapic_init_mappings(void) | ||
3940 | { | 3902 | { |
3941 | unsigned long ioapic_phys, idx = FIX_IO_APIC_BASE_0; | 3903 | unsigned long ioapic_phys, idx = FIX_IO_APIC_BASE_0; |
3942 | struct resource *ioapic_res; | 3904 | struct resource *ioapic_res; |
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 1a2901562059..8526317c5f0b 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
@@ -1012,7 +1012,7 @@ void __init setup_arch(char **cmdline_p) | |||
1012 | init_cpu_to_node(); | 1012 | init_cpu_to_node(); |
1013 | 1013 | ||
1014 | init_apic_mappings(); | 1014 | init_apic_mappings(); |
1015 | ioapic_and_gsi_init(); | 1015 | x86_io_apic_ops.init(); |
1016 | 1016 | ||
1017 | kvm_guest_init(); | 1017 | kvm_guest_init(); |
1018 | 1018 | ||
diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c index 9cf71d0b2d37..35c5e543f550 100644 --- a/arch/x86/kernel/x86_init.c +++ b/arch/x86/kernel/x86_init.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <asm/e820.h> | 18 | #include <asm/e820.h> |
19 | #include <asm/time.h> | 19 | #include <asm/time.h> |
20 | #include <asm/irq.h> | 20 | #include <asm/irq.h> |
21 | #include <asm/io_apic.h> | ||
21 | #include <asm/pat.h> | 22 | #include <asm/pat.h> |
22 | #include <asm/tsc.h> | 23 | #include <asm/tsc.h> |
23 | #include <asm/iommu.h> | 24 | #include <asm/iommu.h> |
@@ -119,3 +120,10 @@ struct x86_msi_ops x86_msi = { | |||
119 | .teardown_msi_irqs = default_teardown_msi_irqs, | 120 | .teardown_msi_irqs = default_teardown_msi_irqs, |
120 | .restore_msi_irqs = default_restore_msi_irqs, | 121 | .restore_msi_irqs = default_restore_msi_irqs, |
121 | }; | 122 | }; |
123 | |||
124 | struct x86_io_apic_ops x86_io_apic_ops = { | ||
125 | .init = native_io_apic_init_mappings, | ||
126 | .read = native_io_apic_read, | ||
127 | .write = native_io_apic_write, | ||
128 | .modify = native_io_apic_modify, | ||
129 | }; | ||
diff --git a/arch/x86/xen/Makefile b/arch/x86/xen/Makefile index add2c2d729ce..96ab2c09cb68 100644 --- a/arch/x86/xen/Makefile +++ b/arch/x86/xen/Makefile | |||
@@ -20,5 +20,5 @@ obj-$(CONFIG_EVENT_TRACING) += trace.o | |||
20 | obj-$(CONFIG_SMP) += smp.o | 20 | obj-$(CONFIG_SMP) += smp.o |
21 | obj-$(CONFIG_PARAVIRT_SPINLOCKS)+= spinlock.o | 21 | obj-$(CONFIG_PARAVIRT_SPINLOCKS)+= spinlock.o |
22 | obj-$(CONFIG_XEN_DEBUG_FS) += debugfs.o | 22 | obj-$(CONFIG_XEN_DEBUG_FS) += debugfs.o |
23 | obj-$(CONFIG_XEN_DOM0) += vga.o | 23 | obj-$(CONFIG_XEN_DOM0) += apic.o vga.o |
24 | obj-$(CONFIG_SWIOTLB_XEN) += pci-swiotlb-xen.o | 24 | obj-$(CONFIG_SWIOTLB_XEN) += pci-swiotlb-xen.o |
diff --git a/arch/x86/xen/apic.c b/arch/x86/xen/apic.c new file mode 100644 index 000000000000..1913bf2d2a9c --- /dev/null +++ b/arch/x86/xen/apic.c | |||
@@ -0,0 +1,30 @@ | |||
1 | #include <linux/init.h> | ||
2 | #include <asm/x86_init.h> | ||
3 | #include <asm/apic.h> | ||
4 | #include <xen/interface/physdev.h> | ||
5 | #include <asm/xen/hypercall.h> | ||
6 | |||
7 | unsigned int xen_io_apic_read(unsigned apic, unsigned reg) | ||
8 | { | ||
9 | struct physdev_apic apic_op; | ||
10 | int ret; | ||
11 | |||
12 | apic_op.apic_physbase = mpc_ioapic_addr(apic); | ||
13 | apic_op.reg = reg; | ||
14 | ret = HYPERVISOR_physdev_op(PHYSDEVOP_apic_read, &apic_op); | ||
15 | if (!ret) | ||
16 | return apic_op.value; | ||
17 | |||
18 | /* fallback to return an emulated IO_APIC values */ | ||
19 | if (reg == 0x1) | ||
20 | return 0x00170020; | ||
21 | else if (reg == 0x0) | ||
22 | return apic << 24; | ||
23 | |||
24 | return 0xfd; | ||
25 | } | ||
26 | |||
27 | void __init xen_init_apic(void) | ||
28 | { | ||
29 | x86_io_apic_ops.read = xen_io_apic_read; | ||
30 | } | ||
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index a8f8844b8d32..c2ea9e9f420d 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c | |||
@@ -1362,6 +1362,8 @@ asmlinkage void __init xen_start_kernel(void) | |||
1362 | xen_start_info->console.domU.mfn = 0; | 1362 | xen_start_info->console.domU.mfn = 0; |
1363 | xen_start_info->console.domU.evtchn = 0; | 1363 | xen_start_info->console.domU.evtchn = 0; |
1364 | 1364 | ||
1365 | xen_init_apic(); | ||
1366 | |||
1365 | /* Make sure ACS will be enabled */ | 1367 | /* Make sure ACS will be enabled */ |
1366 | pci_request_acs(); | 1368 | pci_request_acs(); |
1367 | } | 1369 | } |
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c index b8e279479a6b..988828b479ed 100644 --- a/arch/x86/xen/mmu.c +++ b/arch/x86/xen/mmu.c | |||
@@ -1859,7 +1859,6 @@ pgd_t * __init xen_setup_kernel_pagetable(pgd_t *pgd, | |||
1859 | #endif /* CONFIG_X86_64 */ | 1859 | #endif /* CONFIG_X86_64 */ |
1860 | 1860 | ||
1861 | static unsigned char dummy_mapping[PAGE_SIZE] __page_aligned_bss; | 1861 | static unsigned char dummy_mapping[PAGE_SIZE] __page_aligned_bss; |
1862 | static unsigned char fake_ioapic_mapping[PAGE_SIZE] __page_aligned_bss; | ||
1863 | 1862 | ||
1864 | static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot) | 1863 | static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot) |
1865 | { | 1864 | { |
@@ -1900,7 +1899,7 @@ static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot) | |||
1900 | * We just don't map the IO APIC - all access is via | 1899 | * We just don't map the IO APIC - all access is via |
1901 | * hypercalls. Keep the address in the pte for reference. | 1900 | * hypercalls. Keep the address in the pte for reference. |
1902 | */ | 1901 | */ |
1903 | pte = pfn_pte(PFN_DOWN(__pa(fake_ioapic_mapping)), PAGE_KERNEL); | 1902 | pte = pfn_pte(PFN_DOWN(__pa(dummy_mapping)), PAGE_KERNEL); |
1904 | break; | 1903 | break; |
1905 | #endif | 1904 | #endif |
1906 | 1905 | ||
@@ -2065,7 +2064,6 @@ void __init xen_init_mmu_ops(void) | |||
2065 | pv_mmu_ops = xen_mmu_ops; | 2064 | pv_mmu_ops = xen_mmu_ops; |
2066 | 2065 | ||
2067 | memset(dummy_mapping, 0xff, PAGE_SIZE); | 2066 | memset(dummy_mapping, 0xff, PAGE_SIZE); |
2068 | memset(fake_ioapic_mapping, 0xfd, PAGE_SIZE); | ||
2069 | } | 2067 | } |
2070 | 2068 | ||
2071 | /* Protected by xen_reservation_lock. */ | 2069 | /* Protected by xen_reservation_lock. */ |
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h index b095739ccd4c..45c0c0667bd9 100644 --- a/arch/x86/xen/xen-ops.h +++ b/arch/x86/xen/xen-ops.h | |||
@@ -92,11 +92,15 @@ struct dom0_vga_console_info; | |||
92 | 92 | ||
93 | #ifdef CONFIG_XEN_DOM0 | 93 | #ifdef CONFIG_XEN_DOM0 |
94 | void __init xen_init_vga(const struct dom0_vga_console_info *, size_t size); | 94 | void __init xen_init_vga(const struct dom0_vga_console_info *, size_t size); |
95 | void __init xen_init_apic(void); | ||
95 | #else | 96 | #else |
96 | static inline void __init xen_init_vga(const struct dom0_vga_console_info *info, | 97 | static inline void __init xen_init_vga(const struct dom0_vga_console_info *info, |
97 | size_t size) | 98 | size_t size) |
98 | { | 99 | { |
99 | } | 100 | } |
101 | static inline void __init xen_init_apic(void) | ||
102 | { | ||
103 | } | ||
100 | #endif | 104 | #endif |
101 | 105 | ||
102 | /* Declare an asm function, along with symbols needed to make it | 106 | /* Declare an asm function, along with symbols needed to make it |