diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-02-17 11:20:11 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-02-17 11:20:11 -0500 |
commit | 0b6de0092244c98b5ba1abda34c92470a20e0d0c (patch) | |
tree | 478e4e18c33fd9fa517559e1ce951fe378d5965f /arch/x86/kernel | |
parent | 37a25424252b6cff4dd4b1937ab6a1dbfcadabcc (diff) | |
parent | f62bae5009c1ba596cd475cafbc83e0570a36e26 (diff) |
Merge branch 'x86/apic' into perfcounters/core
Conflicts:
arch/x86/kernel/cpu/perfctr-watchdog.c
Diffstat (limited to 'arch/x86/kernel')
34 files changed, 572 insertions, 658 deletions
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile index 24f357e7557a..9139ff69471c 100644 --- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile | |||
@@ -58,13 +58,12 @@ obj-$(CONFIG_PCI) += early-quirks.o | |||
58 | apm-y := apm_32.o | 58 | apm-y := apm_32.o |
59 | obj-$(CONFIG_APM) += apm.o | 59 | obj-$(CONFIG_APM) += apm.o |
60 | obj-$(CONFIG_SMP) += smp.o | 60 | obj-$(CONFIG_SMP) += smp.o |
61 | obj-$(CONFIG_SMP) += smpboot.o tsc_sync.o ipi.o | 61 | obj-$(CONFIG_SMP) += smpboot.o tsc_sync.o |
62 | obj-$(CONFIG_SMP) += setup_percpu.o | 62 | obj-$(CONFIG_SMP) += setup_percpu.o |
63 | obj-$(CONFIG_X86_64_SMP) += tsc_sync.o | 63 | obj-$(CONFIG_X86_64_SMP) += tsc_sync.o |
64 | obj-$(CONFIG_X86_TRAMPOLINE) += trampoline_$(BITS).o | 64 | obj-$(CONFIG_X86_TRAMPOLINE) += trampoline_$(BITS).o |
65 | obj-$(CONFIG_X86_MPPARSE) += mpparse.o | 65 | obj-$(CONFIG_X86_MPPARSE) += mpparse.o |
66 | obj-$(CONFIG_X86_LOCAL_APIC) += apic.o nmi.o ipi.o | 66 | obj-$(CONFIG_X86_LOCAL_APIC) += apic/ |
67 | obj-$(CONFIG_X86_IO_APIC) += io_apic.o | ||
68 | obj-$(CONFIG_X86_REBOOTFIXUPS) += reboot_fixups_32.o | 67 | obj-$(CONFIG_X86_REBOOTFIXUPS) += reboot_fixups_32.o |
69 | obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o | 68 | obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o |
70 | obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o | 69 | obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o |
@@ -116,17 +115,13 @@ obj-$(CONFIG_SWIOTLB) += pci-swiotlb_64.o # NB rename without _64 | |||
116 | ### | 115 | ### |
117 | # 64 bit specific files | 116 | # 64 bit specific files |
118 | ifeq ($(CONFIG_X86_64),y) | 117 | ifeq ($(CONFIG_X86_64),y) |
119 | obj-y += genapic_64.o genapic_flat_64.o | 118 | obj-$(CONFIG_X86_UV) += tlb_uv.o bios_uv.o uv_irq.o uv_sysfs.o |
120 | obj-y += genx2apic_cluster.o | 119 | obj-$(CONFIG_X86_PM_TIMER) += pmtimer_64.o |
121 | obj-y += genx2apic_phys.o | 120 | obj-$(CONFIG_AUDIT) += audit_64.o |
122 | obj-$(CONFIG_X86_UV) += genx2apic_uv_x.o tlb_uv.o | 121 | |
123 | obj-$(CONFIG_X86_UV) += bios_uv.o uv_irq.o uv_sysfs.o | 122 | obj-$(CONFIG_GART_IOMMU) += pci-gart_64.o aperture_64.o |
124 | obj-$(CONFIG_X86_PM_TIMER) += pmtimer_64.o | 123 | obj-$(CONFIG_CALGARY_IOMMU) += pci-calgary_64.o tce_64.o |
125 | obj-$(CONFIG_AUDIT) += audit_64.o | 124 | obj-$(CONFIG_AMD_IOMMU) += amd_iommu_init.o amd_iommu.o |
126 | 125 | ||
127 | obj-$(CONFIG_GART_IOMMU) += pci-gart_64.o aperture_64.o | 126 | obj-$(CONFIG_PCI_MMCONFIG) += mmconf-fam10h_64.o |
128 | obj-$(CONFIG_CALGARY_IOMMU) += pci-calgary_64.o tce_64.o | ||
129 | obj-$(CONFIG_AMD_IOMMU) += amd_iommu_init.o amd_iommu.o | ||
130 | |||
131 | obj-$(CONFIG_PCI_MMCONFIG) += mmconf-fam10h_64.o | ||
132 | endif | 127 | endif |
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 956c1dee6fbe..a18eb7ce2236 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c | |||
@@ -37,7 +37,6 @@ | |||
37 | #include <asm/pgtable.h> | 37 | #include <asm/pgtable.h> |
38 | #include <asm/io_apic.h> | 38 | #include <asm/io_apic.h> |
39 | #include <asm/apic.h> | 39 | #include <asm/apic.h> |
40 | #include <asm/genapic.h> | ||
41 | #include <asm/io.h> | 40 | #include <asm/io.h> |
42 | #include <asm/mpspec.h> | 41 | #include <asm/mpspec.h> |
43 | #include <asm/smp.h> | 42 | #include <asm/smp.h> |
diff --git a/arch/x86/kernel/apic/Makefile b/arch/x86/kernel/apic/Makefile new file mode 100644 index 000000000000..da20b70c4000 --- /dev/null +++ b/arch/x86/kernel/apic/Makefile | |||
@@ -0,0 +1,15 @@ | |||
1 | # | ||
2 | # Makefile for local APIC drivers and for the IO-APIC code | ||
3 | # | ||
4 | |||
5 | obj-y := apic.o ipi.o nmi.o | ||
6 | obj-$(CONFIG_X86_IO_APIC) += io_apic.o | ||
7 | obj-$(CONFIG_SMP) += ipi.o | ||
8 | |||
9 | ifeq ($(CONFIG_X86_64),y) | ||
10 | obj-y += apic_64.o apic_flat_64.o | ||
11 | obj-$(CONFIG_X86_X2APIC) += x2apic_cluster.o | ||
12 | obj-$(CONFIG_X86_X2APIC) += x2apic_phys.o | ||
13 | obj-$(CONFIG_X86_UV) += x2apic_uv_x.o | ||
14 | endif | ||
15 | |||
diff --git a/arch/x86/kernel/apic.c b/arch/x86/kernel/apic/apic.c index c9aed4510585..d1bf032ba26f 100644 --- a/arch/x86/kernel/apic.c +++ b/arch/x86/kernel/apic/apic.c | |||
@@ -37,7 +37,6 @@ | |||
37 | #include <asm/perf_counter.h> | 37 | #include <asm/perf_counter.h> |
38 | #include <asm/arch_hooks.h> | 38 | #include <asm/arch_hooks.h> |
39 | #include <asm/pgalloc.h> | 39 | #include <asm/pgalloc.h> |
40 | #include <asm/genapic.h> | ||
41 | #include <asm/atomic.h> | 40 | #include <asm/atomic.h> |
42 | #include <asm/mpspec.h> | 41 | #include <asm/mpspec.h> |
43 | #include <asm/i8253.h> | 42 | #include <asm/i8253.h> |
@@ -113,11 +112,7 @@ static __init int setup_apicpmtimer(char *s) | |||
113 | __setup("apicpmtimer", setup_apicpmtimer); | 112 | __setup("apicpmtimer", setup_apicpmtimer); |
114 | #endif | 113 | #endif |
115 | 114 | ||
116 | #ifdef CONFIG_X86_64 | 115 | #ifdef CONFIG_X86_X2APIC |
117 | #define HAVE_X2APIC | ||
118 | #endif | ||
119 | |||
120 | #ifdef HAVE_X2APIC | ||
121 | int x2apic; | 116 | int x2apic; |
122 | /* x2apic enabled before OS handover */ | 117 | /* x2apic enabled before OS handover */ |
123 | static int x2apic_preenabled; | 118 | static int x2apic_preenabled; |
@@ -215,18 +210,13 @@ static int modern_apic(void) | |||
215 | return lapic_get_version() >= 0x14; | 210 | return lapic_get_version() >= 0x14; |
216 | } | 211 | } |
217 | 212 | ||
218 | /* | 213 | void native_apic_wait_icr_idle(void) |
219 | * Paravirt kernels also might be using these below ops. So we still | ||
220 | * use generic apic_read()/apic_write(), which might be pointing to different | ||
221 | * ops in PARAVIRT case. | ||
222 | */ | ||
223 | void xapic_wait_icr_idle(void) | ||
224 | { | 214 | { |
225 | while (apic_read(APIC_ICR) & APIC_ICR_BUSY) | 215 | while (apic_read(APIC_ICR) & APIC_ICR_BUSY) |
226 | cpu_relax(); | 216 | cpu_relax(); |
227 | } | 217 | } |
228 | 218 | ||
229 | u32 safe_xapic_wait_icr_idle(void) | 219 | u32 native_safe_apic_wait_icr_idle(void) |
230 | { | 220 | { |
231 | u32 send_status; | 221 | u32 send_status; |
232 | int timeout; | 222 | int timeout; |
@@ -242,13 +232,13 @@ u32 safe_xapic_wait_icr_idle(void) | |||
242 | return send_status; | 232 | return send_status; |
243 | } | 233 | } |
244 | 234 | ||
245 | void xapic_icr_write(u32 low, u32 id) | 235 | void native_apic_icr_write(u32 low, u32 id) |
246 | { | 236 | { |
247 | apic_write(APIC_ICR2, SET_APIC_DEST_FIELD(id)); | 237 | apic_write(APIC_ICR2, SET_APIC_DEST_FIELD(id)); |
248 | apic_write(APIC_ICR, low); | 238 | apic_write(APIC_ICR, low); |
249 | } | 239 | } |
250 | 240 | ||
251 | static u64 xapic_icr_read(void) | 241 | u64 native_apic_icr_read(void) |
252 | { | 242 | { |
253 | u32 icr1, icr2; | 243 | u32 icr1, icr2; |
254 | 244 | ||
@@ -258,54 +248,6 @@ static u64 xapic_icr_read(void) | |||
258 | return icr1 | ((u64)icr2 << 32); | 248 | return icr1 | ((u64)icr2 << 32); |
259 | } | 249 | } |
260 | 250 | ||
261 | static struct apic_ops xapic_ops = { | ||
262 | .read = native_apic_mem_read, | ||
263 | .write = native_apic_mem_write, | ||
264 | .icr_read = xapic_icr_read, | ||
265 | .icr_write = xapic_icr_write, | ||
266 | .wait_icr_idle = xapic_wait_icr_idle, | ||
267 | .safe_wait_icr_idle = safe_xapic_wait_icr_idle, | ||
268 | }; | ||
269 | |||
270 | struct apic_ops __read_mostly *apic_ops = &xapic_ops; | ||
271 | EXPORT_SYMBOL_GPL(apic_ops); | ||
272 | |||
273 | #ifdef HAVE_X2APIC | ||
274 | static void x2apic_wait_icr_idle(void) | ||
275 | { | ||
276 | /* no need to wait for icr idle in x2apic */ | ||
277 | return; | ||
278 | } | ||
279 | |||
280 | static u32 safe_x2apic_wait_icr_idle(void) | ||
281 | { | ||
282 | /* no need to wait for icr idle in x2apic */ | ||
283 | return 0; | ||
284 | } | ||
285 | |||
286 | void x2apic_icr_write(u32 low, u32 id) | ||
287 | { | ||
288 | wrmsrl(APIC_BASE_MSR + (APIC_ICR >> 4), ((__u64) id) << 32 | low); | ||
289 | } | ||
290 | |||
291 | static u64 x2apic_icr_read(void) | ||
292 | { | ||
293 | unsigned long val; | ||
294 | |||
295 | rdmsrl(APIC_BASE_MSR + (APIC_ICR >> 4), val); | ||
296 | return val; | ||
297 | } | ||
298 | |||
299 | static struct apic_ops x2apic_ops = { | ||
300 | .read = native_apic_msr_read, | ||
301 | .write = native_apic_msr_write, | ||
302 | .icr_read = x2apic_icr_read, | ||
303 | .icr_write = x2apic_icr_write, | ||
304 | .wait_icr_idle = x2apic_wait_icr_idle, | ||
305 | .safe_wait_icr_idle = safe_x2apic_wait_icr_idle, | ||
306 | }; | ||
307 | #endif | ||
308 | |||
309 | /** | 251 | /** |
310 | * enable_NMI_through_LVT0 - enable NMI through local vector table 0 | 252 | * enable_NMI_through_LVT0 - enable NMI through local vector table 0 |
311 | */ | 253 | */ |
@@ -1324,17 +1266,19 @@ void __cpuinit end_local_APIC_setup(void) | |||
1324 | apic_pm_activate(); | 1266 | apic_pm_activate(); |
1325 | } | 1267 | } |
1326 | 1268 | ||
1327 | #ifdef HAVE_X2APIC | 1269 | #ifdef CONFIG_X86_X2APIC |
1328 | void check_x2apic(void) | 1270 | void check_x2apic(void) |
1329 | { | 1271 | { |
1330 | int msr, msr2; | 1272 | int msr, msr2; |
1331 | 1273 | ||
1274 | if (!cpu_has_x2apic) | ||
1275 | return; | ||
1276 | |||
1332 | rdmsr(MSR_IA32_APICBASE, msr, msr2); | 1277 | rdmsr(MSR_IA32_APICBASE, msr, msr2); |
1333 | 1278 | ||
1334 | if (msr & X2APIC_ENABLE) { | 1279 | if (msr & X2APIC_ENABLE) { |
1335 | pr_info("x2apic enabled by BIOS, switching to x2apic ops\n"); | 1280 | pr_info("x2apic enabled by BIOS, switching to x2apic ops\n"); |
1336 | x2apic_preenabled = x2apic = 1; | 1281 | x2apic_preenabled = x2apic = 1; |
1337 | apic_ops = &x2apic_ops; | ||
1338 | } | 1282 | } |
1339 | } | 1283 | } |
1340 | 1284 | ||
@@ -1342,6 +1286,9 @@ void enable_x2apic(void) | |||
1342 | { | 1286 | { |
1343 | int msr, msr2; | 1287 | int msr, msr2; |
1344 | 1288 | ||
1289 | if (!x2apic) | ||
1290 | return; | ||
1291 | |||
1345 | rdmsr(MSR_IA32_APICBASE, msr, msr2); | 1292 | rdmsr(MSR_IA32_APICBASE, msr, msr2); |
1346 | if (!(msr & X2APIC_ENABLE)) { | 1293 | if (!(msr & X2APIC_ENABLE)) { |
1347 | pr_info("Enabling x2apic\n"); | 1294 | pr_info("Enabling x2apic\n"); |
@@ -1405,7 +1352,6 @@ void __init enable_IR_x2apic(void) | |||
1405 | 1352 | ||
1406 | if (!x2apic) { | 1353 | if (!x2apic) { |
1407 | x2apic = 1; | 1354 | x2apic = 1; |
1408 | apic_ops = &x2apic_ops; | ||
1409 | enable_x2apic(); | 1355 | enable_x2apic(); |
1410 | } | 1356 | } |
1411 | 1357 | ||
@@ -1443,7 +1389,7 @@ end: | |||
1443 | 1389 | ||
1444 | return; | 1390 | return; |
1445 | } | 1391 | } |
1446 | #endif /* HAVE_X2APIC */ | 1392 | #endif /* CONFIG_X86_X2APIC */ |
1447 | 1393 | ||
1448 | #ifdef CONFIG_X86_64 | 1394 | #ifdef CONFIG_X86_64 |
1449 | /* | 1395 | /* |
@@ -1574,7 +1520,7 @@ void __init early_init_lapic_mapping(void) | |||
1574 | */ | 1520 | */ |
1575 | void __init init_apic_mappings(void) | 1521 | void __init init_apic_mappings(void) |
1576 | { | 1522 | { |
1577 | #ifdef HAVE_X2APIC | 1523 | #ifdef CONFIG_X86_X2APIC |
1578 | if (x2apic) { | 1524 | if (x2apic) { |
1579 | boot_cpu_physical_apicid = read_apic_id(); | 1525 | boot_cpu_physical_apicid = read_apic_id(); |
1580 | return; | 1526 | return; |
@@ -1638,9 +1584,7 @@ int __init APIC_init_uniprocessor(void) | |||
1638 | } | 1584 | } |
1639 | #endif | 1585 | #endif |
1640 | 1586 | ||
1641 | #ifdef HAVE_X2APIC | ||
1642 | enable_IR_x2apic(); | 1587 | enable_IR_x2apic(); |
1643 | #endif | ||
1644 | #ifdef CONFIG_X86_64 | 1588 | #ifdef CONFIG_X86_64 |
1645 | default_setup_apic_routing(); | 1589 | default_setup_apic_routing(); |
1646 | #endif | 1590 | #endif |
@@ -1663,35 +1607,31 @@ int __init APIC_init_uniprocessor(void) | |||
1663 | physid_set_mask_of_physid(boot_cpu_physical_apicid, &phys_cpu_present_map); | 1607 | physid_set_mask_of_physid(boot_cpu_physical_apicid, &phys_cpu_present_map); |
1664 | setup_local_APIC(); | 1608 | setup_local_APIC(); |
1665 | 1609 | ||
1666 | #ifdef CONFIG_X86_64 | 1610 | #ifdef CONFIG_X86_IO_APIC |
1667 | /* | 1611 | /* |
1668 | * Now enable IO-APICs, actually call clear_IO_APIC | 1612 | * Now enable IO-APICs, actually call clear_IO_APIC |
1669 | * We need clear_IO_APIC before enabling vector on BP | 1613 | * We need clear_IO_APIC before enabling error vector |
1670 | */ | 1614 | */ |
1671 | if (!skip_ioapic_setup && nr_ioapics) | 1615 | if (!skip_ioapic_setup && nr_ioapics) |
1672 | enable_IO_APIC(); | 1616 | enable_IO_APIC(); |
1673 | #endif | 1617 | #endif |
1674 | 1618 | ||
1675 | #ifdef CONFIG_X86_IO_APIC | ||
1676 | if (!smp_found_config || skip_ioapic_setup || !nr_ioapics) | ||
1677 | #endif | ||
1678 | localise_nmi_watchdog(); | ||
1679 | end_local_APIC_setup(); | 1619 | end_local_APIC_setup(); |
1680 | 1620 | ||
1681 | #ifdef CONFIG_X86_IO_APIC | 1621 | #ifdef CONFIG_X86_IO_APIC |
1682 | if (smp_found_config && !skip_ioapic_setup && nr_ioapics) | 1622 | if (smp_found_config && !skip_ioapic_setup && nr_ioapics) |
1683 | setup_IO_APIC(); | 1623 | setup_IO_APIC(); |
1684 | # ifdef CONFIG_X86_64 | 1624 | else { |
1685 | else | ||
1686 | nr_ioapics = 0; | 1625 | nr_ioapics = 0; |
1687 | # endif | 1626 | localise_nmi_watchdog(); |
1627 | } | ||
1628 | #else | ||
1629 | localise_nmi_watchdog(); | ||
1688 | #endif | 1630 | #endif |
1689 | 1631 | ||
1632 | setup_boot_clock(); | ||
1690 | #ifdef CONFIG_X86_64 | 1633 | #ifdef CONFIG_X86_64 |
1691 | setup_boot_APIC_clock(); | ||
1692 | check_nmi_watchdog(); | 1634 | check_nmi_watchdog(); |
1693 | #else | ||
1694 | setup_boot_clock(); | ||
1695 | #endif | 1635 | #endif |
1696 | 1636 | ||
1697 | return 0; | 1637 | return 0; |
@@ -2029,7 +1969,7 @@ static int lapic_resume(struct sys_device *dev) | |||
2029 | 1969 | ||
2030 | local_irq_save(flags); | 1970 | local_irq_save(flags); |
2031 | 1971 | ||
2032 | #ifdef HAVE_X2APIC | 1972 | #ifdef CONFIG_X86_X2APIC |
2033 | if (x2apic) | 1973 | if (x2apic) |
2034 | enable_x2apic(); | 1974 | enable_x2apic(); |
2035 | else | 1975 | else |
diff --git a/arch/x86/kernel/genapic_64.c b/arch/x86/kernel/apic/apic_64.c index 820dea5d0ebe..70935dd904db 100644 --- a/arch/x86/kernel/genapic_64.c +++ b/arch/x86/kernel/apic/apic_64.c | |||
@@ -19,24 +19,27 @@ | |||
19 | #include <linux/dmar.h> | 19 | #include <linux/dmar.h> |
20 | 20 | ||
21 | #include <asm/smp.h> | 21 | #include <asm/smp.h> |
22 | #include <asm/apic.h> | ||
22 | #include <asm/ipi.h> | 23 | #include <asm/ipi.h> |
23 | #include <asm/genapic.h> | ||
24 | #include <asm/setup.h> | 24 | #include <asm/setup.h> |
25 | 25 | ||
26 | extern struct genapic apic_flat; | 26 | extern struct apic apic_flat; |
27 | extern struct genapic apic_physflat; | 27 | extern struct apic apic_physflat; |
28 | extern struct genapic apic_x2xpic_uv_x; | 28 | extern struct apic apic_x2xpic_uv_x; |
29 | extern struct genapic apic_x2apic_phys; | 29 | extern struct apic apic_x2apic_phys; |
30 | extern struct genapic apic_x2apic_cluster; | 30 | extern struct apic apic_x2apic_cluster; |
31 | 31 | ||
32 | struct genapic __read_mostly *apic = &apic_flat; | 32 | struct apic __read_mostly *apic = &apic_flat; |
33 | EXPORT_SYMBOL_GPL(apic); | ||
33 | 34 | ||
34 | static struct genapic *apic_probe[] __initdata = { | 35 | static struct apic *apic_probe[] __initdata = { |
35 | #ifdef CONFIG_X86_UV | 36 | #ifdef CONFIG_X86_UV |
36 | &apic_x2apic_uv_x, | 37 | &apic_x2apic_uv_x, |
37 | #endif | 38 | #endif |
39 | #ifdef CONFIG_X86_X2APIC | ||
38 | &apic_x2apic_phys, | 40 | &apic_x2apic_phys, |
39 | &apic_x2apic_cluster, | 41 | &apic_x2apic_cluster, |
42 | #endif | ||
40 | &apic_physflat, | 43 | &apic_physflat, |
41 | NULL, | 44 | NULL, |
42 | }; | 45 | }; |
@@ -46,10 +49,12 @@ static struct genapic *apic_probe[] __initdata = { | |||
46 | */ | 49 | */ |
47 | void __init default_setup_apic_routing(void) | 50 | void __init default_setup_apic_routing(void) |
48 | { | 51 | { |
52 | #ifdef CONFIG_X86_X2APIC | ||
49 | if (apic == &apic_x2apic_phys || apic == &apic_x2apic_cluster) { | 53 | if (apic == &apic_x2apic_phys || apic == &apic_x2apic_cluster) { |
50 | if (!intr_remapping_enabled) | 54 | if (!intr_remapping_enabled) |
51 | apic = &apic_flat; | 55 | apic = &apic_flat; |
52 | } | 56 | } |
57 | #endif | ||
53 | 58 | ||
54 | if (apic == &apic_flat) { | 59 | if (apic == &apic_flat) { |
55 | if (max_physical_apicid >= 8) | 60 | if (max_physical_apicid >= 8) |
@@ -57,8 +62,8 @@ void __init default_setup_apic_routing(void) | |||
57 | printk(KERN_INFO "Setting APIC routing to %s\n", apic->name); | 62 | printk(KERN_INFO "Setting APIC routing to %s\n", apic->name); |
58 | } | 63 | } |
59 | 64 | ||
60 | if (x86_quirks->update_genapic) | 65 | if (x86_quirks->update_apic) |
61 | x86_quirks->update_genapic(); | 66 | x86_quirks->update_apic(); |
62 | } | 67 | } |
63 | 68 | ||
64 | /* Same for both flat and physical. */ | 69 | /* Same for both flat and physical. */ |
diff --git a/arch/x86/kernel/genapic_flat_64.c b/arch/x86/kernel/apic/apic_flat_64.c index 249d2d3c034c..3b002995e145 100644 --- a/arch/x86/kernel/genapic_flat_64.c +++ b/arch/x86/kernel/apic/apic_flat_64.c | |||
@@ -17,8 +17,8 @@ | |||
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/hardirq.h> | 18 | #include <linux/hardirq.h> |
19 | #include <asm/smp.h> | 19 | #include <asm/smp.h> |
20 | #include <asm/apic.h> | ||
20 | #include <asm/ipi.h> | 21 | #include <asm/ipi.h> |
21 | #include <asm/genapic.h> | ||
22 | 22 | ||
23 | #ifdef CONFIG_ACPI | 23 | #ifdef CONFIG_ACPI |
24 | #include <acpi/acpi_bus.h> | 24 | #include <acpi/acpi_bus.h> |
@@ -178,7 +178,7 @@ static int flat_phys_pkg_id(int initial_apic_id, int index_msb) | |||
178 | return hard_smp_processor_id() >> index_msb; | 178 | return hard_smp_processor_id() >> index_msb; |
179 | } | 179 | } |
180 | 180 | ||
181 | struct genapic apic_flat = { | 181 | struct apic apic_flat = { |
182 | .name = "flat", | 182 | .name = "flat", |
183 | .probe = NULL, | 183 | .probe = NULL, |
184 | .acpi_madt_oem_check = flat_acpi_madt_oem_check, | 184 | .acpi_madt_oem_check = flat_acpi_madt_oem_check, |
@@ -227,8 +227,14 @@ struct genapic apic_flat = { | |||
227 | .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, | 227 | .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, |
228 | .wait_for_init_deassert = NULL, | 228 | .wait_for_init_deassert = NULL, |
229 | .smp_callin_clear_local_apic = NULL, | 229 | .smp_callin_clear_local_apic = NULL, |
230 | .store_NMI_vector = NULL, | ||
231 | .inquire_remote_apic = NULL, | 230 | .inquire_remote_apic = NULL, |
231 | |||
232 | .read = native_apic_mem_read, | ||
233 | .write = native_apic_mem_write, | ||
234 | .icr_read = native_apic_icr_read, | ||
235 | .icr_write = native_apic_icr_write, | ||
236 | .wait_icr_idle = native_apic_wait_icr_idle, | ||
237 | .safe_wait_icr_idle = native_safe_apic_wait_icr_idle, | ||
232 | }; | 238 | }; |
233 | 239 | ||
234 | /* | 240 | /* |
@@ -321,7 +327,7 @@ physflat_cpu_mask_to_apicid_and(const struct cpumask *cpumask, | |||
321 | return BAD_APICID; | 327 | return BAD_APICID; |
322 | } | 328 | } |
323 | 329 | ||
324 | struct genapic apic_physflat = { | 330 | struct apic apic_physflat = { |
325 | 331 | ||
326 | .name = "physical flat", | 332 | .name = "physical flat", |
327 | .probe = NULL, | 333 | .probe = NULL, |
@@ -372,6 +378,12 @@ struct genapic apic_physflat = { | |||
372 | .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, | 378 | .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, |
373 | .wait_for_init_deassert = NULL, | 379 | .wait_for_init_deassert = NULL, |
374 | .smp_callin_clear_local_apic = NULL, | 380 | .smp_callin_clear_local_apic = NULL, |
375 | .store_NMI_vector = NULL, | ||
376 | .inquire_remote_apic = NULL, | 381 | .inquire_remote_apic = NULL, |
382 | |||
383 | .read = native_apic_mem_read, | ||
384 | .write = native_apic_mem_write, | ||
385 | .icr_read = native_apic_icr_read, | ||
386 | .icr_write = native_apic_icr_write, | ||
387 | .wait_icr_idle = native_apic_wait_icr_idle, | ||
388 | .safe_wait_icr_idle = native_safe_apic_wait_icr_idle, | ||
377 | }; | 389 | }; |
diff --git a/arch/x86/kernel/io_apic.c b/arch/x86/kernel/apic/io_apic.c index 7248ca11bdcd..00e6071cefc4 100644 --- a/arch/x86/kernel/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c | |||
@@ -62,7 +62,7 @@ | |||
62 | #include <asm/uv/uv_hub.h> | 62 | #include <asm/uv/uv_hub.h> |
63 | #include <asm/uv/uv_irq.h> | 63 | #include <asm/uv/uv_irq.h> |
64 | 64 | ||
65 | #include <asm/genapic.h> | 65 | #include <asm/apic.h> |
66 | 66 | ||
67 | #define __apicdebuginit(type) static type __init | 67 | #define __apicdebuginit(type) static type __init |
68 | 68 | ||
@@ -813,8 +813,9 @@ static void clear_IO_APIC (void) | |||
813 | */ | 813 | */ |
814 | 814 | ||
815 | #define MAX_PIRQS 8 | 815 | #define MAX_PIRQS 8 |
816 | static int pirq_entries [MAX_PIRQS]; | 816 | static int pirq_entries[MAX_PIRQS] = { |
817 | static int pirqs_enabled; | 817 | [0 ... MAX_PIRQS - 1] = -1 |
818 | }; | ||
818 | 819 | ||
819 | static int __init ioapic_pirq_setup(char *str) | 820 | static int __init ioapic_pirq_setup(char *str) |
820 | { | 821 | { |
@@ -823,10 +824,6 @@ static int __init ioapic_pirq_setup(char *str) | |||
823 | 824 | ||
824 | get_options(str, ARRAY_SIZE(ints), ints); | 825 | get_options(str, ARRAY_SIZE(ints), ints); |
825 | 826 | ||
826 | for (i = 0; i < MAX_PIRQS; i++) | ||
827 | pirq_entries[i] = -1; | ||
828 | |||
829 | pirqs_enabled = 1; | ||
830 | apic_printk(APIC_VERBOSE, KERN_INFO | 827 | apic_printk(APIC_VERBOSE, KERN_INFO |
831 | "PIRQ redirection, working around broken MP-BIOS.\n"); | 828 | "PIRQ redirection, working around broken MP-BIOS.\n"); |
832 | max = MAX_PIRQS; | 829 | max = MAX_PIRQS; |
@@ -1976,13 +1973,6 @@ void __init enable_IO_APIC(void) | |||
1976 | int apic; | 1973 | int apic; |
1977 | unsigned long flags; | 1974 | unsigned long flags; |
1978 | 1975 | ||
1979 | #ifdef CONFIG_X86_32 | ||
1980 | int i; | ||
1981 | if (!pirqs_enabled) | ||
1982 | for (i = 0; i < MAX_PIRQS; i++) | ||
1983 | pirq_entries[i] = -1; | ||
1984 | #endif | ||
1985 | |||
1986 | /* | 1976 | /* |
1987 | * The number of IO-APIC IRQ registers (== #pins): | 1977 | * The number of IO-APIC IRQ registers (== #pins): |
1988 | */ | 1978 | */ |
@@ -3057,13 +3047,9 @@ out: | |||
3057 | void __init setup_IO_APIC(void) | 3047 | void __init setup_IO_APIC(void) |
3058 | { | 3048 | { |
3059 | 3049 | ||
3060 | #ifdef CONFIG_X86_32 | ||
3061 | enable_IO_APIC(); | ||
3062 | #else | ||
3063 | /* | 3050 | /* |
3064 | * calling enable_IO_APIC() is moved to setup_local_APIC for BP | 3051 | * calling enable_IO_APIC() is moved to setup_local_APIC for BP |
3065 | */ | 3052 | */ |
3066 | #endif | ||
3067 | 3053 | ||
3068 | io_apic_irqs = ~PIC_IRQS; | 3054 | io_apic_irqs = ~PIC_IRQS; |
3069 | 3055 | ||
diff --git a/arch/x86/kernel/ipi.c b/arch/x86/kernel/apic/ipi.c index dbf5445727a9..dbf5445727a9 100644 --- a/arch/x86/kernel/ipi.c +++ b/arch/x86/kernel/apic/ipi.c | |||
diff --git a/arch/x86/kernel/nmi.c b/arch/x86/kernel/apic/nmi.c index bdfad80c3cf1..bdfad80c3cf1 100644 --- a/arch/x86/kernel/nmi.c +++ b/arch/x86/kernel/apic/nmi.c | |||
diff --git a/arch/x86/kernel/genx2apic_cluster.c b/arch/x86/kernel/apic/x2apic_cluster.c index 7c87156b6411..4e39d9ad4d52 100644 --- a/arch/x86/kernel/genx2apic_cluster.c +++ b/arch/x86/kernel/apic/x2apic_cluster.c | |||
@@ -7,8 +7,8 @@ | |||
7 | #include <linux/dmar.h> | 7 | #include <linux/dmar.h> |
8 | 8 | ||
9 | #include <asm/smp.h> | 9 | #include <asm/smp.h> |
10 | #include <asm/apic.h> | ||
10 | #include <asm/ipi.h> | 11 | #include <asm/ipi.h> |
11 | #include <asm/genapic.h> | ||
12 | 12 | ||
13 | DEFINE_PER_CPU(u32, x86_cpu_to_logical_apicid); | 13 | DEFINE_PER_CPU(u32, x86_cpu_to_logical_apicid); |
14 | 14 | ||
@@ -46,7 +46,7 @@ static void | |||
46 | /* | 46 | /* |
47 | * send the IPI. | 47 | * send the IPI. |
48 | */ | 48 | */ |
49 | x2apic_icr_write(cfg, apicid); | 49 | native_x2apic_icr_write(cfg, apicid); |
50 | } | 50 | } |
51 | 51 | ||
52 | /* | 52 | /* |
@@ -182,7 +182,7 @@ static void init_x2apic_ldr(void) | |||
182 | per_cpu(x86_cpu_to_logical_apicid, cpu) = apic_read(APIC_LDR); | 182 | per_cpu(x86_cpu_to_logical_apicid, cpu) = apic_read(APIC_LDR); |
183 | } | 183 | } |
184 | 184 | ||
185 | struct genapic apic_x2apic_cluster = { | 185 | struct apic apic_x2apic_cluster = { |
186 | 186 | ||
187 | .name = "cluster x2apic", | 187 | .name = "cluster x2apic", |
188 | .probe = NULL, | 188 | .probe = NULL, |
@@ -232,6 +232,12 @@ struct genapic apic_x2apic_cluster = { | |||
232 | .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, | 232 | .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, |
233 | .wait_for_init_deassert = NULL, | 233 | .wait_for_init_deassert = NULL, |
234 | .smp_callin_clear_local_apic = NULL, | 234 | .smp_callin_clear_local_apic = NULL, |
235 | .store_NMI_vector = NULL, | ||
236 | .inquire_remote_apic = NULL, | 235 | .inquire_remote_apic = NULL, |
236 | |||
237 | .read = native_apic_msr_read, | ||
238 | .write = native_apic_msr_write, | ||
239 | .icr_read = native_x2apic_icr_read, | ||
240 | .icr_write = native_x2apic_icr_write, | ||
241 | .wait_icr_idle = native_x2apic_wait_icr_idle, | ||
242 | .safe_wait_icr_idle = native_safe_x2apic_wait_icr_idle, | ||
237 | }; | 243 | }; |
diff --git a/arch/x86/kernel/genx2apic_phys.c b/arch/x86/kernel/apic/x2apic_phys.c index 5cbae8aa0408..d2d52eb9f7ea 100644 --- a/arch/x86/kernel/genx2apic_phys.c +++ b/arch/x86/kernel/apic/x2apic_phys.c | |||
@@ -7,8 +7,8 @@ | |||
7 | #include <linux/dmar.h> | 7 | #include <linux/dmar.h> |
8 | 8 | ||
9 | #include <asm/smp.h> | 9 | #include <asm/smp.h> |
10 | #include <asm/apic.h> | ||
10 | #include <asm/ipi.h> | 11 | #include <asm/ipi.h> |
11 | #include <asm/genapic.h> | ||
12 | 12 | ||
13 | static int x2apic_phys; | 13 | static int x2apic_phys; |
14 | 14 | ||
@@ -50,7 +50,7 @@ static void __x2apic_send_IPI_dest(unsigned int apicid, int vector, | |||
50 | /* | 50 | /* |
51 | * send the IPI. | 51 | * send the IPI. |
52 | */ | 52 | */ |
53 | x2apic_icr_write(cfg, apicid); | 53 | native_x2apic_icr_write(cfg, apicid); |
54 | } | 54 | } |
55 | 55 | ||
56 | static void x2apic_send_IPI_mask(const struct cpumask *mask, int vector) | 56 | static void x2apic_send_IPI_mask(const struct cpumask *mask, int vector) |
@@ -168,7 +168,7 @@ static void init_x2apic_ldr(void) | |||
168 | { | 168 | { |
169 | } | 169 | } |
170 | 170 | ||
171 | struct genapic apic_x2apic_phys = { | 171 | struct apic apic_x2apic_phys = { |
172 | 172 | ||
173 | .name = "physical x2apic", | 173 | .name = "physical x2apic", |
174 | .probe = NULL, | 174 | .probe = NULL, |
@@ -218,6 +218,12 @@ struct genapic apic_x2apic_phys = { | |||
218 | .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, | 218 | .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, |
219 | .wait_for_init_deassert = NULL, | 219 | .wait_for_init_deassert = NULL, |
220 | .smp_callin_clear_local_apic = NULL, | 220 | .smp_callin_clear_local_apic = NULL, |
221 | .store_NMI_vector = NULL, | ||
222 | .inquire_remote_apic = NULL, | 221 | .inquire_remote_apic = NULL, |
222 | |||
223 | .read = native_apic_msr_read, | ||
224 | .write = native_apic_msr_write, | ||
225 | .icr_read = native_x2apic_icr_read, | ||
226 | .icr_write = native_x2apic_icr_write, | ||
227 | .wait_icr_idle = native_x2apic_wait_icr_idle, | ||
228 | .safe_wait_icr_idle = native_safe_x2apic_wait_icr_idle, | ||
223 | }; | 229 | }; |
diff --git a/arch/x86/kernel/genx2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c index 6adb5e6f4d92..20b4ad07c3a1 100644 --- a/arch/x86/kernel/genx2apic_uv_x.c +++ b/arch/x86/kernel/apic/x2apic_uv_x.c | |||
@@ -22,8 +22,8 @@ | |||
22 | #include <linux/proc_fs.h> | 22 | #include <linux/proc_fs.h> |
23 | #include <asm/current.h> | 23 | #include <asm/current.h> |
24 | #include <asm/smp.h> | 24 | #include <asm/smp.h> |
25 | #include <asm/apic.h> | ||
25 | #include <asm/ipi.h> | 26 | #include <asm/ipi.h> |
26 | #include <asm/genapic.h> | ||
27 | #include <asm/pgtable.h> | 27 | #include <asm/pgtable.h> |
28 | #include <asm/uv/uv.h> | 28 | #include <asm/uv/uv.h> |
29 | #include <asm/uv/uv_mmrs.h> | 29 | #include <asm/uv/uv_mmrs.h> |
@@ -114,16 +114,15 @@ int uv_wakeup_secondary(int phys_apicid, unsigned int start_rip) | |||
114 | 114 | ||
115 | static void uv_send_IPI_one(int cpu, int vector) | 115 | static void uv_send_IPI_one(int cpu, int vector) |
116 | { | 116 | { |
117 | unsigned long val, apicid, lapicid; | 117 | unsigned long val, apicid; |
118 | int pnode; | 118 | int pnode; |
119 | 119 | ||
120 | apicid = per_cpu(x86_cpu_to_apicid, cpu); | 120 | apicid = per_cpu(x86_cpu_to_apicid, cpu); |
121 | lapicid = apicid & 0x3f; /* ZZZ macro needed */ | ||
122 | pnode = uv_apicid_to_pnode(apicid); | 121 | pnode = uv_apicid_to_pnode(apicid); |
123 | 122 | ||
124 | val = ( 1UL << UVH_IPI_INT_SEND_SHFT ) | | 123 | val = (1UL << UVH_IPI_INT_SEND_SHFT) | |
125 | ( lapicid << UVH_IPI_INT_APIC_ID_SHFT ) | | 124 | (apicid << UVH_IPI_INT_APIC_ID_SHFT) | |
126 | ( vector << UVH_IPI_INT_VECTOR_SHFT ); | 125 | (vector << UVH_IPI_INT_VECTOR_SHFT); |
127 | 126 | ||
128 | uv_write_global_mmr64(pnode, UVH_IPI_INT, val); | 127 | uv_write_global_mmr64(pnode, UVH_IPI_INT, val); |
129 | } | 128 | } |
@@ -241,7 +240,7 @@ static void uv_send_IPI_self(int vector) | |||
241 | apic_write(APIC_SELF_IPI, vector); | 240 | apic_write(APIC_SELF_IPI, vector); |
242 | } | 241 | } |
243 | 242 | ||
244 | struct genapic apic_x2apic_uv_x = { | 243 | struct apic apic_x2apic_uv_x = { |
245 | 244 | ||
246 | .name = "UV large system", | 245 | .name = "UV large system", |
247 | .probe = NULL, | 246 | .probe = NULL, |
@@ -291,8 +290,14 @@ struct genapic apic_x2apic_uv_x = { | |||
291 | .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, | 290 | .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, |
292 | .wait_for_init_deassert = NULL, | 291 | .wait_for_init_deassert = NULL, |
293 | .smp_callin_clear_local_apic = NULL, | 292 | .smp_callin_clear_local_apic = NULL, |
294 | .store_NMI_vector = NULL, | ||
295 | .inquire_remote_apic = NULL, | 293 | .inquire_remote_apic = NULL, |
294 | |||
295 | .read = native_apic_msr_read, | ||
296 | .write = native_apic_msr_write, | ||
297 | .icr_read = native_x2apic_icr_read, | ||
298 | .icr_write = native_x2apic_icr_write, | ||
299 | .wait_icr_idle = native_x2apic_wait_icr_idle, | ||
300 | .safe_wait_icr_idle = native_safe_x2apic_wait_icr_idle, | ||
296 | }; | 301 | }; |
297 | 302 | ||
298 | static __cpuinit void set_x2apic_extra_bits(int pnode) | 303 | static __cpuinit void set_x2apic_extra_bits(int pnode) |
diff --git a/arch/x86/kernel/bigsmp_32.c b/arch/x86/kernel/bigsmp_32.c index 47a62f46afdb..0b1093394fdf 100644 --- a/arch/x86/kernel/bigsmp_32.c +++ b/arch/x86/kernel/bigsmp_32.c | |||
@@ -1,28 +1,26 @@ | |||
1 | /* | 1 | /* |
2 | * APIC driver for "bigsmp" XAPIC machines with more than 8 virtual CPUs. | 2 | * APIC driver for "bigsmp" xAPIC machines with more than 8 virtual CPUs. |
3 | * | ||
3 | * Drives the local APIC in "clustered mode". | 4 | * Drives the local APIC in "clustered mode". |
4 | */ | 5 | */ |
5 | #define APIC_DEFINITION 1 | ||
6 | #include <linux/threads.h> | 6 | #include <linux/threads.h> |
7 | #include <linux/cpumask.h> | 7 | #include <linux/cpumask.h> |
8 | #include <asm/mpspec.h> | ||
9 | #include <asm/genapic.h> | ||
10 | #include <asm/fixmap.h> | ||
11 | #include <asm/apicdef.h> | ||
12 | #include <asm/ipi.h> | ||
13 | #include <linux/kernel.h> | 8 | #include <linux/kernel.h> |
14 | #include <linux/init.h> | 9 | #include <linux/init.h> |
15 | #include <linux/dmi.h> | 10 | #include <linux/dmi.h> |
16 | #include <linux/smp.h> | 11 | #include <linux/smp.h> |
17 | 12 | ||
13 | #include <asm/apicdef.h> | ||
14 | #include <asm/fixmap.h> | ||
15 | #include <asm/mpspec.h> | ||
16 | #include <asm/apic.h> | ||
17 | #include <asm/ipi.h> | ||
18 | 18 | ||
19 | static inline unsigned bigsmp_get_apic_id(unsigned long x) | 19 | static inline unsigned bigsmp_get_apic_id(unsigned long x) |
20 | { | 20 | { |
21 | return (x >> 24) & 0xFF; | 21 | return (x >> 24) & 0xFF; |
22 | } | 22 | } |
23 | 23 | ||
24 | #define xapic_phys_to_log_apicid(cpu) (per_cpu(x86_bios_cpu_apicid, cpu)) | ||
25 | |||
26 | static inline int bigsmp_apic_id_registered(void) | 24 | static inline int bigsmp_apic_id_registered(void) |
27 | { | 25 | { |
28 | return 1; | 26 | return 1; |
@@ -37,8 +35,6 @@ static inline const cpumask_t *bigsmp_target_cpus(void) | |||
37 | #endif | 35 | #endif |
38 | } | 36 | } |
39 | 37 | ||
40 | #define APIC_DFR_VALUE (APIC_DFR_FLAT) | ||
41 | |||
42 | static inline unsigned long | 38 | static inline unsigned long |
43 | bigsmp_check_apicid_used(physid_mask_t bitmap, int apicid) | 39 | bigsmp_check_apicid_used(physid_mask_t bitmap, int apicid) |
44 | { | 40 | { |
@@ -53,9 +49,11 @@ static inline unsigned long bigsmp_check_apicid_present(int bit) | |||
53 | static inline unsigned long calculate_ldr(int cpu) | 49 | static inline unsigned long calculate_ldr(int cpu) |
54 | { | 50 | { |
55 | unsigned long val, id; | 51 | unsigned long val, id; |
52 | |||
56 | val = apic_read(APIC_LDR) & ~APIC_LDR_MASK; | 53 | val = apic_read(APIC_LDR) & ~APIC_LDR_MASK; |
57 | id = xapic_phys_to_log_apicid(cpu); | 54 | id = per_cpu(x86_bios_cpu_apicid, cpu); |
58 | val |= SET_APIC_LOGICAL_ID(id); | 55 | val |= SET_APIC_LOGICAL_ID(id); |
56 | |||
59 | return val; | 57 | return val; |
60 | } | 58 | } |
61 | 59 | ||
@@ -71,15 +69,16 @@ static inline void bigsmp_init_apic_ldr(void) | |||
71 | unsigned long val; | 69 | unsigned long val; |
72 | int cpu = smp_processor_id(); | 70 | int cpu = smp_processor_id(); |
73 | 71 | ||
74 | apic_write(APIC_DFR, APIC_DFR_VALUE); | 72 | apic_write(APIC_DFR, APIC_DFR_FLAT); |
75 | val = calculate_ldr(cpu); | 73 | val = calculate_ldr(cpu); |
76 | apic_write(APIC_LDR, val); | 74 | apic_write(APIC_LDR, val); |
77 | } | 75 | } |
78 | 76 | ||
79 | static inline void bigsmp_setup_apic_routing(void) | 77 | static inline void bigsmp_setup_apic_routing(void) |
80 | { | 78 | { |
81 | printk("Enabling APIC mode: %s. Using %d I/O APICs\n", | 79 | printk(KERN_INFO |
82 | "Physflat", nr_ioapics); | 80 | "Enabling APIC mode: Physflat. Using %d I/O APICs\n", |
81 | nr_ioapics); | ||
83 | } | 82 | } |
84 | 83 | ||
85 | static inline int bigsmp_apicid_to_node(int logical_apicid) | 84 | static inline int bigsmp_apicid_to_node(int logical_apicid) |
@@ -100,7 +99,6 @@ static inline physid_mask_t bigsmp_apicid_to_cpu_present(int phys_apicid) | |||
100 | return physid_mask_of_physid(phys_apicid); | 99 | return physid_mask_of_physid(phys_apicid); |
101 | } | 100 | } |
102 | 101 | ||
103 | extern u8 cpu_2_logical_apicid[]; | ||
104 | /* Mapping from cpu number to logical apicid */ | 102 | /* Mapping from cpu number to logical apicid */ |
105 | static inline int bigsmp_cpu_to_logical_apicid(int cpu) | 103 | static inline int bigsmp_cpu_to_logical_apicid(int cpu) |
106 | { | 104 | { |
@@ -176,21 +174,24 @@ static int hp_ht_bigsmp(const struct dmi_system_id *d) | |||
176 | { | 174 | { |
177 | printk(KERN_NOTICE "%s detected: force use of apic=bigsmp\n", d->ident); | 175 | printk(KERN_NOTICE "%s detected: force use of apic=bigsmp\n", d->ident); |
178 | dmi_bigsmp = 1; | 176 | dmi_bigsmp = 1; |
177 | |||
179 | return 0; | 178 | return 0; |
180 | } | 179 | } |
181 | 180 | ||
182 | 181 | ||
183 | static const struct dmi_system_id bigsmp_dmi_table[] = { | 182 | static const struct dmi_system_id bigsmp_dmi_table[] = { |
184 | { hp_ht_bigsmp, "HP ProLiant DL760 G2", | 183 | { hp_ht_bigsmp, "HP ProLiant DL760 G2", |
185 | { DMI_MATCH(DMI_BIOS_VENDOR, "HP"), | 184 | { DMI_MATCH(DMI_BIOS_VENDOR, "HP"), |
186 | DMI_MATCH(DMI_BIOS_VERSION, "P44-"),} | 185 | DMI_MATCH(DMI_BIOS_VERSION, "P44-"), |
186 | } | ||
187 | }, | 187 | }, |
188 | 188 | ||
189 | { hp_ht_bigsmp, "HP ProLiant DL740", | 189 | { hp_ht_bigsmp, "HP ProLiant DL740", |
190 | { DMI_MATCH(DMI_BIOS_VENDOR, "HP"), | 190 | { DMI_MATCH(DMI_BIOS_VENDOR, "HP"), |
191 | DMI_MATCH(DMI_BIOS_VERSION, "P47-"),} | 191 | DMI_MATCH(DMI_BIOS_VERSION, "P47-"), |
192 | } | ||
192 | }, | 193 | }, |
193 | { } | 194 | { } /* NULL entry stops DMI scanning */ |
194 | }; | 195 | }; |
195 | 196 | ||
196 | static void bigsmp_vector_allocation_domain(int cpu, cpumask_t *retmask) | 197 | static void bigsmp_vector_allocation_domain(int cpu, cpumask_t *retmask) |
@@ -205,10 +206,11 @@ static int probe_bigsmp(void) | |||
205 | dmi_bigsmp = 1; | 206 | dmi_bigsmp = 1; |
206 | else | 207 | else |
207 | dmi_check_system(bigsmp_dmi_table); | 208 | dmi_check_system(bigsmp_dmi_table); |
209 | |||
208 | return dmi_bigsmp; | 210 | return dmi_bigsmp; |
209 | } | 211 | } |
210 | 212 | ||
211 | struct genapic apic_bigsmp = { | 213 | struct apic apic_bigsmp = { |
212 | 214 | ||
213 | .name = "bigsmp", | 215 | .name = "bigsmp", |
214 | .probe = probe_bigsmp, | 216 | .probe = probe_bigsmp, |
@@ -261,6 +263,12 @@ struct genapic apic_bigsmp = { | |||
261 | .wait_for_init_deassert = default_wait_for_init_deassert, | 263 | .wait_for_init_deassert = default_wait_for_init_deassert, |
262 | 264 | ||
263 | .smp_callin_clear_local_apic = NULL, | 265 | .smp_callin_clear_local_apic = NULL, |
264 | .store_NMI_vector = NULL, | ||
265 | .inquire_remote_apic = default_inquire_remote_apic, | 266 | .inquire_remote_apic = default_inquire_remote_apic, |
267 | |||
268 | .read = native_apic_mem_read, | ||
269 | .write = native_apic_mem_write, | ||
270 | .icr_read = native_apic_icr_read, | ||
271 | .icr_write = native_apic_icr_write, | ||
272 | .wait_icr_idle = native_apic_wait_icr_idle, | ||
273 | .safe_wait_icr_idle = native_safe_apic_wait_icr_idle, | ||
266 | }; | 274 | }; |
diff --git a/arch/x86/kernel/cpu/addon_cpuid_features.c b/arch/x86/kernel/cpu/addon_cpuid_features.c index e48640cfac0c..6882a735d9c0 100644 --- a/arch/x86/kernel/cpu/addon_cpuid_features.c +++ b/arch/x86/kernel/cpu/addon_cpuid_features.c | |||
@@ -7,7 +7,7 @@ | |||
7 | #include <asm/pat.h> | 7 | #include <asm/pat.h> |
8 | #include <asm/processor.h> | 8 | #include <asm/processor.h> |
9 | 9 | ||
10 | #include <asm/genapic.h> | 10 | #include <asm/apic.h> |
11 | 11 | ||
12 | struct cpuid_bit { | 12 | struct cpuid_bit { |
13 | u16 feature; | 13 | u16 feature; |
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index ff4d7b9e32e4..25423a5b80ed 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c | |||
@@ -12,8 +12,6 @@ | |||
12 | # include <asm/cacheflush.h> | 12 | # include <asm/cacheflush.h> |
13 | #endif | 13 | #endif |
14 | 14 | ||
15 | #include <asm/genapic.h> | ||
16 | |||
17 | #include "cpu.h" | 15 | #include "cpu.h" |
18 | 16 | ||
19 | #ifdef CONFIG_X86_32 | 17 | #ifdef CONFIG_X86_32 |
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 3a9d45a14ad9..b66af09a6c7d 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -24,11 +24,9 @@ | |||
24 | #include <asm/smp.h> | 24 | #include <asm/smp.h> |
25 | #include <asm/cpu.h> | 25 | #include <asm/cpu.h> |
26 | #include <asm/cpumask.h> | 26 | #include <asm/cpumask.h> |
27 | #ifdef CONFIG_X86_LOCAL_APIC | ||
28 | #include <asm/mpspec.h> | ||
29 | #include <asm/apic.h> | 27 | #include <asm/apic.h> |
30 | #include <asm/genapic.h> | 28 | |
31 | #include <asm/genapic.h> | 29 | #ifdef CONFIG_X86_LOCAL_APIC |
32 | #include <asm/uv/uv.h> | 30 | #include <asm/uv/uv.h> |
33 | #endif | 31 | #endif |
34 | 32 | ||
@@ -255,9 +253,9 @@ static void __cpuinit filter_cpuid_features(struct cpuinfo_x86 *c, bool warn) | |||
255 | * signs here... | 253 | * signs here... |
256 | */ | 254 | */ |
257 | if (cpu_has(c, df->feature) && | 255 | if (cpu_has(c, df->feature) && |
258 | ((s32)df->feature < 0 ? | 256 | ((s32)df->level < 0 ? |
259 | (u32)df->feature > (u32)c->extended_cpuid_level : | 257 | (u32)df->level > (u32)c->extended_cpuid_level : |
260 | (s32)df->feature > (s32)c->cpuid_level)) { | 258 | (s32)df->level > (s32)c->cpuid_level)) { |
261 | clear_cpu_cap(c, df->feature); | 259 | clear_cpu_cap(c, df->feature); |
262 | if (warn) | 260 | if (warn) |
263 | printk(KERN_WARNING | 261 | printk(KERN_WARNING |
@@ -267,7 +265,7 @@ static void __cpuinit filter_cpuid_features(struct cpuinfo_x86 *c, bool warn) | |||
267 | df->level); | 265 | df->level); |
268 | } | 266 | } |
269 | } | 267 | } |
270 | } | 268 | } |
271 | 269 | ||
272 | /* | 270 | /* |
273 | * Naming convention should be: <Name> [(<Codename>)] | 271 | * Naming convention should be: <Name> [(<Codename>)] |
@@ -1053,7 +1051,7 @@ void __cpuinit cpu_init(void) | |||
1053 | barrier(); | 1051 | barrier(); |
1054 | 1052 | ||
1055 | check_efer(); | 1053 | check_efer(); |
1056 | if (cpu != 0 && x2apic) | 1054 | if (cpu != 0) |
1057 | enable_x2apic(); | 1055 | enable_x2apic(); |
1058 | 1056 | ||
1059 | /* | 1057 | /* |
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c index 1f137a87d4bd..7aeef1d327b1 100644 --- a/arch/x86/kernel/cpu/intel.c +++ b/arch/x86/kernel/cpu/intel.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #ifdef CONFIG_X86_LOCAL_APIC | 24 | #ifdef CONFIG_X86_LOCAL_APIC |
25 | #include <asm/mpspec.h> | 25 | #include <asm/mpspec.h> |
26 | #include <asm/apic.h> | 26 | #include <asm/apic.h> |
27 | #include <asm/genapic.h> | ||
28 | #endif | 27 | #endif |
29 | 28 | ||
30 | static void __cpuinit early_init_intel(struct cpuinfo_x86 *c) | 29 | static void __cpuinit early_init_intel(struct cpuinfo_x86 *c) |
diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c index ad7f2a696f4a..ff958248e61d 100644 --- a/arch/x86/kernel/crash.c +++ b/arch/x86/kernel/crash.c | |||
@@ -28,8 +28,6 @@ | |||
28 | #include <asm/reboot.h> | 28 | #include <asm/reboot.h> |
29 | #include <asm/virtext.h> | 29 | #include <asm/virtext.h> |
30 | 30 | ||
31 | #include <asm/genapic.h> | ||
32 | |||
33 | 31 | ||
34 | #if defined(CONFIG_SMP) && defined(CONFIG_X86_LOCAL_APIC) | 32 | #if defined(CONFIG_SMP) && defined(CONFIG_X86_LOCAL_APIC) |
35 | 33 | ||
diff --git a/arch/x86/kernel/es7000_32.c b/arch/x86/kernel/es7000_32.c index 55515d73d9c2..320f2d2e4e54 100644 --- a/arch/x86/kernel/es7000_32.c +++ b/arch/x86/kernel/es7000_32.c | |||
@@ -1,10 +1,14 @@ | |||
1 | /* | 1 | /* |
2 | * Written by: Garry Forsgren, Unisys Corporation | 2 | * Written by: Garry Forsgren, Unisys Corporation |
3 | * Natalie Protasevich, Unisys Corporation | 3 | * Natalie Protasevich, Unisys Corporation |
4 | * | ||
4 | * This file contains the code to configure and interface | 5 | * This file contains the code to configure and interface |
5 | * with Unisys ES7000 series hardware system manager. | 6 | * with Unisys ES7000 series hardware system manager. |
6 | * | 7 | * |
7 | * Copyright (c) 2003 Unisys Corporation. All Rights Reserved. | 8 | * Copyright (c) 2003 Unisys Corporation. |
9 | * Copyright (C) 2009, Red Hat, Inc., Ingo Molnar | ||
10 | * | ||
11 | * All Rights Reserved. | ||
8 | * | 12 | * |
9 | * This program is free software; you can redistribute it and/or modify it | 13 | * This program is free software; you can redistribute it and/or modify it |
10 | * under the terms of version 2 of the GNU General Public License as | 14 | * under the terms of version 2 of the GNU General Public License as |
@@ -23,128 +27,105 @@ | |||
23 | * | 27 | * |
24 | * http://www.unisys.com | 28 | * http://www.unisys.com |
25 | */ | 29 | */ |
26 | 30 | #include <linux/notifier.h> | |
27 | #include <linux/module.h> | 31 | #include <linux/spinlock.h> |
28 | #include <linux/types.h> | 32 | #include <linux/cpumask.h> |
33 | #include <linux/threads.h> | ||
29 | #include <linux/kernel.h> | 34 | #include <linux/kernel.h> |
30 | #include <linux/smp.h> | 35 | #include <linux/module.h> |
36 | #include <linux/reboot.h> | ||
31 | #include <linux/string.h> | 37 | #include <linux/string.h> |
32 | #include <linux/spinlock.h> | 38 | #include <linux/types.h> |
33 | #include <linux/errno.h> | 39 | #include <linux/errno.h> |
34 | #include <linux/notifier.h> | ||
35 | #include <linux/reboot.h> | ||
36 | #include <linux/init.h> | ||
37 | #include <linux/acpi.h> | 40 | #include <linux/acpi.h> |
38 | #include <asm/io.h> | 41 | #include <linux/init.h> |
39 | #include <asm/nmi.h> | 42 | #include <linux/nmi.h> |
40 | #include <asm/smp.h> | 43 | #include <linux/smp.h> |
41 | #include <asm/atomic.h> | 44 | #include <linux/io.h> |
45 | |||
42 | #include <asm/apicdef.h> | 46 | #include <asm/apicdef.h> |
43 | #include <asm/genapic.h> | 47 | #include <asm/atomic.h> |
48 | #include <asm/fixmap.h> | ||
49 | #include <asm/mpspec.h> | ||
44 | #include <asm/setup.h> | 50 | #include <asm/setup.h> |
51 | #include <asm/apic.h> | ||
52 | #include <asm/ipi.h> | ||
45 | 53 | ||
46 | /* | 54 | /* |
47 | * ES7000 chipsets | 55 | * ES7000 chipsets |
48 | */ | 56 | */ |
49 | 57 | ||
50 | #define NON_UNISYS 0 | 58 | #define NON_UNISYS 0 |
51 | #define ES7000_CLASSIC 1 | 59 | #define ES7000_CLASSIC 1 |
52 | #define ES7000_ZORRO 2 | 60 | #define ES7000_ZORRO 2 |
53 | 61 | ||
62 | #define MIP_REG 1 | ||
63 | #define MIP_PSAI_REG 4 | ||
54 | 64 | ||
55 | #define MIP_REG 1 | 65 | #define MIP_BUSY 1 |
56 | #define MIP_PSAI_REG 4 | 66 | #define MIP_SPIN 0xf0000 |
67 | #define MIP_VALID 0x0100000000000000ULL | ||
68 | #define MIP_SW_APIC 0x1020b | ||
57 | 69 | ||
58 | #define MIP_BUSY 1 | 70 | #define MIP_PORT(val) ((val >> 32) & 0xffff) |
59 | #define MIP_SPIN 0xf0000 | ||
60 | #define MIP_VALID 0x0100000000000000ULL | ||
61 | #define MIP_PORT(VALUE) ((VALUE >> 32) & 0xffff) | ||
62 | 71 | ||
63 | #define MIP_RD_LO(VALUE) (VALUE & 0xffffffff) | 72 | #define MIP_RD_LO(val) (val & 0xffffffff) |
64 | 73 | ||
65 | struct mip_reg_info { | 74 | struct mip_reg { |
66 | unsigned long long mip_info; | 75 | unsigned long long off_0x00; |
67 | unsigned long long delivery_info; | 76 | unsigned long long off_0x08; |
68 | unsigned long long host_reg; | 77 | unsigned long long off_0x10; |
69 | unsigned long long mip_reg; | 78 | unsigned long long off_0x18; |
79 | unsigned long long off_0x20; | ||
80 | unsigned long long off_0x28; | ||
81 | unsigned long long off_0x30; | ||
82 | unsigned long long off_0x38; | ||
70 | }; | 83 | }; |
71 | 84 | ||
72 | struct part_info { | 85 | struct mip_reg_info { |
73 | unsigned char type; | 86 | unsigned long long mip_info; |
74 | unsigned char length; | 87 | unsigned long long delivery_info; |
75 | unsigned char part_id; | 88 | unsigned long long host_reg; |
76 | unsigned char apic_mode; | 89 | unsigned long long mip_reg; |
77 | unsigned long snum; | ||
78 | char ptype[16]; | ||
79 | char sname[64]; | ||
80 | char pname[64]; | ||
81 | }; | 90 | }; |
82 | 91 | ||
83 | struct psai { | 92 | struct psai { |
84 | unsigned long long entry_type; | 93 | unsigned long long entry_type; |
85 | unsigned long long addr; | 94 | unsigned long long addr; |
86 | unsigned long long bep_addr; | 95 | unsigned long long bep_addr; |
87 | }; | 96 | }; |
88 | 97 | ||
89 | struct es7000_mem_info { | 98 | #ifdef CONFIG_ACPI |
90 | unsigned char type; | ||
91 | unsigned char length; | ||
92 | unsigned char resv[6]; | ||
93 | unsigned long long start; | ||
94 | unsigned long long size; | ||
95 | }; | ||
96 | 99 | ||
97 | struct es7000_oem_table { | 100 | struct es7000_oem_table { |
98 | unsigned long long hdr; | 101 | struct acpi_table_header Header; |
99 | struct mip_reg_info mip; | 102 | u32 OEMTableAddr; |
100 | struct part_info pif; | 103 | u32 OEMTableSize; |
101 | struct es7000_mem_info shm; | ||
102 | struct psai psai; | ||
103 | }; | 104 | }; |
104 | 105 | ||
105 | #ifdef CONFIG_ACPI | 106 | static unsigned long oem_addrX; |
106 | 107 | static unsigned long oem_size; | |
107 | struct oem_table { | ||
108 | struct acpi_table_header Header; | ||
109 | u32 OEMTableAddr; | ||
110 | u32 OEMTableSize; | ||
111 | }; | ||
112 | 108 | ||
113 | extern int find_unisys_acpi_oem_table(unsigned long *oem_addr); | ||
114 | extern void unmap_unisys_acpi_oem_table(unsigned long oem_addr); | ||
115 | #endif | 109 | #endif |
116 | 110 | ||
117 | struct mip_reg { | ||
118 | unsigned long long off_0; | ||
119 | unsigned long long off_8; | ||
120 | unsigned long long off_10; | ||
121 | unsigned long long off_18; | ||
122 | unsigned long long off_20; | ||
123 | unsigned long long off_28; | ||
124 | unsigned long long off_30; | ||
125 | unsigned long long off_38; | ||
126 | }; | ||
127 | |||
128 | #define MIP_SW_APIC 0x1020b | ||
129 | #define MIP_FUNC(VALUE) (VALUE & 0xff) | ||
130 | |||
131 | /* | 111 | /* |
132 | * ES7000 Globals | 112 | * ES7000 Globals |
133 | */ | 113 | */ |
134 | 114 | ||
135 | static volatile unsigned long *psai = NULL; | 115 | static volatile unsigned long *psai; |
136 | static struct mip_reg *mip_reg; | 116 | static struct mip_reg *mip_reg; |
137 | static struct mip_reg *host_reg; | 117 | static struct mip_reg *host_reg; |
138 | static int mip_port; | 118 | static int mip_port; |
139 | static unsigned long mip_addr, host_addr; | 119 | static unsigned long mip_addr; |
120 | static unsigned long host_addr; | ||
140 | 121 | ||
141 | int es7000_plat; | 122 | int es7000_plat; |
142 | 123 | ||
143 | /* | 124 | /* |
144 | * GSI override for ES7000 platforms. | 125 | * GSI override for ES7000 platforms. |
145 | */ | 126 | */ |
146 | 127 | ||
147 | static unsigned int base; | 128 | static unsigned int base; |
148 | 129 | ||
149 | static int | 130 | static int |
150 | es7000_rename_gsi(int ioapic, int gsi) | 131 | es7000_rename_gsi(int ioapic, int gsi) |
@@ -160,6 +141,7 @@ es7000_rename_gsi(int ioapic, int gsi) | |||
160 | 141 | ||
161 | if (!ioapic && (gsi < 16)) | 142 | if (!ioapic && (gsi < 16)) |
162 | gsi += base; | 143 | gsi += base; |
144 | |||
163 | return gsi; | 145 | return gsi; |
164 | } | 146 | } |
165 | 147 | ||
@@ -181,14 +163,14 @@ static int wakeup_secondary_cpu_via_mip(int cpu, unsigned long eip) | |||
181 | return 0; | 163 | return 0; |
182 | } | 164 | } |
183 | 165 | ||
184 | static int __init es7000_update_genapic(void) | 166 | static int __init es7000_update_apic(void) |
185 | { | 167 | { |
186 | apic->wakeup_cpu = wakeup_secondary_cpu_via_mip; | 168 | apic->wakeup_cpu = wakeup_secondary_cpu_via_mip; |
187 | 169 | ||
188 | /* MPENTIUMIII */ | 170 | /* MPENTIUMIII */ |
189 | if (boot_cpu_data.x86 == 6 && | 171 | if (boot_cpu_data.x86 == 6 && |
190 | (boot_cpu_data.x86_model >= 7 || boot_cpu_data.x86_model <= 11)) { | 172 | (boot_cpu_data.x86_model >= 7 || boot_cpu_data.x86_model <= 11)) { |
191 | es7000_update_genapic_to_cluster(); | 173 | es7000_update_apic_to_cluster(); |
192 | apic->wait_for_init_deassert = NULL; | 174 | apic->wait_for_init_deassert = NULL; |
193 | apic->wakeup_cpu = wakeup_secondary_cpu_via_mip; | 175 | apic->wakeup_cpu = wakeup_secondary_cpu_via_mip; |
194 | } | 176 | } |
@@ -196,8 +178,7 @@ static int __init es7000_update_genapic(void) | |||
196 | return 0; | 178 | return 0; |
197 | } | 179 | } |
198 | 180 | ||
199 | void __init | 181 | static void __init setup_unisys(void) |
200 | setup_unisys(void) | ||
201 | { | 182 | { |
202 | /* | 183 | /* |
203 | * Determine the generation of the ES7000 currently running. | 184 | * Determine the generation of the ES7000 currently running. |
@@ -212,22 +193,20 @@ setup_unisys(void) | |||
212 | es7000_plat = ES7000_CLASSIC; | 193 | es7000_plat = ES7000_CLASSIC; |
213 | ioapic_renumber_irq = es7000_rename_gsi; | 194 | ioapic_renumber_irq = es7000_rename_gsi; |
214 | 195 | ||
215 | x86_quirks->update_genapic = es7000_update_genapic; | 196 | x86_quirks->update_apic = es7000_update_apic; |
216 | } | 197 | } |
217 | 198 | ||
218 | /* | 199 | /* |
219 | * Parse the OEM Table | 200 | * Parse the OEM Table: |
220 | */ | 201 | */ |
221 | 202 | static int __init parse_unisys_oem(char *oemptr) | |
222 | int __init | ||
223 | parse_unisys_oem (char *oemptr) | ||
224 | { | 203 | { |
225 | int i; | 204 | int i; |
226 | int success = 0; | 205 | int success = 0; |
227 | unsigned char type, size; | 206 | unsigned char type, size; |
228 | unsigned long val; | 207 | unsigned long val; |
229 | char *tp = NULL; | 208 | char *tp = NULL; |
230 | struct psai *psaip = NULL; | 209 | struct psai *psaip = NULL; |
231 | struct mip_reg_info *mi; | 210 | struct mip_reg_info *mi; |
232 | struct mip_reg *host, *mip; | 211 | struct mip_reg *host, *mip; |
233 | 212 | ||
@@ -235,7 +214,7 @@ parse_unisys_oem (char *oemptr) | |||
235 | 214 | ||
236 | tp += 8; | 215 | tp += 8; |
237 | 216 | ||
238 | for (i=0; i <= 6; i++) { | 217 | for (i = 0; i <= 6; i++) { |
239 | type = *tp++; | 218 | type = *tp++; |
240 | size = *tp++; | 219 | size = *tp++; |
241 | tp -= 2; | 220 | tp -= 2; |
@@ -273,50 +252,96 @@ parse_unisys_oem (char *oemptr) | |||
273 | tp += size; | 252 | tp += size; |
274 | } | 253 | } |
275 | 254 | ||
276 | if (success < 2) { | 255 | if (success < 2) |
277 | es7000_plat = NON_UNISYS; | 256 | es7000_plat = NON_UNISYS; |
278 | } else | 257 | else |
279 | setup_unisys(); | 258 | setup_unisys(); |
259 | |||
280 | return es7000_plat; | 260 | return es7000_plat; |
281 | } | 261 | } |
282 | 262 | ||
283 | #ifdef CONFIG_ACPI | 263 | #ifdef CONFIG_ACPI |
284 | static unsigned long oem_addrX; | 264 | static int __init find_unisys_acpi_oem_table(unsigned long *oem_addr) |
285 | static unsigned long oem_size; | ||
286 | int __init find_unisys_acpi_oem_table(unsigned long *oem_addr) | ||
287 | { | 265 | { |
288 | struct acpi_table_header *header = NULL; | 266 | struct acpi_table_header *header = NULL; |
289 | int i = 0; | 267 | struct es7000_oem_table *table; |
290 | acpi_size tbl_size; | 268 | acpi_size tbl_size; |
269 | acpi_status ret; | ||
270 | int i = 0; | ||
291 | 271 | ||
292 | while (ACPI_SUCCESS(acpi_get_table_with_size("OEM1", i++, &header, &tbl_size))) { | 272 | for (;;) { |
293 | if (!memcmp((char *) &header->oem_id, "UNISYS", 6)) { | 273 | ret = acpi_get_table_with_size("OEM1", i++, &header, &tbl_size); |
294 | struct oem_table *t = (struct oem_table *)header; | 274 | if (!ACPI_SUCCESS(ret)) |
275 | return -1; | ||
295 | 276 | ||
296 | oem_addrX = t->OEMTableAddr; | 277 | if (!memcmp((char *) &header->oem_id, "UNISYS", 6)) |
297 | oem_size = t->OEMTableSize; | 278 | break; |
298 | early_acpi_os_unmap_memory(header, tbl_size); | ||
299 | 279 | ||
300 | *oem_addr = (unsigned long)__acpi_map_table(oem_addrX, | ||
301 | oem_size); | ||
302 | return 0; | ||
303 | } | ||
304 | early_acpi_os_unmap_memory(header, tbl_size); | 280 | early_acpi_os_unmap_memory(header, tbl_size); |
305 | } | 281 | } |
306 | return -1; | 282 | |
283 | table = (void *)header; | ||
284 | |||
285 | oem_addrX = table->OEMTableAddr; | ||
286 | oem_size = table->OEMTableSize; | ||
287 | |||
288 | early_acpi_os_unmap_memory(header, tbl_size); | ||
289 | |||
290 | *oem_addr = (unsigned long)__acpi_map_table(oem_addrX, oem_size); | ||
291 | |||
292 | return 0; | ||
307 | } | 293 | } |
308 | 294 | ||
309 | void __init unmap_unisys_acpi_oem_table(unsigned long oem_addr) | 295 | static void __init unmap_unisys_acpi_oem_table(unsigned long oem_addr) |
310 | { | 296 | { |
311 | if (!oem_addr) | 297 | if (!oem_addr) |
312 | return; | 298 | return; |
313 | 299 | ||
314 | __acpi_unmap_table((char *)oem_addr, oem_size); | 300 | __acpi_unmap_table((char *)oem_addr, oem_size); |
315 | } | 301 | } |
316 | #endif | ||
317 | 302 | ||
318 | static void | 303 | static int es7000_check_dsdt(void) |
319 | es7000_spin(int n) | 304 | { |
305 | struct acpi_table_header header; | ||
306 | |||
307 | if (ACPI_SUCCESS(acpi_get_table_header(ACPI_SIG_DSDT, 0, &header)) && | ||
308 | !strncmp(header.oem_id, "UNISYS", 6)) | ||
309 | return 1; | ||
310 | return 0; | ||
311 | } | ||
312 | |||
313 | /* Hook from generic ACPI tables.c */ | ||
314 | static int __init es7000_acpi_madt_oem_check(char *oem_id, char *oem_table_id) | ||
315 | { | ||
316 | unsigned long oem_addr = 0; | ||
317 | int check_dsdt; | ||
318 | int ret = 0; | ||
319 | |||
320 | /* check dsdt at first to avoid clear fix_map for oem_addr */ | ||
321 | check_dsdt = es7000_check_dsdt(); | ||
322 | |||
323 | if (!find_unisys_acpi_oem_table(&oem_addr)) { | ||
324 | if (check_dsdt) { | ||
325 | ret = parse_unisys_oem((char *)oem_addr); | ||
326 | } else { | ||
327 | setup_unisys(); | ||
328 | ret = 1; | ||
329 | } | ||
330 | /* | ||
331 | * we need to unmap it | ||
332 | */ | ||
333 | unmap_unisys_acpi_oem_table(oem_addr); | ||
334 | } | ||
335 | return ret; | ||
336 | } | ||
337 | #else /* !CONFIG_ACPI: */ | ||
338 | static int __init es7000_acpi_madt_oem_check(char *oem_id, char *oem_table_id) | ||
339 | { | ||
340 | return 0; | ||
341 | } | ||
342 | #endif /* !CONFIG_ACPI */ | ||
343 | |||
344 | static void es7000_spin(int n) | ||
320 | { | 345 | { |
321 | int i = 0; | 346 | int i = 0; |
322 | 347 | ||
@@ -327,16 +352,15 @@ es7000_spin(int n) | |||
327 | static int __init | 352 | static int __init |
328 | es7000_mip_write(struct mip_reg *mip_reg) | 353 | es7000_mip_write(struct mip_reg *mip_reg) |
329 | { | 354 | { |
330 | int status = 0; | 355 | int status = 0; |
331 | int spin; | 356 | int spin; |
332 | 357 | ||
333 | spin = MIP_SPIN; | 358 | spin = MIP_SPIN; |
334 | while (((unsigned long long)host_reg->off_38 & | 359 | while ((host_reg->off_0x38 & MIP_VALID) != 0) { |
335 | (unsigned long long)MIP_VALID) != 0) { | 360 | if (--spin <= 0) { |
336 | if (--spin <= 0) { | 361 | WARN(1, "Timeout waiting for Host Valid Flag\n"); |
337 | printk("es7000_mip_write: Timeout waiting for Host Valid Flag"); | 362 | return -1; |
338 | return -1; | 363 | } |
339 | } | ||
340 | es7000_spin(MIP_SPIN); | 364 | es7000_spin(MIP_SPIN); |
341 | } | 365 | } |
342 | 366 | ||
@@ -345,23 +369,21 @@ es7000_mip_write(struct mip_reg *mip_reg) | |||
345 | 369 | ||
346 | spin = MIP_SPIN; | 370 | spin = MIP_SPIN; |
347 | 371 | ||
348 | while (((unsigned long long)mip_reg->off_38 & | 372 | while ((mip_reg->off_0x38 & MIP_VALID) == 0) { |
349 | (unsigned long long)MIP_VALID) == 0) { | ||
350 | if (--spin <= 0) { | 373 | if (--spin <= 0) { |
351 | printk("es7000_mip_write: Timeout waiting for MIP Valid Flag"); | 374 | WARN(1, "Timeout waiting for MIP Valid Flag\n"); |
352 | return -1; | 375 | return -1; |
353 | } | 376 | } |
354 | es7000_spin(MIP_SPIN); | 377 | es7000_spin(MIP_SPIN); |
355 | } | 378 | } |
356 | 379 | ||
357 | status = ((unsigned long long)mip_reg->off_0 & | 380 | status = (mip_reg->off_0x00 & 0xffff0000000000ULL) >> 48; |
358 | (unsigned long long)0xffff0000000000ULL) >> 48; | 381 | mip_reg->off_0x38 &= ~MIP_VALID; |
359 | mip_reg->off_38 = ((unsigned long long)mip_reg->off_38 & | 382 | |
360 | (unsigned long long)~MIP_VALID); | ||
361 | return status; | 383 | return status; |
362 | } | 384 | } |
363 | 385 | ||
364 | void __init es7000_enable_apic_mode(void) | 386 | static void __init es7000_enable_apic_mode(void) |
365 | { | 387 | { |
366 | struct mip_reg es7000_mip_reg; | 388 | struct mip_reg es7000_mip_reg; |
367 | int mip_status; | 389 | int mip_status; |
@@ -369,53 +391,15 @@ void __init es7000_enable_apic_mode(void) | |||
369 | if (!es7000_plat) | 391 | if (!es7000_plat) |
370 | return; | 392 | return; |
371 | 393 | ||
372 | printk("ES7000: Enabling APIC mode.\n"); | 394 | printk(KERN_INFO "ES7000: Enabling APIC mode.\n"); |
373 | memset(&es7000_mip_reg, 0, sizeof(struct mip_reg)); | 395 | memset(&es7000_mip_reg, 0, sizeof(struct mip_reg)); |
374 | es7000_mip_reg.off_0 = MIP_SW_APIC; | 396 | es7000_mip_reg.off_0x00 = MIP_SW_APIC; |
375 | es7000_mip_reg.off_38 = MIP_VALID; | 397 | es7000_mip_reg.off_0x38 = MIP_VALID; |
376 | 398 | ||
377 | while ((mip_status = es7000_mip_write(&es7000_mip_reg)) != 0) { | 399 | while ((mip_status = es7000_mip_write(&es7000_mip_reg)) != 0) |
378 | printk("es7000_enable_apic_mode: command failed, status = %x\n", | 400 | WARN(1, "Command failed, status = %x\n", mip_status); |
379 | mip_status); | ||
380 | } | ||
381 | } | 401 | } |
382 | 402 | ||
383 | /* | ||
384 | * APIC driver for the Unisys ES7000 chipset. | ||
385 | */ | ||
386 | #define APIC_DEFINITION 1 | ||
387 | #include <linux/threads.h> | ||
388 | #include <linux/cpumask.h> | ||
389 | #include <asm/mpspec.h> | ||
390 | #include <asm/genapic.h> | ||
391 | #include <asm/fixmap.h> | ||
392 | #include <asm/apicdef.h> | ||
393 | #include <linux/kernel.h> | ||
394 | #include <linux/string.h> | ||
395 | #include <linux/init.h> | ||
396 | #include <linux/acpi.h> | ||
397 | #include <linux/smp.h> | ||
398 | #include <asm/ipi.h> | ||
399 | |||
400 | #define APIC_DFR_VALUE_CLUSTER (APIC_DFR_CLUSTER) | ||
401 | #define INT_DELIVERY_MODE_CLUSTER (dest_LowestPrio) | ||
402 | #define INT_DEST_MODE_CLUSTER (1) /* logical delivery broadcast to all procs */ | ||
403 | |||
404 | #define APIC_DFR_VALUE (APIC_DFR_FLAT) | ||
405 | |||
406 | extern void es7000_enable_apic_mode(void); | ||
407 | extern int apic_version [MAX_APICS]; | ||
408 | extern u8 cpu_2_logical_apicid[]; | ||
409 | extern unsigned int boot_cpu_physical_apicid; | ||
410 | |||
411 | extern int parse_unisys_oem (char *oemptr); | ||
412 | extern int find_unisys_acpi_oem_table(unsigned long *oem_addr); | ||
413 | extern void unmap_unisys_acpi_oem_table(unsigned long oem_addr); | ||
414 | extern void setup_unisys(void); | ||
415 | |||
416 | #define apicid_cluster(apicid) (apicid & 0xF0) | ||
417 | #define xapic_phys_to_log_apicid(cpu) per_cpu(x86_bios_cpu_apicid, cpu) | ||
418 | |||
419 | static void es7000_vector_allocation_domain(int cpu, cpumask_t *retmask) | 403 | static void es7000_vector_allocation_domain(int cpu, cpumask_t *retmask) |
420 | { | 404 | { |
421 | /* Careful. Some cpus do not strictly honor the set of cpus | 405 | /* Careful. Some cpus do not strictly honor the set of cpus |
@@ -444,18 +428,6 @@ static unsigned int es7000_get_apic_id(unsigned long x) | |||
444 | return (x >> 24) & 0xFF; | 428 | return (x >> 24) & 0xFF; |
445 | } | 429 | } |
446 | 430 | ||
447 | #ifdef CONFIG_ACPI | ||
448 | static int es7000_check_dsdt(void) | ||
449 | { | ||
450 | struct acpi_table_header header; | ||
451 | |||
452 | if (ACPI_SUCCESS(acpi_get_table_header(ACPI_SIG_DSDT, 0, &header)) && | ||
453 | !strncmp(header.oem_id, "UNISYS", 6)) | ||
454 | return 1; | ||
455 | return 0; | ||
456 | } | ||
457 | #endif | ||
458 | |||
459 | static void es7000_send_IPI_mask(const struct cpumask *mask, int vector) | 431 | static void es7000_send_IPI_mask(const struct cpumask *mask, int vector) |
460 | { | 432 | { |
461 | default_send_IPI_mask_sequence_phys(mask, vector); | 433 | default_send_IPI_mask_sequence_phys(mask, vector); |
@@ -473,7 +445,7 @@ static void es7000_send_IPI_all(int vector) | |||
473 | 445 | ||
474 | static int es7000_apic_id_registered(void) | 446 | static int es7000_apic_id_registered(void) |
475 | { | 447 | { |
476 | return 1; | 448 | return 1; |
477 | } | 449 | } |
478 | 450 | ||
479 | static const cpumask_t *target_cpus_cluster(void) | 451 | static const cpumask_t *target_cpus_cluster(void) |
@@ -498,9 +470,9 @@ static unsigned long es7000_check_apicid_present(int bit) | |||
498 | 470 | ||
499 | static unsigned long calculate_ldr(int cpu) | 471 | static unsigned long calculate_ldr(int cpu) |
500 | { | 472 | { |
501 | unsigned long id = xapic_phys_to_log_apicid(cpu); | 473 | unsigned long id = per_cpu(x86_bios_cpu_apicid, cpu); |
502 | 474 | ||
503 | return (SET_APIC_LOGICAL_ID(id)); | 475 | return SET_APIC_LOGICAL_ID(id); |
504 | } | 476 | } |
505 | 477 | ||
506 | /* | 478 | /* |
@@ -515,7 +487,7 @@ static void es7000_init_apic_ldr_cluster(void) | |||
515 | unsigned long val; | 487 | unsigned long val; |
516 | int cpu = smp_processor_id(); | 488 | int cpu = smp_processor_id(); |
517 | 489 | ||
518 | apic_write(APIC_DFR, APIC_DFR_VALUE_CLUSTER); | 490 | apic_write(APIC_DFR, APIC_DFR_CLUSTER); |
519 | val = calculate_ldr(cpu); | 491 | val = calculate_ldr(cpu); |
520 | apic_write(APIC_LDR, val); | 492 | apic_write(APIC_LDR, val); |
521 | } | 493 | } |
@@ -525,7 +497,7 @@ static void es7000_init_apic_ldr(void) | |||
525 | unsigned long val; | 497 | unsigned long val; |
526 | int cpu = smp_processor_id(); | 498 | int cpu = smp_processor_id(); |
527 | 499 | ||
528 | apic_write(APIC_DFR, APIC_DFR_VALUE); | 500 | apic_write(APIC_DFR, APIC_DFR_FLAT); |
529 | val = calculate_ldr(cpu); | 501 | val = calculate_ldr(cpu); |
530 | apic_write(APIC_LDR, val); | 502 | apic_write(APIC_LDR, val); |
531 | } | 503 | } |
@@ -533,10 +505,12 @@ static void es7000_init_apic_ldr(void) | |||
533 | static void es7000_setup_apic_routing(void) | 505 | static void es7000_setup_apic_routing(void) |
534 | { | 506 | { |
535 | int apic = per_cpu(x86_bios_cpu_apicid, smp_processor_id()); | 507 | int apic = per_cpu(x86_bios_cpu_apicid, smp_processor_id()); |
536 | printk("Enabling APIC mode: %s. Using %d I/O APICs, target cpus %lx\n", | 508 | |
509 | printk(KERN_INFO | ||
510 | "Enabling APIC mode: %s. Using %d I/O APICs, target cpus %lx\n", | ||
537 | (apic_version[apic] == 0x14) ? | 511 | (apic_version[apic] == 0x14) ? |
538 | "Physical Cluster" : "Logical Cluster", | 512 | "Physical Cluster" : "Logical Cluster", |
539 | nr_ioapics, cpus_addr(*es7000_target_cpus())[0]); | 513 | nr_ioapics, cpus_addr(*es7000_target_cpus())[0]); |
540 | } | 514 | } |
541 | 515 | ||
542 | static int es7000_apicid_to_node(int logical_apicid) | 516 | static int es7000_apicid_to_node(int logical_apicid) |
@@ -550,18 +524,19 @@ static int es7000_cpu_present_to_apicid(int mps_cpu) | |||
550 | if (!mps_cpu) | 524 | if (!mps_cpu) |
551 | return boot_cpu_physical_apicid; | 525 | return boot_cpu_physical_apicid; |
552 | else if (mps_cpu < nr_cpu_ids) | 526 | else if (mps_cpu < nr_cpu_ids) |
553 | return (int) per_cpu(x86_bios_cpu_apicid, mps_cpu); | 527 | return per_cpu(x86_bios_cpu_apicid, mps_cpu); |
554 | else | 528 | else |
555 | return BAD_APICID; | 529 | return BAD_APICID; |
556 | } | 530 | } |
557 | 531 | ||
532 | static int cpu_id; | ||
533 | |||
558 | static physid_mask_t es7000_apicid_to_cpu_present(int phys_apicid) | 534 | static physid_mask_t es7000_apicid_to_cpu_present(int phys_apicid) |
559 | { | 535 | { |
560 | static int id = 0; | ||
561 | physid_mask_t mask; | 536 | physid_mask_t mask; |
562 | 537 | ||
563 | mask = physid_mask_of_physid(id); | 538 | mask = physid_mask_of_physid(cpu_id); |
564 | ++id; | 539 | ++cpu_id; |
565 | 540 | ||
566 | return mask; | 541 | return mask; |
567 | } | 542 | } |
@@ -572,7 +547,7 @@ static int es7000_cpu_to_logical_apicid(int cpu) | |||
572 | #ifdef CONFIG_SMP | 547 | #ifdef CONFIG_SMP |
573 | if (cpu >= nr_cpu_ids) | 548 | if (cpu >= nr_cpu_ids) |
574 | return BAD_APICID; | 549 | return BAD_APICID; |
575 | return (int)cpu_2_logical_apicid[cpu]; | 550 | return cpu_2_logical_apicid[cpu]; |
576 | #else | 551 | #else |
577 | return logical_smp_processor_id(); | 552 | return logical_smp_processor_id(); |
578 | #endif | 553 | #endif |
@@ -587,7 +562,7 @@ static physid_mask_t es7000_ioapic_phys_id_map(physid_mask_t phys_map) | |||
587 | static int es7000_check_phys_apicid_present(int cpu_physical_apicid) | 562 | static int es7000_check_phys_apicid_present(int cpu_physical_apicid) |
588 | { | 563 | { |
589 | boot_cpu_physical_apicid = read_apic_id(); | 564 | boot_cpu_physical_apicid = read_apic_id(); |
590 | return (1); | 565 | return 1; |
591 | } | 566 | } |
592 | 567 | ||
593 | static unsigned int | 568 | static unsigned int |
@@ -613,9 +588,8 @@ es7000_cpu_mask_to_apicid_cluster(const struct cpumask *cpumask) | |||
613 | if (cpumask_test_cpu(cpu, cpumask)) { | 588 | if (cpumask_test_cpu(cpu, cpumask)) { |
614 | int new_apicid = es7000_cpu_to_logical_apicid(cpu); | 589 | int new_apicid = es7000_cpu_to_logical_apicid(cpu); |
615 | 590 | ||
616 | if (apicid_cluster(apicid) != | 591 | if (APIC_CLUSTER(apicid) != APIC_CLUSTER(new_apicid)) { |
617 | apicid_cluster(new_apicid)) { | 592 | WARN(1, "Not a valid mask!"); |
618 | printk ("%s: Not a valid mask!\n", __func__); | ||
619 | 593 | ||
620 | return 0xFF; | 594 | return 0xFF; |
621 | } | 595 | } |
@@ -648,9 +622,8 @@ static unsigned int es7000_cpu_mask_to_apicid(const cpumask_t *cpumask) | |||
648 | if (cpu_isset(cpu, *cpumask)) { | 622 | if (cpu_isset(cpu, *cpumask)) { |
649 | int new_apicid = es7000_cpu_to_logical_apicid(cpu); | 623 | int new_apicid = es7000_cpu_to_logical_apicid(cpu); |
650 | 624 | ||
651 | if (apicid_cluster(apicid) != | 625 | if (APIC_CLUSTER(apicid) != APIC_CLUSTER(new_apicid)) { |
652 | apicid_cluster(new_apicid)) { | 626 | printk("%s: Not a valid mask!\n", __func__); |
653 | printk ("%s: Not a valid mask!\n", __func__); | ||
654 | 627 | ||
655 | return es7000_cpu_to_logical_apicid(0); | 628 | return es7000_cpu_to_logical_apicid(0); |
656 | } | 629 | } |
@@ -686,11 +659,12 @@ static int es7000_phys_pkg_id(int cpuid_apic, int index_msb) | |||
686 | return cpuid_apic >> index_msb; | 659 | return cpuid_apic >> index_msb; |
687 | } | 660 | } |
688 | 661 | ||
689 | void __init es7000_update_genapic_to_cluster(void) | 662 | void __init es7000_update_apic_to_cluster(void) |
690 | { | 663 | { |
691 | apic->target_cpus = target_cpus_cluster; | 664 | apic->target_cpus = target_cpus_cluster; |
692 | apic->irq_delivery_mode = INT_DELIVERY_MODE_CLUSTER; | 665 | apic->irq_delivery_mode = dest_LowestPrio; |
693 | apic->irq_dest_mode = INT_DEST_MODE_CLUSTER; | 666 | /* logical delivery broadcast to all procs: */ |
667 | apic->irq_dest_mode = 1; | ||
694 | 668 | ||
695 | apic->init_apic_ldr = es7000_init_apic_ldr_cluster; | 669 | apic->init_apic_ldr = es7000_init_apic_ldr_cluster; |
696 | 670 | ||
@@ -716,40 +690,8 @@ es7000_mps_oem_check(struct mpc_table *mpc, char *oem, char *productid) | |||
716 | return 0; | 690 | return 0; |
717 | } | 691 | } |
718 | 692 | ||
719 | #ifdef CONFIG_ACPI | ||
720 | /* Hook from generic ACPI tables.c */ | ||
721 | static int __init es7000_acpi_madt_oem_check(char *oem_id, char *oem_table_id) | ||
722 | { | ||
723 | unsigned long oem_addr = 0; | ||
724 | int check_dsdt; | ||
725 | int ret = 0; | ||
726 | |||
727 | /* check dsdt at first to avoid clear fix_map for oem_addr */ | ||
728 | check_dsdt = es7000_check_dsdt(); | ||
729 | |||
730 | if (!find_unisys_acpi_oem_table(&oem_addr)) { | ||
731 | if (check_dsdt) | ||
732 | ret = parse_unisys_oem((char *)oem_addr); | ||
733 | else { | ||
734 | setup_unisys(); | ||
735 | ret = 1; | ||
736 | } | ||
737 | /* | ||
738 | * we need to unmap it | ||
739 | */ | ||
740 | unmap_unisys_acpi_oem_table(oem_addr); | ||
741 | } | ||
742 | return ret; | ||
743 | } | ||
744 | #else | ||
745 | static int __init es7000_acpi_madt_oem_check(char *oem_id, char *oem_table_id) | ||
746 | { | ||
747 | return 0; | ||
748 | } | ||
749 | #endif | ||
750 | |||
751 | 693 | ||
752 | struct genapic apic_es7000 = { | 694 | struct apic apic_es7000 = { |
753 | 695 | ||
754 | .name = "es7000", | 696 | .name = "es7000", |
755 | .probe = probe_es7000, | 697 | .probe = probe_es7000, |
@@ -804,6 +746,12 @@ struct genapic apic_es7000 = { | |||
804 | 746 | ||
805 | /* Nothing to do for most platforms, since cleared by the INIT cycle: */ | 747 | /* Nothing to do for most platforms, since cleared by the INIT cycle: */ |
806 | .smp_callin_clear_local_apic = NULL, | 748 | .smp_callin_clear_local_apic = NULL, |
807 | .store_NMI_vector = NULL, | ||
808 | .inquire_remote_apic = default_inquire_remote_apic, | 749 | .inquire_remote_apic = default_inquire_remote_apic, |
750 | |||
751 | .read = native_apic_mem_read, | ||
752 | .write = native_apic_mem_write, | ||
753 | .icr_read = native_apic_icr_read, | ||
754 | .icr_write = native_apic_icr_write, | ||
755 | .wait_icr_idle = native_apic_wait_icr_idle, | ||
756 | .safe_wait_icr_idle = native_safe_apic_wait_icr_idle, | ||
809 | }; | 757 | }; |
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c index 4beb9a13873d..9dc6b2b24275 100644 --- a/arch/x86/kernel/irq_32.c +++ b/arch/x86/kernel/irq_32.c | |||
@@ -212,7 +212,6 @@ bool handle_irq(unsigned irq, struct pt_regs *regs) | |||
212 | } | 212 | } |
213 | 213 | ||
214 | #ifdef CONFIG_HOTPLUG_CPU | 214 | #ifdef CONFIG_HOTPLUG_CPU |
215 | #include <asm/genapic.h> | ||
216 | 215 | ||
217 | /* A cpu has been removed from cpu_online_mask. Reset irq affinities. */ | 216 | /* A cpu has been removed from cpu_online_mask. Reset irq affinities. */ |
218 | void fixup_irqs(void) | 217 | void fixup_irqs(void) |
diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb.c index 5c4f55483849..eedfaebe1063 100644 --- a/arch/x86/kernel/kgdb.c +++ b/arch/x86/kernel/kgdb.c | |||
@@ -46,7 +46,7 @@ | |||
46 | #include <asm/apicdef.h> | 46 | #include <asm/apicdef.h> |
47 | #include <asm/system.h> | 47 | #include <asm/system.h> |
48 | 48 | ||
49 | #include <asm/genapic.h> | 49 | #include <asm/apic.h> |
50 | 50 | ||
51 | /* | 51 | /* |
52 | * Put the error code here just in case the user cares: | 52 | * Put the error code here just in case the user cares: |
diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c index 200764453195..7f4d2586972e 100644 --- a/arch/x86/kernel/mpparse.c +++ b/arch/x86/kernel/mpparse.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #include <asm/setup.h> | 29 | #include <asm/setup.h> |
30 | #include <asm/smp.h> | 30 | #include <asm/smp.h> |
31 | 31 | ||
32 | #include <asm/genapic.h> | 32 | #include <asm/apic.h> |
33 | /* | 33 | /* |
34 | * Checksum an MP configuration block. | 34 | * Checksum an MP configuration block. |
35 | */ | 35 | */ |
diff --git a/arch/x86/kernel/numaq_32.c b/arch/x86/kernel/numaq_32.c index 0cc41a1d2550..d9d6d61eed82 100644 --- a/arch/x86/kernel/numaq_32.c +++ b/arch/x86/kernel/numaq_32.c | |||
@@ -2,6 +2,7 @@ | |||
2 | * Written by: Patricia Gaughen, IBM Corporation | 2 | * Written by: Patricia Gaughen, IBM Corporation |
3 | * | 3 | * |
4 | * Copyright (C) 2002, IBM Corp. | 4 | * Copyright (C) 2002, IBM Corp. |
5 | * Copyright (C) 2009, Red Hat, Inc., Ingo Molnar | ||
5 | * | 6 | * |
6 | * All rights reserved. | 7 | * All rights reserved. |
7 | * | 8 | * |
@@ -22,21 +23,81 @@ | |||
22 | * | 23 | * |
23 | * Send feedback to <gone@us.ibm.com> | 24 | * Send feedback to <gone@us.ibm.com> |
24 | */ | 25 | */ |
25 | |||
26 | #include <linux/nodemask.h> | 26 | #include <linux/nodemask.h> |
27 | #include <linux/topology.h> | ||
27 | #include <linux/bootmem.h> | 28 | #include <linux/bootmem.h> |
29 | #include <linux/threads.h> | ||
30 | #include <linux/cpumask.h> | ||
31 | #include <linux/kernel.h> | ||
28 | #include <linux/mmzone.h> | 32 | #include <linux/mmzone.h> |
29 | #include <linux/module.h> | 33 | #include <linux/module.h> |
34 | #include <linux/string.h> | ||
35 | #include <linux/init.h> | ||
36 | #include <linux/numa.h> | ||
37 | #include <linux/smp.h> | ||
38 | #include <linux/io.h> | ||
30 | #include <linux/mm.h> | 39 | #include <linux/mm.h> |
31 | 40 | ||
32 | #include <asm/processor.h> | 41 | #include <asm/processor.h> |
33 | #include <asm/topology.h> | 42 | #include <asm/fixmap.h> |
34 | #include <asm/genapic.h> | 43 | #include <asm/mpspec.h> |
35 | #include <asm/numaq.h> | 44 | #include <asm/numaq.h> |
36 | #include <asm/setup.h> | 45 | #include <asm/setup.h> |
46 | #include <asm/apic.h> | ||
37 | #include <asm/e820.h> | 47 | #include <asm/e820.h> |
48 | #include <asm/ipi.h> | ||
49 | |||
50 | #define MB_TO_PAGES(addr) ((addr) << (20 - PAGE_SHIFT)) | ||
51 | |||
52 | int found_numaq; | ||
53 | |||
54 | /* | ||
55 | * Have to match translation table entries to main table entries by counter | ||
56 | * hence the mpc_record variable .... can't see a less disgusting way of | ||
57 | * doing this .... | ||
58 | */ | ||
59 | struct mpc_trans { | ||
60 | unsigned char mpc_type; | ||
61 | unsigned char trans_len; | ||
62 | unsigned char trans_type; | ||
63 | unsigned char trans_quad; | ||
64 | unsigned char trans_global; | ||
65 | unsigned char trans_local; | ||
66 | unsigned short trans_reserved; | ||
67 | }; | ||
68 | |||
69 | /* x86_quirks member */ | ||
70 | static int mpc_record; | ||
71 | |||
72 | static __cpuinitdata struct mpc_trans *translation_table[MAX_MPC_ENTRY]; | ||
73 | |||
74 | int mp_bus_id_to_node[MAX_MP_BUSSES]; | ||
75 | int mp_bus_id_to_local[MAX_MP_BUSSES]; | ||
76 | int quad_local_to_mp_bus_id[NR_CPUS/4][4]; | ||
77 | |||
38 | 78 | ||
39 | #define MB_TO_PAGES(addr) ((addr) << (20 - PAGE_SHIFT)) | 79 | static inline void numaq_register_node(int node, struct sys_cfg_data *scd) |
80 | { | ||
81 | struct eachquadmem *eq = scd->eq + node; | ||
82 | |||
83 | node_set_online(node); | ||
84 | |||
85 | /* Convert to pages */ | ||
86 | node_start_pfn[node] = | ||
87 | MB_TO_PAGES(eq->hi_shrd_mem_start - eq->priv_mem_size); | ||
88 | |||
89 | node_end_pfn[node] = | ||
90 | MB_TO_PAGES(eq->hi_shrd_mem_start + eq->hi_shrd_mem_size); | ||
91 | |||
92 | e820_register_active_regions(node, node_start_pfn[node], | ||
93 | node_end_pfn[node]); | ||
94 | |||
95 | memory_present(node, node_start_pfn[node], node_end_pfn[node]); | ||
96 | |||
97 | node_remap_size[node] = node_memmap_size_bytes(node, | ||
98 | node_start_pfn[node], | ||
99 | node_end_pfn[node]); | ||
100 | } | ||
40 | 101 | ||
41 | /* | 102 | /* |
42 | * Function: smp_dump_qct() | 103 | * Function: smp_dump_qct() |
@@ -46,34 +107,18 @@ | |||
46 | */ | 107 | */ |
47 | static void __init smp_dump_qct(void) | 108 | static void __init smp_dump_qct(void) |
48 | { | 109 | { |
110 | struct sys_cfg_data *scd; | ||
49 | int node; | 111 | int node; |
50 | struct eachquadmem *eq; | 112 | |
51 | struct sys_cfg_data *scd = | 113 | scd = (void *)__va(SYS_CFG_DATA_PRIV_ADDR); |
52 | (struct sys_cfg_data *)__va(SYS_CFG_DATA_PRIV_ADDR); | ||
53 | 114 | ||
54 | nodes_clear(node_online_map); | 115 | nodes_clear(node_online_map); |
55 | for_each_node(node) { | 116 | for_each_node(node) { |
56 | if (scd->quads_present31_0 & (1 << node)) { | 117 | if (scd->quads_present31_0 & (1 << node)) |
57 | node_set_online(node); | 118 | numaq_register_node(node, scd); |
58 | eq = &scd->eq[node]; | ||
59 | /* Convert to pages */ | ||
60 | node_start_pfn[node] = MB_TO_PAGES( | ||
61 | eq->hi_shrd_mem_start - eq->priv_mem_size); | ||
62 | node_end_pfn[node] = MB_TO_PAGES( | ||
63 | eq->hi_shrd_mem_start + eq->hi_shrd_mem_size); | ||
64 | |||
65 | e820_register_active_regions(node, node_start_pfn[node], | ||
66 | node_end_pfn[node]); | ||
67 | memory_present(node, | ||
68 | node_start_pfn[node], node_end_pfn[node]); | ||
69 | node_remap_size[node] = node_memmap_size_bytes(node, | ||
70 | node_start_pfn[node], | ||
71 | node_end_pfn[node]); | ||
72 | } | ||
73 | } | 119 | } |
74 | } | 120 | } |
75 | 121 | ||
76 | |||
77 | void __cpuinit numaq_tsc_disable(void) | 122 | void __cpuinit numaq_tsc_disable(void) |
78 | { | 123 | { |
79 | if (!found_numaq) | 124 | if (!found_numaq) |
@@ -91,28 +136,6 @@ static int __init numaq_pre_time_init(void) | |||
91 | return 0; | 136 | return 0; |
92 | } | 137 | } |
93 | 138 | ||
94 | int found_numaq; | ||
95 | |||
96 | /* | ||
97 | * Have to match translation table entries to main table entries by counter | ||
98 | * hence the mpc_record variable .... can't see a less disgusting way of | ||
99 | * doing this .... | ||
100 | */ | ||
101 | struct mpc_config_translation { | ||
102 | unsigned char mpc_type; | ||
103 | unsigned char trans_len; | ||
104 | unsigned char trans_type; | ||
105 | unsigned char trans_quad; | ||
106 | unsigned char trans_global; | ||
107 | unsigned char trans_local; | ||
108 | unsigned short trans_reserved; | ||
109 | }; | ||
110 | |||
111 | /* x86_quirks member */ | ||
112 | static int mpc_record; | ||
113 | static struct mpc_config_translation *translation_table[MAX_MPC_ENTRY] | ||
114 | __cpuinitdata; | ||
115 | |||
116 | static inline int generate_logical_apicid(int quad, int phys_apicid) | 139 | static inline int generate_logical_apicid(int quad, int phys_apicid) |
117 | { | 140 | { |
118 | return (quad << 4) + (phys_apicid ? phys_apicid << 1 : 1); | 141 | return (quad << 4) + (phys_apicid ? phys_apicid << 1 : 1); |
@@ -124,17 +147,15 @@ static int mpc_apic_id(struct mpc_cpu *m) | |||
124 | int quad = translation_table[mpc_record]->trans_quad; | 147 | int quad = translation_table[mpc_record]->trans_quad; |
125 | int logical_apicid = generate_logical_apicid(quad, m->apicid); | 148 | int logical_apicid = generate_logical_apicid(quad, m->apicid); |
126 | 149 | ||
127 | printk(KERN_DEBUG "Processor #%d %u:%u APIC version %d (quad %d, apic %d)\n", | 150 | printk(KERN_DEBUG |
128 | m->apicid, (m->cpufeature & CPU_FAMILY_MASK) >> 8, | 151 | "Processor #%d %u:%u APIC version %d (quad %d, apic %d)\n", |
129 | (m->cpufeature & CPU_MODEL_MASK) >> 4, | 152 | m->apicid, (m->cpufeature & CPU_FAMILY_MASK) >> 8, |
130 | m->apicver, quad, logical_apicid); | 153 | (m->cpufeature & CPU_MODEL_MASK) >> 4, |
154 | m->apicver, quad, logical_apicid); | ||
155 | |||
131 | return logical_apicid; | 156 | return logical_apicid; |
132 | } | 157 | } |
133 | 158 | ||
134 | int mp_bus_id_to_node[MAX_MP_BUSSES]; | ||
135 | |||
136 | int mp_bus_id_to_local[MAX_MP_BUSSES]; | ||
137 | |||
138 | /* x86_quirks member */ | 159 | /* x86_quirks member */ |
139 | static void mpc_oem_bus_info(struct mpc_bus *m, char *name) | 160 | static void mpc_oem_bus_info(struct mpc_bus *m, char *name) |
140 | { | 161 | { |
@@ -143,11 +164,9 @@ static void mpc_oem_bus_info(struct mpc_bus *m, char *name) | |||
143 | 164 | ||
144 | mp_bus_id_to_node[m->busid] = quad; | 165 | mp_bus_id_to_node[m->busid] = quad; |
145 | mp_bus_id_to_local[m->busid] = local; | 166 | mp_bus_id_to_local[m->busid] = local; |
146 | printk(KERN_INFO "Bus #%d is %s (node %d)\n", | ||
147 | m->busid, name, quad); | ||
148 | } | ||
149 | 167 | ||
150 | int quad_local_to_mp_bus_id [NR_CPUS/4][4]; | 168 | printk(KERN_INFO "Bus #%d is %s (node %d)\n", m->busid, name, quad); |
169 | } | ||
151 | 170 | ||
152 | /* x86_quirks member */ | 171 | /* x86_quirks member */ |
153 | static void mpc_oem_pci_bus(struct mpc_bus *m) | 172 | static void mpc_oem_pci_bus(struct mpc_bus *m) |
@@ -158,17 +177,18 @@ static void mpc_oem_pci_bus(struct mpc_bus *m) | |||
158 | quad_local_to_mp_bus_id[quad][local] = m->busid; | 177 | quad_local_to_mp_bus_id[quad][local] = m->busid; |
159 | } | 178 | } |
160 | 179 | ||
161 | static void __init MP_translation_info(struct mpc_config_translation *m) | 180 | static void __init MP_translation_info(struct mpc_trans *m) |
162 | { | 181 | { |
163 | printk(KERN_INFO | 182 | printk(KERN_INFO |
164 | "Translation: record %d, type %d, quad %d, global %d, local %d\n", | 183 | "Translation: record %d, type %d, quad %d, global %d, local %d\n", |
165 | mpc_record, m->trans_type, m->trans_quad, m->trans_global, | 184 | mpc_record, m->trans_type, m->trans_quad, m->trans_global, |
166 | m->trans_local); | 185 | m->trans_local); |
167 | 186 | ||
168 | if (mpc_record >= MAX_MPC_ENTRY) | 187 | if (mpc_record >= MAX_MPC_ENTRY) |
169 | printk(KERN_ERR "MAX_MPC_ENTRY exceeded!\n"); | 188 | printk(KERN_ERR "MAX_MPC_ENTRY exceeded!\n"); |
170 | else | 189 | else |
171 | translation_table[mpc_record] = m; /* stash this for later */ | 190 | translation_table[mpc_record] = m; /* stash this for later */ |
191 | |||
172 | if (m->trans_quad < MAX_NUMNODES && !node_online(m->trans_quad)) | 192 | if (m->trans_quad < MAX_NUMNODES && !node_online(m->trans_quad)) |
173 | node_set_online(m->trans_quad); | 193 | node_set_online(m->trans_quad); |
174 | } | 194 | } |
@@ -186,16 +206,16 @@ static int __init mpf_checksum(unsigned char *mp, int len) | |||
186 | /* | 206 | /* |
187 | * Read/parse the MPC oem tables | 207 | * Read/parse the MPC oem tables |
188 | */ | 208 | */ |
189 | 209 | static void __init | |
190 | static void __init smp_read_mpc_oem(struct mpc_oemtable *oemtable, | 210 | smp_read_mpc_oem(struct mpc_oemtable *oemtable, unsigned short oemsize) |
191 | unsigned short oemsize) | ||
192 | { | 211 | { |
193 | int count = sizeof(*oemtable); /* the header size */ | 212 | int count = sizeof(*oemtable); /* the header size */ |
194 | unsigned char *oemptr = ((unsigned char *)oemtable) + count; | 213 | unsigned char *oemptr = ((unsigned char *)oemtable) + count; |
195 | 214 | ||
196 | mpc_record = 0; | 215 | mpc_record = 0; |
197 | printk(KERN_INFO "Found an OEM MPC table at %8p - parsing it ... \n", | 216 | printk(KERN_INFO |
198 | oemtable); | 217 | "Found an OEM MPC table at %8p - parsing it ... \n", oemtable); |
218 | |||
199 | if (memcmp(oemtable->signature, MPC_OEM_SIGNATURE, 4)) { | 219 | if (memcmp(oemtable->signature, MPC_OEM_SIGNATURE, 4)) { |
200 | printk(KERN_WARNING | 220 | printk(KERN_WARNING |
201 | "SMP mpc oemtable: bad signature [%c%c%c%c]!\n", | 221 | "SMP mpc oemtable: bad signature [%c%c%c%c]!\n", |
@@ -203,16 +223,18 @@ static void __init smp_read_mpc_oem(struct mpc_oemtable *oemtable, | |||
203 | oemtable->signature[2], oemtable->signature[3]); | 223 | oemtable->signature[2], oemtable->signature[3]); |
204 | return; | 224 | return; |
205 | } | 225 | } |
226 | |||
206 | if (mpf_checksum((unsigned char *)oemtable, oemtable->length)) { | 227 | if (mpf_checksum((unsigned char *)oemtable, oemtable->length)) { |
207 | printk(KERN_WARNING "SMP oem mptable: checksum error!\n"); | 228 | printk(KERN_WARNING "SMP oem mptable: checksum error!\n"); |
208 | return; | 229 | return; |
209 | } | 230 | } |
231 | |||
210 | while (count < oemtable->length) { | 232 | while (count < oemtable->length) { |
211 | switch (*oemptr) { | 233 | switch (*oemptr) { |
212 | case MP_TRANSLATION: | 234 | case MP_TRANSLATION: |
213 | { | 235 | { |
214 | struct mpc_config_translation *m = | 236 | struct mpc_trans *m = (void *)oemptr; |
215 | (struct mpc_config_translation *)oemptr; | 237 | |
216 | MP_translation_info(m); | 238 | MP_translation_info(m); |
217 | oemptr += sizeof(*m); | 239 | oemptr += sizeof(*m); |
218 | count += sizeof(*m); | 240 | count += sizeof(*m); |
@@ -220,12 +242,10 @@ static void __init smp_read_mpc_oem(struct mpc_oemtable *oemtable, | |||
220 | break; | 242 | break; |
221 | } | 243 | } |
222 | default: | 244 | default: |
223 | { | 245 | printk(KERN_WARNING |
224 | printk(KERN_WARNING | 246 | "Unrecognised OEM table entry type! - %d\n", |
225 | "Unrecognised OEM table entry type! - %d\n", | 247 | (int)*oemptr); |
226 | (int)*oemptr); | 248 | return; |
227 | return; | ||
228 | } | ||
229 | } | 249 | } |
230 | } | 250 | } |
231 | } | 251 | } |
@@ -236,7 +256,7 @@ static int __init numaq_setup_ioapic_ids(void) | |||
236 | return 1; | 256 | return 1; |
237 | } | 257 | } |
238 | 258 | ||
239 | static int __init numaq_update_genapic(void) | 259 | static int __init numaq_update_apic(void) |
240 | { | 260 | { |
241 | apic->wakeup_cpu = wakeup_secondary_cpu_via_nmi; | 261 | apic->wakeup_cpu = wakeup_secondary_cpu_via_nmi; |
242 | 262 | ||
@@ -244,37 +264,30 @@ static int __init numaq_update_genapic(void) | |||
244 | } | 264 | } |
245 | 265 | ||
246 | static struct x86_quirks numaq_x86_quirks __initdata = { | 266 | static struct x86_quirks numaq_x86_quirks __initdata = { |
247 | .arch_pre_time_init = numaq_pre_time_init, | 267 | .arch_pre_time_init = numaq_pre_time_init, |
248 | .arch_time_init = NULL, | 268 | .arch_time_init = NULL, |
249 | .arch_pre_intr_init = NULL, | 269 | .arch_pre_intr_init = NULL, |
250 | .arch_memory_setup = NULL, | 270 | .arch_memory_setup = NULL, |
251 | .arch_intr_init = NULL, | 271 | .arch_intr_init = NULL, |
252 | .arch_trap_init = NULL, | 272 | .arch_trap_init = NULL, |
253 | .mach_get_smp_config = NULL, | 273 | .mach_get_smp_config = NULL, |
254 | .mach_find_smp_config = NULL, | 274 | .mach_find_smp_config = NULL, |
255 | .mpc_record = &mpc_record, | 275 | .mpc_record = &mpc_record, |
256 | .mpc_apic_id = mpc_apic_id, | 276 | .mpc_apic_id = mpc_apic_id, |
257 | .mpc_oem_bus_info = mpc_oem_bus_info, | 277 | .mpc_oem_bus_info = mpc_oem_bus_info, |
258 | .mpc_oem_pci_bus = mpc_oem_pci_bus, | 278 | .mpc_oem_pci_bus = mpc_oem_pci_bus, |
259 | .smp_read_mpc_oem = smp_read_mpc_oem, | 279 | .smp_read_mpc_oem = smp_read_mpc_oem, |
260 | .setup_ioapic_ids = numaq_setup_ioapic_ids, | 280 | .setup_ioapic_ids = numaq_setup_ioapic_ids, |
261 | .update_genapic = numaq_update_genapic, | 281 | .update_apic = numaq_update_apic, |
262 | }; | 282 | }; |
263 | 283 | ||
264 | void numaq_mps_oem_check(struct mpc_table *mpc, char *oem, char *productid) | ||
265 | { | ||
266 | if (strncmp(oem, "IBM NUMA", 8)) | ||
267 | printk("Warning! Not a NUMA-Q system!\n"); | ||
268 | else | ||
269 | found_numaq = 1; | ||
270 | } | ||
271 | |||
272 | static __init void early_check_numaq(void) | 284 | static __init void early_check_numaq(void) |
273 | { | 285 | { |
274 | /* | 286 | /* |
275 | * Find possible boot-time SMP configuration: | 287 | * Find possible boot-time SMP configuration: |
276 | */ | 288 | */ |
277 | early_find_smp_config(); | 289 | early_find_smp_config(); |
290 | |||
278 | /* | 291 | /* |
279 | * get boot-time SMP configuration: | 292 | * get boot-time SMP configuration: |
280 | */ | 293 | */ |
@@ -291,30 +304,10 @@ int __init get_memcfg_numaq(void) | |||
291 | if (!found_numaq) | 304 | if (!found_numaq) |
292 | return 0; | 305 | return 0; |
293 | smp_dump_qct(); | 306 | smp_dump_qct(); |
307 | |||
294 | return 1; | 308 | return 1; |
295 | } | 309 | } |
296 | 310 | ||
297 | /* | ||
298 | * APIC driver for the IBM NUMAQ chipset. | ||
299 | */ | ||
300 | #define APIC_DEFINITION 1 | ||
301 | #include <linux/threads.h> | ||
302 | #include <linux/cpumask.h> | ||
303 | #include <asm/mpspec.h> | ||
304 | #include <asm/genapic.h> | ||
305 | #include <asm/fixmap.h> | ||
306 | #include <asm/apicdef.h> | ||
307 | #include <asm/ipi.h> | ||
308 | #include <linux/kernel.h> | ||
309 | #include <linux/string.h> | ||
310 | #include <linux/init.h> | ||
311 | #include <linux/numa.h> | ||
312 | #include <linux/smp.h> | ||
313 | #include <asm/numaq.h> | ||
314 | #include <asm/io.h> | ||
315 | #include <linux/mmzone.h> | ||
316 | #include <linux/nodemask.h> | ||
317 | |||
318 | #define NUMAQ_APIC_DFR_VALUE (APIC_DFR_CLUSTER) | 311 | #define NUMAQ_APIC_DFR_VALUE (APIC_DFR_CLUSTER) |
319 | 312 | ||
320 | static inline unsigned int numaq_get_apic_id(unsigned long x) | 313 | static inline unsigned int numaq_get_apic_id(unsigned long x) |
@@ -337,10 +330,8 @@ static inline void numaq_send_IPI_all(int vector) | |||
337 | numaq_send_IPI_mask(cpu_online_mask, vector); | 330 | numaq_send_IPI_mask(cpu_online_mask, vector); |
338 | } | 331 | } |
339 | 332 | ||
340 | extern void numaq_mps_oem_check(struct mpc_table *, char *, char *); | 333 | #define NUMAQ_TRAMPOLINE_PHYS_LOW (0x8) |
341 | 334 | #define NUMAQ_TRAMPOLINE_PHYS_HIGH (0xa) | |
342 | #define NUMAQ_TRAMPOLINE_PHYS_LOW (0x8) | ||
343 | #define NUMAQ_TRAMPOLINE_PHYS_HIGH (0xa) | ||
344 | 335 | ||
345 | /* | 336 | /* |
346 | * Because we use NMIs rather than the INIT-STARTUP sequence to | 337 | * Because we use NMIs rather than the INIT-STARTUP sequence to |
@@ -351,16 +342,6 @@ static inline void numaq_smp_callin_clear_local_apic(void) | |||
351 | clear_local_APIC(); | 342 | clear_local_APIC(); |
352 | } | 343 | } |
353 | 344 | ||
354 | static inline void | ||
355 | numaq_store_NMI_vector(unsigned short *high, unsigned short *low) | ||
356 | { | ||
357 | printk("Storing NMI vector\n"); | ||
358 | *high = | ||
359 | *((volatile unsigned short *)phys_to_virt(NUMAQ_TRAMPOLINE_PHYS_HIGH)); | ||
360 | *low = | ||
361 | *((volatile unsigned short *)phys_to_virt(NUMAQ_TRAMPOLINE_PHYS_LOW)); | ||
362 | } | ||
363 | |||
364 | static inline const cpumask_t *numaq_target_cpus(void) | 345 | static inline const cpumask_t *numaq_target_cpus(void) |
365 | { | 346 | { |
366 | return &CPU_MASK_ALL; | 347 | return &CPU_MASK_ALL; |
@@ -377,8 +358,6 @@ static inline unsigned long numaq_check_apicid_present(int bit) | |||
377 | return physid_isset(bit, phys_cpu_present_map); | 358 | return physid_isset(bit, phys_cpu_present_map); |
378 | } | 359 | } |
379 | 360 | ||
380 | #define apicid_cluster(apicid) (apicid & 0xF0) | ||
381 | |||
382 | static inline int numaq_apic_id_registered(void) | 361 | static inline int numaq_apic_id_registered(void) |
383 | { | 362 | { |
384 | return 1; | 363 | return 1; |
@@ -391,8 +370,9 @@ static inline void numaq_init_apic_ldr(void) | |||
391 | 370 | ||
392 | static inline void numaq_setup_apic_routing(void) | 371 | static inline void numaq_setup_apic_routing(void) |
393 | { | 372 | { |
394 | printk("Enabling APIC mode: %s. Using %d I/O APICs\n", | 373 | printk(KERN_INFO |
395 | "NUMA-Q", nr_ioapics); | 374 | "Enabling APIC mode: NUMA-Q. Using %d I/O APICs\n", |
375 | nr_ioapics); | ||
396 | } | 376 | } |
397 | 377 | ||
398 | /* | 378 | /* |
@@ -410,14 +390,11 @@ static inline physid_mask_t numaq_ioapic_phys_id_map(physid_mask_t phys_map) | |||
410 | return physids_promote(0xFUL); | 390 | return physids_promote(0xFUL); |
411 | } | 391 | } |
412 | 392 | ||
413 | /* Mapping from cpu number to logical apicid */ | ||
414 | extern u8 cpu_2_logical_apicid[]; | ||
415 | |||
416 | static inline int numaq_cpu_to_logical_apicid(int cpu) | 393 | static inline int numaq_cpu_to_logical_apicid(int cpu) |
417 | { | 394 | { |
418 | if (cpu >= nr_cpu_ids) | 395 | if (cpu >= nr_cpu_ids) |
419 | return BAD_APICID; | 396 | return BAD_APICID; |
420 | return (int)cpu_2_logical_apicid[cpu]; | 397 | return cpu_2_logical_apicid[cpu]; |
421 | } | 398 | } |
422 | 399 | ||
423 | /* | 400 | /* |
@@ -433,7 +410,7 @@ static inline int numaq_cpu_present_to_apicid(int mps_cpu) | |||
433 | return BAD_APICID; | 410 | return BAD_APICID; |
434 | } | 411 | } |
435 | 412 | ||
436 | static inline int numaq_apicid_to_node(int logical_apicid) | 413 | static inline int numaq_apicid_to_node(int logical_apicid) |
437 | { | 414 | { |
438 | return logical_apicid >> 4; | 415 | return logical_apicid >> 4; |
439 | } | 416 | } |
@@ -475,9 +452,15 @@ static inline int numaq_phys_pkg_id(int cpuid_apic, int index_msb) | |||
475 | { | 452 | { |
476 | return cpuid_apic >> index_msb; | 453 | return cpuid_apic >> index_msb; |
477 | } | 454 | } |
478 | static int __numaq_mps_oem_check(struct mpc_table *mpc, char *oem, char *productid) | 455 | |
456 | static int | ||
457 | numaq_mps_oem_check(struct mpc_table *mpc, char *oem, char *productid) | ||
479 | { | 458 | { |
480 | numaq_mps_oem_check(mpc, oem, productid); | 459 | if (strncmp(oem, "IBM NUMA", 8)) |
460 | printk(KERN_ERR "Warning! Not a NUMA-Q system!\n"); | ||
461 | else | ||
462 | found_numaq = 1; | ||
463 | |||
481 | return found_numaq; | 464 | return found_numaq; |
482 | } | 465 | } |
483 | 466 | ||
@@ -507,13 +490,17 @@ static void numaq_setup_portio_remap(void) | |||
507 | if (num_quads <= 1) | 490 | if (num_quads <= 1) |
508 | return; | 491 | return; |
509 | 492 | ||
510 | printk("Remapping cross-quad port I/O for %d quads\n", num_quads); | 493 | printk(KERN_INFO |
494 | "Remapping cross-quad port I/O for %d quads\n", num_quads); | ||
495 | |||
511 | xquad_portio = ioremap(XQUAD_PORTIO_BASE, num_quads*XQUAD_PORTIO_QUAD); | 496 | xquad_portio = ioremap(XQUAD_PORTIO_BASE, num_quads*XQUAD_PORTIO_QUAD); |
512 | printk("xquad_portio vaddr 0x%08lx, len %08lx\n", | 497 | |
498 | printk(KERN_INFO | ||
499 | "xquad_portio vaddr 0x%08lx, len %08lx\n", | ||
513 | (u_long) xquad_portio, (u_long) num_quads*XQUAD_PORTIO_QUAD); | 500 | (u_long) xquad_portio, (u_long) num_quads*XQUAD_PORTIO_QUAD); |
514 | } | 501 | } |
515 | 502 | ||
516 | struct genapic apic_numaq = { | 503 | struct apic apic_numaq = { |
517 | 504 | ||
518 | .name = "NUMAQ", | 505 | .name = "NUMAQ", |
519 | .probe = probe_numaq, | 506 | .probe = probe_numaq, |
@@ -544,7 +531,7 @@ struct genapic apic_numaq = { | |||
544 | .check_phys_apicid_present = numaq_check_phys_apicid_present, | 531 | .check_phys_apicid_present = numaq_check_phys_apicid_present, |
545 | .enable_apic_mode = NULL, | 532 | .enable_apic_mode = NULL, |
546 | .phys_pkg_id = numaq_phys_pkg_id, | 533 | .phys_pkg_id = numaq_phys_pkg_id, |
547 | .mps_oem_check = __numaq_mps_oem_check, | 534 | .mps_oem_check = numaq_mps_oem_check, |
548 | 535 | ||
549 | .get_apic_id = numaq_get_apic_id, | 536 | .get_apic_id = numaq_get_apic_id, |
550 | .set_apic_id = NULL, | 537 | .set_apic_id = NULL, |
@@ -567,6 +554,12 @@ struct genapic apic_numaq = { | |||
567 | .wait_for_init_deassert = NULL, | 554 | .wait_for_init_deassert = NULL, |
568 | 555 | ||
569 | .smp_callin_clear_local_apic = numaq_smp_callin_clear_local_apic, | 556 | .smp_callin_clear_local_apic = numaq_smp_callin_clear_local_apic, |
570 | .store_NMI_vector = numaq_store_NMI_vector, | ||
571 | .inquire_remote_apic = NULL, | 557 | .inquire_remote_apic = NULL, |
558 | |||
559 | .read = native_apic_mem_read, | ||
560 | .write = native_apic_mem_write, | ||
561 | .icr_read = native_apic_icr_read, | ||
562 | .icr_write = native_apic_icr_write, | ||
563 | .wait_icr_idle = native_apic_wait_icr_idle, | ||
564 | .safe_wait_icr_idle = native_safe_apic_wait_icr_idle, | ||
572 | }; | 565 | }; |
diff --git a/arch/x86/kernel/olpc.c b/arch/x86/kernel/olpc.c index 7a13fac63a1f..4006c522adc7 100644 --- a/arch/x86/kernel/olpc.c +++ b/arch/x86/kernel/olpc.c | |||
@@ -203,7 +203,7 @@ static void __init platform_detect(void) | |||
203 | static void __init platform_detect(void) | 203 | static void __init platform_detect(void) |
204 | { | 204 | { |
205 | /* stopgap until OFW support is added to the kernel */ | 205 | /* stopgap until OFW support is added to the kernel */ |
206 | olpc_platform_info.boardrev = 0xc2; | 206 | olpc_platform_info.boardrev = olpc_board(0xc2); |
207 | } | 207 | } |
208 | #endif | 208 | #endif |
209 | 209 | ||
diff --git a/arch/x86/kernel/probe_32.c b/arch/x86/kernel/probe_32.c index 22337b75de62..5fa48332c5c8 100644 --- a/arch/x86/kernel/probe_32.c +++ b/arch/x86/kernel/probe_32.c | |||
@@ -8,6 +8,7 @@ | |||
8 | */ | 8 | */ |
9 | #include <linux/threads.h> | 9 | #include <linux/threads.h> |
10 | #include <linux/cpumask.h> | 10 | #include <linux/cpumask.h> |
11 | #include <linux/module.h> | ||
11 | #include <linux/string.h> | 12 | #include <linux/string.h> |
12 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
13 | #include <linux/ctype.h> | 14 | #include <linux/ctype.h> |
@@ -16,20 +17,18 @@ | |||
16 | #include <asm/fixmap.h> | 17 | #include <asm/fixmap.h> |
17 | #include <asm/mpspec.h> | 18 | #include <asm/mpspec.h> |
18 | #include <asm/apicdef.h> | 19 | #include <asm/apicdef.h> |
19 | #include <asm/genapic.h> | 20 | #include <asm/apic.h> |
20 | #include <asm/setup.h> | 21 | #include <asm/setup.h> |
21 | 22 | ||
22 | #include <linux/threads.h> | 23 | #include <linux/threads.h> |
23 | #include <linux/cpumask.h> | 24 | #include <linux/cpumask.h> |
24 | #include <asm/mpspec.h> | 25 | #include <asm/mpspec.h> |
25 | #include <asm/genapic.h> | ||
26 | #include <asm/fixmap.h> | 26 | #include <asm/fixmap.h> |
27 | #include <asm/apicdef.h> | 27 | #include <asm/apicdef.h> |
28 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
29 | #include <linux/string.h> | 29 | #include <linux/string.h> |
30 | #include <linux/smp.h> | 30 | #include <linux/smp.h> |
31 | #include <linux/init.h> | 31 | #include <linux/init.h> |
32 | #include <asm/genapic.h> | ||
33 | #include <asm/ipi.h> | 32 | #include <asm/ipi.h> |
34 | 33 | ||
35 | #include <linux/smp.h> | 34 | #include <linux/smp.h> |
@@ -40,8 +39,6 @@ | |||
40 | #include <asm/e820.h> | 39 | #include <asm/e820.h> |
41 | #include <asm/setup.h> | 40 | #include <asm/setup.h> |
42 | 41 | ||
43 | #include <asm/genapic.h> | ||
44 | |||
45 | #ifdef CONFIG_HOTPLUG_CPU | 42 | #ifdef CONFIG_HOTPLUG_CPU |
46 | #define DEFAULT_SEND_IPI (1) | 43 | #define DEFAULT_SEND_IPI (1) |
47 | #else | 44 | #else |
@@ -52,6 +49,15 @@ int no_broadcast = DEFAULT_SEND_IPI; | |||
52 | 49 | ||
53 | #ifdef CONFIG_X86_LOCAL_APIC | 50 | #ifdef CONFIG_X86_LOCAL_APIC |
54 | 51 | ||
52 | void default_setup_apic_routing(void) | ||
53 | { | ||
54 | #ifdef CONFIG_X86_IO_APIC | ||
55 | printk(KERN_INFO | ||
56 | "Enabling APIC mode: Flat. Using %d I/O APICs\n", | ||
57 | nr_ioapics); | ||
58 | #endif | ||
59 | } | ||
60 | |||
55 | static void default_vector_allocation_domain(int cpu, struct cpumask *retmask) | 61 | static void default_vector_allocation_domain(int cpu, struct cpumask *retmask) |
56 | { | 62 | { |
57 | /* | 63 | /* |
@@ -72,7 +78,7 @@ static int probe_default(void) | |||
72 | return 1; | 78 | return 1; |
73 | } | 79 | } |
74 | 80 | ||
75 | struct genapic apic_default = { | 81 | struct apic apic_default = { |
76 | 82 | ||
77 | .name = "default", | 83 | .name = "default", |
78 | .probe = probe_default, | 84 | .probe = probe_default, |
@@ -125,19 +131,26 @@ struct genapic apic_default = { | |||
125 | .wait_for_init_deassert = default_wait_for_init_deassert, | 131 | .wait_for_init_deassert = default_wait_for_init_deassert, |
126 | 132 | ||
127 | .smp_callin_clear_local_apic = NULL, | 133 | .smp_callin_clear_local_apic = NULL, |
128 | .store_NMI_vector = NULL, | ||
129 | .inquire_remote_apic = default_inquire_remote_apic, | 134 | .inquire_remote_apic = default_inquire_remote_apic, |
135 | |||
136 | .read = native_apic_mem_read, | ||
137 | .write = native_apic_mem_write, | ||
138 | .icr_read = native_apic_icr_read, | ||
139 | .icr_write = native_apic_icr_write, | ||
140 | .wait_icr_idle = native_apic_wait_icr_idle, | ||
141 | .safe_wait_icr_idle = native_safe_apic_wait_icr_idle, | ||
130 | }; | 142 | }; |
131 | 143 | ||
132 | extern struct genapic apic_numaq; | 144 | extern struct apic apic_numaq; |
133 | extern struct genapic apic_summit; | 145 | extern struct apic apic_summit; |
134 | extern struct genapic apic_bigsmp; | 146 | extern struct apic apic_bigsmp; |
135 | extern struct genapic apic_es7000; | 147 | extern struct apic apic_es7000; |
136 | extern struct genapic apic_default; | 148 | extern struct apic apic_default; |
137 | 149 | ||
138 | struct genapic *apic = &apic_default; | 150 | struct apic *apic = &apic_default; |
151 | EXPORT_SYMBOL_GPL(apic); | ||
139 | 152 | ||
140 | static struct genapic *apic_probe[] __initdata = { | 153 | static struct apic *apic_probe[] __initdata = { |
141 | #ifdef CONFIG_X86_NUMAQ | 154 | #ifdef CONFIG_X86_NUMAQ |
142 | &apic_numaq, | 155 | &apic_numaq, |
143 | #endif | 156 | #endif |
@@ -170,8 +183,8 @@ static int __init parse_apic(char *arg) | |||
170 | } | 183 | } |
171 | } | 184 | } |
172 | 185 | ||
173 | if (x86_quirks->update_genapic) | 186 | if (x86_quirks->update_apic) |
174 | x86_quirks->update_genapic(); | 187 | x86_quirks->update_apic(); |
175 | 188 | ||
176 | /* Parsed again by __setup for debug/verbose */ | 189 | /* Parsed again by __setup for debug/verbose */ |
177 | return 0; | 190 | return 0; |
@@ -191,8 +204,8 @@ void __init generic_bigsmp_probe(void) | |||
191 | if (!cmdline_apic && apic == &apic_default) { | 204 | if (!cmdline_apic && apic == &apic_default) { |
192 | if (apic_bigsmp.probe()) { | 205 | if (apic_bigsmp.probe()) { |
193 | apic = &apic_bigsmp; | 206 | apic = &apic_bigsmp; |
194 | if (x86_quirks->update_genapic) | 207 | if (x86_quirks->update_apic) |
195 | x86_quirks->update_genapic(); | 208 | x86_quirks->update_apic(); |
196 | printk(KERN_INFO "Overriding APIC driver with %s\n", | 209 | printk(KERN_INFO "Overriding APIC driver with %s\n", |
197 | apic->name); | 210 | apic->name); |
198 | } | 211 | } |
@@ -214,8 +227,8 @@ void __init generic_apic_probe(void) | |||
214 | if (!apic_probe[i]) | 227 | if (!apic_probe[i]) |
215 | panic("Didn't find an APIC driver"); | 228 | panic("Didn't find an APIC driver"); |
216 | 229 | ||
217 | if (x86_quirks->update_genapic) | 230 | if (x86_quirks->update_apic) |
218 | x86_quirks->update_genapic(); | 231 | x86_quirks->update_apic(); |
219 | } | 232 | } |
220 | printk(KERN_INFO "Using APIC driver %s\n", apic->name); | 233 | printk(KERN_INFO "Using APIC driver %s\n", apic->name); |
221 | } | 234 | } |
@@ -235,8 +248,8 @@ generic_mps_oem_check(struct mpc_table *mpc, char *oem, char *productid) | |||
235 | 248 | ||
236 | if (!cmdline_apic) { | 249 | if (!cmdline_apic) { |
237 | apic = apic_probe[i]; | 250 | apic = apic_probe[i]; |
238 | if (x86_quirks->update_genapic) | 251 | if (x86_quirks->update_apic) |
239 | x86_quirks->update_genapic(); | 252 | x86_quirks->update_apic(); |
240 | printk(KERN_INFO "Switched to APIC driver `%s'.\n", | 253 | printk(KERN_INFO "Switched to APIC driver `%s'.\n", |
241 | apic->name); | 254 | apic->name); |
242 | } | 255 | } |
@@ -257,8 +270,8 @@ int __init default_acpi_madt_oem_check(char *oem_id, char *oem_table_id) | |||
257 | 270 | ||
258 | if (!cmdline_apic) { | 271 | if (!cmdline_apic) { |
259 | apic = apic_probe[i]; | 272 | apic = apic_probe[i]; |
260 | if (x86_quirks->update_genapic) | 273 | if (x86_quirks->update_apic) |
261 | x86_quirks->update_genapic(); | 274 | x86_quirks->update_apic(); |
262 | printk(KERN_INFO "Switched to APIC driver `%s'.\n", | 275 | printk(KERN_INFO "Switched to APIC driver `%s'.\n", |
263 | apic->name); | 276 | apic->name); |
264 | } | 277 | } |
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c index 32e8f0af292c..1cc18d439bbb 100644 --- a/arch/x86/kernel/reboot.c +++ b/arch/x86/kernel/reboot.c | |||
@@ -24,8 +24,6 @@ | |||
24 | # include <asm/iommu.h> | 24 | # include <asm/iommu.h> |
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | #include <asm/genapic.h> | ||
28 | |||
29 | /* | 27 | /* |
30 | * Power off function, if any | 28 | * Power off function, if any |
31 | */ | 29 | */ |
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 8fce6c714514..6b588d6b3889 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
@@ -97,7 +97,6 @@ | |||
97 | #include <asm/mmu_context.h> | 97 | #include <asm/mmu_context.h> |
98 | #include <asm/proto.h> | 98 | #include <asm/proto.h> |
99 | 99 | ||
100 | #include <asm/genapic.h> | ||
101 | #include <asm/paravirt.h> | 100 | #include <asm/paravirt.h> |
102 | #include <asm/hypervisor.h> | 101 | #include <asm/hypervisor.h> |
103 | 102 | ||
@@ -600,7 +599,7 @@ static int __init setup_elfcorehdr(char *arg) | |||
600 | early_param("elfcorehdr", setup_elfcorehdr); | 599 | early_param("elfcorehdr", setup_elfcorehdr); |
601 | #endif | 600 | #endif |
602 | 601 | ||
603 | static int __init default_update_genapic(void) | 602 | static int __init default_update_apic(void) |
604 | { | 603 | { |
605 | #ifdef CONFIG_SMP | 604 | #ifdef CONFIG_SMP |
606 | if (!apic->wakeup_cpu) | 605 | if (!apic->wakeup_cpu) |
@@ -611,7 +610,7 @@ static int __init default_update_genapic(void) | |||
611 | } | 610 | } |
612 | 611 | ||
613 | static struct x86_quirks default_x86_quirks __initdata = { | 612 | static struct x86_quirks default_x86_quirks __initdata = { |
614 | .update_genapic = default_update_genapic, | 613 | .update_apic = default_update_apic, |
615 | }; | 614 | }; |
616 | 615 | ||
617 | struct x86_quirks *x86_quirks __initdata = &default_x86_quirks; | 616 | struct x86_quirks *x86_quirks __initdata = &default_x86_quirks; |
@@ -836,8 +835,7 @@ void __init setup_arch(char **cmdline_p) | |||
836 | #else | 835 | #else |
837 | num_physpages = max_pfn; | 836 | num_physpages = max_pfn; |
838 | 837 | ||
839 | if (cpu_has_x2apic) | 838 | check_x2apic(); |
840 | check_x2apic(); | ||
841 | 839 | ||
842 | /* How many end-of-memory variables you have, grandma! */ | 840 | /* How many end-of-memory variables you have, grandma! */ |
843 | /* need this before calling reserve_initrd */ | 841 | /* need this before calling reserve_initrd */ |
diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c index eaaffae31cc0..13f33ea8ccaa 100644 --- a/arch/x86/kernel/smp.c +++ b/arch/x86/kernel/smp.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include <asm/tlbflush.h> | 26 | #include <asm/tlbflush.h> |
27 | #include <asm/mmu_context.h> | 27 | #include <asm/mmu_context.h> |
28 | #include <asm/proto.h> | 28 | #include <asm/proto.h> |
29 | #include <asm/genapic.h> | 29 | #include <asm/apic.h> |
30 | /* | 30 | /* |
31 | * Some notes on x86 processor bugs affecting SMP operation: | 31 | * Some notes on x86 processor bugs affecting SMP operation: |
32 | * | 32 | * |
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index af57f88186e7..9ce666387f37 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -60,12 +60,11 @@ | |||
60 | #include <asm/tlbflush.h> | 60 | #include <asm/tlbflush.h> |
61 | #include <asm/mtrr.h> | 61 | #include <asm/mtrr.h> |
62 | #include <asm/vmi.h> | 62 | #include <asm/vmi.h> |
63 | #include <asm/genapic.h> | 63 | #include <asm/apic.h> |
64 | #include <asm/setup.h> | 64 | #include <asm/setup.h> |
65 | #include <asm/uv/uv.h> | 65 | #include <asm/uv/uv.h> |
66 | #include <linux/mc146818rtc.h> | 66 | #include <linux/mc146818rtc.h> |
67 | 67 | ||
68 | #include <asm/genapic.h> | ||
69 | #include <asm/smpboot_hooks.h> | 68 | #include <asm/smpboot_hooks.h> |
70 | 69 | ||
71 | #ifdef CONFIG_X86_32 | 70 | #ifdef CONFIG_X86_32 |
@@ -746,21 +745,21 @@ static void __cpuinit do_fork_idle(struct work_struct *work) | |||
746 | complete(&c_idle->done); | 745 | complete(&c_idle->done); |
747 | } | 746 | } |
748 | 747 | ||
749 | static int __cpuinit do_boot_cpu(int apicid, int cpu) | ||
750 | /* | 748 | /* |
751 | * NOTE - on most systems this is a PHYSICAL apic ID, but on multiquad | 749 | * NOTE - on most systems this is a PHYSICAL apic ID, but on multiquad |
752 | * (ie clustered apic addressing mode), this is a LOGICAL apic ID. | 750 | * (ie clustered apic addressing mode), this is a LOGICAL apic ID. |
753 | * Returns zero if CPU booted OK, else error code from ->wakeup_cpu. | 751 | * Returns zero if CPU booted OK, else error code from ->wakeup_cpu. |
754 | */ | 752 | */ |
753 | static int __cpuinit do_boot_cpu(int apicid, int cpu) | ||
755 | { | 754 | { |
756 | unsigned long boot_error = 0; | 755 | unsigned long boot_error = 0; |
757 | int timeout; | ||
758 | unsigned long start_ip; | 756 | unsigned long start_ip; |
759 | unsigned short nmi_high = 0, nmi_low = 0; | 757 | int timeout; |
760 | struct create_idle c_idle = { | 758 | struct create_idle c_idle = { |
761 | .cpu = cpu, | 759 | .cpu = cpu, |
762 | .done = COMPLETION_INITIALIZER_ONSTACK(c_idle.done), | 760 | .done = COMPLETION_INITIALIZER_ONSTACK(c_idle.done), |
763 | }; | 761 | }; |
762 | |||
764 | INIT_WORK(&c_idle.work, do_fork_idle); | 763 | INIT_WORK(&c_idle.work, do_fork_idle); |
765 | 764 | ||
766 | alternatives_smp_switch(1); | 765 | alternatives_smp_switch(1); |
@@ -825,9 +824,6 @@ do_rest: | |||
825 | 824 | ||
826 | pr_debug("Setting warm reset code and vector.\n"); | 825 | pr_debug("Setting warm reset code and vector.\n"); |
827 | 826 | ||
828 | if (apic->store_NMI_vector) | ||
829 | apic->store_NMI_vector(&nmi_high, &nmi_low); | ||
830 | |||
831 | smpboot_setup_warm_reset_vector(start_ip); | 827 | smpboot_setup_warm_reset_vector(start_ip); |
832 | /* | 828 | /* |
833 | * Be paranoid about clearing APIC errors. | 829 | * Be paranoid about clearing APIC errors. |
@@ -1128,8 +1124,8 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus) | |||
1128 | current_thread_info()->cpu = 0; /* needed? */ | 1124 | current_thread_info()->cpu = 0; /* needed? */ |
1129 | set_cpu_sibling_map(0); | 1125 | set_cpu_sibling_map(0); |
1130 | 1126 | ||
1131 | #ifdef CONFIG_X86_64 | ||
1132 | enable_IR_x2apic(); | 1127 | enable_IR_x2apic(); |
1128 | #ifdef CONFIG_X86_64 | ||
1133 | default_setup_apic_routing(); | 1129 | default_setup_apic_routing(); |
1134 | #endif | 1130 | #endif |
1135 | 1131 | ||
@@ -1154,13 +1150,12 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus) | |||
1154 | */ | 1150 | */ |
1155 | setup_local_APIC(); | 1151 | setup_local_APIC(); |
1156 | 1152 | ||
1157 | #ifdef CONFIG_X86_64 | ||
1158 | /* | 1153 | /* |
1159 | * Enable IO APIC before setting up error vector | 1154 | * Enable IO APIC before setting up error vector |
1160 | */ | 1155 | */ |
1161 | if (!skip_ioapic_setup && nr_ioapics) | 1156 | if (!skip_ioapic_setup && nr_ioapics) |
1162 | enable_IO_APIC(); | 1157 | enable_IO_APIC(); |
1163 | #endif | 1158 | |
1164 | end_local_APIC_setup(); | 1159 | end_local_APIC_setup(); |
1165 | 1160 | ||
1166 | map_cpu_to_logical_apicid(); | 1161 | map_cpu_to_logical_apicid(); |
diff --git a/arch/x86/kernel/summit_32.c b/arch/x86/kernel/summit_32.c index 1e733eff9b33..cfe7b09015d8 100644 --- a/arch/x86/kernel/summit_32.c +++ b/arch/x86/kernel/summit_32.c | |||
@@ -34,13 +34,11 @@ | |||
34 | /* | 34 | /* |
35 | * APIC driver for the IBM "Summit" chipset. | 35 | * APIC driver for the IBM "Summit" chipset. |
36 | */ | 36 | */ |
37 | #define APIC_DEFINITION 1 | ||
38 | #include <linux/threads.h> | 37 | #include <linux/threads.h> |
39 | #include <linux/cpumask.h> | 38 | #include <linux/cpumask.h> |
40 | #include <asm/mpspec.h> | 39 | #include <asm/mpspec.h> |
41 | #include <asm/apic.h> | 40 | #include <asm/apic.h> |
42 | #include <asm/smp.h> | 41 | #include <asm/smp.h> |
43 | #include <asm/genapic.h> | ||
44 | #include <asm/fixmap.h> | 42 | #include <asm/fixmap.h> |
45 | #include <asm/apicdef.h> | 43 | #include <asm/apicdef.h> |
46 | #include <asm/ipi.h> | 44 | #include <asm/ipi.h> |
@@ -209,16 +207,12 @@ static inline unsigned long summit_check_apicid_present(int bit) | |||
209 | return 1; | 207 | return 1; |
210 | } | 208 | } |
211 | 209 | ||
212 | #define apicid_cluster(apicid) ((apicid) & XAPIC_DEST_CLUSTER_MASK) | ||
213 | |||
214 | extern u8 cpu_2_logical_apicid[]; | ||
215 | |||
216 | static inline void summit_init_apic_ldr(void) | 210 | static inline void summit_init_apic_ldr(void) |
217 | { | 211 | { |
218 | unsigned long val, id; | 212 | unsigned long val, id; |
219 | int count = 0; | 213 | int count = 0; |
220 | u8 my_id = (u8)hard_smp_processor_id(); | 214 | u8 my_id = (u8)hard_smp_processor_id(); |
221 | u8 my_cluster = (u8)apicid_cluster(my_id); | 215 | u8 my_cluster = APIC_CLUSTER(my_id); |
222 | #ifdef CONFIG_SMP | 216 | #ifdef CONFIG_SMP |
223 | u8 lid; | 217 | u8 lid; |
224 | int i; | 218 | int i; |
@@ -226,7 +220,7 @@ static inline void summit_init_apic_ldr(void) | |||
226 | /* Create logical APIC IDs by counting CPUs already in cluster. */ | 220 | /* Create logical APIC IDs by counting CPUs already in cluster. */ |
227 | for (count = 0, i = nr_cpu_ids; --i >= 0; ) { | 221 | for (count = 0, i = nr_cpu_ids; --i >= 0; ) { |
228 | lid = cpu_2_logical_apicid[i]; | 222 | lid = cpu_2_logical_apicid[i]; |
229 | if (lid != BAD_APICID && apicid_cluster(lid) == my_cluster) | 223 | if (lid != BAD_APICID && APIC_CLUSTER(lid) == my_cluster) |
230 | ++count; | 224 | ++count; |
231 | } | 225 | } |
232 | #endif | 226 | #endif |
@@ -266,7 +260,7 @@ static inline int summit_cpu_to_logical_apicid(int cpu) | |||
266 | #ifdef CONFIG_SMP | 260 | #ifdef CONFIG_SMP |
267 | if (cpu >= nr_cpu_ids) | 261 | if (cpu >= nr_cpu_ids) |
268 | return BAD_APICID; | 262 | return BAD_APICID; |
269 | return (int)cpu_2_logical_apicid[cpu]; | 263 | return cpu_2_logical_apicid[cpu]; |
270 | #else | 264 | #else |
271 | return logical_smp_processor_id(); | 265 | return logical_smp_processor_id(); |
272 | #endif | 266 | #endif |
@@ -323,8 +317,7 @@ static inline unsigned int summit_cpu_mask_to_apicid(const cpumask_t *cpumask) | |||
323 | if (cpu_isset(cpu, *cpumask)) { | 317 | if (cpu_isset(cpu, *cpumask)) { |
324 | int new_apicid = summit_cpu_to_logical_apicid(cpu); | 318 | int new_apicid = summit_cpu_to_logical_apicid(cpu); |
325 | 319 | ||
326 | if (apicid_cluster(apicid) != | 320 | if (APIC_CLUSTER(apicid) != APIC_CLUSTER(new_apicid)) { |
327 | apicid_cluster(new_apicid)) { | ||
328 | printk ("%s: Not a valid mask!\n", __func__); | 321 | printk ("%s: Not a valid mask!\n", __func__); |
329 | 322 | ||
330 | return 0xFF; | 323 | return 0xFF; |
@@ -544,7 +537,7 @@ void __init setup_summit(void) | |||
544 | } | 537 | } |
545 | #endif | 538 | #endif |
546 | 539 | ||
547 | struct genapic apic_summit = { | 540 | struct apic apic_summit = { |
548 | 541 | ||
549 | .name = "summit", | 542 | .name = "summit", |
550 | .probe = probe_summit, | 543 | .probe = probe_summit, |
@@ -597,6 +590,12 @@ struct genapic apic_summit = { | |||
597 | .wait_for_init_deassert = default_wait_for_init_deassert, | 590 | .wait_for_init_deassert = default_wait_for_init_deassert, |
598 | 591 | ||
599 | .smp_callin_clear_local_apic = NULL, | 592 | .smp_callin_clear_local_apic = NULL, |
600 | .store_NMI_vector = NULL, | ||
601 | .inquire_remote_apic = default_inquire_remote_apic, | 593 | .inquire_remote_apic = default_inquire_remote_apic, |
594 | |||
595 | .read = native_apic_mem_read, | ||
596 | .write = native_apic_mem_write, | ||
597 | .icr_read = native_apic_icr_read, | ||
598 | .icr_write = native_apic_icr_write, | ||
599 | .wait_icr_idle = native_apic_wait_icr_idle, | ||
600 | .safe_wait_icr_idle = native_safe_apic_wait_icr_idle, | ||
602 | }; | 601 | }; |
diff --git a/arch/x86/kernel/tlb_uv.c b/arch/x86/kernel/tlb_uv.c index f396e61bcb34..f04549afcfe9 100644 --- a/arch/x86/kernel/tlb_uv.c +++ b/arch/x86/kernel/tlb_uv.c | |||
@@ -15,13 +15,11 @@ | |||
15 | #include <asm/uv/uv_mmrs.h> | 15 | #include <asm/uv/uv_mmrs.h> |
16 | #include <asm/uv/uv_hub.h> | 16 | #include <asm/uv/uv_hub.h> |
17 | #include <asm/uv/uv_bau.h> | 17 | #include <asm/uv/uv_bau.h> |
18 | #include <asm/genapic.h> | 18 | #include <asm/apic.h> |
19 | #include <asm/idle.h> | 19 | #include <asm/idle.h> |
20 | #include <asm/tsc.h> | 20 | #include <asm/tsc.h> |
21 | #include <asm/irq_vectors.h> | 21 | #include <asm/irq_vectors.h> |
22 | 22 | ||
23 | #include <asm/genapic.h> | ||
24 | |||
25 | static struct bau_control **uv_bau_table_bases __read_mostly; | 23 | static struct bau_control **uv_bau_table_bases __read_mostly; |
26 | static int uv_bau_retry_limit __read_mostly; | 24 | static int uv_bau_retry_limit __read_mostly; |
27 | 25 | ||
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c index 6cba7abf3518..c85a86cb7fb1 100644 --- a/arch/x86/kernel/traps.c +++ b/arch/x86/kernel/traps.c | |||
@@ -98,6 +98,12 @@ static inline void preempt_conditional_sti(struct pt_regs *regs) | |||
98 | local_irq_enable(); | 98 | local_irq_enable(); |
99 | } | 99 | } |
100 | 100 | ||
101 | static inline void conditional_cli(struct pt_regs *regs) | ||
102 | { | ||
103 | if (regs->flags & X86_EFLAGS_IF) | ||
104 | local_irq_disable(); | ||
105 | } | ||
106 | |||
101 | static inline void preempt_conditional_cli(struct pt_regs *regs) | 107 | static inline void preempt_conditional_cli(struct pt_regs *regs) |
102 | { | 108 | { |
103 | if (regs->flags & X86_EFLAGS_IF) | 109 | if (regs->flags & X86_EFLAGS_IF) |
@@ -625,8 +631,10 @@ clear_dr7: | |||
625 | 631 | ||
626 | #ifdef CONFIG_X86_32 | 632 | #ifdef CONFIG_X86_32 |
627 | debug_vm86: | 633 | debug_vm86: |
634 | /* reenable preemption: handle_vm86_trap() might sleep */ | ||
635 | dec_preempt_count(); | ||
628 | handle_vm86_trap((struct kernel_vm86_regs *) regs, error_code, 1); | 636 | handle_vm86_trap((struct kernel_vm86_regs *) regs, error_code, 1); |
629 | preempt_conditional_cli(regs); | 637 | conditional_cli(regs); |
630 | return; | 638 | return; |
631 | #endif | 639 | #endif |
632 | 640 | ||
diff --git a/arch/x86/kernel/visws_quirks.c b/arch/x86/kernel/visws_quirks.c index 4fd646e6dd43..34199d30ff46 100644 --- a/arch/x86/kernel/visws_quirks.c +++ b/arch/x86/kernel/visws_quirks.c | |||
@@ -29,13 +29,10 @@ | |||
29 | #include <asm/fixmap.h> | 29 | #include <asm/fixmap.h> |
30 | #include <asm/reboot.h> | 30 | #include <asm/reboot.h> |
31 | #include <asm/setup.h> | 31 | #include <asm/setup.h> |
32 | #include <asm/apic.h> | ||
32 | #include <asm/e820.h> | 33 | #include <asm/e820.h> |
33 | #include <asm/io.h> | 34 | #include <asm/io.h> |
34 | 35 | ||
35 | #include <asm/genapic.h> | ||
36 | |||
37 | #include <asm/genapic.h> | ||
38 | |||
39 | #include <linux/kernel_stat.h> | 36 | #include <linux/kernel_stat.h> |
40 | 37 | ||
41 | #include <asm/i8259.h> | 38 | #include <asm/i8259.h> |
@@ -49,8 +46,6 @@ | |||
49 | 46 | ||
50 | extern int no_broadcast; | 47 | extern int no_broadcast; |
51 | 48 | ||
52 | #include <asm/apic.h> | ||
53 | |||
54 | char visws_board_type = -1; | 49 | char visws_board_type = -1; |
55 | char visws_board_rev = -1; | 50 | char visws_board_rev = -1; |
56 | 51 | ||
diff --git a/arch/x86/kernel/vmi_32.c b/arch/x86/kernel/vmi_32.c index f052c84ecbe4..2cc4a90e2cb3 100644 --- a/arch/x86/kernel/vmi_32.c +++ b/arch/x86/kernel/vmi_32.c | |||
@@ -798,8 +798,8 @@ static inline int __init activate_vmi(void) | |||
798 | #endif | 798 | #endif |
799 | 799 | ||
800 | #ifdef CONFIG_X86_LOCAL_APIC | 800 | #ifdef CONFIG_X86_LOCAL_APIC |
801 | para_fill(apic_ops->read, APICRead); | 801 | para_fill(apic->read, APICRead); |
802 | para_fill(apic_ops->write, APICWrite); | 802 | para_fill(apic->write, APICWrite); |
803 | #endif | 803 | #endif |
804 | 804 | ||
805 | /* | 805 | /* |