aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/hvm/nestedhvm.c
diff options
context:
space:
mode:
authorTim Deegan <Tim.Deegan@citrix.com>2011-04-07 11:12:55 +0100
committerTim Deegan <Tim.Deegan@citrix.com>2011-04-07 11:12:55 +0100
commitf08e80a9df74ab40c3da0da4dc059300973e6dbf (patch)
treed00346e3ae218820c6ba52e836761b6150efaff7 /xen/arch/x86/hvm/nestedhvm.c
parentbbfc7c38075c1f5181ff205b5111eddc0a8c76eb (diff)
downloadxen-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.c21
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