aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2011-02-25 10:09:31 -0500
committerThomas Gleixner <tglx@linutronix.de>2011-02-25 10:18:52 -0500
commita906fdaacca49917d83e5032dfc31f694249ad10 (patch)
tree6b00061e1db64f5f2767c129b666ee25487fd59e /arch/x86/kernel
parent4a66b1d95ad8baf6ab884a1c64461449b463eb78 (diff)
x86: dt: Cleanup local apic setup
Up to now we force enable the local apic in the devicetree setup uncoditionally and set smp_found_config unconditionally to 1 when a devicetree blob is available. This breaks, when local apic is disabled in the Kconfig. Make it consistent by initializing device tree explicitely before smp_get_config() so a non lapic configuration could be used as well. To be functional that would require to implement PIT as an interrupt host, but the only user of this code until now is ce4100 which requires apics to be available. So we leave this up to those who need it. Tested-by: Sebastian Siewior <bigeasy@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r--arch/x86/kernel/apic/apic.c6
-rw-r--r--arch/x86/kernel/devicetree.c40
-rw-r--r--arch/x86/kernel/setup.c2
3 files changed, 24 insertions, 24 deletions
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index f0e079823c43..4f43312cfbf8 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -1563,7 +1563,7 @@ static int apic_verify(void)
1563 return 0; 1563 return 0;
1564} 1564}
1565 1565
1566int apic_force_enable(void) 1566int apic_force_enable(unsigned long addr)
1567{ 1567{
1568 u32 h, l; 1568 u32 h, l;
1569 1569
@@ -1579,7 +1579,7 @@ int apic_force_enable(void)
1579 if (!(l & MSR_IA32_APICBASE_ENABLE)) { 1579 if (!(l & MSR_IA32_APICBASE_ENABLE)) {
1580 pr_info("Local APIC disabled by BIOS -- reenabling.\n"); 1580 pr_info("Local APIC disabled by BIOS -- reenabling.\n");
1581 l &= ~MSR_IA32_APICBASE_BASE; 1581 l &= ~MSR_IA32_APICBASE_BASE;
1582 l |= MSR_IA32_APICBASE_ENABLE | APIC_DEFAULT_PHYS_BASE; 1582 l |= MSR_IA32_APICBASE_ENABLE | addr;
1583 wrmsr(MSR_IA32_APICBASE, l, h); 1583 wrmsr(MSR_IA32_APICBASE, l, h);
1584 enabled_via_apicbase = 1; 1584 enabled_via_apicbase = 1;
1585 } 1585 }
@@ -1620,7 +1620,7 @@ static int __init detect_init_APIC(void)
1620 "you can enable it with \"lapic\"\n"); 1620 "you can enable it with \"lapic\"\n");
1621 return -1; 1621 return -1;
1622 } 1622 }
1623 if (apic_force_enable()) 1623 if (apic_force_enable(APIC_DEFAULT_PHYS_BASE))
1624 return -1; 1624 return -1;
1625 } else { 1625 } else {
1626 if (apic_verify()) 1626 if (apic_verify())
diff --git a/arch/x86/kernel/devicetree.c b/arch/x86/kernel/devicetree.c
index 06e5e91939c5..7a8cebc9ff29 100644
--- a/arch/x86/kernel/devicetree.c
+++ b/arch/x86/kernel/devicetree.c
@@ -26,6 +26,7 @@ static DEFINE_RAW_SPINLOCK(big_irq_lock);
26 26
27int __initdata of_ioapic; 27int __initdata of_ioapic;
28 28
29#ifdef CONFIG_X86_IO_APIC
29static void add_interrupt_host(struct irq_domain *ih) 30static void add_interrupt_host(struct irq_domain *ih)
30{ 31{
31 unsigned long flags; 32 unsigned long flags;
@@ -34,6 +35,7 @@ static void add_interrupt_host(struct irq_domain *ih)
34 list_add(&ih->l, &irq_domains); 35 list_add(&ih->l, &irq_domains);
35 raw_spin_unlock_irqrestore(&big_irq_lock, flags); 36 raw_spin_unlock_irqrestore(&big_irq_lock, flags);
36} 37}
38#endif
37 39
38static struct irq_domain *get_ih_from_node(struct device_node *controller) 40static struct irq_domain *get_ih_from_node(struct device_node *controller)
39{ 41{
@@ -223,18 +225,28 @@ static void __init dtb_setup_hpet(void)
223static void __init dtb_lapic_setup(void) 225static void __init dtb_lapic_setup(void)
224{ 226{
225#ifdef CONFIG_X86_LOCAL_APIC 227#ifdef CONFIG_X86_LOCAL_APIC
226 if (apic_force_enable()) 228 struct device_node *dn;
229 struct resource r;
230 int ret;
231
232 dn = of_find_compatible_node(NULL, NULL, "intel,ce4100-lapic");
233 if (!dn)
234 return;
235
236 ret = of_address_to_resource(dn, 0, &r);
237 if (WARN_ON(ret))
227 return; 238 return;
228 239
240 /* Did the boot loader setup the local APIC ? */
241 if (!cpu_has_apic) {
242 if (apic_force_enable(r.start))
243 return;
244 }
229 smp_found_config = 1; 245 smp_found_config = 1;
230 pic_mode = 1; 246 pic_mode = 1;
231 /* Required for ioapic registration */ 247 register_lapic_address(r.start);
232 set_fixmap_nocache(FIX_APIC_BASE, mp_lapic_addr);
233 if (boot_cpu_physical_apicid == -1U)
234 boot_cpu_physical_apicid = read_apic_id();
235
236 generic_processor_info(boot_cpu_physical_apicid, 248 generic_processor_info(boot_cpu_physical_apicid,
237 GET_APIC_VERSION(apic_read(APIC_LVR))); 249 GET_APIC_VERSION(apic_read(APIC_LVR)));
238#endif 250#endif
239} 251}
240 252
@@ -259,9 +271,6 @@ static void __init dtb_ioapic_setup(void)
259{ 271{
260 struct device_node *dn; 272 struct device_node *dn;
261 273
262 if (!smp_found_config)
263 return;
264
265 for_each_compatible_node(dn, NULL, "intel,ce4100-ioapic") 274 for_each_compatible_node(dn, NULL, "intel,ce4100-ioapic")
266 dtb_add_ioapic(dn); 275 dtb_add_ioapic(dn);
267 276
@@ -270,7 +279,6 @@ static void __init dtb_ioapic_setup(void)
270 return; 279 return;
271 } 280 }
272 printk(KERN_ERR "Error: No information about IO-APIC in OF.\n"); 281 printk(KERN_ERR "Error: No information about IO-APIC in OF.\n");
273 smp_found_config = 0;
274} 282}
275#else 283#else
276static void __init dtb_ioapic_setup(void) {} 284static void __init dtb_ioapic_setup(void) {}
@@ -282,14 +290,6 @@ static void __init dtb_apic_setup(void)
282 dtb_ioapic_setup(); 290 dtb_ioapic_setup();
283} 291}
284 292
285void __init x86_dtb_find_config(void)
286{
287 if (initial_dtb)
288 smp_found_config = 1;
289 else
290 printk(KERN_ERR "Missing device tree!.\n");
291}
292
293#ifdef CONFIG_OF_FLATTREE 293#ifdef CONFIG_OF_FLATTREE
294static void __init x86_flattree_get_config(void) 294static void __init x86_flattree_get_config(void)
295{ 295{
@@ -325,7 +325,7 @@ static void __init x86_flattree_get_config(void)
325static inline void x86_flattree_get_config(void) { } 325static inline void x86_flattree_get_config(void) { }
326#endif 326#endif
327 327
328void __init x86_dtb_get_config(unsigned int unused) 328void __init x86_dtb_init(void)
329{ 329{
330 x86_flattree_get_config(); 330 x86_flattree_get_config();
331 331
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 33dcbce1ab0f..b3143bc74e6c 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -1044,8 +1044,8 @@ void __init setup_arch(char **cmdline_p)
1044 * Read APIC and some other early information from ACPI tables. 1044 * Read APIC and some other early information from ACPI tables.
1045 */ 1045 */
1046 acpi_boot_init(); 1046 acpi_boot_init();
1047
1048 sfi_init(); 1047 sfi_init();
1048 x86_dtb_init();
1049 1049
1050 /* 1050 /*
1051 * get boot-time SMP configuration: 1051 * get boot-time SMP configuration: