summaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/apic
diff options
context:
space:
mode:
authorThomas Gleixner2015-01-15 22:22:27 +0100
committerThomas Gleixner2015-01-22 15:10:55 +0100
commit6d2d49d2cd0199ce298d111ee7fd405af3344a70 (patch)
treeaf046d12b29257c249ed86b7a90a2be7ae831bd6 /arch/x86/kernel/apic
parentx86/x2apic: Split enable and setup function (diff)
downloadkernel-qcow2-linux-6d2d49d2cd0199ce298d111ee7fd405af3344a70.tar.gz
kernel-qcow2-linux-6d2d49d2cd0199ce298d111ee7fd405af3344a70.tar.xz
kernel-qcow2-linux-6d2d49d2cd0199ce298d111ee7fd405af3344a70.zip
x86/x2apic: Use state information for disable
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>
Diffstat (limited to 'arch/x86/kernel/apic')
-rw-r--r--arch/x86/kernel/apic/apic.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 0ee96b9fe4e6..0c554f5d03a6 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -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)