xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Roger Pau Monne <roger.pau@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Tim Deegan <tim@xen.org>, Ian Jackson <ian.jackson@eu.citrix.com>,
	Ian Campbell <ian.campbell@citrix.com>,
	Jan Beulich <jbeulich@suse.com>,
	Roger Pau Monne <roger.pau@citrix.com>
Subject: [PATCH v3 2/4] xen/save: allow the usage of zeroextend and a fixup function
Date: Wed, 18 Nov 2015 16:37:09 +0000	[thread overview]
Message-ID: <1447864631-4174-3-git-send-email-roger.pau@citrix.com> (raw)
In-Reply-To: <1447864631-4174-1-git-send-email-roger.pau@citrix.com>

With the current compat implementation in the save/restore context handling,
only one compat structure is allowed, and using _zeroextend prevents the
fixup function from being called.

In order to allow for the compat handling layer to be able to handle
different compat versions allow calling the fixup function with
hvm_load_entry_zeroextend.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Tim Deegan <tim@xen.org>
---
 xen/include/xen/hvm/save.h | 29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/xen/include/xen/hvm/save.h b/xen/include/xen/hvm/save.h
index a97694e..22bcdb9 100644
--- a/xen/include/xen/hvm/save.h
+++ b/xen/include/xen/hvm/save.h
@@ -58,19 +58,22 @@ void _hvm_read_entry(struct hvm_domain_context *h,
  * Unmarshalling: check, then copy. Evaluates to zero on success. This load
  * function requires the save entry to be the same size as the dest structure.
  */
-#define _hvm_load_entry(_x, _h, _dst, _strict) ({                       \
-    int r;                                                              \
-    struct hvm_save_descriptor *d                                       \
-        = (struct hvm_save_descriptor *)&(_h)->data[(_h)->cur];         \
-    if ( (r = _hvm_check_entry((_h), HVM_SAVE_CODE(_x),                 \
-               HVM_SAVE_LENGTH(_x), (_strict))) == 0 )                  \
-        _hvm_read_entry((_h), (_dst), HVM_SAVE_LENGTH(_x));             \
-    else if (HVM_SAVE_HAS_COMPAT(_x)                                    \
-             && (r = _hvm_check_entry((_h), HVM_SAVE_CODE(_x),          \
-                       HVM_SAVE_LENGTH_COMPAT(_x), (_strict))) == 0 ) { \
-        _hvm_read_entry((_h), (_dst), HVM_SAVE_LENGTH_COMPAT(_x));      \
-        r = HVM_SAVE_FIX_COMPAT(_x, (_dst), d->length);                 \
-    }                                                                   \
+#define _hvm_load_entry(_x, _h, _dst, _strict) ({                           \
+    int r;                                                                  \
+    struct hvm_save_descriptor *d                                           \
+        = (struct hvm_save_descriptor *)&(_h)->data[(_h)->cur];             \
+    if ( (r = _hvm_check_entry((_h), HVM_SAVE_CODE(_x),                     \
+               HVM_SAVE_LENGTH(_x), (_strict))) == 0 ) {                    \
+        _hvm_read_entry((_h), (_dst), HVM_SAVE_LENGTH(_x));                 \
+        if ( HVM_SAVE_HAS_COMPAT(_x) && d->length != HVM_SAVE_LENGTH(_x) )  \
+            r = HVM_SAVE_FIX_COMPAT(_x, (_dst), d->length);                 \
+    }                                                                       \
+    else if (HVM_SAVE_HAS_COMPAT(_x)                                        \
+             && (r = _hvm_check_entry((_h), HVM_SAVE_CODE(_x),              \
+                       HVM_SAVE_LENGTH_COMPAT(_x), (_strict))) == 0 ) {     \
+        _hvm_read_entry((_h), (_dst), HVM_SAVE_LENGTH_COMPAT(_x));          \
+        r = HVM_SAVE_FIX_COMPAT(_x, (_dst), d->length);                     \
+    }                                                                       \
     r; })
 
 #define hvm_load_entry(_x, _h, _dst)            \
-- 
1.9.5 (Apple Git-50.3)


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

  parent reply	other threads:[~2015-11-18 16:41 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-18 16:37 [PATCH v3 0/4] Introduce a fpu_initilised field to HVM CPU context Roger Pau Monne
2015-11-18 16:37 ` [PATCH v3 1/4] xen/save: pass a size parameter to the HVM compat functions Roger Pau Monne
2015-11-20 14:17   ` Andrew Cooper
2015-11-20 15:37   ` Jan Beulich
2015-11-24 12:54     ` Roger Pau Monné
2015-11-24 13:06       ` Jan Beulich
2015-11-24 13:11         ` Roger Pau Monné
2015-11-18 16:37 ` Roger Pau Monne [this message]
2015-11-20 14:32   ` [PATCH v3 2/4] xen/save: allow the usage of zeroextend and a fixup function Andrew Cooper
2015-11-20 15:41   ` Jan Beulich
2015-11-18 16:37 ` [PATCH v3 3/4] xen/hvm: introduce a fpu_uninitialised field to the CPU save record Roger Pau Monne
2015-11-20 14:35   ` Andrew Cooper
2015-11-20 15:49   ` Jan Beulich
2015-11-24 13:10     ` Roger Pau Monné
2015-11-24 13:34       ` Jan Beulich
2015-11-24 14:38         ` Roger Pau Monné
2015-11-24 14:48           ` Jan Beulich
2015-11-18 16:37 ` [PATCH v3 4/4] Revert "libxc: create an initial FPU state for HVM guests" Roger Pau Monne

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=1447864631-4174-3-git-send-email-roger.pau@citrix.com \
    --to=roger.pau@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xenproject.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).