hypervisor.c (6548698f929814375fa5d62ae1db96959b0418c1) hypervisor.c (a2a47c6c3d1a7c01da4464b3b7be93b924f874c1)
1/*
2 * Common hypervisor code
3 *
4 * Copyright (C) 2008, VMware, Inc.
5 * Author : Alok N Kataria <akataria@vmware.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by

--- 9 unchanged lines hidden (view full) ---

18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
22 */
23
24#include <asm/processor.h>
25#include <asm/vmware.h>
1/*
2 * Common hypervisor code
3 *
4 * Copyright (C) 2008, VMware, Inc.
5 * Author : Alok N Kataria <akataria@vmware.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by

--- 9 unchanged lines hidden (view full) ---

18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
22 */
23
24#include <asm/processor.h>
25#include <asm/vmware.h>
26#include <asm/mshyperv.h>
26#include <asm/hypervisor.h>
27
28static inline void __cpuinit
29detect_hypervisor_vendor(struct cpuinfo_x86 *c)
30{
31 if (vmware_platform())
32 c->x86_hyper_vendor = X86_HYPER_VENDOR_VMWARE;
27#include <asm/hypervisor.h>
28
29static inline void __cpuinit
30detect_hypervisor_vendor(struct cpuinfo_x86 *c)
31{
32 if (vmware_platform())
33 c->x86_hyper_vendor = X86_HYPER_VENDOR_VMWARE;
34 else if (ms_hyperv_platform())
35 c->x86_hyper_vendor = X86_HYPER_VENDOR_MSFT;
33 else
34 c->x86_hyper_vendor = X86_HYPER_VENDOR_NONE;
35}
36
37static inline void __cpuinit
38hypervisor_set_feature_bits(struct cpuinfo_x86 *c)
39{
36 else
37 c->x86_hyper_vendor = X86_HYPER_VENDOR_NONE;
38}
39
40static inline void __cpuinit
41hypervisor_set_feature_bits(struct cpuinfo_x86 *c)
42{
40 if (boot_cpu_data.x86_hyper_vendor == X86_HYPER_VENDOR_VMWARE) {
43 if (boot_cpu_data.x86_hyper_vendor == X86_HYPER_VENDOR_VMWARE)
41 vmware_set_feature_bits(c);
44 vmware_set_feature_bits(c);
42 return;
43 }
45 else if (boot_cpu_data.x86_hyper_vendor == X86_HYPER_VENDOR_MSFT)
46 ms_hyperv_set_feature_bits(c);
47 return;
44}
45
46void __cpuinit init_hypervisor(struct cpuinfo_x86 *c)
47{
48 detect_hypervisor_vendor(c);
49 hypervisor_set_feature_bits(c);
50}
51
52void __init init_hypervisor_platform(void)
53{
54 init_hypervisor(&boot_cpu_data);
55 if (boot_cpu_data.x86_hyper_vendor == X86_HYPER_VENDOR_VMWARE)
56 vmware_platform_setup();
57}
48}
49
50void __cpuinit init_hypervisor(struct cpuinfo_x86 *c)
51{
52 detect_hypervisor_vendor(c);
53 hypervisor_set_feature_bits(c);
54}
55
56void __init init_hypervisor_platform(void)
57{
58 init_hypervisor(&boot_cpu_data);
59 if (boot_cpu_data.x86_hyper_vendor == X86_HYPER_VENDOR_VMWARE)
60 vmware_platform_setup();
61}