WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] nestedhvm: Remove nhvm_{initialise, destr

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] nestedhvm: Remove nhvm_{initialise, destroy, reset}.
From: Xen patchbot-unstable <patchbot@xxxxxxx>
Date: Sat, 09 Apr 2011 23:35:08 +0100
Delivery-date: Sat, 09 Apr 2011 15:35:35 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir@xxxxxxx>
# Date 1302349344 -3600
# Node ID 697ac895c11c6d5d82524de56796cee98fded2a5
# Parent  49626dab36181471ae1fafbdcd7dd66e6e6d349c
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@xxxxxxx>
---


diff -r 49626dab3618 -r 697ac895c11c xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c    Fri Apr 08 16:56:08 2011 +0100
+++ b/xen/arch/x86/hvm/hvm.c    Sat Apr 09 12:42:24 2011 +0100
@@ -4020,26 +4020,6 @@
 }
 #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)
diff -r 49626dab3618 -r 697ac895c11c xen/arch/x86/hvm/nestedhvm.c
--- a/xen/arch/x86/hvm/nestedhvm.c      Fri Apr 08 16:56:08 2011 +0100
+++ b/xen/arch/x86/hvm/nestedhvm.c      Sat Apr 09 12:42:24 2011 +0100
@@ -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 @@
     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 @@
 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 @@
 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
diff -r 49626dab3618 -r 697ac895c11c xen/include/asm-x86/hvm/hvm.h
--- a/xen/include/asm-x86/hvm/hvm.h     Fri Apr 08 16:56:08 2011 +0100
+++ b/xen/include/asm-x86/hvm/hvm.h     Sat Apr 09 12:42:24 2011 +0100
@@ -412,12 +412,6 @@
  * 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

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] nestedhvm: Remove nhvm_{initialise, destroy, reset}., Xen patchbot-unstable <=