lkml.org 
[lkml]   [2015]   [Jan]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch 12/23] 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>
---
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)



\
 
 \ /
  Last update: 2015-01-15 22:41    [W:1.030 / U:0.260 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site