All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandru Isaila <aisaila@bitdefender.com>
To: xen-devel@lists.xen.org
Cc: wei.liu2@citrix.com, andrew.cooper3@citrix.com,
	ian.jackson@eu.citrix.com, paul.durrant@citrix.com,
	jbeulich@suse.com, Alexandru Isaila <aisaila@bitdefender.com>
Subject: [PATCH v19 07/13] x86/hvm: Introduce viridian_save_vcpu_ctxt_one() func
Date: Mon, 10 Sep 2018 15:36:34 +0300	[thread overview]
Message-ID: <20180910123640.496-8-aisaila@bitdefender.com> (raw)
In-Reply-To: <20180910123640.496-1-aisaila@bitdefender.com>

This is used to save data from a single instance.

Signed-off-by: Alexandru Isaila <aisaila@bitdefender.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>

---
Changes since V14:
	- Moved all the operations in the initializer.
---
 xen/arch/x86/hvm/viridian.c | 30 +++++++++++++++++++-----------
 1 file changed, 19 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/hvm/viridian.c b/xen/arch/x86/hvm/viridian.c
index a23d0876c4..2df0127a46 100644
--- a/xen/arch/x86/hvm/viridian.c
+++ b/xen/arch/x86/hvm/viridian.c
@@ -1030,24 +1030,32 @@ static int viridian_load_domain_ctxt(struct domain *d, hvm_domain_context_t *h)
 HVM_REGISTER_SAVE_RESTORE(VIRIDIAN_DOMAIN, viridian_save_domain_ctxt,
                           viridian_load_domain_ctxt, 1, HVMSR_PER_DOM);
 
-static int viridian_save_vcpu_ctxt(struct domain *d, hvm_domain_context_t *h)
+static int viridian_save_vcpu_ctxt_one(struct vcpu *v, hvm_domain_context_t *h)
 {
-    struct vcpu *v;
+    struct hvm_viridian_vcpu_context ctxt = {
+        .vp_assist_msr = v->arch.hvm.viridian.vp_assist.msr.raw,
+        .vp_assist_pending = v->arch.hvm.viridian.vp_assist.pending,
+    };
 
-    if ( !is_viridian_domain(d) )
+    if ( !is_viridian_domain(v->domain) )
         return 0;
 
-    for_each_vcpu( d, v ) {
-        struct hvm_viridian_vcpu_context ctxt = {
-            .vp_assist_msr = v->arch.hvm.viridian.vp_assist.msr.raw,
-            .vp_assist_pending = v->arch.hvm.viridian.vp_assist.pending,
-        };
+    return hvm_save_entry(VIRIDIAN_VCPU, v->vcpu_id, h, &ctxt);
+}
+
+static int viridian_save_vcpu_ctxt(struct domain *d, hvm_domain_context_t *h)
+{
+    struct vcpu *v;
+    int err = 0;
 
-        if ( hvm_save_entry(VIRIDIAN_VCPU, v->vcpu_id, h, &ctxt) != 0 )
-            return 1;
+    for_each_vcpu ( d, v )
+    {
+        err = viridian_save_vcpu_ctxt_one(v, h);
+        if ( err )
+            break;
     }
 
-    return 0;
+    return err;
 }
 
 static int viridian_load_vcpu_ctxt(struct domain *d, hvm_domain_context_t *h)
-- 
2.17.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2018-09-10 12:36 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-10 12:36 [PATCH v19 00/13] x86/domctl: Save info for one vcpu instance Alexandru Isaila
2018-09-10 12:36 ` [PATCH v19 01/13] x86/cpu: Introduce vmce_save_vcpu_ctxt_one() func Alexandru Isaila
2018-09-10 12:36 ` [PATCH v19 02/13] x86/hvm: Introduce hvm_save_tsc_adjust_one() func Alexandru Isaila
2018-09-10 12:36 ` [PATCH v19 03/13] x86/hvm: Introduce hvm_save_cpu_ctxt_one func Alexandru Isaila
2018-09-10 12:36 ` [PATCH v19 04/13] x86/hvm: Introduce hvm_save_cpu_xsave_states_one Alexandru Isaila
2018-09-10 12:36 ` [PATCH v19 05/13] x86/hvm: Introduce hvm_save_cpu_msrs_one func Alexandru Isaila
2018-09-10 12:36 ` [PATCH v19 06/13] x86/hvm: Introduce hvm_save_mtrr_msr_one func Alexandru Isaila
2018-09-10 12:36 ` Alexandru Isaila [this message]
2018-09-10 12:36 ` [PATCH v19 08/13] x86/hvm: Introduce lapic_save_hidden_one Alexandru Isaila
2018-09-10 12:36 ` [PATCH v19 09/13] x86/hvm: Introduce lapic_save_regs_one func Alexandru Isaila
2018-09-10 12:36 ` [PATCH v19 10/13] x86/hvm: Add handler for save_one funcs Alexandru Isaila
2018-09-10 12:36 ` [PATCH v19 11/13] x86/domctl: Use hvm_save_vcpu_handler Alexandru Isaila
2018-09-10 12:36 ` [PATCH v19 12/13] x86/hvm: Remove redundant save functions Alexandru Isaila
2018-09-10 13:33   ` Isaila Alexandru
2018-09-10 13:42     ` Jan Beulich
2018-09-10 13:54       ` Isaila Alexandru
2018-09-10 14:05         ` Jan Beulich
2018-09-10 12:36 ` [PATCH v19 13/13] x86/domctl: Don't pause the whole domain if only getting vcpu state Alexandru Isaila
2018-09-10 13:25   ` Jan Beulich
2018-09-10 13:29     ` Isaila Alexandru
2018-09-10 13:35       ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180910123640.496-8-aisaila@bitdefender.com \
    --to=aisaila@bitdefender.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=paul.durrant@citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.