Skip to contentSkip to conversation

save restore: new hyper-call

Xen-changelog Hollis Blanchard 3 participants 3 messages Jan 19, 2007 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

This patch breaks PowerPC, which does not supply arch_(get| set)hvm_ctxt(). In fact, I don't see where IA64 supplies these either.

Please revert and refactor into arch_do_domctl(), thanks.

Signature · 2 lines
Hollis Blanchard
IBM Linux Technology Center
Quoted 20 lines · Xen patchbot-unstable

# HG changeset patch
# User Tim Deegan <[email protected]> # Date 1169138884 0
# Node ID 44668189f354a3d928e4e5a37df416ffc2992772 # Parent 1e590ddb127789cfde6ed29eef0127b79bfff2a8 [HVM] save restore: new hyper-call

add a pair of hyper-call for hvm guest context

---
 tools/libxc/xc_domain.c           |   44 +++++++
 tools/libxc/xenctrl.h             |   24 +++
 xen/arch/x86/hvm/hvm.c            |    8 +
 xen/arch/x86/hvm/intercept.c      |  231 ++++++++++++++++++++++++++++++++++++++
 xen/common/domctl.c               |   73 ++++++++++++
 xen/include/asm-x86/hvm/domain.h  |   17 ++
 xen/include/asm-x86/hvm/support.h |  125 ++++++++++++++++++++
 xen/include/public/domctl.h       |   16 ++
 8 files changed, 538 insertions(+)

...

Quoted 90 lines

diff -r 1e590ddb1277 -r 44668189f354 xen/common/domctl.c

xen/common/domctl.c +73 -0
@@ -215,6 +215,39 @@ ret_t do_domctl(XEN_GUEST_HANDLE(xen_dom
     }
     break;
 
+    case XEN_DOMCTL_sethvmcontext:
+    {
+        struct hvm_domain_context *c;
+        struct domain             *d;
+        struct vcpu               *v;
+
+        ret = -ESRCH;
+        if ( (d = find_domain_by_id(op->domain)) == NULL )
+            break;
+
+        ret = -ENOMEM;
+        if ( (c = xmalloc(struct hvm_domain_context)) == NULL )
+            goto sethvmcontext_out;
+
+        v = d->vcpu[0];
+
+        ret = -EFAULT;
+
+#ifndef CONFIG_COMPAT
+        if ( copy_from_guest(c, op->u.hvmcontext.ctxt, 1) != 0 )
+            goto sethvmcontext_out;
+
+        ret = arch_sethvm_ctxt(v, c);
+#endif
+
+        xfree(c);
+
+    sethvmcontext_out:
+        put_domain(d);
+
+    }
+    break;
+
     case XEN_DOMCTL_pausedomain:
     {
         struct domain *d = find_domain_by_id(op->domain);
@@ -552,6 +585,46 @@ ret_t do_domctl(XEN_GUEST_HANDLE(xen_dom
     }
     break;
 
+    case XEN_DOMCTL_gethvmcontext:
+    {
+        struct hvm_domain_context *c;
+        struct domain             *d;
+        struct vcpu               *v;
+
+        ret = -ESRCH;
+        if ( (d = find_domain_by_id(op->domain)) == NULL )
+            break;
+
+        ret = -ENOMEM;
+        if ( (c = xmalloc(struct hvm_domain_context)) == NULL )
+            goto gethvmcontext_out;
+
+        v = d->vcpu[0];
+
+        ret = -ENODATA;
+        if ( !test_bit(_VCPUF_initialised, &v->vcpu_flags) )
+            goto gethvmcontext_out;
+
+        ret = 0;
+        if (arch_gethvm_ctxt(v, c) == -1)
+            ret = -EFAULT;
+
+#ifndef CONFIG_COMPAT
+        if ( copy_to_guest(op->u.hvmcontext.ctxt, c, 1) )
+            ret = -EFAULT;
+
+        xfree(c);
+#endif
+
+        if ( copy_to_guest(u_domctl, op, 1) )
+            ret = -EFAULT;
+
+    gethvmcontext_out:
+        put_domain(d);
+
+    }
+    break;
+
     case XEN_DOMCTL_getvcpuinfo:
     {
         struct domain *d;
#2 lore raw
Quoted 2 lines · Hollis Blanchard

This patch breaks PowerPC, which does not supply arch_(get| set)hvm_ctxt(). In fact, I don't see where IA64 supplies these either.

We don't. This definitely breaks ia64 as well. Thanks,

Alex

Signature · 1 line
Alex Williamson                             HP Open Source & Linux Org.
#3 lore raw
In reply to Hollis Blanchard
Quoted 4 lines · Hollis Blanchard

This patch breaks PowerPC, which does not supply arch_(get| set)hvm_ctxt(). In fact, I don't see where IA64 supplies these either.

Please revert and refactor into arch_do_domctl(), thanks.

Now done.

K.