WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] [LIBXC] add architecture-specific parameter to x

To: Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] [LIBXC] add architecture-specific parameter to xc_linux_build()
From: Hollis Blanchard <hollisb@xxxxxxxxxx>
Date: Tue, 08 Aug 2006 23:39:33 -0500
Cc: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>, xen-ppc-devel <xen-ppc-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Tue, 08 Aug 2006 21:39:13 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <1155068905.30116.245.camel@xxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: IBM Linux Technology Center
References: <1155068905.30116.245.camel@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Tue, 2006-08-08 at 15:28 -0500, Hollis Blanchard wrote:
> diff -r 375fb1f773c5 -r e74340460b8c tools/python/xen/lowlevel/xc/xc.c
> --- a/tools/python/xen/lowlevel/xc/xc.c       Tue Aug 08 15:11:25 2006 -0500
> +++ b/tools/python/xen/lowlevel/xc/xc.c       Tue Aug 08 15:17:24 2006 -0500
> @@ -331,25 +331,26 @@ static PyObject *pyxc_linux_build(XcObje
>      int store_evtchn, console_evtchn;
>      unsigned long store_mfn = 0;
>      unsigned long console_mfn = 0;
> +    void *arch_args = NULL;
>  
>      static char *kwd_list[] = { "dom", "store_evtchn",
>                                  "console_evtchn", "image",
>                                  /* optional */
>                                  "ramdisk", "cmdline", "flags",
> -                                "features", "arch", NULL };
> -
> -    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiis|ssis", kwd_list,
> +                                "features", "arch_args", NULL };
> +
> +    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiis|ssiss", kwd_list,

The one complication is that PPC's data structure has NULL characters in
it, which the "s" conversion char doesn't like. Instead you must use
"s#" to get the length as well, except I think it's ok to leave it up to
the architecture to handle the length itself (after all, even an int
that has a NULL byte trips this problem). So here is the updated patch.

# HG changeset patch
# User Hollis Blanchard <hollisb@xxxxxxxxxx>
# Date 1155068244 18000
# Node ID e74340460b8cac614ac71d540ca78eb11a0e917f
# Parent  375fb1f773c5ec053d63315e4d942e7d3aeb0cda
[LIBXC] add architecture-specific parameter to xc_linux_build()
On PowerPC, we will pass down the flattened device tree from Python this way.
Other architectures currently leave this unused. Should more than one
parameter be needed in the future, the address of an architecture-specific
structure can be passed instead (i.e. we won't need to add more parameters to
the prototype).
Signed-off-by: Hollis Blanchard <hollisb@xxxxxxxxxx>

diff -r 375fb1f773c5 -r e74340460b8c tools/libxc/powerpc64/xc_linux_build.c
--- a/tools/libxc/powerpc64/xc_linux_build.c    Tue Aug 08 15:11:25 2006 -0500
+++ b/tools/libxc/powerpc64/xc_linux_build.c    Tue Aug 08 15:17:24 2006 -0500
@@ -352,7 +352,8 @@ int xc_linux_build(int xc_handle,
                    unsigned int store_evtchn,
                    unsigned long *store_mfn,
                    unsigned int console_evtchn,
-                   unsigned long *console_mfn)
+                   unsigned long *console_mfn,
+                   void *devtree)
 {
     struct domain_setup_info dsi;
     xen_pfn_t *page_array = NULL;
diff -r 375fb1f773c5 -r e74340460b8c tools/libxc/xc_linux_build.c
--- a/tools/libxc/xc_linux_build.c      Tue Aug 08 15:11:25 2006 -0500
+++ b/tools/libxc/xc_linux_build.c      Tue Aug 08 15:17:24 2006 -0500
@@ -1337,7 +1337,8 @@ int xc_linux_build(int xc_handle,
                    unsigned int store_evtchn,
                    unsigned long *store_mfn,
                    unsigned int console_evtchn,
-                   unsigned long *console_mfn)
+                   unsigned long *console_mfn,
+                   void *unused)
 {
     char *image = NULL;
     unsigned long image_size;
diff -r 375fb1f773c5 -r e74340460b8c tools/libxc/xenguest.h
--- a/tools/libxc/xenguest.h    Tue Aug 08 15:11:25 2006 -0500
+++ b/tools/libxc/xenguest.h    Tue Aug 08 15:17:24 2006 -0500
@@ -55,7 +55,8 @@ int xc_linux_restore(int xc_handle, int 
  * @parm store_evtchn the store event channel for this domain to use
  * @parm store_mfn returned with the mfn of the store page
  * @parm console_evtchn the console event channel for this domain to use
- * @parm conole_mfn returned with the mfn of the console page
+ * @parm console_mfn returned with the mfn of the console page
+ * @parm arch_args architecture-specific data
  * @return 0 on success, -1 on failure
  */
 int xc_linux_build(int xc_handle,
@@ -68,7 +69,8 @@ int xc_linux_build(int xc_handle,
                    unsigned int store_evtchn,
                    unsigned long *store_mfn,
                    unsigned int console_evtchn,
-                   unsigned long *console_mfn);
+                   unsigned long *console_mfn,
+                   void *arch_args);
 
 /**
  * This function will create a domain for a paravirtualized Linux
--- tools/python/xen/lowlevel/xc/xc.c.orig      2006-08-08 23:36:31.000000000 
-0500
+++ tools/python/xen/lowlevel/xc/xc.c   2006-08-08 23:36:34.000000000 -0500
@@ -331,25 +331,27 @@
     int store_evtchn, console_evtchn;
     unsigned long store_mfn = 0;
     unsigned long console_mfn = 0;
+    void *arch_args = NULL;
+    int unused;
 
     static char *kwd_list[] = { "dom", "store_evtchn",
                                 "console_evtchn", "image",
                                 /* optional */
                                 "ramdisk", "cmdline", "flags",
-                                "features", NULL };
+                                "features", "arch_args", NULL };
 
-    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiis|ssis", kwd_list,
+    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiis|ssiss#", kwd_list,
                                       &dom, &store_evtchn,
                                       &console_evtchn, &image,
                                       /* optional */
                                       &ramdisk, &cmdline, &flags,
-                                      &features) )
+                                      &features, &arch_args, &unused) )
         return NULL;
 
     if ( xc_linux_build(self->xc_handle, dom, image,
                         ramdisk, cmdline, features, flags,
                         store_evtchn, &store_mfn,
-                        console_evtchn, &console_mfn) != 0 ) {
+                        console_evtchn, &console_mfn, arch_args) != 0 ) {
         if (!errno)
              errno = EINVAL;
         return PyErr_SetFromErrno(xc_error);


-- 
Hollis Blanchard
IBM Linux Technology Center


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel