diff options
-rw-r--r-- | arch/x86/include/asm/hypervisor.h | 10 | ||||
-rw-r--r-- | arch/x86/mm/init.c | 3 |
2 files changed, 13 insertions, 0 deletions
diff --git a/arch/x86/include/asm/hypervisor.h b/arch/x86/include/asm/hypervisor.h index 21126155a739..0ead9dbb9130 100644 --- a/arch/x86/include/asm/hypervisor.h +++ b/arch/x86/include/asm/hypervisor.h | |||
@@ -43,6 +43,9 @@ struct hypervisor_x86 { | |||
43 | 43 | ||
44 | /* pin current vcpu to specified physical cpu (run rarely) */ | 44 | /* pin current vcpu to specified physical cpu (run rarely) */ |
45 | void (*pin_vcpu)(int); | 45 | void (*pin_vcpu)(int); |
46 | |||
47 | /* called during init_mem_mapping() to setup early mappings. */ | ||
48 | void (*init_mem_mapping)(void); | ||
46 | }; | 49 | }; |
47 | 50 | ||
48 | extern const struct hypervisor_x86 *x86_hyper; | 51 | extern const struct hypervisor_x86 *x86_hyper; |
@@ -57,8 +60,15 @@ extern const struct hypervisor_x86 x86_hyper_kvm; | |||
57 | extern void init_hypervisor_platform(void); | 60 | extern void init_hypervisor_platform(void); |
58 | extern bool hypervisor_x2apic_available(void); | 61 | extern bool hypervisor_x2apic_available(void); |
59 | extern void hypervisor_pin_vcpu(int cpu); | 62 | extern void hypervisor_pin_vcpu(int cpu); |
63 | |||
64 | static inline void hypervisor_init_mem_mapping(void) | ||
65 | { | ||
66 | if (x86_hyper && x86_hyper->init_mem_mapping) | ||
67 | x86_hyper->init_mem_mapping(); | ||
68 | } | ||
60 | #else | 69 | #else |
61 | static inline void init_hypervisor_platform(void) { } | 70 | static inline void init_hypervisor_platform(void) { } |
62 | static inline bool hypervisor_x2apic_available(void) { return false; } | 71 | static inline bool hypervisor_x2apic_available(void) { return false; } |
72 | static inline void hypervisor_init_mem_mapping(void) { } | ||
63 | #endif /* CONFIG_HYPERVISOR_GUEST */ | 73 | #endif /* CONFIG_HYPERVISOR_GUEST */ |
64 | #endif /* _ASM_X86_HYPERVISOR_H */ | 74 | #endif /* _ASM_X86_HYPERVISOR_H */ |
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c index 673541eb3b3f..bf3f1065d6ad 100644 --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <asm/dma.h> /* for MAX_DMA_PFN */ | 18 | #include <asm/dma.h> /* for MAX_DMA_PFN */ |
19 | #include <asm/microcode.h> | 19 | #include <asm/microcode.h> |
20 | #include <asm/kaslr.h> | 20 | #include <asm/kaslr.h> |
21 | #include <asm/hypervisor.h> | ||
21 | 22 | ||
22 | /* | 23 | /* |
23 | * We need to define the tracepoints somewhere, and tlb.c | 24 | * We need to define the tracepoints somewhere, and tlb.c |
@@ -636,6 +637,8 @@ void __init init_mem_mapping(void) | |||
636 | load_cr3(swapper_pg_dir); | 637 | load_cr3(swapper_pg_dir); |
637 | __flush_tlb_all(); | 638 | __flush_tlb_all(); |
638 | 639 | ||
640 | hypervisor_init_mem_mapping(); | ||
641 | |||
639 | early_memtest(0, max_pfn_mapped << PAGE_SHIFT); | 642 | early_memtest(0, max_pfn_mapped << PAGE_SHIFT); |
640 | } | 643 | } |
641 | 644 | ||