Commit 4cdb5e83 authored by Charlie Jacobsen's avatar Charlie Jacobsen Committed by Vikram Narayanan

Added header doc to lcd-vmx.h and lcd_vmx_destroy.

lcd_destroy => lcd_vmx_destroy. Pretty much a straight
copy over, but removed some unneeded code.
parent aad218b5
......@@ -95,8 +95,27 @@ struct lcd_vmx {
} msr_autoload;
};
/**
* Initializes the arch-dependent code for LCD (detects required
* features, turns on VMX on *all* cpu's).
*/
int lcd_vmx_init(void);
/**
* Turns off VMX on *all* cpu's and tears down arch-dependent code.
*
* Important: All LCDs should be destroyed before calling this
* routine (otherwise, memory will leak).
*/
void lcd_vmx_exit(void);
/**
* Creates the arch-dependent part of an LCD, and initializes
* the settings and most register values.
*/
struct lcd_vmx *lcd_vmx_create(void);
/**
* Tears down arch-dep part of LCD. (If LCD is launched on
* some cpu, it will become inactive.)
*/
void lcd_vmx_destroy(struct lcd_vmx *vcpu);
#endif /* LCD_VMX_H */
......@@ -1390,7 +1390,7 @@ static void vmx_put_cpu(struct lcd_vmx *vcpu)
}
/* VMX INIT -------------------------------------------------- */
/* VMX CREATE / DESTROY -------------------------------------------------- */
/**
* Reserves a vpid and sets it in the vcpu.
......@@ -1475,8 +1475,45 @@ fail_vcpu:
return NULL;
}
static void lcd_vmx_destroy(struct lcd_vmx *vcpu)
{
/*
* Premption Disabled
*
* The call to vmx_get_cpu is done because if vcpu is
* active on a different cpu, it needs to be
* vmclear'd there (and vmx_get_cpu will do
* that, as a side effect).
*
* There might be alternative ways, but this works ...
*/
vmx_get_cpu(vcpu);
/*
* Invalidate any cached ept and vpid mappings.
*/
invept_single_context(vcpu->eptp);
invvpid_single_context(vcpu->vpid)
/*
* VM clear on this cpu
*/
vmcs_clear(vcpu->vmcs);
__get_cpu_var(local_vcpu) = NULL;
/*
* Preemption enabled
*/
vmx_put_cpu();
/*
* Free remaining junk
*/
vmx_free_vpid(vcpu);
vmx_free_vmcs(vcpu->vmcs);
kfree(vcpu);
}
/* EXPORTS -------------------------------------------------- */
EXPORT_SYMBOL(lcd_vmx_init);
EXPORT_SYMBOL(lcd_vmx_exit);
EXPORT_SYMBOL(lcd_vmx_create);
EXPORT_SYMBOL(lcd_vmx_destroy);
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment