]> xenbits.xensource.com Git - xen.git/commitdiff
nestedhvm: Remove nhvm_{initialise,destroy,reset}.
authorKeir Fraser <keir@xen.org>
Sat, 9 Apr 2011 11:42:24 +0000 (12:42 +0100)
committerKeir Fraser <keir@xen.org>
Sat, 9 Apr 2011 11:42:24 +0000 (12:42 +0100)
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>
xen/arch/x86/hvm/hvm.c
xen/arch/x86/hvm/nestedhvm.c
xen/include/asm-x86/hvm/hvm.h

index 1ae4df98f013a34687bd69589dc7b01526b93a03..edeffe06cf901f1e4dda30ee278f81bf06eea5f1 100644 (file)
@@ -4020,26 +4020,6 @@ int hvm_memory_event_int3(unsigned long gla)
 }
 #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)
index ef9a867527fab4b99a53e409a26b93bfacc13377..fb239b9bb4a71d63b561d1cf971e40b684f5d008 100644 (file)
@@ -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
index 1445fd982ee4e7b3c2bf60314937deb2e318e940..12bd8a82b1c5f1ff3e74c6c10efc3b435fa70379 100644 (file)
@@ -412,12 +412,6 @@ static inline int hvm_memory_event_int3(unsigned long gla)
  * 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