Patch "x86/virt: Add enum for hypervisors to replace x86_hyper" has been added to the 4.14-stable tree
Subsystems (10)
This is a note to let you know that I've just added the patch titled
x86/virt: Add enum for hypervisors to replace x86_hyper
to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
x86-virt-add-enum-for-hypervisors-to-replace-x86_hyper.patch
and it can be found in the queue-4.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
03b2a320b19f1424e9ac9c21696be9c60b6d0d93Mon Sep 17 00:00:00 2001
From: Juergen Gross <[email protected]>
Date: Thu, 9 Nov 2017 14:27:36 +0100
Subject: x86/virt: Add enum for hypervisors to replace x86_hyper
From: Juergen Gross <[email protected]>
commit 03b2a320b19f1424e9ac9c21696be9c60b6d0d93 upstream.
The x86_hyper pointer is only used for checking whether a virtual device is supporting the hypervisor the system is running on.
Use an enum for that purpose instead and drop the x86_hyper pointer.
--- arch/x86/hyperv/hv_init.c | 2 +- arch/x86/include/asm/hypervisor.h | 23 ++++++++++++++--------- arch/x86/kernel/cpu/hypervisor.c | 12 +++++++++--- arch/x86/kernel/cpu/mshyperv.c | 4 ++-- arch/x86/kernel/cpu/vmware.c | 4 ++-- arch/x86/kernel/kvm.c | 4 ++-- arch/x86/xen/enlighten_hvm.c | 4 ++-- arch/x86/xen/enlighten_pv.c | 4 ++-- drivers/hv/vmbus_drv.c | 2 +- drivers/input/mouse/vmmouse.c | 10 ++++------ drivers/misc/vmw_balloon.c | 2 +- 11 files changed, 40 insertions(+), 31 deletions(-)
arch/x86/hyperv/hv_init.c +1 -1
@@ -113,7 +113,7 @@ void hyperv_init(void)u64 guest_id;union hv_x64_msr_hypercall_contents hypercall_msr; -if (x86_hyper != &x86_hyper_ms_hyperv) +if (x86_hyper_type !=X86_HYPER_MS_HYPERV )return ;/* Allocate percpu VP index */
arch/x86/include/asm/hypervisor.h +14 -9
@@ -29,6 +29,16 @@/* * x86 hypervisor information */ + +enum x86_hypervisor_type { +X86_HYPER_NATIVE =0 , +X86_HYPER_VMWARE , +X86_HYPER_MS_HYPERV , +X86_HYPER_XEN_PV , +X86_HYPER_XEN_HVM , +X86_HYPER_KVM , +}; +struct hypervisor_x86 {/* Hypervisor name */ const char *name;
@@ -36,6 +46,9 @@ struct hypervisor_x86 {/* Detection routine */ uint32_t (*detect)(void ); +/* Hypervisor type */ +enum x86_hypervisor_type type; +/* init time callbacks */ struct x86_hyper_init init;
@@ -43,15 +56,7 @@ struct hypervisor_x86 { struct x86_hyper_runtime runtime; }; -extern const struct hypervisor_x86 *x86_hyper; - -/* Recognized hypervisors */ -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_pv; -extern const struct hypervisor_x86 x86_hyper_xen_hvm; -extern const struct hypervisor_x86 x86_hyper_kvm; - +extern enum x86_hypervisor_type x86_hyper_type;extern void init_hypervisor_platform (void );#else static inline void init_hypervisor_platform (void ) { }
arch/x86/kernel/cpu/hypervisor.c +9 -3
@@ -26,6 +26,12 @@#include <asm/processor.h> #include <asm/hypervisor.h> +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_pv; +extern const struct hypervisor_x86 x86_hyper_xen_hvm; +extern const struct hypervisor_x86 x86_hyper_kvm; +static const __initconst struct hypervisor_x86 *const hypervisors[] = { #ifdef CONFIG_XEN_PV
@@ -41,8 +47,8 @@ static const __initconst struct hypervis#endif }; -const struct hypervisor_x86 *x86_hyper; -EXPORT_SYMBOL (x86_hyper); +enum x86_hypervisor_type x86_hyper_type; +EXPORT_SYMBOL (x86_hyper_type);static inline const struct hypervisor_x86 *__init detect_hypervisor_vendor (void )
@@ -87,6 +93,6 @@ void __init init_hypervisor_platform(voicopy_array (&h->init, &x86_init.hyper,sizeof (h->init));copy_array (&h->runtime, &x86_platform.hyper,sizeof (h->runtime)); - x86_hyper = h; + x86_hyper_type = h->type; x86_init.hyper.init_platform (); }
arch/x86/kernel/cpu/mshyperv.c +2 -2
@@ -254,9 +254,9 @@ static void __init ms_hyperv_init_platfo#endif } -const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = { +const __initconst struct hypervisor_x86 x86_hyper_ms_hyperv = { .name ="Microsoft Hyper-V" , .detect = ms_hyperv_platform, + .type =X86_HYPER_MS_HYPERV , .init.init_platform = ms_hyperv_init_platform, }; -EXPORT_SYMBOL (x86_hyper_ms_hyperv);
arch/x86/kernel/cpu/vmware.c +2 -2
@@ -205,10 +205,10 @@ static bool __init vmware_legacy_x2apic_ (eax & (1 <<VMWARE_PORT_CMD_LEGACY_X2APIC )) !=0 ; } -const __refconst struct hypervisor_x86 x86_hyper_vmware = { +const __initconst struct hypervisor_x86 x86_hyper_vmware = { .name ="VMware" , .detect = vmware_platform, + .type =X86_HYPER_VMWARE , .init.init_platform = vmware_platform_setup, .init.x2apic_available = vmware_legacy_x2apic_available, }; -EXPORT_SYMBOL (x86_hyper_vmware);
arch/x86/kernel/kvm.c +2 -2
@@ -544,12 +544,12 @@ static uint32_t __init kvm_detect(void)return kvm_cpuid_base (); } -const struct hypervisor_x86 x86_hyper_kvm__refconst = { +const __initconst struct hypervisor_x86 x86_hyper_kvm = { .name ="KVM" , .detect = kvm_detect, + .type =X86_HYPER_KVM , .init.x2apic_available = kvm_para_available, }; -EXPORT_SYMBOL_GPL (x86_hyper_kvm);static __init int activate_jump_labels (void ) {
arch/x86/xen/enlighten_hvm.c +2 -2
@@ -226,12 +226,12 @@ static uint32_t __init xen_platform_hvm(return xen_cpuid_base (); } -const struct hypervisor_x86 x86_hyper_xen_hvm = { +const __initconst struct hypervisor_x86 x86_hyper_xen_hvm = { .name ="Xen HVM" , .detect = xen_platform_hvm, + .type =X86_HYPER_XEN_HVM , .init.init_platform = xen_hvm_guest_init, .init.x2apic_available = xen_x2apic_para_available, .init.init_mem_mapping = xen_hvm_init_mem_mapping, .runtime.pin_vcpu = xen_pin_vcpu, }; -EXPORT_SYMBOL (x86_hyper_xen_hvm);
arch/x86/xen/enlighten_pv.c +2 -2
@@ -1459,9 +1459,9 @@ static uint32_t __init xen_platform_pv(vreturn 0 ; } -const struct hypervisor_x86 x86_hyper_xen_pv = { +const __initconst struct hypervisor_x86 x86_hyper_xen_pv = { .name ="Xen PV" , .detect = xen_platform_pv, + .type =X86_HYPER_XEN_PV , .runtime.pin_vcpu = xen_pin_vcpu, }; -EXPORT_SYMBOL (x86_hyper_xen_pv);
drivers/hv/vmbus_drv.c +1 -1
@@ -1534,7 +1534,7 @@ static int __init hv_acpi_init(void) {int ret, t; -if (x86_hyper != &x86_hyper_ms_hyperv) +if (x86_hyper_type !=X86_HYPER_MS_HYPERV )return -ENODEV ;init_completion (&probe_event);
drivers/input/mouse/vmmouse.c +4 -6
@@ -316,11 +316,9 @@ static int vmmouse_enable(struct psmouse/* * Array of supported hypervisors. */ -static const struct hypervisor_x86 *vmmouse_supported_hypervisors[] = { - &x86_hyper_vmware, -#ifdef CONFIG_KVM_GUEST - &x86_hyper_kvm, -#endif +static enum x86_hypervisor_type vmmouse_supported_hypervisors[] = { +X86_HYPER_VMWARE , +X86_HYPER_KVM , };/**
@@ -331,7 +329,7 @@ static bool vmmouse_check_hypervisor(voiint i;for (i =0 ; i <ARRAY_SIZE (vmmouse_supported_hypervisors); i++) -if (vmmouse_supported_hypervisors[i] == x86_hyper) +if (vmmouse_supported_hypervisors[i] == x86_hyper_type)return true;return false;
drivers/misc/vmw_balloon.c +1 -1
@@ -1271,7 +1271,7 @@ static int __init vmballoon_init(void)* Check if we are running on VMware's hypervisor and bail out * if we are not. */ -if (x86_hyper != &x86_hyper_vmware) +if (x86_hyper_type !=X86_HYPER_VMWARE )return -ENODEV ; for (is_2m_pages = 0; is_2m_pages < VMW_BALLOON_NUM_PAGE_SIZES;
Patches currently in stable-queue which might be from [email protected] are
queue-4.14/x86-entry-64-move-the-ist-stacks-into-struct-cpu_entry_area.patch queue-4.14/x86-dumpstack-add-get_stack_info-support-for-the-sysenter-stack.patch queue-4.14/x86-virt-add-enum-for-hypervisors-to-replace-x86_hyper.patch queue-4.14/x86-xen-provide-pre-built-page-tables-only-for-config_xen_pv-y-and-config_xen_pvh-y.patch queue-4.14/x86-entry-remap-the-tss-into-the-cpu-entry-area.patch queue-4.14/x86-entry-64-paravirt-use-paravirt-safe-macro-to-access-eflags.patch queue-4.14/x86-mm-fixmap-generalize-the-gdt-fixmap-mechanism-introduce-struct-cpu_entry_area.patch queue-4.14/x86-xen-drop-5-level-paging-support-code-from-the-xen_pv-code.patch queue-4.14/x86-paravirt-dont-patch-flush_tlb_single.patch queue-4.14/x86-dumpstack-handle-stack-overflow-on-all-stacks.patch queue-4.14/x86-entry-64-return-to-userspace-from-the-trampoline-stack.patch queue-4.14/x86-paravirt-provide-a-way-to-check-for-hypervisors.patch queue-4.14/xen-x86-entry-64-add-xen-nmi-trap-entry.patch queue-4.14/x86-entry-64-create-a-per-cpu-syscall-entry-trampoline.patch queue-4.14/x86-xen-64-x86-entry-64-clean-up-sp-code-in-cpu_initialize_context.patch queue-4.14/x86-entry-64-de-xen-ify-our-nmi-code.patch queue-4.14/objtool-don-t-report-end-of-section-error-after-an-empty-unwind-hint.patch queue-4.14/x86-entry-64-use-a-per-cpu-trampoline-stack-for-idt-entries.patch queue-4.14/x86-cpufeatures-make-cpu-bugs-sticky.patch queue-4.14/x86-espfix-64-stop-assuming-that-pt_regs-is-on-the-entry-stack.patch queue-4.14/x86-xen-fix-xen-head-elf-annotations.patch queue-4.14/x86-entry-move-sysenter_stack-to-the-beginning-of-struct-tss_struct.patch queue-4.14/x86-entry-64-allocate-and-enable-the-sysenter-stack.patch queue-4.14/x86-unwinder-orc-dont-bail-on-stack-overflow.patch queue-4.14/x86-head-fix-head-elf-function-annotations.patch queue-4.14/x86-head-add-unwind-hint-annotations.patch queue-4.14/x86-head-remove-unused-bad_address-code.patch queue-4.14/x86-xen-add-unwind-hint-annotations.patch queue-4.14/x86-kasan-64-teach-kasan-about-the-cpu_entry_area.patch queue-4.14/x86-head-remove-confusing-comment.patch queue-4.14/x86-entry-64-remove-the-sysenter-stack-canary.patch queue-4.14/x86-entry-gdt-put-per-cpu-gdt-remaps-in-ascending-order.patch queue-4.14/x86-entry-fix-assumptions-that-the-hw-tss-is-at-the-beginning-of-cpu_tss.patch queue-4.14/x86-entry-64-make-cpu_entry_area.tss-read-only.patch queue-4.14/x86-virt-x86-platform-merge-struct-x86_hyper-into-struct-x86_platform-and-struct-x86_init.patch queue-4.14/x86-unwinder-handle-stack-overflows-more-gracefully.patch queue-4.14/x86-irq-64-print-the-offending-ip-in-the-stack-overflow-warning.patch queue-4.14/x86-entry-clean-up-the-sysenter_stack-code.patch queue-4.14/x86-entry-64-separate-cpu_current_top_of_stack-from-tss.sp0.patch queue-4.14/x86-boot-annotate-verify_cpu-as-a-callable-function.patch queue-4.14/x86-irq-remove-an-old-outdated-comment-about-context-tracking-races.patch