Skip to content

Commit

Permalink
x86/x2apic: Use state information for disable
Browse files Browse the repository at this point in the history
Use the state information to simplify the disable logic further.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Borislav Petkov <bp@alien8.de>
Cc: Jiang Liu <jiang.liu@linux.intel.com>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Tony Luck <tony.luck@intel.com>
Link: http://lkml.kernel.org/r/20150115211703.209387598@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
KAGA-KOKO committed Jan 22, 2015
1 parent 659006b commit 6d2d49d
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions arch/x86/kernel/apic/apic.c
Original file line number Diff line number Diff line change
Expand Up @@ -1547,26 +1547,20 @@ void x2apic_setup(void)

static __init void x2apic_disable(void)
{
u64 msr;

if (!cpu_has_x2apic)
return;

rdmsrl(MSR_IA32_APICBASE, msr);
if (msr & X2APIC_ENABLE) {
u32 x2apic_id = read_apic_id();
u32 x2apic_id;

if (x2apic_id >= 255)
panic("Cannot disable x2apic, id: %08x\n", x2apic_id);
if (x2apic_state != X2APIC_ON)
goto out;

__x2apic_disable();

x2apic_mode = 0;

register_lapic_address(mp_lapic_addr);
}
x2apic_id = read_apic_id();
if (x2apic_id >= 255)
panic("Cannot disable x2apic, id: %08x\n", x2apic_id);

__x2apic_disable();
register_lapic_address(mp_lapic_addr);
out:
x2apic_state = X2APIC_DISABLED;
x2apic_mode = 0;
}

static __init void x2apic_enable(void)
Expand Down

0 comments on commit 6d2d49d

Please sign in to comment.