kvm, Add x86_hyper_kvm to complete detect_hypervisor_platform check
Subsystems (2)
PATCH 1/1 kvm, Add x86_hyper_kvm to complete detect_hypervisor_platform check
While debugging I noticed that unlike all the other hypervisor code in the kernel, kvm does not have an entry for x86_hyper which is used in detect_hypervisor_platform(), and results in a nice message about the hypervisor being used. This is only really a stub function and it makes kvm more consistent with the other hypervisors (and it makes debugging a little easier).
--- arch/x86/include/asm/hypervisor.h | 1 + arch/x86/kernel/cpu/hypervisor.c | 1 + arch/x86/kernel/kvm.c | 6 ++++++ 3 files changed, 8 insertions(+)
arch/x86/include/asm/hypervisor.h +1 -0
@@ -49,6 +49,7 @@ extern const struct hypervisor_x86 *x86_hyper;extern const struct hypervisor_x86 x86_hyper_vmware;extern const struct hypervisor_x86 x86_hyper_ms_hyperv;extern const struct hypervisor_x86 x86_hyper_xen_hvm; +extern const struct hypervisor_x86 x86_hyper_kvm;static inline bool hypervisor_x2apic_available (void ) {
arch/x86/kernel/cpu/hypervisor.c +1 -0
@@ -37,6 +37,7 @@ static const __initconst struct hypervisor_x86 * const hypervisors[] =#endif &x86_hyper_vmware, &x86_hyper_ms_hyperv, + &x86_hyper_kvm, };const struct hypervisor_x86 *x86_hyper;
arch/x86/kernel/kvm.c +6 -0
@@ -39,6 +39,7 @@#include <asm/desc.h> #include <asm/tlbflush.h> #include <asm/idle.h> +#include <asm/hypervisor.h> static int kvmapf =1 ;
@@ -432,6 +433,11 @@ void __init kvm_guest_init(void)#endif } +const struct hypervisor_x86 x86_hyper_kvm__refconst = { + .name ="KVM" , +}; +EXPORT_SYMBOL (x86_hyper_kvm); +static __init int activate_jump_labels (void ) {if (has_steal_clock) {
Signature · 1 line
1.7.9.3
Quoted 11 lines · Prarit Bhargava
While debugging I noticed that unlike all the other hypervisor code in the kernel, kvm does not have an entry for
x86_hyperwhich is used indetect_hypervisor_platform(), and results in a nice message about the hypervisor being used. This is only really a stub function and it makes kvm more consistent with the other hypervisors (and it makes debugging a little easier).Signed-off-by Prarit Bhargava <[email protected]>Cc Avi Kivity <[email protected]>Cc Gleb Natapov <[email protected]>Cc Alex Williamson <[email protected]>
Self - nak this ... new patch coming. Sorry for the noise.
P.
Quoted 54 lines · Prarit Bhargava
While debugging I noticed that unlike all the other hypervisor code in the kernel, kvm does not have an entry for
x86_hyperwhich is used indetect_hypervisor_platform(), and results in a nice message about the hypervisor being used. This is only really a stub function and it makes kvm more consistent with the other hypervisors (and it makes debugging a little easier).Signed-off-by Prarit Bhargava <[email protected]>Cc Avi Kivity <[email protected]>Cc Gleb Natapov <[email protected]>Cc Alex Williamson <[email protected]>--- arch/x86/include/asm/hypervisor.h | 1 + arch/x86/kernel/cpu/hypervisor.c | 1 + arch/x86/kernel/kvm.c | 6 ++++++ 3 files changed, 8 insertions(+)arch/x86/include/asm/hypervisor.h +1
-0@@ -49,6 +49,7 @@ extern const struct hypervisor_x86 *x86_hyper;extern const struct hypervisor_x86 x86_hyper_vmware;extern const struct hypervisor_x86 x86_hyper_ms_hyperv;extern const struct hypervisor_x86 x86_hyper_xen_hvm; +extern const struct hypervisor_x86 x86_hyper_kvm;static inline bool hypervisor_x2apic_available (void ) {arch/x86/kernel/cpu/hypervisor.c +1
-0@@ -37,6 +37,7 @@ static const __initconst struct hypervisor_x86 * const hypervisors[] =#endif &x86_hyper_vmware, &x86_hyper_ms_hyperv, + &x86_hyper_kvm, };const struct hypervisor_x86 *x86_hyper;arch/x86/kernel/kvm.c +1
-0@@ -39,6 +39,7 @@#include <asm/desc.h> #include <asm/tlbflush.h> #include <asm/idle.h> +#include <asm/hypervisor.h> static int kvmapf =1 ;
arch/x86/kernel/kvm.c void __init kvm_guest_init(void) · line 439
Quoted 7 lines
arch/x86/kernel/kvm.c +4
-0@@ -432,6 +433,11 @@ void __init kvm_guest_init(void)#endif } +const struct hypervisor_x86 x86_hyper_kvm__refconst = { + .name ="KVM" , +}; +EXPORT_SYMBOL (x86_hyper_kvm);
EXPORT_SYMBOL_GPL version. ?
Quoted 12 lines
arch/x86/kernel/kvm.c +1
-0+static __init int activate_jump_labels (void ) {if (has_steal_clock) {Signature · 7 lines
1.7.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Quoted 58 lines · Konrad Rzeszutek Wilk
Quoted 57 lines · Prarit Bhargava
While debugging I noticed that unlike all the other hypervisor code in the kernel, kvm does not have an entry for
x86_hyperwhich is used indetect_hypervisor_platform(), and results in a nice message about the hypervisor being used. This is only really a stub function and it makes kvm more consistent with the other hypervisors (and it makes debugging a little easier).Signed-off-by Prarit Bhargava <[email protected]>Cc Avi Kivity <[email protected]>Cc Gleb Natapov <[email protected]>Cc Alex Williamson <[email protected]>--- arch/x86/include/asm/hypervisor.h | 1 + arch/x86/kernel/cpu/hypervisor.c | 1 + arch/x86/kernel/kvm.c | 6 ++++++ 3 files changed, 8 insertions(+)arch/x86/include/asm/hypervisor.h +1
-0@@ -49,6 +49,7 @@ extern const struct hypervisor_x86 *x86_hyper;extern const struct hypervisor_x86 x86_hyper_vmware;extern const struct hypervisor_x86 x86_hyper_ms_hyperv;extern const struct hypervisor_x86 x86_hyper_xen_hvm; +extern const struct hypervisor_x86 x86_hyper_kvm;static inline bool hypervisor_x2apic_available (void ) {arch/x86/kernel/cpu/hypervisor.c +1
-0@@ -37,6 +37,7 @@ static const __initconst struct hypervisor_x86 * const hypervisors[] =#endif &x86_hyper_vmware, &x86_hyper_ms_hyperv, + &x86_hyper_kvm, };const struct hypervisor_x86 *x86_hyper;arch/x86/kernel/kvm.c +1
-0@@ -39,6 +39,7 @@#include <asm/desc.h> #include <asm/tlbflush.h> #include <asm/idle.h> +#include <asm/hypervisor.h> static int kvmapf =1 ;@@ -432,6 +433,11 @@ void __init kvm_guest_init(void)#endif }
Quoted 6 lines
arch/x86/kernel/kvm.c void __init kvm_guest_init(void) · line 439
Quoted 4 lines
arch/x86/kernel/kvm.c +4
-0+const struct hypervisor_x86 x86_hyper_kvm__refconst = { + .name ="KVM" , +}; +EXPORT_SYMBOL (x86_hyper_kvm);
EXPORT_SYMBOL_GPLversion. ?
Hey Konrad, thanks for the review.
The other hypervisor_x86 structs are only EXPORT_SYMBOL, so I maintained that convention here.
If I'm mistaken in that assumption, please let me know.
Thanks again,
P.
Quoted 61 lines · Prarit Bhargava
Quoted 58 lines · Konrad Rzeszutek Wilk
Quoted 57 lines · Prarit Bhargava
While debugging I noticed that unlike all the other hypervisor code in the kernel, kvm does not have an entry for
x86_hyperwhich is used indetect_hypervisor_platform(), and results in a nice message about the hypervisor being used. This is only really a stub function and it makes kvm more consistent with the other hypervisors (and it makes debugging a little easier).Signed-off-by Prarit Bhargava <[email protected]>Cc Avi Kivity <[email protected]>Cc Gleb Natapov <[email protected]>Cc Alex Williamson <[email protected]>--- arch/x86/include/asm/hypervisor.h | 1 + arch/x86/kernel/cpu/hypervisor.c | 1 + arch/x86/kernel/kvm.c | 6 ++++++ 3 files changed, 8 insertions(+)arch/x86/include/asm/hypervisor.h +1
-0@@ -49,6 +49,7 @@ extern const struct hypervisor_x86 *x86_hyper;extern const struct hypervisor_x86 x86_hyper_vmware;extern const struct hypervisor_x86 x86_hyper_ms_hyperv;extern const struct hypervisor_x86 x86_hyper_xen_hvm; +extern const struct hypervisor_x86 x86_hyper_kvm;static inline bool hypervisor_x2apic_available (void ) {arch/x86/kernel/cpu/hypervisor.c +1
-0@@ -37,6 +37,7 @@ static const __initconst struct hypervisor_x86 * const hypervisors[] =#endif &x86_hyper_vmware, &x86_hyper_ms_hyperv, + &x86_hyper_kvm, };const struct hypervisor_x86 *x86_hyper;arch/x86/kernel/kvm.c +1
-0@@ -39,6 +39,7 @@#include <asm/desc.h> #include <asm/tlbflush.h> #include <asm/idle.h> +#include <asm/hypervisor.h> static int kvmapf =1 ;@@ -432,6 +433,11 @@ void __init kvm_guest_init(void)#endif }
Quoted 8 lines
Quoted 6 lines
arch/x86/kernel/kvm.c void __init kvm_guest_init(void) · line 439
Quoted 4 lines
arch/x86/kernel/kvm.c +4
-0+const struct hypervisor_x86 x86_hyper_kvm__refconst = { + .name ="KVM" , +}; +EXPORT_SYMBOL (x86_hyper_kvm);
EXPORT_SYMBOL_GPLversion. ?Hey Konrad, thanks for the review.
Sure thing.
Quoted 3 lines
The other
hypervisor_x86structs are onlyEXPORT_SYMBOL, so I maintained that convention here.
Go for _GPL. Not sure why they were the non-GPL version but there is no need for non-GPL version.