}
#endif /* __x86_64__ */
-int nhvm_vcpu_initialise(struct vcpu *v)
-{
- if (hvm_funcs.nhvm_vcpu_initialise)
- return hvm_funcs.nhvm_vcpu_initialise(v);
- return -EOPNOTSUPP;
-}
-
-void nhvm_vcpu_destroy(struct vcpu *v)
-{
- if ( hvm_funcs.nhvm_vcpu_destroy )
- hvm_funcs.nhvm_vcpu_destroy(v);
-}
-
-int nhvm_vcpu_reset(struct vcpu *v)
-{
- if (hvm_funcs.nhvm_vcpu_reset)
- return hvm_funcs.nhvm_vcpu_reset(v);
- return -EOPNOTSUPP;
-}
-
int nhvm_vcpu_hostrestore(struct vcpu *v, struct cpu_user_regs *regs)
{
if (hvm_funcs.nhvm_vcpu_hostrestore)
#include <asm/event.h> /* for local_event_delivery_(en|dis)able */
#include <asm/paging.h> /* for paging_mode_hap() */
-
/* Nested HVM on/off per domain */
bool_t
nestedhvm_enabled(struct domain *d)
nv->nv_flushp2m = 0;
nv->nv_p2m = NULL;
- nhvm_vcpu_reset(v);
+ if ( hvm_funcs.nhvm_vcpu_reset )
+ hvm_funcs.nhvm_vcpu_reset(v);
/* vcpu is in host mode */
nestedhvm_vcpu_exit_guestmode(v);
int
nestedhvm_vcpu_initialise(struct vcpu *v)
{
- int rc;
+ int rc = -EOPNOTSUPP;
- if ( (rc = nhvm_vcpu_initialise(v)) )
- {
- nhvm_vcpu_destroy(v);
- return rc;
- }
+ if ( !hvm_funcs.nhvm_vcpu_initialise ||
+ ((rc = hvm_funcs.nhvm_vcpu_initialise(v)) != 0) )
+ return rc;
nestedhvm_vcpu_reset(v);
return 0;
void
nestedhvm_vcpu_destroy(struct vcpu *v)
{
- if ( nestedhvm_enabled(v->domain) )
- nhvm_vcpu_destroy(v);
+ if ( nestedhvm_enabled(v->domain) && hvm_funcs.nhvm_vcpu_destroy )
+ hvm_funcs.nhvm_vcpu_destroy(v);
}
static void
* Nested HVM
*/
-/* Initialize vcpu's struct nestedhvm */
-int nhvm_vcpu_initialise(struct vcpu *v);
-/* Destroy and free vcpu's struct nestedhvm */
-void nhvm_vcpu_destroy(struct vcpu *v);
-/* Reset vcpu's state when l1 guest disables nested virtualization */
-int nhvm_vcpu_reset(struct vcpu *v);
/* Restores l1 guest state */
int nhvm_vcpu_hostrestore(struct vcpu *v, struct cpu_user_regs *regs);
/* Fill l1 guest's VMCB/VMCS with data provided by generic exit codes