aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'arch/i386/kernel')
-rw-r--r--arch/i386/kernel/vmi.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/arch/i386/kernel/vmi.c b/arch/i386/kernel/vmi.c
index fb07a1aad225..edc339fa5038 100644
--- a/arch/i386/kernel/vmi.c
+++ b/arch/i386/kernel/vmi.c
@@ -69,6 +69,7 @@ struct {
69 void (*flush_tlb)(int); 69 void (*flush_tlb)(int);
70 void (*set_initial_ap_state)(int, int); 70 void (*set_initial_ap_state)(int, int);
71 void (*halt)(void); 71 void (*halt)(void);
72 void (*set_lazy_mode)(int mode);
72} vmi_ops; 73} vmi_ops;
73 74
74/* XXX move this to alternative.h */ 75/* XXX move this to alternative.h */
@@ -574,6 +575,26 @@ vmi_startup_ipi_hook(int phys_apicid, unsigned long start_eip,
574} 575}
575#endif 576#endif
576 577
578static void vmi_set_lazy_mode(int mode)
579{
580 static DEFINE_PER_CPU(int, lazy_mode);
581
582 if (!vmi_ops.set_lazy_mode)
583 return;
584
585 /* Modes should never nest or overlap */
586 BUG_ON(__get_cpu_var(lazy_mode) && !(mode == PARAVIRT_LAZY_NONE ||
587 mode == PARAVIRT_LAZY_FLUSH));
588
589 if (mode == PARAVIRT_LAZY_FLUSH) {
590 vmi_ops.set_lazy_mode(0);
591 vmi_ops.set_lazy_mode(__get_cpu_var(lazy_mode));
592 } else {
593 vmi_ops.set_lazy_mode(mode);
594 __get_cpu_var(lazy_mode) = mode;
595 }
596}
597
577static inline int __init check_vmi_rom(struct vrom_header *rom) 598static inline int __init check_vmi_rom(struct vrom_header *rom)
578{ 599{
579 struct pci_header *pci; 600 struct pci_header *pci;
@@ -804,7 +825,7 @@ static inline int __init activate_vmi(void)
804 para_wrap(load_esp0, vmi_load_esp0, set_kernel_stack, UpdateKernelStack); 825 para_wrap(load_esp0, vmi_load_esp0, set_kernel_stack, UpdateKernelStack);
805 para_fill(set_iopl_mask, SetIOPLMask); 826 para_fill(set_iopl_mask, SetIOPLMask);
806 para_fill(io_delay, IODelay); 827 para_fill(io_delay, IODelay);
807 para_fill(set_lazy_mode, SetLazyMode); 828 para_wrap(set_lazy_mode, vmi_set_lazy_mode, set_lazy_mode, SetLazyMode);
808 829
809 /* user and kernel flush are just handled with different flags to FlushTLB */ 830 /* user and kernel flush are just handled with different flags to FlushTLB */
810 para_wrap(flush_tlb_user, vmi_flush_tlb_user, flush_tlb, FlushTLB); 831 para_wrap(flush_tlb_user, vmi_flush_tlb_user, flush_tlb, FlushTLB);