]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - arch/x86/kernel/paravirt-spinlocks.c
x86/speculation: Consolidate CPU whitelists
[mirror_ubuntu-bionic-kernel.git] / arch / x86 / kernel / paravirt-spinlocks.c
CommitLineData
b2441318 1// SPDX-License-Identifier: GPL-2.0
d5de8841
JF
2/*
3 * Split spinlock implementation out into its own file, so it can be
4 * compiled in a FTRACE-compatible way.
5 */
6#include <linux/spinlock.h>
186f4360 7#include <linux/export.h>
96f853ea 8#include <linux/jump_label.h>
d5de8841
JF
9
10#include <asm/paravirt.h>
11
f233f7f1
PZI
12__visible void __native_queued_spin_unlock(struct qspinlock *lock)
13{
14 native_queued_spin_unlock(lock);
15}
f233f7f1
PZI
16PV_CALLEE_SAVE_REGS_THUNK(__native_queued_spin_unlock);
17
18bool pv_is_native_spin_unlock(void)
19{
20 return pv_lock_ops.queued_spin_unlock.func ==
21 __raw_callee_save___native_queued_spin_unlock;
22}
f233f7f1 23
6c62985d 24__visible bool __native_vcpu_is_preempted(long cpu)
3cded417
PZ
25{
26 return false;
27}
28PV_CALLEE_SAVE_REGS_THUNK(__native_vcpu_is_preempted);
29
30bool pv_is_native_vcpu_is_preempted(void)
446f3dc8 31{
3cded417
PZ
32 return pv_lock_ops.vcpu_is_preempted.func ==
33 __raw_callee_save___native_vcpu_is_preempted;
446f3dc8
PX
34}
35
d5de8841
JF
36struct pv_lock_ops pv_lock_ops = {
37#ifdef CONFIG_SMP
f233f7f1
PZI
38 .queued_spin_lock_slowpath = native_queued_spin_lock_slowpath,
39 .queued_spin_unlock = PV_CALLEE_SAVE(__native_queued_spin_unlock),
40 .wait = paravirt_nop,
41 .kick = paravirt_nop,
3cded417 42 .vcpu_is_preempted = PV_CALLEE_SAVE(__native_vcpu_is_preempted),
f233f7f1 43#endif /* SMP */
d5de8841 44};
25258ef7 45EXPORT_SYMBOL(pv_lock_ops);