ia64/xen-unstable

changeset 12991:e080700efa56

[TOOLS] Fix the build. Clearly demarcate PPC-specific stuff.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Wed Dec 13 10:23:53 2006 +0000 (2006-12-13)
parents 1fa7e524b354
children 65c3287306db
files tools/libxc/xenctrl.h tools/libxc/xenguest.h tools/python/xen/lowlevel/xc/xc.c tools/python/xen/xend/image.py
line diff
     1.1 --- a/tools/libxc/xenctrl.h	Wed Dec 13 10:14:40 2006 +0000
     1.2 +++ b/tools/libxc/xenctrl.h	Wed Dec 13 10:23:53 2006 +0000
     1.3 @@ -447,10 +447,6 @@ int xc_domain_memory_populate_physmap(in
     1.4                                        unsigned int address_bits,
     1.5                                        xen_pfn_t *extent_start);
     1.6  
     1.7 -int xc_alloc_real_mode_area(int xc_handle,
     1.8 -                            uint32_t domid,
     1.9 -                            unsigned int log);
    1.10 -
    1.11  int xc_domain_ioport_permission(int xc_handle,
    1.12                                  uint32_t domid,
    1.13                                  uint32_t first_port,
    1.14 @@ -732,4 +728,8 @@ const char *xc_error_code_to_desc(int co
    1.15   */
    1.16  xc_error_handler xc_set_error_handler(xc_error_handler handler);
    1.17  
    1.18 +/* PowerPC specific. */
    1.19 +int xc_alloc_real_mode_area(int xc_handle,
    1.20 +                            uint32_t domid,
    1.21 +                            unsigned int log);
    1.22  #endif
     2.1 --- a/tools/libxc/xenguest.h	Wed Dec 13 10:14:40 2006 +0000
     2.2 +++ b/tools/libxc/xenguest.h	Wed Dec 13 10:23:53 2006 +0000
     2.3 @@ -122,6 +122,7 @@ int xc_set_hvm_param(
     2.4  int xc_get_hvm_param(
     2.5      int handle, domid_t dom, int param, unsigned long *value);
     2.6  
     2.7 +/* PowerPC specific. */
     2.8  int xc_prose_build(int xc_handle,
     2.9                     uint32_t domid,
    2.10                     unsigned int mem_mb,
     3.1 --- a/tools/python/xen/lowlevel/xc/xc.c	Wed Dec 13 10:14:40 2006 +0000
     3.2 +++ b/tools/python/xen/lowlevel/xc/xc.c	Wed Dec 13 10:23:53 2006 +0000
     3.3 @@ -386,47 +386,6 @@ static PyObject *pyxc_linux_build(XcObje
     3.4                           "console_mfn", console_mfn);
     3.5  }
     3.6  
     3.7 -static PyObject *pyxc_prose_build(XcObject *self,
     3.8 -                                  PyObject *args,
     3.9 -                                  PyObject *kwds)
    3.10 -{
    3.11 -    uint32_t dom;
    3.12 -    char *image, *ramdisk = NULL, *cmdline = "", *features = NULL;
    3.13 -    int flags = 0;
    3.14 -    int store_evtchn, console_evtchn;
    3.15 -    unsigned long store_mfn = 0;
    3.16 -    unsigned long console_mfn = 0;
    3.17 -    void *arch_args = NULL;
    3.18 -    int unused;
    3.19 -
    3.20 -    static char *kwd_list[] = { "dom", "store_evtchn",
    3.21 -                                "console_evtchn", "image",
    3.22 -                                /* optional */
    3.23 -                                "ramdisk", "cmdline", "flags",
    3.24 -                                "features", "arch_args", NULL };
    3.25 -
    3.26 -    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiis|ssiss#", kwd_list,
    3.27 -                                      &dom, &store_evtchn,
    3.28 -                                      &console_evtchn, &image,
    3.29 -                                      /* optional */
    3.30 -                                      &ramdisk, &cmdline, &flags,
    3.31 -                                      &features, &arch_args, &unused) )
    3.32 -        return NULL;
    3.33 -
    3.34 -    if ( xc_prose_build(self->xc_handle, dom, image,
    3.35 -                        ramdisk, cmdline, features, flags,
    3.36 -                        store_evtchn, &store_mfn,
    3.37 -                        console_evtchn, &console_mfn,
    3.38 -                        arch_args) != 0 ) {
    3.39 -        if (!errno)
    3.40 -             errno = EINVAL;
    3.41 -        return PyErr_SetFromErrno(xc_error);
    3.42 -    }
    3.43 -    return Py_BuildValue("{s:i,s:i}", 
    3.44 -                         "store_mfn", store_mfn,
    3.45 -                         "console_mfn", console_mfn);
    3.46 -}
    3.47 -
    3.48  static PyObject *pyxc_hvm_build(XcObject *self,
    3.49                                  PyObject *args,
    3.50                                  PyObject *kwds)
    3.51 @@ -852,28 +811,6 @@ static PyObject *pyxc_domain_memory_incr
    3.52      return zero;
    3.53  }
    3.54  
    3.55 -#ifdef __powerpc__
    3.56 -static PyObject *pyxc_alloc_real_mode_area(XcObject *self,
    3.57 -                                           PyObject *args,
    3.58 -                                           PyObject *kwds)
    3.59 -{
    3.60 -    uint32_t dom;
    3.61 -    unsigned int log;
    3.62 -
    3.63 -    static char *kwd_list[] = { "dom", "log", NULL };
    3.64 -
    3.65 -    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii", kwd_list, 
    3.66 -                                      &dom, &log) )
    3.67 -        return NULL;
    3.68 -
    3.69 -    if ( xc_alloc_real_mode_area(self->xc_handle, dom, log) )
    3.70 -        return PyErr_SetFromErrno(xc_error);
    3.71 -
    3.72 -    Py_INCREF(zero);
    3.73 -    return zero;
    3.74 -}
    3.75 -#endif
    3.76 -
    3.77  static PyObject *pyxc_domain_ioport_permission(XcObject *self,
    3.78                                                 PyObject *args,
    3.79                                                 PyObject *kwds)
    3.80 @@ -982,6 +919,68 @@ static PyObject *dom_op(XcObject *self, 
    3.81      return zero;
    3.82  }
    3.83  
    3.84 +#ifdef __powerpc__
    3.85 +static PyObject *pyxc_alloc_real_mode_area(XcObject *self,
    3.86 +                                           PyObject *args,
    3.87 +                                           PyObject *kwds)
    3.88 +{
    3.89 +    uint32_t dom;
    3.90 +    unsigned int log;
    3.91 +
    3.92 +    static char *kwd_list[] = { "dom", "log", NULL };
    3.93 +
    3.94 +    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii", kwd_list, 
    3.95 +                                      &dom, &log) )
    3.96 +        return NULL;
    3.97 +
    3.98 +    if ( xc_alloc_real_mode_area(self->xc_handle, dom, log) )
    3.99 +        return PyErr_SetFromErrno(xc_error);
   3.100 +
   3.101 +    Py_INCREF(zero);
   3.102 +    return zero;
   3.103 +}
   3.104 +
   3.105 +static PyObject *pyxc_prose_build(XcObject *self,
   3.106 +                                  PyObject *args,
   3.107 +                                  PyObject *kwds)
   3.108 +{
   3.109 +    uint32_t dom;
   3.110 +    char *image, *ramdisk = NULL, *cmdline = "", *features = NULL;
   3.111 +    int flags = 0;
   3.112 +    int store_evtchn, console_evtchn;
   3.113 +    unsigned long store_mfn = 0;
   3.114 +    unsigned long console_mfn = 0;
   3.115 +    void *arch_args = NULL;
   3.116 +    int unused;
   3.117 +
   3.118 +    static char *kwd_list[] = { "dom", "store_evtchn",
   3.119 +                                "console_evtchn", "image",
   3.120 +                                /* optional */
   3.121 +                                "ramdisk", "cmdline", "flags",
   3.122 +                                "features", "arch_args", NULL };
   3.123 +
   3.124 +    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiis|ssiss#", kwd_list,
   3.125 +                                      &dom, &store_evtchn,
   3.126 +                                      &console_evtchn, &image,
   3.127 +                                      /* optional */
   3.128 +                                      &ramdisk, &cmdline, &flags,
   3.129 +                                      &features, &arch_args, &unused) )
   3.130 +        return NULL;
   3.131 +
   3.132 +    if ( xc_prose_build(self->xc_handle, dom, image,
   3.133 +                        ramdisk, cmdline, features, flags,
   3.134 +                        store_evtchn, &store_mfn,
   3.135 +                        console_evtchn, &console_mfn,
   3.136 +                        arch_args) != 0 ) {
   3.137 +        if (!errno)
   3.138 +             errno = EINVAL;
   3.139 +        return PyErr_SetFromErrno(xc_error);
   3.140 +    }
   3.141 +    return Py_BuildValue("{s:i,s:i}", 
   3.142 +                         "store_mfn", store_mfn,
   3.143 +                         "console_mfn", console_mfn);
   3.144 +}
   3.145 +#endif /* powerpc */
   3.146  
   3.147  static PyMethodDef pyxc_methods[] = {
   3.148      { "handle",
   3.149 @@ -1109,18 +1108,6 @@ static PyMethodDef pyxc_methods[] = {
   3.150        " vcpus   [int, 1]:   Number of Virtual CPUS in domain.\n\n"
   3.151        "Returns: [int] 0 on success; -1 on error.\n" },
   3.152  
   3.153 -    { "prose_build", 
   3.154 -      (PyCFunction)pyxc_prose_build, 
   3.155 -      METH_VARARGS | METH_KEYWORDS, "\n"
   3.156 -      "Build a new Linux guest OS.\n"
   3.157 -      " dom     [int]:      Identifier of domain to build into.\n"
   3.158 -      " image   [str]:      Name of kernel image file. May be gzipped.\n"
   3.159 -      " ramdisk [str, n/a]: Name of ramdisk file, if any.\n"
   3.160 -      " cmdline [str, n/a]: Kernel parameters, if any.\n\n"
   3.161 -      " vcpus   [int, 1]:   Number of Virtual CPUS in domain.\n\n"
   3.162 -      "Returns: [int] 0 on success; -1 on error.\n" },
   3.163 -
   3.164 -
   3.165      { "hvm_build", 
   3.166        (PyCFunction)pyxc_hvm_build, 
   3.167        METH_VARARGS | METH_KEYWORDS, "\n"
   3.168 @@ -1258,16 +1245,6 @@ static PyMethodDef pyxc_methods[] = {
   3.169        " mem_kb [long]: .\n"
   3.170        "Returns: [int] 0 on success; -1 on error.\n" },
   3.171  
   3.172 -#ifdef __powerpc__
   3.173 -    { "arch_alloc_real_mode_area", 
   3.174 -      (PyCFunction)pyxc_alloc_real_mode_area, 
   3.175 -      METH_VARARGS | METH_KEYWORDS, "\n"
   3.176 -      "Allocate a domain's real mode area.\n"
   3.177 -      " dom [int]: Identifier of domain.\n"
   3.178 -      " log [int]: Specifies the area's size.\n"
   3.179 -      "Returns: [int] 0 on success; -1 on error.\n" },
   3.180 -#endif
   3.181 -
   3.182      { "domain_ioport_permission",
   3.183        (PyCFunction)pyxc_domain_ioport_permission,
   3.184        METH_VARARGS | METH_KEYWORDS, "\n"
   3.185 @@ -1310,6 +1287,27 @@ static PyMethodDef pyxc_methods[] = {
   3.186        " dom        [int]: Domain whose time offset is being set.\n"
   3.187        "Returns: [int] 0 on success; -1 on error.\n" },
   3.188  
   3.189 +#ifdef __powerpc__
   3.190 +    { "arch_alloc_real_mode_area", 
   3.191 +      (PyCFunction)pyxc_alloc_real_mode_area, 
   3.192 +      METH_VARARGS | METH_KEYWORDS, "\n"
   3.193 +      "Allocate a domain's real mode area.\n"
   3.194 +      " dom [int]: Identifier of domain.\n"
   3.195 +      " log [int]: Specifies the area's size.\n"
   3.196 +      "Returns: [int] 0 on success; -1 on error.\n" },
   3.197 +
   3.198 +    { "arch_prose_build", 
   3.199 +      (PyCFunction)pyxc_prose_build, 
   3.200 +      METH_VARARGS | METH_KEYWORDS, "\n"
   3.201 +      "Build a new Linux guest OS.\n"
   3.202 +      " dom     [int]:      Identifier of domain to build into.\n"
   3.203 +      " image   [str]:      Name of kernel image file. May be gzipped.\n"
   3.204 +      " ramdisk [str, n/a]: Name of ramdisk file, if any.\n"
   3.205 +      " cmdline [str, n/a]: Kernel parameters, if any.\n\n"
   3.206 +      " vcpus   [int, 1]:   Number of Virtual CPUS in domain.\n\n"
   3.207 +      "Returns: [int] 0 on success; -1 on error.\n" },
   3.208 +#endif /* __powerpc */
   3.209 +
   3.210      { NULL, NULL, 0, NULL }
   3.211  };
   3.212  
     4.1 --- a/tools/python/xen/xend/image.py	Wed Dec 13 10:14:40 2006 +0000
     4.2 +++ b/tools/python/xen/xend/image.py	Wed Dec 13 10:23:53 2006 +0000
     4.3 @@ -270,15 +270,15 @@ class PPC_ProseImageHandler(LinuxImageHa
     4.4  
     4.5          devtree = FlatDeviceTree.build(self)
     4.6  
     4.7 -        return xc.prose_build(dom            = self.vm.getDomid(),
     4.8 -                              memsize        = mem_mb,
     4.9 -                              image          = self.kernel,
    4.10 -                              store_evtchn   = store_evtchn,
    4.11 -                              console_evtchn = console_evtchn,
    4.12 -                              cmdline        = self.cmdline,
    4.13 -                              ramdisk        = self.ramdisk,
    4.14 -                              features       = self.vm.getFeatures(),
    4.15 -                              arch_args      = devtree.to_bin())
    4.16 +        return xc.arch_prose_build(dom            = self.vm.getDomid(),
    4.17 +                                   memsize        = mem_mb,
    4.18 +                                   image          = self.kernel,
    4.19 +                                   store_evtchn   = store_evtchn,
    4.20 +                                   console_evtchn = console_evtchn,
    4.21 +                                   cmdline        = self.cmdline,
    4.22 +                                   ramdisk        = self.ramdisk,
    4.23 +                                   features       = self.vm.getFeatures(),
    4.24 +                                   arch_args      = devtree.to_bin())
    4.25  
    4.26      def getRequiredShadowMemory(self, shadow_mem_kb, maxmem_kb):
    4.27          """@param shadow_mem_kb The configured shadow memory, in KiB.