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);
-
-static inline void enter_lazy(enum xen_lazy_mode mode)
-{
- BUG_ON(this_cpu_read(xen_lazy_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);
-
- this_cpu_write(xen_lazy_mode, XEN_LAZY_NONE);
-}
-
-enum xen_lazy_mode xen_get_lazy_mode(void);
+bool xen_is_cpu_lazy_mode(void);
#if defined(CONFIG_XEN_DOM0) && defined(CONFIG_ACPI)
void xen_sanitize_proc_cap_bits(uint32_t *buf);
struct desc_struct desc[3];
};
-DEFINE_PER_CPU(enum xen_lazy_mode, xen_lazy_mode) = XEN_LAZY_NONE;
+static DEFINE_PER_CPU(bool, xen_cpu_lazy_mode);
-enum xen_lazy_mode xen_get_lazy_mode(void)
+bool xen_is_cpu_lazy_mode(void)
{
- if (in_interrupt())
- return XEN_LAZY_NONE;
-
- return this_cpu_read(xen_lazy_mode);
+ return !in_interrupt() && this_cpu_read(xen_cpu_lazy_mode);
}
/*
BUG_ON(preemptible());
__task_lazy_mmu_mode_pause(prev);
- enter_lazy(XEN_LAZY_CPU);
+ this_cpu_write(xen_cpu_lazy_mode, true);
}
static void xen_end_context_switch(struct task_struct *next)
BUG_ON(preemptible());
xen_mc_flush();
- leave_lazy(XEN_LAZY_CPU);
+ this_cpu_write(xen_cpu_lazy_mode, false);
__task_lazy_mmu_mode_resume(next);
}
MULTI_mmuext_op(mcs.mc, op, 1, NULL, DOMID_SELF);
- xen_mc_issue(xen_get_lazy_mode() != XEN_LAZY_CPU);
+ xen_mc_issue(!xen_is_cpu_lazy_mode());
}
static void xen_load_gdt(const struct desc_ptr *dtr)
* exception between the new %fs descriptor being loaded and
* %fs being effectively cleared at __switch_to().
*/
- if (xen_get_lazy_mode() == XEN_LAZY_CPU)
+ if (xen_is_cpu_lazy_mode())
loadsegment(fs, 0);
xen_mc_batch();
load_TLS_descriptor(t, cpu, 1);
load_TLS_descriptor(t, cpu, 2);
- xen_mc_issue(xen_get_lazy_mode() != XEN_LAZY_CPU);
+ xen_mc_issue(!xen_is_cpu_lazy_mode());
}
static void xen_load_gs_index(unsigned int idx)
mcs = xen_mc_entry(0);
MULTI_stack_switch(mcs.mc, __KERNEL_DS, sp0);
- xen_mc_issue(xen_get_lazy_mode() != XEN_LAZY_CPU);
+ xen_mc_issue(!xen_is_cpu_lazy_mode());
this_cpu_write(cpu_tss_rw.x86_tss.sp0, sp0);
}
MULTI_fpu_taskswitch(mcs.mc, (cr0 & X86_CR0_TS) != 0);
- xen_mc_issue(xen_get_lazy_mode() != XEN_LAZY_CPU);
+ xen_mc_issue(!xen_is_cpu_lazy_mode());
}
static void xen_write_cr4(unsigned long cr4)
else
__xen_write_cr3(false, 0);
- xen_mc_issue(xen_get_lazy_mode() != XEN_LAZY_CPU); /* interrupts restored */
+ xen_mc_issue(!xen_is_cpu_lazy_mode()); /* interrupts restored */
}
/*
__xen_write_cr3(true, cr3);
- xen_mc_issue(xen_get_lazy_mode() != XEN_LAZY_CPU); /* interrupts restored */
+ xen_mc_issue(!xen_is_cpu_lazy_mode()); /* interrupts restored */
}
static int xen_pgd_alloc(struct mm_struct *mm)
*/
xen_mc_batch();
__xen_write_cr3(true, __pa(init_top_pgt));
- xen_mc_issue(xen_get_lazy_mode() != XEN_LAZY_CPU);
+ xen_mc_issue(!xen_is_cpu_lazy_mode());
/* We can't that easily rip out L3 and L2, as the Xen pagetables are
* set out this way: [L4], [L1], [L2], [L3], [L1], [L1] ... for