diff options
author | Keir Fraser <keir@xen.org> | 2011-04-09 12:42:24 +0100 |
---|---|---|
committer | Keir Fraser <keir@xen.org> | 2011-04-09 12:42:24 +0100 |
commit | a2b5f214696a76d24f4f464d77f552b8c2a81879 (patch) | |
tree | b98dc38aafcc3db7edfe284a790e17ed7811384d /xen/arch/x86/hvm/nestedhvm.c | |
parent | a0968ec7530a2ebc91b1384379e2129c3b369af8 (diff) | |
download | xen-a2b5f214696a76d24f4f464d77f552b8c2a81879.tar.gz xen-a2b5f214696a76d24f4f464d77f552b8c2a81879.tar.bz2 xen-a2b5f214696a76d24f4f464d77f552b8c2a81879.zip |
nestedhvm: Remove nhvm_{initialise,destroy,reset}.
They are a pointless level of abstraction beneath nestedhvm_* variants
of the same operations, which all callers should be using.
At the same time, nestedhvm_vcpu_initialise() does not need to call
destroy if initialisation fails. That is the vendor-specific init
function's job (clearing up its own state on failure).
Signed-off-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/arch/x86/hvm/nestedhvm.c')
-rw-r--r-- | xen/arch/x86/hvm/nestedhvm.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/xen/arch/x86/hvm/nestedhvm.c b/xen/arch/x86/hvm/nestedhvm.c index ef9a867527..fb239b9bb4 100644 --- a/xen/arch/x86/hvm/nestedhvm.c +++ b/xen/arch/x86/hvm/nestedhvm.c @@ -25,7 +25,6 @@ #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) @@ -63,7 +62,8 @@ nestedhvm_vcpu_reset(struct vcpu *v) 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); @@ -72,13 +72,11 @@ nestedhvm_vcpu_reset(struct vcpu *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; @@ -87,8 +85,8 @@ nestedhvm_vcpu_initialise(struct vcpu *v) 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 |