[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-ia64-devel] catch up new hypercall HYPERVISR_hvm_op for IPF



Hi all,

  We are porting Steven Smith's para drivers for full-VM to IPF.
In the xen-unstable.hg:

  * cs:10911-10912:
    + implement new hypercall called HYPERVISOR_hvm_op.
    + the hypercall has new feature about set/get params.

  We want to catch up this common feature. Thus I'll post the
catch-up patch for IPF. This patch includes:

  * append new hypercall HYPSERVISOR_hvm_op for IPF
    - This patch only includes same feature of x86.
    - We will plan to append the archtecture specific feature for IPF,
      but not yet.
  * append xc_set_hvm_param() to xc_ia64_hvm_build.c
    - This patch includes same feature of x86, but is not used, yet.
  * a part of xen-unstable.hg(cs:10911)
    - This patch is added only for compiling on IPF.
    - If xen-ia64-unstable.hg will be synchronized with
      xen-unstable.hg(cs:10911), the patch is not needed.


Thanks,
- Tsunehisa Doi
# HG changeset patch
# User Doi.Tsunehisa@xxxxxxxxxxxxxx
# Node ID 47afb9c05e3e93cadcd50c4a06785dcb088e5bf3
# Parent  c3e20511c74508c78b4b15e4c3f94f84ce1c3c40
append HYPERVISOR_hvm_op for IPF

Signed-off-by: Tsunehisa Doi <Doi.Tsunehisa@xxxxxxxxxxxxxx>
Signed-off-by: Tomonari Horikoshi <t.horikoshi@xxxxxxxxxxxxxx>

diff -r c3e20511c745 -r 47afb9c05e3e xen/arch/ia64/vmx/vmx_hypercall.c
--- a/xen/arch/ia64/vmx/vmx_hypercall.c Fri Aug 04 09:32:00 2006 -0600
+++ b/xen/arch/ia64/vmx/vmx_hypercall.c Mon Aug 07 21:01:37 2006 +0900
@@ -35,4 +35,53 @@
 #include <asm/dom_fw.h>
 #include <xen/domain.h>
 
-/* This file will include the hypercall code for VT-i domain, soon. */
+long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE(void) arg)
+{
+    long rc = 0;
+
+    switch (op) {
+    case HVMOP_set_param:
+    case HVMOP_get_param:
+    {
+       struct xen_hvm_param a;
+       struct domain *d;
+
+       if (copy_from_guest(&a, arg, 1))
+           return -EFAULT;
+
+       if (a.index < 0 || a.index > HVM_NR_PARAMS) {
+           return -EINVAL;
+       }
+
+       if (a.domid == DOMID_SELF) {
+           get_knownalive_domain(current->domain);
+           d = current->domain;
+       }
+       else if (IS_PRIV(current->domain)) {
+           d = find_domain_by_id(a.domid);
+           if (!d) {
+               return -ESRCH;
+           }
+       }
+       else {
+           return -EPERM;
+       }
+
+       if (op == HVMOP_set_param) {
+           rc = 0;
+           d->arch.hvm_domain.params[a.index] = a.value;
+       }
+       else {
+           rc = d->arch.hvm_domain.params[a.index];
+       }
+
+       put_domain(d);
+       return rc;
+    }
+
+    default:
+       DPRINTK("Bad HVM op %ld.\n", op);
+       rc = -EINVAL;
+    }
+    return rc;
+}
diff -r c3e20511c745 -r 47afb9c05e3e xen/arch/ia64/xen/hypercall.c
--- a/xen/arch/ia64/xen/hypercall.c     Fri Aug 04 09:32:00 2006 -0600
+++ b/xen/arch/ia64/xen/hypercall.c     Mon Aug 07 21:01:37 2006 +0900
@@ -70,7 +70,7 @@ hypercall_t ia64_hypercall_table[] =
        (hypercall_t)do_ni_hypercall,           /*  */
        (hypercall_t)do_event_channel_op,
        (hypercall_t)do_physdev_op,
