diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2008-07-05 14:43:37 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2008-07-05 14:43:37 +0100 |
commit | 24342075eacb997caed94aaf83f57e521fa70fc9 (patch) | |
tree | 86d3c862a847a94b369c919b659827a0fa2e52b7 /tools | |
parent | 24a06f7ce128efb2188ab30512bd4d9e1dbab754 (diff) | |
download | xen-24342075eacb997caed94aaf83f57e521fa70fc9.tar.gz xen-24342075eacb997caed94aaf83f57e521fa70fc9.tar.bz2 xen-24342075eacb997caed94aaf83f57e521fa70fc9.zip |
numa: Extend MEMOP_ allocation functions to take a node argument.
The address_bits field will be limited to 8 bits and is now embedded
in the mem_flags member, which additionally contains the node number
(limited to 8 bit).
Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/ioemu/vl.c | 5 | ||||
-rw-r--r-- | tools/libxc/xc_domain.c | 22 | ||||
-rw-r--r-- | tools/libxc/xc_private.c | 2 | ||||
-rw-r--r-- | tools/libxc/xenctrl.h | 4 | ||||
-rw-r--r-- | tools/python/xen/lowlevel/xc/xc.c | 34 |
5 files changed, 17 insertions, 50 deletions
diff --git a/tools/ioemu/vl.c b/tools/ioemu/vl.c index 9c4c54d8f1..129e0d4475 100644 --- a/tools/ioemu/vl.c +++ b/tools/ioemu/vl.c @@ -7044,8 +7044,9 @@ int set_mm_mapping(int xc_handle, uint32_t domid, { int err = 0; - err = xc_domain_memory_populate_physmap(xc_handle, domid, nr_pages, 0, - address_bits, extent_start); + err = xc_domain_memory_populate_physmap( + xc_handle, domid, nr_pages, 0, + XENMEMF_address_bits(address_bits), extent_start); if (err) { fprintf(stderr, "Failed to populate physmap\n"); return -1; diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c index f46fe4a671..3b08922067 100644 --- a/tools/libxc/xc_domain.c +++ b/tools/libxc/xc_domain.c @@ -438,14 +438,14 @@ int xc_domain_memory_increase_reservation(int xc_handle, uint32_t domid, unsigned long nr_extents, unsigned int extent_order, - unsigned int address_bits, + unsigned int mem_flags, xen_pfn_t *extent_start) { int err; struct xen_memory_reservation reservation = { .nr_extents = nr_extents, .extent_order = extent_order, - .address_bits = address_bits, + .mem_flags = mem_flags, .domid = domid }; @@ -459,8 +459,8 @@ int xc_domain_memory_increase_reservation(int xc_handle, if ( err >= 0 ) { DPRINTF("Failed allocation for dom %d: " - "%ld extents of order %d, addr_bits %d\n", - domid, nr_extents, extent_order, address_bits); + "%ld extents of order %d, mem_flags %x\n", + domid, nr_extents, extent_order, mem_flags); errno = ENOMEM; err = -1; } @@ -478,7 +478,7 @@ int xc_domain_memory_decrease_reservation(int xc_handle, struct xen_memory_reservation reservation = { .nr_extents = nr_extents, .extent_order = extent_order, - .address_bits = 0, + .mem_flags = 0, .domid = domid }; @@ -507,17 +507,17 @@ int xc_domain_memory_decrease_reservation(int xc_handle, } int xc_domain_memory_populate_physmap(int xc_handle, - uint32_t domid, - unsigned long nr_extents, - unsigned int extent_order, - unsigned int address_bits, - xen_pfn_t *extent_start) + uint32_t domid, + unsigned long nr_extents, + unsigned int extent_order, + unsigned int mem_flags, + xen_pfn_t *extent_start) { int err; struct xen_memory_reservation reservation = { .nr_extents = nr_extents, .extent_order = extent_order, - .address_bits = address_bits, + .mem_flags = mem_flags, .domid = domid }; set_xen_guest_handle(reservation.extent_start, extent_start); diff --git a/tools/libxc/xc_private.c b/tools/libxc/xc_private.c index 8b7770be6e..44cd9cb92b 100644 --- a/tools/libxc/xc_private.c +++ b/tools/libxc/xc_private.c @@ -501,7 +501,7 @@ unsigned long xc_make_page_below_4G( } if ( xc_domain_memory_increase_reservation( - xc_handle, domid, 1, 0, 32, &new_mfn) != 0 ) + xc_handle, domid, 1, 0, XENMEMF_address_bits(32), &new_mfn) != 0 ) { DPRINTF("xc_make_page_below_4G increase failed. mfn=%lx\n",mfn); return 0; diff --git a/tools/libxc/xenctrl.h b/tools/libxc/xenctrl.h index bb10ead825..040f67dc9b 100644 --- a/tools/libxc/xenctrl.h +++ b/tools/libxc/xenctrl.h @@ -611,7 +611,7 @@ int xc_domain_memory_increase_reservation(int xc_handle, uint32_t domid, unsigned long nr_extents, unsigned int extent_order, - unsigned int address_bits, + unsigned int mem_flags, xen_pfn_t *extent_start); int xc_domain_memory_decrease_reservation(int xc_handle, @@ -624,7 +624,7 @@ int xc_domain_memory_populate_physmap(int xc_handle, uint32_t domid, unsigned long nr_extents, unsigned int extent_order, - unsigned int address_bits, + unsigned int mem_flags, xen_pfn_t *extent_start); int xc_domain_ioport_permission(int xc_handle, diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c index af5ac34cd8..932525507f 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -1317,33 +1317,6 @@ static PyObject *pyxc_domain_set_memmap_limit(XcObject *self, PyObject *args) return zero; } -static PyObject *pyxc_domain_memory_increase_reservation(XcObject *self, - PyObject *args, - PyObject *kwds) -{ - uint32_t dom; - unsigned long mem_kb; - unsigned int extent_order = 0 , address_bits = 0; - unsigned long nr_extents; - - static char *kwd_list[] = { "domid", "mem_kb", "extent_order", "address_bits", NULL }; - - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "il|ii", kwd_list, - &dom, &mem_kb, &extent_order, &address_bits) ) - return NULL; - - /* round down to nearest power of 2. Assume callers using extent_order>0 - know what they are doing */ - nr_extents = (mem_kb / (XC_PAGE_SIZE/1024)) >> extent_order; - if ( xc_domain_memory_increase_reservation(self->xc_handle, dom, - nr_extents, extent_order, - address_bits, NULL) ) - return pyxc_error_to_exception(); - - Py_INCREF(zero); - return zero; -} - static PyObject *pyxc_domain_ioport_permission(XcObject *self, PyObject *args, PyObject *kwds) @@ -1817,13 +1790,6 @@ static PyMethodDef pyxc_methods[] = { " map_limitkb [int]: .\n" "Returns: [int] 0 on success; -1 on error.\n" }, - { "domain_memory_increase_reservation", - (PyCFunction)pyxc_domain_memory_increase_reservation, - METH_VARARGS | METH_KEYWORDS, "\n" - "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" }, #ifdef __ia64__ { "nvram_init", (PyCFunction)pyxc_nvram_init, |