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 v11 01/11] x86/cpu: Introduce vmce_save_vcpu_ctxt_one() func
Date: Fri, 13 Jul 2018 12:04:00 +0300	[thread overview]
Message-ID: <1531472650-6718-2-git-send-email-aisaila@bitdefender.com> (raw)
In-Reply-To: <1531472650-6718-1-git-send-email-aisaila@bitdefender.com>

This is used to save data from a single instance.

Signed-off-by: Alexandru Isaila <aisaila@bitdefender.com>

---
Changes since V10:
	- Add memset to 0 for ctxt.
---
 xen/arch/x86/cpu/mcheck/vmce.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/cpu/mcheck/vmce.c b/xen/arch/x86/cpu/mcheck/vmce.c
index e07cd2f..bf58ef5 100644
--- a/xen/arch/x86/cpu/mcheck/vmce.c
+++ b/xen/arch/x86/cpu/mcheck/vmce.c
@@ -349,6 +349,20 @@ int vmce_wrmsr(uint32_t msr, uint64_t val)
     return ret;
 }
 
+static int vmce_save_vcpu_ctxt_one(struct vcpu *v, hvm_domain_context_t *h)
+ {
+    struct hvm_vmce_vcpu ctxt;
+
+    memset(&ctxt, 0, sizeof(ctxt));
+
+    ctxt.caps = v->arch.vmce.mcg_cap;
+    ctxt.mci_ctl2_bank0 = v->arch.vmce.bank[0].mci_ctl2;
+    ctxt.mci_ctl2_bank1 = v->arch.vmce.bank[1].mci_ctl2;
+    ctxt.mcg_ext_ctl = v->arch.vmce.mcg_ext_ctl;
+
+    return hvm_save_entry(VMCE_VCPU, v->vcpu_id, h, &ctxt);
+ }
+
 static int vmce_save_vcpu_ctxt(struct domain *d, hvm_domain_context_t *h)
 {
     struct vcpu *v;
@@ -356,14 +370,7 @@ static int vmce_save_vcpu_ctxt(struct domain *d, hvm_domain_context_t *h)
 
     for_each_vcpu ( d, v )
     {
-        struct hvm_vmce_vcpu ctxt = {
-            .caps = v->arch.vmce.mcg_cap,
-            .mci_ctl2_bank0 = v->arch.vmce.bank[0].mci_ctl2,
-            .mci_ctl2_bank1 = v->arch.vmce.bank[1].mci_ctl2,
-            .mcg_ext_ctl = v->arch.vmce.mcg_ext_ctl,
-        };
-
-        err = hvm_save_entry(VMCE_VCPU, v->vcpu_id, h, &ctxt);
+        err = vmce_save_vcpu_ctxt_one(v, h);
         if ( err )
             break;
     }
-- 
2.7.4


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

  reply	other threads:[~2018-07-13  9:04 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-13  9:03 [PATCH v11 00/11] x86/domctl: Save info for one vcpu instance Alexandru Isaila
2018-07-13  9:04 ` Alexandru Isaila [this message]
2018-07-13 10:29   ` [PATCH v11 01/11] x86/cpu: Introduce vmce_save_vcpu_ctxt_one() func Jan Beulich
2018-07-13 11:19     ` Alexandru Stefan ISAILA
2018-07-13 11:50       ` Jan Beulich
2018-07-13  9:04 ` [PATCH v11 02/11] x86/hvm: Introduce hvm_save_tsc_adjust_one() func Alexandru Isaila
2018-07-13  9:04 ` [PATCH v11 03/11] x86/hvm: Introduce hvm_save_cpu_ctxt_one func Alexandru Isaila
2018-07-13  9:04 ` [PATCH v11 04/11] x86/hvm: Introduce hvm_save_cpu_xsave_states_one Alexandru Isaila
2018-07-13  9:04 ` [PATCH v11 05/11] x86/hvm: Introduce hvm_save_cpu_msrs_one func Alexandru Isaila
2018-07-13  9:04 ` [PATCH v11 06/11] x86/hvm: Introduce hvm_save_mtrr_msr_one func Alexandru Isaila
2018-07-13  9:04 ` [PATCH v11 07/11] x86/hvm: Introduce viridian_save_vcpu_ctxt_one() func Alexandru Isaila
2018-07-13 10:34   ` Jan Beulich
2018-07-13 11:14     ` Alexandru Stefan ISAILA
2018-07-13 11:53       ` Jan Beulich
2018-07-13 13:35         ` Alexandru Stefan ISAILA
2018-07-13  9:04 ` [PATCH v11 08/11] x86/hvm: Add handler for save_one funcs Alexandru Isaila
2018-07-13  9:04 ` [PATCH v11 09/11] x86/domctl: Don't pause the whole domain if only getting vcpu state Alexandru Isaila
2018-07-13  9:04 ` [PATCH v11 10/11] x86/hvm: Remove redundant save functions Alexandru Isaila
2018-07-13  9:04 ` [PATCH v11 11/11] x86/hvm: Remove save_one handler Alexandru Isaila

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=1531472650-6718-2-git-send-email-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.