-       (hypercall_t)do_ni_hypercall,           /*  */
+       (hypercall_t)do_hvm_op,                 /*  */
        (hypercall_t)do_ni_hypercall,           /*  */                  /* 35 */
        (hypercall_t)do_ni_hypercall,           /*  */
        (hypercall_t)do_ni_hypercall,           /*  */
diff -r c3e20511c745 -r 47afb9c05e3e xen/include/asm-ia64/vmx_platform.h
--- a/xen/include/asm-ia64/vmx_platform.h       Fri Aug 04 09:32:00 2006 -0600
+++ b/xen/include/asm-ia64/vmx_platform.h       Mon Aug 07 21:01:37 2006 +0900
@@ -20,6 +20,7 @@
 #define __ASM_IA64_VMX_PLATFORM_H__
 
 #include <public/xen.h>
+#include <public/hvm/params.h>
 #include <public/arch-ia64.h>
 #include <asm/hvm/vioapic.h>
 struct mmio_list;
@@ -27,6 +28,7 @@ typedef struct virtual_platform_def {
     unsigned long       shared_page_va;
     unsigned long       pib_base;
     unsigned char       xtp;
+    unsigned long       params[HVM_NR_PARAMS];
     struct mmio_list    *mmio;
     /* One IOSAPIC now... */
     struct hvm_vioapic  vioapic;
# HG changeset patch
# User Doi.Tsunehisa@xxxxxxxxxxxxxx
# Node ID f9e44dceef9e4a6d809e2d4f7b81dea96bc1c5a5
# Parent  47afb9c05e3e93cadcd50c4a06785dcb088e5bf3
append xc_set_hvm_param for IPF

Signed-off-by: Tsunehisa Doi <Doi.Tsunehisa@xxxxxxxxxxxxxx>
Signed-off-by: Tomonari Horikoshi <t.horikoshi@xxxxxxxxxxxxxx>

diff -r c3e20511c745 tools/libxc/ia64/xc_ia64_hvm_build.c
--- a/tools/libxc/ia64/xc_ia64_hvm_build.c      Fri Aug 04 09:32:00 2006 -0600
+++ b/tools/libxc/ia64/xc_ia64_hvm_build.c      Mon Aug 07 22:15:47 2006 +0900
@@ -6,6 +6,7 @@
 #include <zlib.h>
 #include "xen/arch-ia64.h"
 #include <xen/hvm/ioreq.h>
+#include <xen/hvm/params.h>
 
 static int
 xc_ia64_copy_to_domain_pages(int xc_handle, uint32_t domid, void* src_page,
@@ -38,6 +39,30 @@ error_out:
 error_out:
     free(page_array);
     return -1;
+}
+
+
+static void
+xc_set_hvm_param(int handle, domid_t dom, int param, unsigned long value)
+{
+    DECLARE_HYPERCALL;
+    xen_hvm_param_t arg;
+    int rc;
+
+    hypercall.op     = __HYPERVISOR_hvm_op;
+    hypercall.arg[0] = HVMOP_set_param;
+    hypercall.arg[1] = (unsigned long)&arg;
+    arg.domid = dom;
+    arg.index = param;
+    arg.value = value;
+    if (mlock(&arg, sizeof(arg)) != 0) {
+       PERROR("Could not lock memory for set parameter");
+       return;
+    }
+    rc = do_xen_hypercall(handle, &hypercall);
+    safe_munlock(&arg, sizeof(arg));
+    if (rc < 0)
+       PERROR("set HVM parameter failed (%d)", rc);
 }
 
 
@@ -568,6 +593,11 @@ setup_guest(int xc_handle, uint32_t dom,
         goto error_out;
     }
 
+    xc_set_hvm_param(xc_handle, dom,
+                       HVM_PARAM_STORE_PFN, STORE_PAGE_START>>PAGE_SHIFT);
+    xc_set_hvm_param(xc_handle, dom,
+                       HVM_PARAM_STORE_EVTCHN, store_evtchn);
+
     *store_mfn = page_array[1];
     sp = (shared_iopage_t *)xc_map_foreign_range(xc_handle, dom,
                                PAGE_SIZE, PROT_READ|PROT_WRITE, page_array[0]);
# HG changeset patch
# User Doi.Tsunehisa@xxxxxxxxxxxxxx
# Node ID 46b0d9c2c6bf5917f60a9654e529109e39554257
# Parent  f9e44dceef9e4a6d809e2d4f7b81dea96bc1c5a5
a part of xen-unstable.hg(cs:10911)

Signed-off-by: Tsunehisa Doi <Doi.Tsunehisa@xxxxxxxxxxxxxx>
Signed-off-by: Tomonari Horikoshi <t.horikoshi@xxxxxxxxxxxxxx>

diff -r f9e44dceef9e -r 46b0d9c2c6bf 
linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c
--- a/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c        Mon Aug 07 
21:08:01 2006 +0900
+++ b/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c        Mon Aug 07 
21:16:24 2006 +0900
@@ -270,6 +270,7 @@ static int __init privcmd_init(void)
        set_bit(__HYPERVISOR_sched_op_compat,  hypercall_permission_map);
        set_bit(__HYPERVISOR_event_channel_op_compat,
                hypercall_permission_map);
+       set_bit(__HYPERVISOR_hvm_op,           hypercall_permission_map);
 
        privcmd_intf = create_xen_proc_entry("privcmd", 0400);
        if (privcmd_intf != NULL)
diff -r f9e44dceef9e -r 46b0d9c2c6bf xen/include/public/hvm/params.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/public/hvm/params.h   Mon Aug 07 21:16:24 2006 +0900
@@ -0,0 +1,22 @@
+#ifndef PARAMS_H__
+#define PARAMS_H__
+
+#define HVM_NR_PARAMS 4
+
+#define HVM_PARAM_CALLBACK_IRQ 0
+#define HVM_PARAM_STORE_PFN    1
+#define HVM_PARAM_STORE_EVTCHN 2
+#define HVM_PARAM_APIC_ENABLED 3
+
+#define HVMOP_set_param 0
+#define HVMOP_get_param 1
+
+struct xen_hvm_param {
+    domid_t domid;
+    unsigned index;
+    unsigned long value;
+};
+typedef struct xen_hvm_param xen_hvm_param_t;
+DEFINE_XEN_GUEST_HANDLE(xen_hvm_param_t);
+
+#endif /* PARAMS_H__ */
diff -r 46b0d9c2c6bf -r 074eb4c1c061 xen/include/public/xen.h
--- a/xen/include/public/xen.h  Mon Aug 07 21:16:24 2006 +0900
+++ b/xen/include/public/xen.h  Mon Aug 07 21:46:42 2006 +0900
@@ -66,6 +66,7 @@
 #define __HYPERVISOR_xenoprof_op          31
 #define __HYPERVISOR_event_channel_op     32
 #define __HYPERVISOR_physdev_op           33
+#define __HYPERVISOR_hvm_op               34
 
 /* Architecture-specific hypercall definitions. */
 #define __HYPERVISOR_arch_0               48
diff -r 46b0d9c2c6bf -r 074eb4c1c061 xen/include/xen/hypercall.h
--- a/xen/include/xen/hypercall.h       Mon Aug 07 21:16:24 2006 +0900
+++ b/xen/include/xen/hypercall.h       Mon Aug 07 21:46:42 2006 +0900
@@ -87,4 +87,9 @@ do_nmi_op(
     unsigned int cmd,
     XEN_GUEST_HANDLE(void) arg);
 
+extern long
+do_hvm_op(
+    unsigned long op,
+    XEN_GUEST_HANDLE(void) arg);
+
 #endif /* __XEN_HYPERCALL_H__ */
_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.