diff options
author | Ravikiran G Thirumalai <kiran@scalex86.org> | 2008-03-20 03:41:16 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-04-17 11:41:08 -0400 |
commit | aa7d8e25eca5deb33eb08013bc78a80514349b40 (patch) | |
tree | 71075bf2c7103641377e5e182102cf8350797f8b | |
parent | 3250c91ada16a06de5afef55bce7b766c894d75c (diff) |
x86: fix build breakage when PCI is define and PARAVIRT is not
- Fix the the build breakage when PARAVIRT is defined
but PCI is not
This fixes problem reported at:
http://marc.info/?l=linux-kernel&m=120525966600698&w=2
- Make is_vsmp_box() available even when PARAVIRT is not defined.
This is needed to determine if tsc's are reliable as a time source
even when PARAVIRT is not defined.
- split vsmp_init to use is_vsmp_box() and set_vsmp_pv_ops()
set_vsmp_pv_ops will do nothing if PCI is not enabled in the config.
Signed-off-by: Ravikiran Thirumalai <kiran@scalex86.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | arch/x86/kernel/Makefile | 2 | ||||
-rw-r--r-- | arch/x86/kernel/setup_64.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/vsmp_64.c | 72 | ||||
-rw-r--r-- | include/asm-x86/apic.h | 7 |
4 files changed, 46 insertions, 37 deletions
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile index d5a05a0cef62..1fe841a86f7e 100644 --- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile | |||
@@ -60,7 +60,7 @@ obj-$(CONFIG_KEXEC) += relocate_kernel_$(BITS).o crash.o | |||
60 | obj-$(CONFIG_CRASH_DUMP) += crash_dump_$(BITS).o | 60 | obj-$(CONFIG_CRASH_DUMP) += crash_dump_$(BITS).o |
61 | obj-$(CONFIG_X86_NUMAQ) += numaq_32.o | 61 | obj-$(CONFIG_X86_NUMAQ) += numaq_32.o |
62 | obj-$(CONFIG_X86_SUMMIT_NUMA) += summit_32.o | 62 | obj-$(CONFIG_X86_SUMMIT_NUMA) += summit_32.o |
63 | obj-$(CONFIG_PARAVIRT) += vsmp_64.o | 63 | obj-y += vsmp_64.o |
64 | obj-$(CONFIG_KPROBES) += kprobes.o | 64 | obj-$(CONFIG_KPROBES) += kprobes.o |
65 | obj-$(CONFIG_MODULES) += module_$(BITS).o | 65 | obj-$(CONFIG_MODULES) += module_$(BITS).o |
66 | obj-$(CONFIG_ACPI_SRAT) += srat_32.o | 66 | obj-$(CONFIG_ACPI_SRAT) += srat_32.o |
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c index 990724143c43..20034493b5ad 100644 --- a/arch/x86/kernel/setup_64.c +++ b/arch/x86/kernel/setup_64.c | |||
@@ -351,9 +351,7 @@ void __init setup_arch(char **cmdline_p) | |||
351 | if (efi_enabled) | 351 | if (efi_enabled) |
352 | efi_init(); | 352 | efi_init(); |
353 | 353 | ||
354 | #ifdef CONFIG_PARAVIRT | ||
355 | vsmp_init(); | 354 | vsmp_init(); |
356 | #endif | ||
357 | 355 | ||
358 | dmi_scan_machine(); | 356 | dmi_scan_machine(); |
359 | 357 | ||
diff --git a/arch/x86/kernel/vsmp_64.c b/arch/x86/kernel/vsmp_64.c index eb25584c54c3..4a790a5f61b7 100644 --- a/arch/x86/kernel/vsmp_64.c +++ b/arch/x86/kernel/vsmp_64.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <asm/io.h> | 19 | #include <asm/io.h> |
20 | #include <asm/paravirt.h> | 20 | #include <asm/paravirt.h> |
21 | 21 | ||
22 | #if defined CONFIG_PCI && defined CONFIG_PARAVIRT | ||
22 | /* | 23 | /* |
23 | * Interrupt control on vSMPowered systems: | 24 | * Interrupt control on vSMPowered systems: |
24 | * ~AC is a shadow of IF. If IF is 'on' AC should be 'off' | 25 | * ~AC is a shadow of IF. If IF is 'on' AC should be 'off' |
@@ -72,39 +73,11 @@ static unsigned __init vsmp_patch(u8 type, u16 clobbers, void *ibuf, | |||
72 | 73 | ||
73 | } | 74 | } |
74 | 75 | ||
75 | static int vsmp = -1; | 76 | static void __init set_vsmp_pv_ops(void) |
76 | |||
77 | int is_vsmp_box(void) | ||
78 | { | ||
79 | if (vsmp != -1) | ||
80 | return vsmp; | ||
81 | |||
82 | vsmp = 0; | ||
83 | if (!early_pci_allowed()) | ||
84 | return vsmp; | ||
85 | |||
86 | /* Check if we are running on a ScaleMP vSMP box */ | ||
87 | if ((read_pci_config_16(0, 0x1f, 0, PCI_VENDOR_ID) == | ||
88 | PCI_VENDOR_ID_SCALEMP) && | ||
89 | (read_pci_config_16(0, 0x1f, 0, PCI_DEVICE_ID) == | ||
90 | PCI_DEVICE_ID_SCALEMP_VSMP_CTL)) | ||
91 | vsmp = 1; | ||
92 | |||
93 | return vsmp; | ||
94 | } | ||
95 | |||
96 | void __init vsmp_init(void) | ||
97 | { | 77 | { |
98 | void *address; | 78 | void *address; |
99 | unsigned int cap, ctl, cfg; | 79 | unsigned int cap, ctl, cfg; |
100 | 80 | ||
101 | if (!is_vsmp_box()) | ||
102 | return; | ||
103 | |||
104 | if (!early_pci_allowed()) | ||
105 | return; | ||
106 | |||
107 | /* If we are, use the distinguished irq functions */ | ||
108 | pv_irq_ops.irq_disable = vsmp_irq_disable; | 81 | pv_irq_ops.irq_disable = vsmp_irq_disable; |
109 | pv_irq_ops.irq_enable = vsmp_irq_enable; | 82 | pv_irq_ops.irq_enable = vsmp_irq_enable; |
110 | pv_irq_ops.save_fl = vsmp_save_fl; | 83 | pv_irq_ops.save_fl = vsmp_save_fl; |
@@ -127,5 +100,46 @@ void __init vsmp_init(void) | |||
127 | } | 100 | } |
128 | 101 | ||
129 | early_iounmap(address, 8); | 102 | early_iounmap(address, 8); |
103 | } | ||
104 | #else | ||
105 | static void __init set_vsmp_pv_ops(void) | ||
106 | { | ||
107 | } | ||
108 | #endif | ||
109 | |||
110 | #ifdef CONFIG_PCI | ||
111 | static int vsmp = -1; | ||
112 | |||
113 | int is_vsmp_box(void) | ||
114 | { | ||
115 | if (vsmp != -1) | ||
116 | return vsmp; | ||
117 | |||
118 | vsmp = 0; | ||
119 | if (!early_pci_allowed()) | ||
120 | return vsmp; | ||
121 | |||
122 | /* Check if we are running on a ScaleMP vSMP box */ | ||
123 | if ((read_pci_config_16(0, 0x1f, 0, PCI_VENDOR_ID) == | ||
124 | PCI_VENDOR_ID_SCALEMP) && | ||
125 | (read_pci_config_16(0, 0x1f, 0, PCI_DEVICE_ID) == | ||
126 | PCI_DEVICE_ID_SCALEMP_VSMP_CTL)) | ||
127 | vsmp = 1; | ||
128 | |||
129 | return vsmp; | ||
130 | } | ||
131 | #else | ||
132 | int is_vsmp_box(void) | ||
133 | { | ||
134 | return 0; | ||
135 | } | ||
136 | #endif | ||
137 | |||
138 | void __init vsmp_init(void) | ||
139 | { | ||
140 | if (!is_vsmp_box()) | ||
141 | return; | ||
142 | |||
143 | set_vsmp_pv_ops(); | ||
130 | return; | 144 | return; |
131 | } | 145 | } |
diff --git a/include/asm-x86/apic.h b/include/asm-x86/apic.h index b804238489a1..b11d6524fb13 100644 --- a/include/asm-x86/apic.h +++ b/include/asm-x86/apic.h | |||
@@ -50,19 +50,16 @@ extern int disable_apic_timer; | |||
50 | */ | 50 | */ |
51 | #ifdef CONFIG_PARAVIRT | 51 | #ifdef CONFIG_PARAVIRT |
52 | #include <asm/paravirt.h> | 52 | #include <asm/paravirt.h> |
53 | extern int is_vsmp_box(void); | ||
54 | #else | 53 | #else |
55 | #define apic_write native_apic_write | 54 | #define apic_write native_apic_write |
56 | #define apic_write_atomic native_apic_write_atomic | 55 | #define apic_write_atomic native_apic_write_atomic |
57 | #define apic_read native_apic_read | 56 | #define apic_read native_apic_read |
58 | #define setup_boot_clock setup_boot_APIC_clock | 57 | #define setup_boot_clock setup_boot_APIC_clock |
59 | #define setup_secondary_clock setup_secondary_APIC_clock | 58 | #define setup_secondary_clock setup_secondary_APIC_clock |
60 | static int inline is_vsmp_box(void) | ||
61 | { | ||
62 | return 0; | ||
63 | } | ||
64 | #endif | 59 | #endif |
65 | 60 | ||
61 | extern int is_vsmp_box(void); | ||
62 | |||
66 | static inline void native_apic_write(unsigned long reg, u32 v) | 63 | static inline void native_apic_write(unsigned long reg, u32 v) |
67 | { | 64 | { |
68 | *((volatile u32 *)(APIC_BASE + reg)) = v; | 65 | *((volatile u32 *)(APIC_BASE + reg)) = v; |