direct-io.hg
changeset 10893:022f29d4d2b8
[HVM][VMX] Clean up vmx hvm interface functions:
1) define vmx hvm interface functions static.
2) setup hvm interface functions only once.
Signed-off-by: Xin Li <xin.b.li@intel.com>
1) define vmx hvm interface functions static.
2) setup hvm interface functions only once.
Signed-off-by: Xin Li <xin.b.li@intel.com>
author | kfraser@localhost.localdomain |
---|---|
date | Wed Aug 02 09:38:08 2006 +0100 (2006-08-02) |
parents | 556022fb8eb6 |
children | 822c39808e62 |
files | xen/arch/x86/hvm/vmx/vmx.c xen/include/asm-x86/hvm/vmx/vmcs.h |
line diff
1.1 --- a/xen/arch/x86/hvm/vmx/vmx.c Wed Aug 02 09:20:09 2006 +0100 1.2 +++ b/xen/arch/x86/hvm/vmx/vmx.c Wed Aug 02 09:38:08 2006 +0100 1.3 @@ -477,7 +477,7 @@ static void vmx_ctxt_switch_to(struct vc 1.4 vmx_restore_dr(v); 1.5 } 1.6 1.7 -void stop_vmx(void) 1.8 +static void stop_vmx(void) 1.9 { 1.10 if (read_cr4() & X86_CR4_VMXE) 1.11 __vmxoff(); 1.12 @@ -562,7 +562,7 @@ static void fixup_vm86_seg_bases(struct 1.13 BUG_ON(err); 1.14 } 1.15 1.16 -void vmx_load_cpu_guest_regs(struct vcpu *v, struct cpu_user_regs *regs) 1.17 +static void vmx_load_cpu_guest_regs(struct vcpu *v, struct cpu_user_regs *regs) 1.18 { 1.19 vmx_vmcs_enter(v); 1.20 1.21 @@ -588,7 +588,7 @@ void vmx_load_cpu_guest_regs(struct vcpu 1.22 vmx_vmcs_exit(v); 1.23 } 1.24 1.25 -int vmx_realmode(struct vcpu *v) 1.26 +static int vmx_realmode(struct vcpu *v) 1.27 { 1.28 unsigned long rflags; 1.29 1.30 @@ -596,7 +596,7 @@ int vmx_realmode(struct vcpu *v) 1.31 return rflags & X86_EFLAGS_VM; 1.32 } 1.33 1.34 -int vmx_instruction_length(struct vcpu *v) 1.35 +static int vmx_instruction_length(struct vcpu *v) 1.36 { 1.37 unsigned long inst_len; 1.38 1.39 @@ -605,7 +605,7 @@ int vmx_instruction_length(struct vcpu * 1.40 return inst_len; 1.41 } 1.42 1.43 -unsigned long vmx_get_ctrl_reg(struct vcpu *v, unsigned int num) 1.44 +static unsigned long vmx_get_ctrl_reg(struct vcpu *v, unsigned int num) 1.45 { 1.46 switch ( num ) 1.47 { 1.48 @@ -622,7 +622,7 @@ unsigned long vmx_get_ctrl_reg(struct vc 1.49 } 1.50 1.51 /* SMP VMX guest support */ 1.52 -void vmx_init_ap_context(struct vcpu_guest_context *ctxt, 1.53 +static void vmx_init_ap_context(struct vcpu_guest_context *ctxt, 1.54 int vcpuid, int trampoline_vector) 1.55 { 1.56 int i; 1.57 @@ -669,6 +669,28 @@ static int check_vmx_controls(u32 ctrls, 1.58 return 1; 1.59 } 1.60 1.61 +/* Setup HVM interfaces */ 1.62 +static void vmx_setup_hvm_funcs(void) 1.63 +{ 1.64 + if ( hvm_enabled ) 1.65 + return; 1.66 + 1.67 + hvm_funcs.disable = stop_vmx; 1.68 + 1.69 + hvm_funcs.initialize_guest_resources = vmx_initialize_guest_resources; 1.70 + hvm_funcs.relinquish_guest_resources = vmx_relinquish_guest_resources; 1.71 + 1.72 + hvm_funcs.store_cpu_guest_regs = vmx_store_cpu_guest_regs; 1.73 + hvm_funcs.load_cpu_guest_regs = vmx_load_cpu_guest_regs; 1.74 + 1.75 + hvm_funcs.realmode = vmx_realmode; 1.76 + hvm_funcs.paging_enabled = vmx_paging_enabled; 1.77 + hvm_funcs.instruction_length = vmx_instruction_length; 1.78 + hvm_funcs.get_guest_ctrl_reg = vmx_get_ctrl_reg; 1.79 + 1.80 + hvm_funcs.init_ap_context = vmx_init_ap_context; 1.81 +} 1.82 + 1.83 static void vmx_init_hypercall_page(struct domain *d, void *hypercall_page) 1.84 { 1.85 char *p; 1.86 @@ -755,21 +777,7 @@ int start_vmx(void) 1.87 1.88 vmx_save_init_msrs(); 1.89 1.90 - /* Setup HVM interfaces */ 1.91 - hvm_funcs.disable = stop_vmx; 1.92 - 1.93 - hvm_funcs.initialize_guest_resources = vmx_initialize_guest_resources; 1.94 - hvm_funcs.relinquish_guest_resources = vmx_relinquish_guest_resources; 1.95 - 1.96 - hvm_funcs.store_cpu_guest_regs = vmx_store_cpu_guest_regs; 1.97 - hvm_funcs.load_cpu_guest_regs = vmx_load_cpu_guest_regs; 1.98 - 1.99 - hvm_funcs.realmode = vmx_realmode; 1.100 - hvm_funcs.paging_enabled = vmx_paging_enabled; 1.101 - hvm_funcs.instruction_length = vmx_instruction_length; 1.102 - hvm_funcs.get_guest_ctrl_reg = vmx_get_ctrl_reg; 1.103 - 1.104 - hvm_funcs.init_ap_context = vmx_init_ap_context; 1.105 + vmx_setup_hvm_funcs(); 1.106 1.107 hvm_funcs.init_hypercall_page = vmx_init_hypercall_page; 1.108
2.1 --- a/xen/include/asm-x86/hvm/vmx/vmcs.h Wed Aug 02 09:20:09 2006 +0100 2.2 +++ b/xen/include/asm-x86/hvm/vmx/vmcs.h Wed Aug 02 09:38:08 2006 +0100 2.3 @@ -25,7 +25,6 @@ 2.4 #include <public/hvm/vmx_assist.h> 2.5 2.6 extern int start_vmx(void); 2.7 -extern void stop_vmx(void); 2.8 extern void vmcs_dump_vcpu(void); 2.9 extern void vmx_init_vmcs_config(void); 2.10