@@ -1541,14 +1541,6 @@ static __init void disable_x2apic(void)
1541
1541
x2apic_disabled = 1 ;
1542
1542
}
1543
1543
1544
- void check_x2apic (void )
1545
- {
1546
- if (x2apic_enabled ()) {
1547
- pr_info ("x2apic enabled by BIOS, switching to x2apic ops\n" );
1548
- x2apic_mode = 1 ;
1549
- }
1550
- }
1551
-
1552
1544
void enable_x2apic (void )
1553
1545
{
1554
1546
u64 msr ;
@@ -1568,7 +1560,26 @@ void enable_x2apic(void)
1568
1560
wrmsrl (MSR_IA32_APICBASE , msr | X2APIC_ENABLE );
1569
1561
}
1570
1562
}
1571
- #endif /* CONFIG_X86_X2APIC */
1563
+
1564
+ void __init check_x2apic (void )
1565
+ {
1566
+ if (x2apic_enabled ()) {
1567
+ pr_info ("x2apic enabled by BIOS, switching to x2apic ops\n" );
1568
+ x2apic_mode = 1 ;
1569
+ }
1570
+ }
1571
+ #else /* CONFIG_X86_X2APIC */
1572
+ static int __init validate_x2apic (void )
1573
+ {
1574
+ if (!apic_is_x2apic_enabled ())
1575
+ return 0 ;
1576
+ /*
1577
+ * Checkme: Can we simply turn off x2apic here instead of panic?
1578
+ */
1579
+ panic ("BIOS has enabled x2apic but kernel doesn't support x2apic, please disable x2apic in BIOS.\n" );
1580
+ }
1581
+ early_initcall (validate_x2apic );
1582
+ #endif /* !CONFIG_X86_X2APIC */
1572
1583
1573
1584
static int __init try_to_enable_IR (void )
1574
1585
{
@@ -1620,11 +1631,6 @@ void __init enable_IR_x2apic(void)
1620
1631
unsigned long flags ;
1621
1632
int ret , ir_stat ;
1622
1633
1623
- if (!IS_ENABLED (CONFIG_X86_X2APIC )) {
1624
- if (apic_is_x2apic_enabled ())
1625
- panic ("BIOS has enabled x2apic but kernel doesn't support x2apic, please disable x2apic in BIOS.\n" );
1626
- }
1627
-
1628
1634
ir_stat = irq_remapping_prepare ();
1629
1635
if (ir_stat < 0 && !x2apic_supported ())
1630
1636
return ;
0 commit comments