void __init check_x2apic_preenabled(void) { u32 lo, hi; if ( !cpu_has_x2apic ) return; /* Check whether x2apic mode was already enabled by the BIOS. */ rdmsr(MSR_IA32_APICBASE, lo, hi); if ( lo & MSR_IA32_APICBASE_EXTD ) { printk("x2APIC mode is already enabled by BIOS.\n"); #ifndef __i386__ x2apic_enabled = 1; genapic = apic_x2apic_probe(); #else lo &= ~(MSR_IA32_APICBASE_ENABLE | MSR_IA32_APICBASE_EXTD); wrmsr(MSR_IA32_APICBASE, lo, hi); lo |= MSR_IA32_APICBASE_ENABLE; wrmsr(MSR_IA32_APICBASE, lo, hi); printk("x2APIC disabled permanently on x86_32.\n"); #endif } #ifdef __i386__ clear_bit(X86_FEATURE_X2APIC, boot_cpu_data.x86_capability); #endif }
void __init check_x2apic_preenabled(void) { u32 lo, hi; if ( !cpu_has_x2apic ) return; /* Check whether x2apic mode was already enabled by the BIOS. */ rdmsr(MSR_IA32_APICBASE, lo, hi); if ( lo & MSR_IA32_APICBASE_EXTD ) { printk("x2APIC mode is already enabled by BIOS.\n"); x2apic_enabled = 1; genapic = apic_x2apic_probe(); } }
void __init x2apic_bsp_setup(void) { struct IO_APIC_route_entry **ioapic_entries = NULL; if ( !cpu_has_x2apic ) return; if ( !opt_x2apic ) { if ( !x2apic_enabled ) { printk("Not enabling x2APIC: disabled by cmdline.\n"); return; } printk("x2APIC: Already enabled by BIOS: Ignoring cmdline disable.\n"); } if ( !iommu_supports_eim() ) { if ( !x2apic_enabled ) { printk("Not enabling x2APIC: depends on iommu_supports_eim.\n"); return; } panic("x2APIC: already enabled by BIOS, but " "iommu_supports_eim failed!\n"); } if ( (ioapic_entries = alloc_ioapic_entries()) == NULL ) { printk("Allocate ioapic_entries failed\n"); goto out; } if ( save_IO_APIC_setup(ioapic_entries) ) { printk("Saving IO-APIC state failed\n"); goto out; } mask_8259A(); mask_IO_APIC_setup(ioapic_entries); if ( iommu_enable_x2apic_IR() ) { if ( x2apic_enabled ) panic("Interrupt remapping could not be enabled while " "x2APIC is already enabled by BIOS!\n"); printk(XENLOG_ERR "Failed to enable Interrupt Remapping: Will not enable x2APIC.\n"); goto restore_out; } force_iommu = 1; genapic = apic_x2apic_probe(); printk("Switched to APIC driver %s.\n", genapic->name); if ( !x2apic_enabled ) { x2apic_enabled = 1; __enable_x2apic(); } restore_out: restore_IO_APIC_setup(ioapic_entries); unmask_8259A(); out: if ( ioapic_entries ) free_ioapic_entries(ioapic_entries); }