arch-specific xc.c code?
Hi Ewan/Alistair, I have a patch that looks like this:
tools/libxc/xenctrl.h +4 -0
@@ -416,6 +416,10 @@ int xc_domain_memory_populate_physmap(inunsigned int address_bits, xen_pfn_t *extent_start); +int xc_alloc_real_mode_area (int xc_handle, +uint32_t domid, +unsigned int log); + int xc_domain_translate_gpfn_list(int xc_handle, uint32_t domid, unsigned long nr_gpfns,
tools/python/xen/lowlevel/xc/xc.c +28 -0
@@ -732,6 +732,26 @@ static PyObject *pyxc_domain_memory_incrreturn zero; } +static PyObject *pyxc_alloc_real_mode_area (XcObject *self, +PyObject *args, +PyObject *kwds) +{ +uint32_t dom; +unsigned int log; + +static char *kwd_list[] = {"dom" ,"log" ,NULL }; + +if ( !PyArg_ParseTupleAndKeywords (args, kwds,"ii" , kwd_list, + &dom, &log) ) +return NULL ; + +if (xc_alloc_real_mode_area (self->xc_handle, dom, log) ) +return PyErr_SetFromErrno (xc_error); + +Py_INCREF (zero); +return zero; +} +static PyObject *pyxc_domain_ioport_permission (XcObject *self,PyObject *args,PyObject *kwds)
@@ -1088,6 +1108,14 @@ static PyMethodDef pyxc_methods[] = {"Increase a domain's memory reservation\n" " dom [int]: Identifier of domain.\n" " mem_kb [long]: .\n" + "Returns: [int] 0 on success; -1 on error.\n" }, + + { "alloc_real_mode_area", + (PyCFunction )pyxc_alloc_real_mode_area, +METH_VARARGS |METH_KEYWORDS ,"\n" +"Allocate a domain's real mode area.\n" +" dom [int]: Identifier of domain.\n" +" log [int]: Specifies the area's size.\n" "Returns: [int] 0 on success; -1 on error.\n" }, { "domain_ioport_permission",
xc_alloc_real_mode_area() is a PowerPC-specific libxc function. How would you like this handled in xc.c? Just an ifdef?
Signature · 2 lines
Hollis Blanchard IBM Linux Technology Center
Quoted 6 lines · Hollis Blanchard
Hi Ewan/Alistair, I have a patch that looks like this:
[Snip]
xc_alloc_real_mode_area()is a PowerPC-specific libxc function. How would you like this handled inxc.c? Just an ifdef?
I'd like the xc object to be a direct reflection of what's in libxenguest and libxenctrl, so if you've got an arch-specific #ifdef that puts this function into libxc, then yes, just using that would be fine. (I don't see that function in my tree, so I can't see for myself which library it ends up in).
Ewan.
Quoted 11 lines · Ewan Mellor
Quoted 4 lines · Hollis Blanchard
Hi Ewan/Alistair, I have a patch that looks like this:
xc_alloc_real_mode_area()is a PowerPC-specific libxc function. How would you like this handled inxc.c? Just an ifdef?I'd like the xc object to be a direct reflection of what's in libxenguest and libxenctrl, so if you've got an arch-specific #ifdef that puts this function into libxc, then yes, just using that would be fine. (I don't see that function in my tree, so I can't see for myself which library it ends up in).
Yeah, I'm adding that function to libxc but wasn't sure how to modify xc.c to expose it. In libxc, whole files are conditionally built (so technically no ifdef is used), but I will add an ifdef to xc.c. Thanks.
Signature · 2 lines
Hollis Blanchard IBM Linux Technology Center
Quoted 8 lines · Hollis Blanchard
Quoted 4 lines
I'd like the xc object to be a direct reflection of what's in libxenguest and libxenctrl, so if you've got an arch-specific #ifdef that puts this function into libxc, then yes, just using that would be fine. (I don't see that function in my tree, so I can't see for myself which library it ends up in).
Yeah, I'm adding that function to libxc but wasn't sure how to modify
xc.cto expose it. In libxc, whole files are conditionally built (so technically no ifdef is used), but I will add an ifdef toxc.c. Thanks.
It'd be nice to have arch-specific files/directories for the Python wrapper too, if that's not too much hassle. An arch-specific file that exported an arch-specific python object that gets attached to the main xc object with name 'arch' would be kind of neat (so that you get at arch-specific functions as e.g., xc.arch.alloc_real(...), making the arch-specific calls immediately obvious).
-- Keir