[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 1/2] x86/mm: Plumb a error return through {paging, hap, shadow}_vcpu_init()



No functional change yet, but required for subsequent changes.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Tim Deegan <tim@xxxxxxx>
CC: George Dunlap <george.dunlap@xxxxxxxxxxxxx>
---
 xen/arch/x86/domain.c           | 3 ++-
 xen/arch/x86/mm/hap/hap.c       | 3 ++-
 xen/arch/x86/mm/paging.c        | 6 +++---
 xen/arch/x86/mm/shadow/common.c | 3 ++-
 xen/arch/x86/mm/shadow/none.c   | 3 ++-
 xen/include/asm-x86/hap.h       | 2 +-
 xen/include/asm-x86/paging.h    | 2 +-
 xen/include/asm-x86/shadow.h    | 2 +-
 8 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 71c0e3c..4edc4c8 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -384,7 +384,8 @@ int vcpu_initialise(struct vcpu *v)
 
     if ( !is_idle_domain(d) )
     {
-        paging_vcpu_init(v);
+        if ( (rc = paging_vcpu_init(v)) )
+            return rc;
 
         if ( (rc = vcpu_init_fpu(v)) != 0 )
             return rc;
diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c
index 6dbb3cc..2d52dbd 100644
--- a/xen/arch/x86/mm/hap/hap.c
+++ b/xen/arch/x86/mm/hap/hap.c
@@ -641,10 +641,11 @@ static const struct paging_mode hap_paging_protected_mode;
 static const struct paging_mode hap_paging_pae_mode;
 static const struct paging_mode hap_paging_long_mode;
 
-void hap_vcpu_init(struct vcpu *v)
+int hap_vcpu_init(struct vcpu *v)
 {
     v->arch.paging.mode = &hap_paging_real_mode;
     v->arch.paging.nestedmode = &hap_paging_real_mode;
+    return 0;
 }
 
 /************************************************/
diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c
index d964ed5..bd4f469 100644
--- a/xen/arch/x86/mm/paging.c
+++ b/xen/arch/x86/mm/paging.c
@@ -673,12 +673,12 @@ int paging_domain_init(struct domain *d, unsigned int 
domcr_flags)
 }
 
 /* vcpu paging struct initialization goes here */
-void paging_vcpu_init(struct vcpu *v)
+int paging_vcpu_init(struct vcpu *v)
 {
     if ( hap_enabled(v->domain) )
-        hap_vcpu_init(v);
+        return hap_vcpu_init(v);
     else
-        shadow_vcpu_init(v);
+        return shadow_vcpu_init(v);
 }
 
 
diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index a619d65..aa0b8f0 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -81,7 +81,7 @@ int shadow_domain_init(struct domain *d, unsigned int 
domcr_flags)
  * matter to have v->arch.paging.mode pointing to any mode, as long as it can
  * be compiled.
  */
-void shadow_vcpu_init(struct vcpu *v)
+int shadow_vcpu_init(struct vcpu *v)
 {
 #if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC)
     int i, j;
@@ -98,6 +98,7 @@ void shadow_vcpu_init(struct vcpu *v)
     v->arch.paging.mode = is_pv_vcpu(v) ?
                           &SHADOW_INTERNAL_NAME(sh_paging_mode, 4) :
                           &SHADOW_INTERNAL_NAME(sh_paging_mode, 3);
+    return 0;
 }
 
 #if SHADOW_AUDIT
diff --git a/xen/arch/x86/mm/shadow/none.c b/xen/arch/x86/mm/shadow/none.c
index 69e56c5..81ab42a 100644
--- a/xen/arch/x86/mm/shadow/none.c
+++ b/xen/arch/x86/mm/shadow/none.c
@@ -71,8 +71,9 @@ static const struct paging_mode sh_paging_none = {
     .write_p2m_entry               = _write_p2m_entry,
 };
 
-void shadow_vcpu_init(struct vcpu *v)
+int shadow_vcpu_init(struct vcpu *v)
 {
     ASSERT(is_pv_vcpu(v));
     v->arch.paging.mode = &sh_paging_none;
+    return 0;
 }
diff --git a/xen/include/asm-x86/hap.h b/xen/include/asm-x86/hap.h
index 88587c4..ca55328 100644
--- a/xen/include/asm-x86/hap.h
+++ b/xen/include/asm-x86/hap.h
@@ -39,7 +39,7 @@ int   hap_domctl(struct domain *d, xen_domctl_shadow_op_t *sc,
 int   hap_enable(struct domain *d, u32 mode);
 void  hap_final_teardown(struct domain *d);
 void  hap_teardown(struct domain *d, bool *preempted);
-void  hap_vcpu_init(struct vcpu *v);
+int   hap_vcpu_init(struct vcpu *v);
 int   hap_track_dirty_vram(struct domain *d,
                            unsigned long begin_pfn,
                            unsigned long nr,
diff --git a/xen/include/asm-x86/paging.h b/xen/include/asm-x86/paging.h
index cec6bfd..4857871 100644
--- a/xen/include/asm-x86/paging.h
+++ b/xen/include/asm-x86/paging.h
@@ -197,7 +197,7 @@ struct sh_dirty_vram {
 
 /* Initialize the paging resource for vcpu struct. It is called by
  * vcpu_initialise() in domain.c */
-void paging_vcpu_init(struct vcpu *v);
+int paging_vcpu_init(struct vcpu *v);
 
 /* Set up the paging-assistance-specific parts of a domain struct at
  * start of day.  Called for every domain from arch_domain_create() */
diff --git a/xen/include/asm-x86/shadow.h b/xen/include/asm-x86/shadow.h
index 7e1ed3b..da83188 100644
--- a/xen/include/asm-x86/shadow.h
+++ b/xen/include/asm-x86/shadow.h
@@ -52,7 +52,7 @@ int shadow_domain_init(struct domain *d, unsigned int 
domcr_flags);
 
 /* Setup the shadow-specific parts of a vcpu struct. It is called by
  * paging_vcpu_init() in paging.c */
-void shadow_vcpu_init(struct vcpu *v);
+int shadow_vcpu_init(struct vcpu *v);
 
 #ifdef CONFIG_SHADOW_PAGING
 
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.