From: Andy Lutomirski Date: Mon, 9 Oct 2017 04:53:05 +0000 (-0700) Subject: x86/mm/64: Fix reboot interaction with CR4.PCIDE X-Git-Tag: v3.2.98~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=add19752eb782379610a01ea0d8cfce83cf071b0;p=thirdparty%2Fkernel%2Fstable.git x86/mm/64: Fix reboot interaction with CR4.PCIDE commit 924c6b900cfdf376b07bccfd80e62b21914f8a5a upstream. Trying to reboot via real mode fails with PCID on: long mode cannot be exited while CR4.PCIDE is set. (No, I have no idea why, but the SDM and actual CPUs are in agreement here.) The result is a GPF and a hang instead of a reboot. I didn't catch this in testing because neither my computer nor my VM reboots this way. I can trigger it with reboot=bios, though. Fixes: 660da7c9228f ("x86/mm: Enable CR4.PCIDE on supported systems") Reported-and-tested-by: Steven Rostedt (VMware) Signed-off-by: Andy Lutomirski Signed-off-by: Thomas Gleixner Cc: Borislav Petkov Link: https://lkml.kernel.org/r/f1e7d965998018450a7a70c2823873686a8b21c0.1507524746.git.luto@kernel.org Signed-off-by: Hugh Dickins Signed-off-by: Ben Hutchings --- diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c index a34bdddeca854..04da0bf5c314b 100644 --- a/arch/x86/kernel/reboot.c +++ b/arch/x86/kernel/reboot.c @@ -357,6 +357,12 @@ void machine_real_restart(unsigned int type) lowmem_gdt[1] = GDT_ENTRY(0x009b, restart_pa, 0xffff); +#ifdef CONFIG_X86_64 + /* Exiting long mode will fail if CR4.PCIDE is set. */ + if (static_cpu_has(X86_FEATURE_PCID)) + clear_in_cr4(X86_CR4_PCIDE); +#endif + /* Jump to the identity-mapped low memory code */ restart_lowmem(type); }