[patch 12/23] x86/x2apic: Use state information for disable

From: Thomas Gleixner
Date: Thu Jan 15 2015 - 16:24:57 EST


Use the state information to simplify the disable logic further.

Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
---
arch/x86/kernel/apic/apic.c | 25 ++++++++++---------------
1 file changed, 10 insertions(+), 15 deletions(-)

Index: tip/arch/x86/kernel/apic/apic.c
===================================================================
--- tip.orig/arch/x86/kernel/apic/apic.c
+++ tip/arch/x86/kernel/apic/apic.c
@@ -1545,26 +1545,21 @@ void x2apic_setup(void)

static __init void x2apic_disable(void)
{
- u64 msr;
+ u32 x2apic_id;

- if (!cpu_has_x2apic)
- return;
+ if (x2apic_state != X2APIC_ON)
+ goto out;

- rdmsrl(MSR_IA32_APICBASE, msr);
- if (msr & X2APIC_ENABLE) {
- u32 x2apic_id = read_apic_id();
+ x2apic_id = read_apic_id();
+ if (x2apic_id >= 255)
+ panic("Cannot disable x2apic, id: %08x\n", x2apic_id);

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

+out:
x2apic_state = X2APIC_DISABLED;
+ x2apic_mode = 0;
}

static __init void x2apic_enable(void)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/