diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-02-28 13:59:18 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-02-28 13:59:18 -0500 |
commit | c7e15899d07c9813c1aa96b21699d2d9c8314c4b (patch) | |
tree | 16e9b4dceddf1b4d1dad05588d700c70cf8fcb88 /arch | |
parent | f6a0b5cd34d6e922cc7258c5429fb0f17508ceb6 (diff) | |
parent | 78c06176466cbd1b3f0f67709d3023c40dbebcbd (diff) |
Merge branch 'x86-pci-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'x86-pci-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
x86: Enable NMI on all cpus on UV
vgaarb: Add user selectability of the number of GPUS in a system
vgaarb: Fix VGA arbiter to accept PCI domains other than 0
x86, uv: Update UV arch to target Legacy VGA I/O correctly.
pci: Update pci_set_vga_state() to call arch functions
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/include/asm/uv/bios.h | 4 | ||||
-rw-r--r-- | arch/x86/include/asm/uv/uv.h | 1 | ||||
-rw-r--r-- | arch/x86/include/asm/x86_init.h | 2 | ||||
-rw-r--r-- | arch/x86/kernel/apic/x2apic_uv_x.c | 74 | ||||
-rw-r--r-- | arch/x86/kernel/bios_uv.c | 19 | ||||
-rw-r--r-- | arch/x86/kernel/smpboot.c | 1 | ||||
-rw-r--r-- | arch/x86/kernel/x86_init.c | 3 |
7 files changed, 103 insertions, 1 deletions
diff --git a/arch/x86/include/asm/uv/bios.h b/arch/x86/include/asm/uv/bios.h index 2751f3075d8b..163427597d03 100644 --- a/arch/x86/include/asm/uv/bios.h +++ b/arch/x86/include/asm/uv/bios.h | |||
@@ -36,7 +36,8 @@ enum uv_bios_cmd { | |||
36 | UV_BIOS_WATCHLIST_ALLOC, | 36 | UV_BIOS_WATCHLIST_ALLOC, |
37 | UV_BIOS_WATCHLIST_FREE, | 37 | UV_BIOS_WATCHLIST_FREE, |
38 | UV_BIOS_MEMPROTECT, | 38 | UV_BIOS_MEMPROTECT, |
39 | UV_BIOS_GET_PARTITION_ADDR | 39 | UV_BIOS_GET_PARTITION_ADDR, |
40 | UV_BIOS_SET_LEGACY_VGA_TARGET | ||
40 | }; | 41 | }; |
41 | 42 | ||
42 | /* | 43 | /* |
@@ -96,6 +97,7 @@ extern int uv_bios_mq_watchlist_alloc(unsigned long, unsigned int, | |||
96 | extern int uv_bios_mq_watchlist_free(int, int); | 97 | extern int uv_bios_mq_watchlist_free(int, int); |
97 | extern s64 uv_bios_change_memprotect(u64, u64, enum uv_memprotect); | 98 | extern s64 uv_bios_change_memprotect(u64, u64, enum uv_memprotect); |
98 | extern s64 uv_bios_reserved_page_pa(u64, u64 *, u64 *, u64 *); | 99 | extern s64 uv_bios_reserved_page_pa(u64, u64 *, u64 *, u64 *); |
100 | extern int uv_bios_set_legacy_vga_target(bool decode, int domain, int bus); | ||
99 | 101 | ||
100 | extern void uv_bios_init(void); | 102 | extern void uv_bios_init(void); |
101 | 103 | ||
diff --git a/arch/x86/include/asm/uv/uv.h b/arch/x86/include/asm/uv/uv.h index c0a01b5d985b..3bb9491b7659 100644 --- a/arch/x86/include/asm/uv/uv.h +++ b/arch/x86/include/asm/uv/uv.h | |||
@@ -11,6 +11,7 @@ struct mm_struct; | |||
11 | extern enum uv_system_type get_uv_system_type(void); | 11 | extern enum uv_system_type get_uv_system_type(void); |
12 | extern int is_uv_system(void); | 12 | extern int is_uv_system(void); |
13 | extern void uv_cpu_init(void); | 13 | extern void uv_cpu_init(void); |
14 | extern void uv_nmi_init(void); | ||
14 | extern void uv_system_init(void); | 15 | extern void uv_system_init(void); |
15 | extern const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask, | 16 | extern const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask, |
16 | struct mm_struct *mm, | 17 | struct mm_struct *mm, |
diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_init.h index ea0e8ea15e15..60cc35269083 100644 --- a/arch/x86/include/asm/x86_init.h +++ b/arch/x86/include/asm/x86_init.h | |||
@@ -126,6 +126,7 @@ struct x86_cpuinit_ops { | |||
126 | * @get_wallclock: get time from HW clock like RTC etc. | 126 | * @get_wallclock: get time from HW clock like RTC etc. |
127 | * @set_wallclock: set time back to HW clock | 127 | * @set_wallclock: set time back to HW clock |
128 | * @is_untracked_pat_range exclude from PAT logic | 128 | * @is_untracked_pat_range exclude from PAT logic |
129 | * @nmi_init enable NMI on cpus | ||
129 | */ | 130 | */ |
130 | struct x86_platform_ops { | 131 | struct x86_platform_ops { |
131 | unsigned long (*calibrate_tsc)(void); | 132 | unsigned long (*calibrate_tsc)(void); |
@@ -133,6 +134,7 @@ struct x86_platform_ops { | |||
133 | int (*set_wallclock)(unsigned long nowtime); | 134 | int (*set_wallclock)(unsigned long nowtime); |
134 | void (*iommu_shutdown)(void); | 135 | void (*iommu_shutdown)(void); |
135 | bool (*is_untracked_pat_range)(u64 start, u64 end); | 136 | bool (*is_untracked_pat_range)(u64 start, u64 end); |
137 | void (*nmi_init)(void); | ||
136 | }; | 138 | }; |
137 | 139 | ||
138 | extern struct x86_init_ops x86_init; | 140 | extern struct x86_init_ops x86_init; |
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c index 21db3cbea7dc..4b8dbb256147 100644 --- a/arch/x86/kernel/apic/x2apic_uv_x.c +++ b/arch/x86/kernel/apic/x2apic_uv_x.c | |||
@@ -20,6 +20,8 @@ | |||
20 | #include <linux/cpu.h> | 20 | #include <linux/cpu.h> |
21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
22 | #include <linux/io.h> | 22 | #include <linux/io.h> |
23 | #include <linux/pci.h> | ||
24 | #include <linux/kdebug.h> | ||
23 | 25 | ||
24 | #include <asm/uv/uv_mmrs.h> | 26 | #include <asm/uv/uv_mmrs.h> |
25 | #include <asm/uv/uv_hub.h> | 27 | #include <asm/uv/uv_hub.h> |
@@ -34,10 +36,13 @@ | |||
34 | 36 | ||
35 | DEFINE_PER_CPU(int, x2apic_extra_bits); | 37 | DEFINE_PER_CPU(int, x2apic_extra_bits); |
36 | 38 | ||
39 | #define PR_DEVEL(fmt, args...) pr_devel("%s: " fmt, __func__, args) | ||
40 | |||
37 | static enum uv_system_type uv_system_type; | 41 | static enum uv_system_type uv_system_type; |
38 | static u64 gru_start_paddr, gru_end_paddr; | 42 | static u64 gru_start_paddr, gru_end_paddr; |
39 | int uv_min_hub_revision_id; | 43 | int uv_min_hub_revision_id; |
40 | EXPORT_SYMBOL_GPL(uv_min_hub_revision_id); | 44 | EXPORT_SYMBOL_GPL(uv_min_hub_revision_id); |
45 | static DEFINE_SPINLOCK(uv_nmi_lock); | ||
41 | 46 | ||
42 | static inline bool is_GRU_range(u64 start, u64 end) | 47 | static inline bool is_GRU_range(u64 start, u64 end) |
43 | { | 48 | { |
@@ -71,6 +76,7 @@ static int __init uv_acpi_madt_oem_check(char *oem_id, char *oem_table_id) | |||
71 | if (!strcmp(oem_id, "SGI")) { | 76 | if (!strcmp(oem_id, "SGI")) { |
72 | nodeid = early_get_nodeid(); | 77 | nodeid = early_get_nodeid(); |
73 | x86_platform.is_untracked_pat_range = uv_is_untracked_pat_range; | 78 | x86_platform.is_untracked_pat_range = uv_is_untracked_pat_range; |
79 | x86_platform.nmi_init = uv_nmi_init; | ||
74 | if (!strcmp(oem_table_id, "UVL")) | 80 | if (!strcmp(oem_table_id, "UVL")) |
75 | uv_system_type = UV_LEGACY_APIC; | 81 | uv_system_type = UV_LEGACY_APIC; |
76 | else if (!strcmp(oem_table_id, "UVX")) | 82 | else if (!strcmp(oem_table_id, "UVX")) |
@@ -553,6 +559,30 @@ late_initcall(uv_init_heartbeat); | |||
553 | 559 | ||
554 | #endif /* !CONFIG_HOTPLUG_CPU */ | 560 | #endif /* !CONFIG_HOTPLUG_CPU */ |
555 | 561 | ||
562 | /* Direct Legacy VGA I/O traffic to designated IOH */ | ||
563 | int uv_set_vga_state(struct pci_dev *pdev, bool decode, | ||
564 | unsigned int command_bits, bool change_bridge) | ||
565 | { | ||
566 | int domain, bus, rc; | ||
567 | |||
568 | PR_DEVEL("devfn %x decode %d cmd %x chg_brdg %d\n", | ||
569 | pdev->devfn, decode, command_bits, change_bridge); | ||
570 | |||
571 | if (!change_bridge) | ||
572 | return 0; | ||
573 | |||
574 | if ((command_bits & PCI_COMMAND_IO) == 0) | ||
575 | return 0; | ||
576 | |||
577 | domain = pci_domain_nr(pdev->bus); | ||
578 | bus = pdev->bus->number; | ||
579 | |||
580 | rc = uv_bios_set_legacy_vga_target(decode, domain, bus); | ||
581 | PR_DEVEL("vga decode %d %x:%x, rc: %d\n", decode, domain, bus, rc); | ||
582 | |||
583 | return rc; | ||
584 | } | ||
585 | |||
556 | /* | 586 | /* |
557 | * Called on each cpu to initialize the per_cpu UV data area. | 587 | * Called on each cpu to initialize the per_cpu UV data area. |
558 | * FIXME: hotplug not supported yet | 588 | * FIXME: hotplug not supported yet |
@@ -569,6 +599,46 @@ void __cpuinit uv_cpu_init(void) | |||
569 | set_x2apic_extra_bits(uv_hub_info->pnode); | 599 | set_x2apic_extra_bits(uv_hub_info->pnode); |
570 | } | 600 | } |
571 | 601 | ||
602 | /* | ||
603 | * When NMI is received, print a stack trace. | ||
604 | */ | ||
605 | int uv_handle_nmi(struct notifier_block *self, unsigned long reason, void *data) | ||
606 | { | ||
607 | if (reason != DIE_NMI_IPI) | ||
608 | return NOTIFY_OK; | ||
609 | /* | ||
610 | * Use a lock so only one cpu prints at a time | ||
611 | * to prevent intermixed output. | ||
612 | */ | ||
613 | spin_lock(&uv_nmi_lock); | ||
614 | pr_info("NMI stack dump cpu %u:\n", smp_processor_id()); | ||
615 | dump_stack(); | ||
616 | spin_unlock(&uv_nmi_lock); | ||
617 | |||
618 | return NOTIFY_STOP; | ||
619 | } | ||
620 | |||
621 | static struct notifier_block uv_dump_stack_nmi_nb = { | ||
622 | .notifier_call = uv_handle_nmi | ||
623 | }; | ||
624 | |||
625 | void uv_register_nmi_notifier(void) | ||
626 | { | ||
627 | if (register_die_notifier(&uv_dump_stack_nmi_nb)) | ||
628 | printk(KERN_WARNING "UV NMI handler failed to register\n"); | ||
629 | } | ||
630 | |||
631 | void uv_nmi_init(void) | ||
632 | { | ||
633 | unsigned int value; | ||
634 | |||
635 | /* | ||
636 | * Unmask NMI on all cpus | ||
637 | */ | ||
638 | value = apic_read(APIC_LVT1) | APIC_DM_NMI; | ||
639 | value &= ~APIC_LVT_MASKED; | ||
640 | apic_write(APIC_LVT1, value); | ||
641 | } | ||
572 | 642 | ||
573 | void __init uv_system_init(void) | 643 | void __init uv_system_init(void) |
574 | { | 644 | { |
@@ -690,5 +760,9 @@ void __init uv_system_init(void) | |||
690 | 760 | ||
691 | uv_cpu_init(); | 761 | uv_cpu_init(); |
692 | uv_scir_register_cpu_notifier(); | 762 | uv_scir_register_cpu_notifier(); |
763 | uv_register_nmi_notifier(); | ||
693 | proc_mkdir("sgi_uv", NULL); | 764 | proc_mkdir("sgi_uv", NULL); |
765 | |||
766 | /* register Legacy VGA I/O redirection handler */ | ||
767 | pci_register_set_vga_state(uv_set_vga_state); | ||
694 | } | 768 | } |
diff --git a/arch/x86/kernel/bios_uv.c b/arch/x86/kernel/bios_uv.c index b0206a211b09..575127a6e352 100644 --- a/arch/x86/kernel/bios_uv.c +++ b/arch/x86/kernel/bios_uv.c | |||
@@ -154,6 +154,25 @@ s64 uv_bios_freq_base(u64 clock_type, u64 *ticks_per_second) | |||
154 | } | 154 | } |
155 | EXPORT_SYMBOL_GPL(uv_bios_freq_base); | 155 | EXPORT_SYMBOL_GPL(uv_bios_freq_base); |
156 | 156 | ||
157 | /* | ||
158 | * uv_bios_set_legacy_vga_target - Set Legacy VGA I/O Target | ||
159 | * @decode: true to enable target, false to disable target | ||
160 | * @domain: PCI domain number | ||
161 | * @bus: PCI bus number | ||
162 | * | ||
163 | * Returns: | ||
164 | * 0: Success | ||
165 | * -EINVAL: Invalid domain or bus number | ||
166 | * -ENOSYS: Capability not available | ||
167 | * -EBUSY: Legacy VGA I/O cannot be retargeted at this time | ||
168 | */ | ||
169 | int uv_bios_set_legacy_vga_target(bool decode, int domain, int bus) | ||
170 | { | ||
171 | return uv_bios_call(UV_BIOS_SET_LEGACY_VGA_TARGET, | ||
172 | (u64)decode, (u64)domain, (u64)bus, 0, 0); | ||
173 | } | ||
174 | EXPORT_SYMBOL_GPL(uv_bios_set_legacy_vga_target); | ||
175 | |||
157 | 176 | ||
158 | #ifdef CONFIG_EFI | 177 | #ifdef CONFIG_EFI |
159 | void uv_bios_init(void) | 178 | void uv_bios_init(void) |
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index b4e870cbdc60..9b4401115ea1 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -320,6 +320,7 @@ notrace static void __cpuinit start_secondary(void *unused) | |||
320 | unlock_vector_lock(); | 320 | unlock_vector_lock(); |
321 | ipi_call_unlock(); | 321 | ipi_call_unlock(); |
322 | per_cpu(cpu_state, smp_processor_id()) = CPU_ONLINE; | 322 | per_cpu(cpu_state, smp_processor_id()) = CPU_ONLINE; |
323 | x86_platform.nmi_init(); | ||
323 | 324 | ||
324 | /* enable local interrupts */ | 325 | /* enable local interrupts */ |
325 | local_irq_enable(); | 326 | local_irq_enable(); |
diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c index ccd179dec36e..ee5746c94628 100644 --- a/arch/x86/kernel/x86_init.c +++ b/arch/x86/kernel/x86_init.c | |||
@@ -76,10 +76,13 @@ struct x86_cpuinit_ops x86_cpuinit __cpuinitdata = { | |||
76 | .setup_percpu_clockev = setup_secondary_APIC_clock, | 76 | .setup_percpu_clockev = setup_secondary_APIC_clock, |
77 | }; | 77 | }; |
78 | 78 | ||
79 | static void default_nmi_init(void) { }; | ||
80 | |||
79 | struct x86_platform_ops x86_platform = { | 81 | struct x86_platform_ops x86_platform = { |
80 | .calibrate_tsc = native_calibrate_tsc, | 82 | .calibrate_tsc = native_calibrate_tsc, |
81 | .get_wallclock = mach_get_cmos_time, | 83 | .get_wallclock = mach_get_cmos_time, |
82 | .set_wallclock = mach_set_rtc_mmss, | 84 | .set_wallclock = mach_set_rtc_mmss, |
83 | .iommu_shutdown = iommu_shutdown_noop, | 85 | .iommu_shutdown = iommu_shutdown_noop, |
84 | .is_untracked_pat_range = is_ISA_range, | 86 | .is_untracked_pat_range = is_ISA_range, |
87 | .nmi_init = default_nmi_init | ||
85 | }; | 88 | }; |