提交 f3614646 编写于 作者: J Juergen Gross 提交者: Ingo Molnar

x86/virt, x86/platform: Add ->guest_late_init() callback to hypervisor_x86 structure

Add a new guest_late_init callback to the hypervisor_x86 structure. It
will replace the current kvm_guest_init() call which is changed to
make use of the new callback.
Signed-off-by: NJuergen Gross <jgross@suse.com>
Acked-by: NThomas Gleixner <tglx@linutronix.de>
Acked-by: NPaolo Bonzini <pbonzini@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: kvm@vger.kernel.org
Cc: rkrcmar@redhat.com
Link: http://lkml.kernel.org/r/20171109132739.23465-5-jgross@suse.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
上级 6d730525
...@@ -88,7 +88,6 @@ static inline long kvm_hypercall4(unsigned int nr, unsigned long p1, ...@@ -88,7 +88,6 @@ static inline long kvm_hypercall4(unsigned int nr, unsigned long p1,
#ifdef CONFIG_KVM_GUEST #ifdef CONFIG_KVM_GUEST
bool kvm_para_available(void); bool kvm_para_available(void);
unsigned int kvm_arch_para_features(void); unsigned int kvm_arch_para_features(void);
void __init kvm_guest_init(void);
void kvm_async_pf_task_wait(u32 token, int interrupt_kernel); void kvm_async_pf_task_wait(u32 token, int interrupt_kernel);
void kvm_async_pf_task_wake(u32 token); void kvm_async_pf_task_wake(u32 token);
u32 kvm_read_and_reset_pf_reason(void); u32 kvm_read_and_reset_pf_reason(void);
...@@ -103,7 +102,6 @@ static inline void kvm_spinlock_init(void) ...@@ -103,7 +102,6 @@ static inline void kvm_spinlock_init(void)
#endif /* CONFIG_PARAVIRT_SPINLOCKS */ #endif /* CONFIG_PARAVIRT_SPINLOCKS */
#else /* CONFIG_KVM_GUEST */ #else /* CONFIG_KVM_GUEST */
#define kvm_guest_init() do {} while (0)
#define kvm_async_pf_task_wait(T, I) do {} while(0) #define kvm_async_pf_task_wait(T, I) do {} while(0)
#define kvm_async_pf_task_wake(T) do {} while(0) #define kvm_async_pf_task_wake(T) do {} while(0)
......
...@@ -117,11 +117,13 @@ struct x86_init_pci { ...@@ -117,11 +117,13 @@ struct x86_init_pci {
/** /**
* struct x86_hyper_init - x86 hypervisor init functions * struct x86_hyper_init - x86 hypervisor init functions
* @init_platform: platform setup * @init_platform: platform setup
* @guest_late_init: guest late init
* @x2apic_available: X2APIC detection * @x2apic_available: X2APIC detection
* @init_mem_mapping: setup early mappings during init_mem_mapping() * @init_mem_mapping: setup early mappings during init_mem_mapping()
*/ */
struct x86_hyper_init { struct x86_hyper_init {
void (*init_platform)(void); void (*init_platform)(void);
void (*guest_late_init)(void);
bool (*x2apic_available)(void); bool (*x2apic_available)(void);
void (*init_mem_mapping)(void); void (*init_mem_mapping)(void);
}; };
......
...@@ -465,7 +465,7 @@ static void __init kvm_apf_trap_init(void) ...@@ -465,7 +465,7 @@ static void __init kvm_apf_trap_init(void)
update_intr_gate(X86_TRAP_PF, async_page_fault); update_intr_gate(X86_TRAP_PF, async_page_fault);
} }
void __init kvm_guest_init(void) static void __init kvm_guest_init(void)
{ {
int i; int i;
...@@ -548,6 +548,7 @@ const __initconst struct hypervisor_x86 x86_hyper_kvm = { ...@@ -548,6 +548,7 @@ const __initconst struct hypervisor_x86 x86_hyper_kvm = {
.name = "KVM", .name = "KVM",
.detect = kvm_detect, .detect = kvm_detect,
.type = X86_HYPER_KVM, .type = X86_HYPER_KVM,
.init.guest_late_init = kvm_guest_init,
.init.x2apic_available = kvm_para_available, .init.x2apic_available = kvm_para_available,
}; };
......
...@@ -1294,7 +1294,7 @@ void __init setup_arch(char **cmdline_p) ...@@ -1294,7 +1294,7 @@ void __init setup_arch(char **cmdline_p)
io_apic_init_mappings(); io_apic_init_mappings();
kvm_guest_init(); x86_init.hyper.guest_late_init();
e820__reserve_resources(); e820__reserve_resources();
e820__register_nosave_regions(max_low_pfn); e820__register_nosave_regions(max_low_pfn);
......
...@@ -86,6 +86,7 @@ struct x86_init_ops x86_init __initdata = { ...@@ -86,6 +86,7 @@ struct x86_init_ops x86_init __initdata = {
.hyper = { .hyper = {
.init_platform = x86_init_noop, .init_platform = x86_init_noop,
.guest_late_init = x86_init_noop,
.x2apic_available = bool_x86_init_noop, .x2apic_available = bool_x86_init_noop,
.init_mem_mapping = x86_init_noop, .init_mem_mapping = x86_init_noop,
}, },
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册