@@ -339,6 +339,7 @@ extern struct paravirt_patch_template pv_ops;
#ifdef CONFIG_PARAVIRT_RUNTIME
#define PVRT_SUFFIX ".runtime"
+extern struct paravirt_patch_template native_pv_ops;
#else
#define PVRT_SUFFIX ""
#endif
@@ -775,6 +776,9 @@ extern struct paravirt_patch_site __parainstructions[],
#ifdef CONFIG_PARAVIRT_RUNTIME
extern struct paravirt_patch_site __parainstructions_runtime[],
__parainstructions_runtime_end[];
+void paravirt_ops_init(void);
+#else
+static inline void paravirt_ops_init(void) { }
#endif
#endif /* __ASSEMBLY__ */
@@ -458,5 +458,15 @@ NOKPROBE_SYMBOL(native_set_debugreg);
NOKPROBE_SYMBOL(native_load_idt);
#endif
+#ifdef CONFIG_PARAVIRT_RUNTIME
+__ro_after_init struct paravirt_patch_template native_pv_ops;
+
+void __init paravirt_ops_init(void)
+{
+ native_pv_ops = pv_ops;
+}
+EXPORT_SYMBOL(native_pv_ops);
+#endif
+
EXPORT_SYMBOL(pv_ops);
EXPORT_SYMBOL_GPL(pv_info);
@@ -43,6 +43,7 @@
#include <asm/unwind.h>
#include <asm/vsyscall.h>
#include <linux/vmalloc.h>
+#include <asm/paravirt_types.h>
/*
* max_low_pfn_mapped: highest directly mapped pfn < 4 GB
@@ -831,6 +832,7 @@ void __init setup_arch(char **cmdline_p)
boot_cpu_data.x86_phys_bits = MAX_PHYSMEM_BITS;
#endif
+ paravirt_ops_init();
/*
* If we have OLPC OFW, we might end up relocating the fixmap due to
* reserve_top(), so do this before touching the ioremap area.
Introduce native_pv_ops where we stash the pv_ops array before hypervisor specific hooks have modified it. native_pv_ops get used when switching between paravirt and native pv-ops at runtime. Signed-off-by: Ankur Arora <ankur.a.arora@oracle.com> --- arch/x86/include/asm/paravirt_types.h | 4 ++++ arch/x86/kernel/paravirt.c | 10 ++++++++++ arch/x86/kernel/setup.c | 2 ++ 3 files changed, 16 insertions(+)