diff options
author | 2023-10-05 10:05:51 +0200 | |
---|---|---|
committer | 2023-10-05 10:05:51 +0200 | |
commit | 3fc18b06b8f3408951b5e43548f22984412b0831 (patch) | |
tree | 5d509acc9a9010aae791cdba9e9f6a02e94b962c /arch/x86/include/asm/xen/hypervisor.h | |
parent | x86: Make IA32_EMULATION boot time configurable (diff) | |
parent | Linux 6.6-rc4 (diff) | |
download | linux-3fc18b06b8f3408951b5e43548f22984412b0831.tar.gz linux-3fc18b06b8f3408951b5e43548f22984412b0831.tar.bz2 linux-3fc18b06b8f3408951b5e43548f22984412b0831.zip |
Merge tag 'v6.6-rc4' into x86/entry, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/include/asm/xen/hypervisor.h')
-rw-r--r-- | arch/x86/include/asm/xen/hypervisor.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/arch/x86/include/asm/xen/hypervisor.h b/arch/x86/include/asm/xen/hypervisor.h index 5fc35f889cd1..7048dfacc04b 100644 --- a/arch/x86/include/asm/xen/hypervisor.h +++ b/arch/x86/include/asm/xen/hypervisor.h @@ -36,6 +36,7 @@ extern struct shared_info *HYPERVISOR_shared_info; extern struct start_info *xen_start_info; +#include <asm/bug.h> #include <asm/processor.h> #define XEN_SIGNATURE "XenVMMXenVMM" @@ -63,4 +64,40 @@ void __init xen_pvh_init(struct boot_params *boot_params); void __init mem_map_via_hcall(struct boot_params *boot_params_p); #endif +/* Lazy mode for batching updates / context switch */ +enum xen_lazy_mode { + XEN_LAZY_NONE, + XEN_LAZY_MMU, + XEN_LAZY_CPU, +}; + +DECLARE_PER_CPU(enum xen_lazy_mode, xen_lazy_mode); +DECLARE_PER_CPU(unsigned int, xen_lazy_nesting); + +static inline void enter_lazy(enum xen_lazy_mode mode) +{ + enum xen_lazy_mode old_mode = this_cpu_read(xen_lazy_mode); + + if (mode == old_mode) { + this_cpu_inc(xen_lazy_nesting); + return; + } + + BUG_ON(old_mode != XEN_LAZY_NONE); + + this_cpu_write(xen_lazy_mode, mode); +} + +static inline void leave_lazy(enum xen_lazy_mode mode) +{ + BUG_ON(this_cpu_read(xen_lazy_mode) != mode); + + if (this_cpu_read(xen_lazy_nesting) == 0) + this_cpu_write(xen_lazy_mode, XEN_LAZY_NONE); + else + this_cpu_dec(xen_lazy_nesting); +} + +enum xen_lazy_mode xen_get_lazy_mode(void); + #endif /* _ASM_X86_XEN_HYPERVISOR_H */ |