aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xc_private.c
Commit message (Collapse)AuthorAgeFilesLines
...
* libxc: Consolidate read()/write() syscall wrappers to read/write anKeir Fraser2007-11-111-0/+36
| | | | | | | exact number of bytes. The consolidated versions are more watertight than the various versions previously distributed around the library source code. Signed-off-by: Keir Fraser <keir@xensource.com>
* Initialize last_error in libxc.Keir Fraser2007-10-051-0/+1
| | | | Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
* libxenctrl: Fix lock_pages()/unlock_pages() region-size calculation.Keir Fraser2007-10-011-2/+4
| | | | Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
* libxc portability fixes for NetBSD.kfraser@localhost.localdomain2007-09-191-16/+79
| | | | | | | | | | | - use MAP_ANON, that is what both (BSD-)Unix and Linux have - change last_error handling to use pthreads - round mlock() parameters to page alignment - cleanup: No need to include <xen/sys/privcmd.h> a second time in xg_private.h Signed-off-by: Christoph Egger <Christoph.Egger@amd.com> Signed-off-by: Keir Fraser <keir@xensource.com>
* tools: Clean up usage of const type qualifier.kfraser@localhost.localdomain2007-06-121-1/+1
| | | | Signed-off-by: Keir Fraser <keir@xensource.com>
* libxc: Clarify xc_mmu interface and make it private.kfraser@localhost.localdomain2007-04-061-5/+5
| | | | Signed-off-by: Keir Fraser <keir@xensource.com>
* hvm: Do not save/restore shared_info gpfn location.kfraser@localhost.localdomain2007-03-191-0/+14
| | | | | | | | | | | | | | | | Instead of kludging a max_gpfn estimate in shared_info, add a new XENMEM command to discover the actual maximum gpfn value as known by the shadow code. This needs to be more robust when we support HVM ballooning in future anyway. One interesting point is that max_gpfn may be close to 4GB even for small-memory HVM guests since for example SVGA LFB is mapped into the I/O hole. We may need to special case the I/O hole somehow, or provide some finer-grained way to find out which parts of the GPFN space are actually used (e.g., get Xen to fill in a bitmap with 1 bit per 1024 pages, or similar). Signed-off-by: Keir Fraser <keir@xensource.com>
* Fix duplicate consts around xc_error declarations.Ewan Mellor2007-03-081-1/+1
| | | | Signed-off-by: Ewan Mellor <ewan@xensource.com>
* libxc: Code format cleanups.Keir Fraser2007-02-241-1/+1
| | | | Signed-off-by: Keir Fraser <keir@xensource.com>
* Remove old elf-parsing code from tools and from Xen.kfraser@localhost.localdomain2007-02-151-20/+0
| | | | Signed-off-by: Keir Fraser <keir@xensource.com>
* Add more xc_error_code values.Emmanuel Ackaouy2007-01-251-0/+4
| | | | | | | | | | | | | XC_INVALID_PARAM such as asking for features unsupported by either xen or guest kernel. XC_OUT_OF_MEMORY no comment ;) Signed-off-by: Gerd Hoffmann <kraxel@suse.de> --- tools/libxc/xc_private.c | 4 ++++ tools/libxc/xenctrl.h | 2 ++ 2 files changed, 6 insertions(+)
* Make domctl/sysctl interfaces 32-/64-bit invariant.kfraser@localhost.localdomain2007-01-241-20/+5
| | | | | | | This kills off a fair amount of unpleasant CONFIG_COMPAT shimming and avoids needing to keep the compat paths in sync as these interfaces continue to develop. Signed-off-by: Keir Fraser <keir@xensource.com>
* Fix byte-to-long bitmap conversions.kaf24@localhost.localdomain2007-01-211-2/+1
| | | | Signed-off-by: Keir Fraser <keir@xensource.com>
* [LIBXC] Convert between byte-based and 64-bit bitmap arrays. Use thiskfraser@localhost.localdomain2007-01-191-0/+31
| | | | | | for conversion of the domctl_cpumap. Original patch from Jimi Xenidis <jimix@watson.ibm.com> Signed-off-by: Keir Fraser <keir@xensource.com>
* [LIBXC] Make strerror() thread-safe by protecting it with a mutex.kfraser@localhost.localdomain2006-12-081-8/+14
| | | | | | Using strerror_r() is made difficult by the different GNU definition, and different distros variously choose the POSIX or GNU prototype. Signed-off-by: Keir Fraser <keir@xensource.com>
* [LIBXC] Clean up use of sterror(). Define a thread-safekfraser@localhost.localdomain2006-12-081-0/+13
| | | | | | version which uses strerror_r(), and tries to cope with the POSIX and GNU versions of that function. Signed-off-by: Keir Fraser <keir@xensource.com>
* [LIBXC] Add an error reporting API to the libxc library.kfraser@localhost.localdomain2006-12-071-0/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - An 'xc_error' struct is used to pass around error details. Currently contains two members 'code' an enumeration of error types, and 'message' a free text description of the specific problem. - The xc_get_last_error() method returns a const pointer to the internal instance of this struct manged by libxc. By returning a const pointer we can add extra members to the end of the struct at any time without worrying about ABI of callers. This will let us provide more fine-grained info if needed in the future. - The xc_error instance is statically defined inside libxc and marked __thread. This ensures that errors are recorded per-thread, and that when dealing with errors we never need to call malloc - all storage needed is statically allocated. - The xc_clear_last_error() method resets any currently recorded error details - The xc_error_code_to_desc() method converts the integer error code into a generic user facing messsage. eg "Invalid kernel". Together with the 'message' field from xc_error, this provides the user visible feedback. eg "Invalid kernel: Non PAE-kernel on PAE host." - A callback can be registered with xc_set_error_handler to receive notification whenever an error is recorded, rather than querying for error details after the fact with xc_get_last_error - If built with -DDEBUG set, a default error handler will be registered which calls fprintf(stderr), thus maintaining current behaviour of logging errors to stderr during developer builds. - The python binding for libxc is updated to use xc_get_last_error to pull out error details whenever appropriate, instead of returning info based on 'errno' - The xc_set_error method is private to libxc internals, and is used for setting error details - The ERROR and PERROR macros have been updated to call xc_set_error automatically specifying XC_INTERNAL_ERROR as the error code. This gives a generic error report for all current failure points - Some uses of the ERROR macro have been replaced with explicit calls to xc_set_error to enable finer grained error reporting. In particular the code dealing with invalid kernel types uses this to report about PAE/architecture/wordsize mismatches The patch has been tested by calling xm create against a varietry of config files defining invalid kernels of various kinds. It has also been tested with libvirt talking to xend. In both cases the error messages were propagated all the way back up the stack. There is only one place where I need to do further work. The suspend & restore APIs in Xend invoke external helper programs rather than calling libxc directly. This means that error details are essentially lost. Since there is already code in XenD which scans STDERR from these programs I will investigate adapting this to extract actual error messages from these helpers. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* [XEN] Cleanups to phys/mach address handling.kfraser@localhost.localdomain2006-11-271-32/+0
| | | | | | | | | | 1. Balloon driver does not need to set M2P entry. This is done by the populate_physmap hypercall. 2. Xen now translates foreign mappings from GMFN->MFN. Tools are simplified because of this. Signed-off-by: Keir Fraser <keir@xensource.com>
* [TOOLS] Uncompress and allocate memory for gzipped kernel and initrd images onIan Campbell2006-10-261-22/+0
| | | | | | | | | the fly. We cannot rely on the length contained in the gzip trailer to determine the length of the decompressed data because images have been observed which have trailing junk. Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
* [LIBXC] Add -Wmissing-prototypes to CFLAGS, fix warnings resulting from that.kfraser@localhost.localdomain2006-10-251-17/+1
| | | | Signed-off-by: Gerd Hoffmann <kraxel@suse.de>
* [SOLARIS] Don't mlock() hypercall buffers.kfraser@localhost.localdomain2006-10-231-40/+56
| | | | | | | On solaris mlock requires a page aligned address and mlock doesn't ensure the pages won't minor page fault. Signed-off-by: Mark Johnson <mark.johnson@sun.com>
* Replace dom0_ops hypercall with three new hypercalls:kfraser@localhost.localdomain2006-08-251-33/+38
| | | | | | | | | | | | | | | | | | | | | | 1. platform_op -- used by dom0 kernel to perform actions on the hardware platform (e.g., MTRR access, microcode update, platform quirks, ...) 2. domctl -- used by management tools to control a specified domain 3. sysctl -- used by management tools for system-wide actions Benefits include more sensible factoring of actions to hypercalls. Also allows tool compatibility to be tracked separately from the dom0 kernel. The assumption is that it will be easier to replace libxenctrl, libxenguest and Xen as a matched set if the dom0 kernel does not need to be replaced too (e.g., because that would require vendor revalidation). From here on we hope to maintain dom0 kernel compatibility. This promise is not extended to tool compatibility beyond the existing guarantee that compatibility will not be broken within a three-level stable release [3.0.2, 3.0.3, etc.]. Signed-off-by: Keir Fraser <keir@xensource.com>
* [IA64] Creates tools/libxc/ia64 directory.awilliam@xenbuild.aw2006-07-111-0/+2
| | | | | | | | | | | | | Split and move xc_ia64_stubs.c into ia64/xc_ia64_hvm_build.c and ia64/xc_ia64_stubs.c Creates ia64/Makefile. Clean up (static in const) in xc_ia64_hvm_build.c Signed-off-by: Tristan Gingold <tristan.gingold@bull.net> [whitespace cleanups in new files] Signed-off-by: Alex Williamson <alex.williamson@hp.com>
* [XEN] getpagframeinfo field name mfn -> gmfn.kfraser@localhost.localdomain2006-07-051-1/+1
| | | | | Signed-off-by: Keir Fraser <keir@xensource.com>
* [LIBXC] Convert all printf/fprintf uses to use a macro instead.kaf24@firebug.cl.cam.ac.uk2006-06-071-5/+5
| | | | | | | Thus all can be disabled at compile time. It would be easy to make enabling/disabling a run-time option too. Signed-off-by: Keir Fraser <keir@xensource.com>
* Represent PFNs with their own type, rather than 'unsigned long'.kaf24@firebug.cl.cam.ac.uk2006-06-061-19/+21
| | | | | | ('long' changes size and alignment between 32- and 64-bit ABIs.) Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
* Create new vmassist type 'pae_extended_cr3'. Only advertisekaf24@firebug.cl.cam.ac.uk2006-06-051-0/+22
| | | | | | | | | pae_pgdir_above_4gb tp guests that have enabled this vmassist. Control tools ensure all PAE page directories are below 4GB unless the vmassist is enabled (triggered via an extended-cr3 option in guest Elf header). Signed-off-by: Keir Fraser <keir@xensource.com>
* [PAE] Allow pgdirs above 4GB for paravirt guests.kaf24@firebug.cl.cam.ac.uk2006-05-261-22/+0
| | | | | | | | **NOTE**: This obviates the need for lowmem_emergency_pool. Unpriv guests no longer need to be able to allocate memory below 4GB for PAE PDPTs. Signed-off-by: Keir Fraser <keir@xensource.com>
* Move Linux-specific privcmd code into private libxc implementations.kaf24@firebug.cl.cam.ac.uk2006-05-021-57/+0
| | | | | | | | | Make header path for kernel's privcmd/evtchn headers generic. Remove pointless xi_*() interface that was using private libxc interfaces. Signed-off-by: John Levon <john.levon@sun.com>
* Rename {SG}ET_XEN_GUEST_HANDLE to {sg}et_Xen_guest_handle, as theykaf24@firebug.cl.cam.ac.uk2006-04-281-10/+10
| | | | | | | are function macros rather than define/declare macros. Signed-off-by: Keir Fraser <keir@xensource.com>
* Fix memory_op hypercall mlock/munlock wrapping after thekaf24@firebug.cl.cam.ac.uk2006-04-271-2/+2
| | | | | | | GET/SET_XEN_GUEST_HANDLE patch. Signed-off-by: Keir Fraser <keir@xensource.com>
* Wrap all GUEST_HANDLEs in structures, and define SET/GET macros to access themkaf24@firebug.cl.cam.ac.uk2006-04-271-13/+24
| | | | | | | in Linux and libxc. Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
* Fix whitespace in libxc. Tabs are manually fixed.kaf24@firebug.cl.cam.ac.uk2006-04-151-16/+16
| | | | | | | | Trailing whitespace removed with: perl -p -i -e 's/\s+$/\n/g' tools/libxc/*.[ch] Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
* Remove unnecessary zlib includes.kaf24@firebug.cl.cam.ac.uk2006-03-231-1/+0
| | | | | | Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
* Replace memory_op subcommands reserved_phys_area and map_shared_infokaf24@firebug.cl.cam.ac.uk2006-03-101-4/+4
| | | | | | | | | | | with new subcommand add_to_physmap. This changes the domain0 tools interface, but only when building shadow-translate-mode guests. Signed-off-by: Keir Fraser <keir@xensource.com>
* Clean up internal libxc functions to take 'const char *'kaf24@firebug.cl.cam.ac.uk2006-03-091-2/+2
| | | | | | | | parameters where possible, to avoid unnecessary casts. Signed-off-by: Keir Fraser <keir@xensource.com>
* New memory_op subcall XENMEM_translate_gpfn_list.kaf24@firebug.cl.cam.ac.uk2006-02-161-0/+26
| | | | | | | | | Allows translation from GPFNs to MFNs for an auto-translated guest. Signed-off-by: Keir Fraser <keir@xensource.com>
* Fix some more pfn/mfn/gmfn/gpfn inconsistencies. Fix some directkaf24@firebug.cl.cam.ac.uk2006-02-021-1/+1
| | | | | | | | uses of max_page variable to use the mfn_valid() predicate. Signed-off-by: Keir Fraser <keir@xensource.com>
* Replace the MMUEXTOP 'pfn hole' commands with a newkaf24@firebug.cl.cam.ac.uk2006-01-281-0/+12
| | | | | | | | arch-specific XENMEM_ operation. Signed-off-by: Keir Fraser <keir@xensource.com>
* Create a block of reserved PFNs in shadow translate mode guests, andsos22@douglas.cl.cam.ac.uk2006-01-261-29/+0
| | | | | | | | | | | | | | move the shared info and grant table pfns into that block. This allows us to remove the get_gnttablist dom0 op, and simplifies the domain creation code slightly. Having the reserved block managed by Xen may also make it slightly easier to handle the case where the grant table needs to be extended at run time. Suggested-by: kaf24 Signed-off-by: Steven Smith, sos22@cam.ac.uk
* Make some basic cases of grant tables work in shadow translate mode.sos22@douglas.cl.cam.ac.uk2006-01-251-0/+29
| | | | | | | | | | | | | This is enough to get block devices to work. Note that this involves assigning PFNs to the machine frames used for the grant table structures. While I'm here, I also assigned a PFN to the shared info frame. Signed-off-by: Steven Smith, sos22@cam.ac.uk
* Implement new memory_op() XENMEM_machphys_mfn_list. Replaces oldkaf24@firebug.cl.cam.ac.uk2005-11-251-0/+20
| | | | | | | | privcmd Linux ioctl and includes an implementation for x86/64. Signed-off-by: Keir Fraser <keir@xensource.com>
* Make it possible to run valgrind on code linked with the libxc libraries.emellor@leeni.uk.xensource.com2005-11-221-8/+16
| | | | | | | | | | | | | | Valgrind cannot see when a hypercall has initialised entries in a data structure, so appropriate memsets have been placed before using dom0_op_t, privcmd_hypercall_t, and a couple of miscellaneous blocks passed into this layer. This initialises the block so that valgrind considers it to be valid, but the data therein will be immediately overwritten by the hypercall, all being well. These changes are semantically neutral if -DVALGRIND is not set. Signed-off-by: Ewan Mellor <ewan@xensource.com>
* Update the memory_op() hypercall. Add two new subcommands, tokaf24@firebug.cl.cam.ac.uk2005-11-211-10/+0
| | | | | | | | | | | | | query a domain's current and maximum memory reservation. Also, XENMEM_maximum_ram_page now returns the max_page directly, rather than writing through a passed-in pointer. Also, disable PAE in the default config (accidentally checked in two changesets ago). Signed-off-by: Keir Fraser <keir@xensource.com>
* Many fixes for save/restore and related areas for PAE in particular. Nowsmh22@firebug.cl.cam.ac.uk2005-11-161-12/+0
| | | | | | | | should be able to save/restore successfully on machines with up to 16GB and any size of guest. Signed-off-by: Steven Hand <steven@xensource.com>
* Rename XENVER_parameters to slightly more informativekaf24@firebug.cl.cam.ac.uk2005-11-161-5/+15
| | | | | | | | XENVER_platform_parameters. Signed-off-by: Keir Fraser <keir@xensource.com>
* Clean up xenstore/console shared page initialisation, which iskaf24@firebug.cl.cam.ac.uk2005-11-141-0/+13
| | | | | | | | now handled solely by the domain builder. Signed-off-by: Keir Fraser <keir@xensource.com>
* Revert accidentally applied changes from changesetkaf24@firebug.cl.cam.ac.uk2005-11-141-13/+0
| | | | | | | | 7783:5aad7e145e501fbfb346954950a33b042a963633. Signed-off-by: Keir Fraser <keir@xensource.com>
* If /sbin/ isn't in the path, udev rules will erroneously not getkaf24@firebug.cl.cam.ac.uk2005-11-141-0/+13
| | | | | | | | installed. Signed-off-by: Nivedita Singhvi <niv@us.ibm.com>
* Necessary change to support ia64/vti domain build in common code.djm@kirby.fc.hp.com2005-10-241-40/+0
| | | | | | | | Signed-off-by Ke Yu <ke.yu@intel.com> Signed-off-by Anthony Xu <anthony.xu@intel.com> Signed-off-by Kevin Tian <kevin.tian@intel.com>