x86/apic: Clear stale x2apic mode
x86/apic: Clear stale x2apic mode

If x2apic got disabled on the kernel command line, then the following
issue can happen:

enable_IR_x2apic()
   ....
   x2apic_mode = 1;
   enable_x2apic();

     if (x2apic_disabled) {
	__disable_x2apic();
	return;
     }

That leaves X2APIC disabled in hardware, but x2apic_mode stays 1. So
all other code which checks x2apic_mode gets the wrong information.

Set x2apic_mode to 0 after disabling it in hardware.

This is just a hotfix. The proper solution is to rework this code so
it has seperate functions for the initial setup on the boot processor
and the secondary cpus, but that's beyond the scope of this fix.

Signed-off-by: Thomas Gleixner <00e4cf8f46a57000a44449bf9dd8cbbcc209fd2a@linutronix.de>
Cc: Jiang Liu <68ee766e574f18b34b683085865827393efe88bd@linux.intel.com>
Cc: Tony Luck <e7984595ec0368ff920a7b3521dc7093683f6f26@intel.com>
Cc: d4d3187dbcba3fb2e2e25a4ce499c8e441b6817d@lists.linux-foundation.org
Cc: H. Peter Anvin <8a453bad9912ffe59bc0f0b8abe03df9be19379e@linux.intel.com>
Cc: Joerg Roedel <4688a6871ff025801033b3c4b039d55a29f8f937@8bytes.org>
Cc: Benjamin Herrenschmidt <a7089bb6e7e92505d88aaff006cbdd60cc9120b6@kernel.crashing.org>
Cc: Yinghai Lu <0674548f4d596393408a51d6287a76ebba2f42aa@kernel.org>
Cc: Borislav Petkov <0691a664b24b6f15b20cd5aee64b72271db08be1@alien8.de>
Cc: David Rientjes <d8cd2994e15bc61ddb2b113030bda55eebc3a0fe@google.com>
Cc: HATAYAMA Daisuke <e293c7e13ecc029aa287dca4b8ecfdf8a10ea3b9@jp.fujitsu.com>
Cc: Jan Beulich <051346888327db48cce19d2cfd0e1c700bb7cf16@suse.com>
Cc: Richard Weinberger <320bca71fc381a4a025636043ca86e734e31cf8b@nod.at>
Cc: Oren Twaig <86e82526d0ff2908f3d9c305629c4fafaa5fe794@scalemp.com>

KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs