x86/boot/compressed/64: Set EFER.LME=1 in 32-bit trampoline before returning to long...
authorWei Huang <wei@redhat.com>
Fri, 4 Jan 2019 05:44:11 +0000 (23:44 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Mar 2019 21:02:31 +0000 (14:02 -0700)
commit15fb5d73e47e89171a38962a23cc39c213e40500
tree6c1c5f0ebf620a63ce8657e731230c7bd584e1a3
parentbd13a72a537af1ddf2ae744df8a9193e64f18495
x86/boot/compressed/64: Set EFER.LME=1 in 32-bit trampoline before returning to long mode

[ Upstream commit b677dfae5aa197afc5191755a76a8727ffca538a ]

In some old AMD KVM implementation, guest's EFER.LME bit is cleared by KVM
when the hypervsior detects that the guest sets CR0.PG to 0. This causes
the guest OS to reboot when it tries to return from 32-bit trampoline code
because the CPU is in incorrect state: CR4.PAE=1, CR0.PG=1, CS.L=1, but
EFER.LME=0.  As a precaution, set EFER.LME=1 as part of long mode
activation procedure. This extra step won't cause any harm when Linux is
booted on a bare-metal machine.

Signed-off-by: Wei Huang <wei@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: bp@alien8.de
Cc: hpa@zytor.com
Link: https://lkml.kernel.org/r/20190104054411.12489-1-wei@redhat.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/x86/boot/compressed/head_64.S
arch/x86/boot/compressed/pgtable.h