# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID 022f29d4d2b8f240ef7aaf5c0b6d352fcb0d2023
# Parent 556022fb8eb6d62846bc106356fb23d3e5201ad1
[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@xxxxxxxxx>
---
xen/arch/x86/hvm/vmx/vmx.c | 50 +++++++++++++++++++++----------------
xen/include/asm-x86/hvm/vmx/vmcs.h | 1
2 files changed, 29 insertions(+), 22 deletions(-)
diff -r 556022fb8eb6 -r 022f29d4d2b8 xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c Wed Aug 02 09:20:09 2006 +0100
+++ b/xen/arch/x86/hvm/vmx/vmx.c Wed Aug 02 09:38:08 2006 +0100
@@ -477,7 +477,7 @@ static void vmx_ctxt_switch_to(struct vc
vmx_restore_dr(v);
}
-void stop_vmx(void)
+static void stop_vmx(void)
{
if (read_cr4() & X86_CR4_VMXE)
__vmxoff();
@@ -562,7 +562,7 @@ static void fixup_vm86_seg_bases(struct
BUG_ON(err);
}
-void vmx_load_cpu_guest_regs(struct vcpu *v, struct cpu_user_regs *regs)
+static void vmx_load_cpu_guest_regs(struct vcpu *v, struct cpu_user_regs *regs)
{
vmx_vmcs_enter(v);
@@ -588,7 +588,7 @@ void vmx_load_cpu_guest_regs(struct vcpu
vmx_vmcs_exit(v);
}
-int vmx_realmode(struct vcpu *v)
+static int vmx_realmode(struct vcpu *v)
{
unsigned long rflags;
@@ -596,7 +596,7 @@ int vmx_realmode(struct vcpu *v)
return rflags & X86_EFLAGS_VM;
}
-int vmx_instruction_length(struct vcpu *v)
+static int vmx_instruction_length(struct vcpu *v)
{
unsigned long inst_len;
@@ -605,7 +605,7 @@ int vmx_instruction_length(struct vcpu *
return inst_len;
}
-unsigned long vmx_get_ctrl_reg(struct vcpu *v, unsigned int num)
+static unsigned long vmx_get_ctrl_reg(struct vcpu *v, unsigned int num)
{
switch ( num )
{
@@ -622,7 +622,7 @@ unsigned long vmx_get_ctrl_reg(struct vc
}
/* SMP VMX guest support */
-void vmx_init_ap_context(struct vcpu_guest_context *ctxt,
+static void vmx_init_ap_context(struct vcpu_guest_context *ctxt,
int vcpuid, int trampoline_vector)
{
int i;
@@ -667,6 +667,28 @@ static int check_vmx_controls(u32 ctrls,
return 0;
}
return 1;
+}
+
+/* Setup HVM interfaces */
+static void vmx_setup_hvm_funcs(void)
+{
+ if ( hvm_enabled )
+ return;
+
+ hvm_funcs.disable = stop_vmx;
+
+ hvm_funcs.initialize_guest_resources = vmx_initialize_guest_resources;
+ hvm_funcs.relinquish_guest_resources = vmx_relinquish_guest_resources;
+
+ hvm_funcs.store_cpu_guest_regs = vmx_store_cpu_guest_regs;
+ hvm_funcs.load_cpu_guest_regs = vmx_load_cpu_guest_regs;
+
+ hvm_funcs.realmode = vmx_realmode;
+ hvm_funcs.paging_enabled = vmx_paging_enabled;
+ hvm_funcs.instruction_length = vmx_instruction_length;
+ hvm_funcs.get_guest_ctrl_reg = vmx_get_ctrl_reg;
+
+ hvm_funcs.init_ap_context = vmx_init_ap_context;
}
static void vmx_init_hypercall_page(struct domain *d, void *hypercall_page)
@@ -755,21 +777,7 @@ int start_vmx(void)
vmx_save_init_msrs();
- /* Setup HVM interfaces */
- hvm_funcs.disable = stop_vmx;
-
- hvm_funcs.initialize_guest_resources = vmx_initialize_guest_resources;
- hvm_funcs.relinquish_guest_resources = vmx_relinquish_guest_resources;
-
- hvm_funcs.store_cpu_guest_regs = vmx_store_cpu_guest_regs;
- hvm_funcs.load_cpu_guest_regs = vmx_load_cpu_guest_regs;
-
- hvm_funcs.realmode = vmx_realmode;
- hvm_funcs.paging_enabled = vmx_paging_enabled;
- hvm_funcs.instruction_length = vmx_instruction_length;
- hvm_funcs.get_guest_ctrl_reg = vmx_get_ctrl_reg;
-
- hvm_funcs.init_ap_context = vmx_init_ap_context;
+ vmx_setup_hvm_funcs();
hvm_funcs.init_hypercall_page = vmx_init_hypercall_page;
diff -r 556022fb8eb6 -r 022f29d4d2b8 xen/include/asm-x86/hvm/vmx/vmcs.h
--- a/xen/include/asm-x86/hvm/vmx/vmcs.h Wed Aug 02 09:20:09 2006 +0100
+++ b/xen/include/asm-x86/hvm/vmx/vmcs.h Wed Aug 02 09:38:08 2006 +0100
@@ -25,7 +25,6 @@
#include <public/hvm/vmx_assist.h>
extern int start_vmx(void);
-extern void stop_vmx(void);
extern void vmcs_dump_vcpu(void);
extern void vmx_init_vmcs_config(void);
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|