diff options
author | Tim Deegan <Tim.Deegan@citrix.com> | 2011-04-07 11:12:55 +0100 |
---|---|---|
committer | Tim Deegan <Tim.Deegan@citrix.com> | 2011-04-07 11:12:55 +0100 |
commit | f08e80a9df74ab40c3da0da4dc059300973e6dbf (patch) | |
tree | d00346e3ae218820c6ba52e836761b6150efaff7 /xen/arch/x86/hvm/nestedhvm.c | |
parent | bbfc7c38075c1f5181ff205b5111eddc0a8c76eb (diff) | |
download | xen-f08e80a9df74ab40c3da0da4dc059300973e6dbf.tar.gz xen-f08e80a9df74ab40c3da0da4dc059300973e6dbf.tar.bz2 xen-f08e80a9df74ab40c3da0da4dc059300973e6dbf.zip |
x86/hvm: Don't unconditionally set up nested HVM state
for domains that aren't going to use it.
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Diffstat (limited to 'xen/arch/x86/hvm/nestedhvm.c')
-rw-r--r-- | xen/arch/x86/hvm/nestedhvm.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/xen/arch/x86/hvm/nestedhvm.c b/xen/arch/x86/hvm/nestedhvm.c index 601a0b9246..298f34ae1b 100644 --- a/xen/arch/x86/hvm/nestedhvm.c +++ b/xen/arch/x86/hvm/nestedhvm.c @@ -33,12 +33,8 @@ nestedhvm_enabled(struct domain *d) bool_t enabled; enabled = !!(d->arch.hvm_domain.params[HVM_PARAM_NESTEDHVM]); - /* sanity check */ BUG_ON(enabled && !is_hvm_domain(d)); - - if (!is_hvm_domain(d)) - return 0; - + return enabled; } @@ -78,8 +74,11 @@ nestedhvm_vcpu_initialise(struct vcpu *v) { int rc; - rc = nhvm_vcpu_initialise(v); - if (rc) { + if ( !nestedhvm_enabled(v->domain) ) + return 0; + + if ( (rc = nhvm_vcpu_initialise(v)) ) + { nhvm_vcpu_destroy(v); return rc; } @@ -88,13 +87,11 @@ nestedhvm_vcpu_initialise(struct vcpu *v) return 0; } -int +void nestedhvm_vcpu_destroy(struct vcpu *v) { - if (!nestedhvm_enabled(v->domain)) - return 0; - - return nhvm_vcpu_destroy(v); + if ( nestedhvm_enabled(v->domain) ) + nhvm_vcpu_destroy(v); } static void |