x86/mm: Factor out CR3-building code
authorAndy Lutomirski <luto@kernel.org>
Sun, 17 Sep 2017 16:03:48 +0000 (09:03 -0700)
committerIngo Molnar <mingo@kernel.org>
Sun, 17 Sep 2017 16:59:08 +0000 (18:59 +0200)
commit47061a24e2ee5bd8a40d473d47a5bd823fa0081f
treed147d513c17c141d9a3028d00bdc575a168cc659
parent0666f560b71b899cd11a7caf39fd45129e9030fd
x86/mm: Factor out CR3-building code

Current, the code that assembles a value to load into CR3 is
open-coded everywhere.  Factor it out into helpers build_cr3() and
build_cr3_noflush().

This makes one semantic change: __get_current_cr3_fast() was wrong
on SME systems.  No one noticed because the only caller is in the
VMX code, and there are no CPUs with both SME and VMX.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bpetkov@suse.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tom Lendacky <Thomas.Lendacky@amd.com>
Link: http://lkml.kernel.org/r/ce350cf11e93e2842d14d0b95b0199c7d881f527.1505663533.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/include/asm/mmu_context.h
arch/x86/mm/tlb.c