]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
x86/hvm: introduce lapic_save_regs_one()
authorAlexandru Isaila <aisaila@bitdefender.com>
Mon, 10 Sep 2018 14:26:00 +0000 (16:26 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 12 Sep 2018 14:40:50 +0000 (16:40 +0200)
This is used to save data from a single instance.

Signed-off-by: Alexandru Isaila <aisaila@bitdefender.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/hvm/vlapic.c

index 31c7a66d01ae8b60c5e3268316da7bef877b87d9..8b2955365fb740d567a02a0de1574c16ee04b06e 100644 (file)
@@ -1422,26 +1422,30 @@ static int lapic_save_hidden(struct domain *d, hvm_domain_context_t *h)
     return err;
 }
 
+static int lapic_save_regs_one(struct vcpu *v, hvm_domain_context_t *h)
+{
+    if ( !has_vlapic(v->domain) )
+        return 0;
+
+    if ( hvm_funcs.sync_pir_to_irr )
+        hvm_funcs.sync_pir_to_irr(v);
+
+    return hvm_save_entry(LAPIC_REGS, v->vcpu_id, h, vcpu_vlapic(v)->regs);
+}
+
 static int lapic_save_regs(struct domain *d, hvm_domain_context_t *h)
 {
     struct vcpu *v;
-    struct vlapic *s;
-    int rc = 0;
-
-    if ( !has_vlapic(d) )
-        return 0;
+    int err = 0;
 
     for_each_vcpu ( d, v )
     {
-        if ( hvm_funcs.sync_pir_to_irr )
-            hvm_funcs.sync_pir_to_irr(v);
-
-        s = vcpu_vlapic(v);
-        if ( (rc = hvm_save_entry(LAPIC_REGS, v->vcpu_id, h, s->regs)) != 0 )
+        err = lapic_save_regs_one(v, h);
+        if ( err )
             break;
     }
 
-    return rc;
+    return err;
 }
 
 /*