Commit d029bff6 authored by Andy Lutomirski's avatar Andy Lutomirski Committed by Thomas Gleixner

x86/fsgsbase: Fix Xen PV support

On Xen PV, SWAPGS doesn't work.  Teach __rdfsbase_inactive() and
__wrgsbase_inactive() to use rdmsrl()/wrmsrl() on Xen PV.  The Xen
pvop code will understand this and issue the correct hypercalls.
Signed-off-by: default avatarAndy Lutomirski <luto@kernel.org>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/f07c08f178fe9711915862b656722a207cd52c28.1593192140.git.luto@kernel.org
parent 40c45904
...@@ -163,9 +163,15 @@ static noinstr unsigned long __rdgsbase_inactive(void) ...@@ -163,9 +163,15 @@ static noinstr unsigned long __rdgsbase_inactive(void)
lockdep_assert_irqs_disabled(); lockdep_assert_irqs_disabled();
if (!static_cpu_has(X86_FEATURE_XENPV)) {
native_swapgs(); native_swapgs();
gsbase = rdgsbase(); gsbase = rdgsbase();
native_swapgs(); native_swapgs();
} else {
instrumentation_begin();
rdmsrl(MSR_KERNEL_GS_BASE, gsbase);
instrumentation_end();
}
return gsbase; return gsbase;
} }
...@@ -182,9 +188,15 @@ static noinstr void __wrgsbase_inactive(unsigned long gsbase) ...@@ -182,9 +188,15 @@ static noinstr void __wrgsbase_inactive(unsigned long gsbase)
{ {
lockdep_assert_irqs_disabled(); lockdep_assert_irqs_disabled();
if (!static_cpu_has(X86_FEATURE_XENPV)) {
native_swapgs(); native_swapgs();
wrgsbase(gsbase); wrgsbase(gsbase);
native_swapgs(); native_swapgs();
} else {
instrumentation_begin();
wrmsrl(MSR_KERNEL_GS_BASE, gsbase);
instrumentation_end();
}
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment