aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xc_linux.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix emacs local variable block to use correct C style variable.David Vrabel2013-02-211-1/+1
| | | | | | | The emacs variable to set the C style from a local variable block is c-file-style, not c-set-style. Signed-off-by: David Vrabel <david.vrabel@citrix.com
* tools/libxc: introduce xc_memalign in xc_{minios,linux,solaris,netbsd}.cShriram Rajagopalan2011-12-011-0/+12
| | | | | | | | | | | Move (page aligned) buffer allocations in {os}_privcmd_alloc_hypercall_buffer into a global function xc_memalign. This API is also used by Remus compression code to allocate compression caches that need to be page aligned. Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca> Acked-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Brendan Cully <brendan@cs.ubc.ca> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxc: Do not use dom0 physmem as parameter to lzma decoderIan Jackson2011-01-281-21/+0
| | | | | | | | | | | | | | | | | | It's not clear why a userspace lzma decode would want to use that particular value, what bearing it has on anything or why it would assume it could use 1/3 of the total RAM in the system (potentially quite a large amount of RAM) as opposed to any other limit number. Instead, hardcode 32Mby. This reverts 22830:c80960244942, removes the xc_get_physmem/physmem function entirely, and replaces the expression at the call site with a fixed constant. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <Ian.Campbell@eu.citrix.com> Cc: Christoph Egger <Christoph.Egger@amd.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxc: break xc_get_physmem out into os-dependent filesChristoph Egger2011-01-271-0/+21
| | | | | | | | | | | NetBSD doesn't have sysconf(_SC_PHYS_PAGES). Factor physmem() out into os-dependent files and rename it to xc_get_physmem() so as not to pollute the namespace. Signed-off-by: Christoph Egger <Christoph.Egger@amd.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxc: refactor Linux OS interface into a separate file.Ian Campbell2010-12-031-641/+0
| | | | | | | | | | | This helps ensure that the osdep abstraction is complete by allowing us to avoid including xc_private.h. All the other OS backends could benefit from the same treatment but since I cannot compile test I did not do this. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
* libxc: osdep: Use XC_PAGE_{SHIFT,MASK}.Ian Campbell2010-12-031-12/+12
| | | | | | | Avoid dependency on xc_private.h Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
* libxc: drop fd from xc_interfaceIan Campbell2010-12-031-4/+0
| | | | | | | | Transition to xc_osdep_handle is now complete and nothing uses (or should be using) it. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
* libxc: add ability to query OS interface for "fakeness"Ian Campbell2010-12-031-0/+1
| | | | | | | | | | | | i.e. not running on a real hypervisor Allows users of the library to adjust behaviour. I don't especially like this violation of the abstraction but both oxenstored and xapi use this to avoid difficult to simulate operations when running on the simulator. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
* libxc: osdep: convert xc_gnttab_set_max_grants()Ian Campbell2010-12-031-2/+4
| | | | | Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
* libxc: osdep: convert xc_gnttab_munmap()Ian Campbell2010-12-031-3/+6
| | | | | Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
* libxc: osdep: convert xc_gnttab_map_{grant_ref,grant_refs,domain_grant_refs}()Ian Campbell2010-12-031-14/+26
| | | | | Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
* libxc: osdep: convert xc_evtchn_{pending,unmask}()Ian Campbell2010-12-031-5/+11
| | | | | Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
* libxc: osdep: convert xc_evtchn_unbind()Ian Campbell2010-12-031-2/+4
| | | | | Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
* libxc: osdep: convert xc_evtchn_bind_virq()Ian Campbell2010-12-031-3/+5
| | | | | Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
* libxc: osdep: convert xc_evtchn_bind_interdomain()Ian Campbell2010-12-031-4/+6
| | | | | Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
* libxc: osdep: convert xc_evtchn_bind_unbound_port()Ian Campbell2010-12-031-3/+5
| | | | | Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
* libxc: osdep: convert xc_evtchn_notify()Ian Campbell2010-12-031-2/+4
| | | | | Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
* libxc: osdep: convert xc_evtchn_fd()Ian Campbell2010-12-031-2/+6
| | | | | Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
* libxc: osdep: convert xc_map_foreign_ranges()Ian Campbell2010-12-031-3/+5
| | | | | Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
* libxc: osdep: convert xc_map_foreign_range()Ian Campbell2010-12-031-2/+4
| | | | | Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
* libxc: osdep: convert xc_map_foreign_{batch,bulk}Ian Campbell2010-12-031-14/+21
| | | | | Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
* libxc: osdep: convert do_xen_hypercall()Ian Campbell2010-12-031-11/+10
| | | | | | | do_privcmd() was only ever used by do_xen_hypercall() so remove it. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
* libxc: osdep: add framework for abstracting access to dom0 OS hypervisor ↵Ian Campbell2010-12-031-15/+65
| | | | | | | | | | interfaces. This patch introduces the basic infrastructure and uses it for open and close operations on privcmd, evtchn and gnttab devices. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
* libxc: convert gnttab interfaces to use an opaque handle typeIan Campbell2010-12-231-26/+20
| | | | | | | | | | | | | The xc_interface previously passed to xc_gnttab_* was only used for logging which can now be done via the xc_gnttab handle instead. This makes the interface consistent with the changes made to the main interface in 21483:779c0ef9682c. Also update QEMU_TAG to pull in the corresponding qemu change. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxc: convert evtchn interfaces to use an opaque handle typeIan Campbell2010-12-231-21/+21
| | | | | | | | | | | | This makes the interface consistent with the changes made to the main interface in 21483:779c0ef9682c. Also fix some references to "struct xc_interface" which should have been simply "xc_interface" in tools/xenpaging, and update QEMU_TAG to pull in the corresponding qemu change. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxc: some xc_gnttab_* functions are not Linux specificIan Campbell2010-12-231-126/+0
| | | | | | | | | They simply make hypercalls and perform other operations via the abstract interface. Create xc_gnttab.c and move those functions there. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Christoph Egger <Christoph.Egger@amd.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxc: finalise transition to hypercall buffers.Ian Campbell2010-10-221-1/+1
| | | | | | | | | | | | | | | | | | | | | Rename xc_set_xen_guest_handle to set_xen_guest_handle[0] and remove now unused functions: - xc_memalign - lock_pages - unlock_pages - hcall_buf_prep - hcall_buf_release [0] sed -i -e 's/xc_set_xen_guest_handle/set_xen_guest_handle/g' \ tools/libxc/*.[ch] \ tools/python/xen/lowlevel/xc/xc.c \ tools/python/xen/lowlevel/acm/acm.c \ tools/libxc/ia64/xc_ia64_stubs.c \ tools/security/secpol_tool.c \ tools/misc/xenpm.c Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
* libxc: convert gnttab interfaces over to hypercall buffersIan Campbell2010-10-221-21/+16
| | | | | Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
* libxc: pass an xc_interface handle to page locking functionsIan Campbell2010-10-181-4/+4
| | | | | | | | | Not actually used here but useful to confirm that a handle is passed down to each location where it will be required once we switch to hypercall buffers. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* # HG changeset patchIan Campbell2010-08-241-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | | # User Ian Campbell <ian.campbell@citrix.com> # Date 1282671421 -3600 # Node ID d1dd29a470ef1b9d2c77478a123326036dfe90bb # Parent d7a4adad9c328decbd384d87b23001aea8951b86 tools/libxc, tools/libelf: Relicense under LGPL v2.1 Relicense these two libraries under LGPL v2.1 only except where individual files already included the "or later" provision. Copyright holders have been contacted by Stephen Spector and have all agreed this change. Removed tools/libxc/ia64/aclinux.h since it appeared to be unused. There is a separate, more up to date, copy in xen/include/acpi/platform/aclinux.h which does appear to be used. Clarify the license of MiniOS privcmd.h under the same terms as other tools/include/xen-sys headers. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Stephen Spector <stephen.spector@citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* tools: assume that special Xen devices have been created by the platformKeir Fraser2010-06-021-118/+3
| | | | | | | | | | | | | | | Remove all the magic surrounding the special Xen devices in Linux specific code whereby we attempt to figure out what the correct major:minor number is and check the the existing device has these numbers etc. In 2010 we really should be able to trust that the platform has created the devices correctly or provide correct configuration settings such that they are without resorting to tearing down the platform configured state and rebuilding it. tools/hotplug/Linux/xen-backend.rules already contains the necessary udev rules to create /dev/xen/evtchn and friends in the correct place. Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
* xc: deal with xen/evtchn and xen/gntdev device namesKeir Fraser2010-06-011-43/+49
| | | | | | | | | | | | | | | | | | | | This patch makes xc_linux properly deal with: 1. discovering and creating device nodes if necessary 2. the new form of xen/<dev> device names soon to be used by the kernel This changes the logic slightly: - If a device node already exists with the proper name, then it uses it as-is, assuming it has already been correctly created. - If the path doesn't exist, or it exists but isn't a device node, and it has successfully found the major/minor for the device, then (re)create the device node. Since this logic is identical for gntdev and evtchn, make a common function to handle both. Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
* libxc: eliminate static variables, use xentoollog; API changeKeir Fraser2010-05-281-58/+66
| | | | | | | | | | | | | | | | | | | | This patch eliminate the global variables in libxenctrl (used for logging and error reporting). Instead the information which was in the global variables is now in a new xc_interface* opaque structure, which xc_interface open returns instead of the raw file descriptor; furthermore, logging is done via xentoollog. There are three new parameters to xc_interface_open to control the logging, but existing callers can just pass "0" for all three to get the old behaviour. All libxc callers have been adjusted accordingly. Also update QEMU_TAG for corresponding qemu change. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxc: mmapbatch-v2 adjustmentsKeir Fraser2010-01-221-1/+1
| | | | | | | | | | | | | | | Just like the kernel, the fallback implementation of xc_map_foreign_bulk() should clear the error indication array upon success. Also, a few allocations were needlessly using calloc() instead of malloc(). Finally, in xc_domain_save() allocate the error indicator array once (along with the other arrays) instead of using realloc() (without error checking) in the loop body. Signed-off-by: Jan Beulich <jbeulich@novell.com>
* libxc: Fix IOCTL_PRIVCMD_MMAPBATCH_V2 fallback checkKeir Fraser2010-01-141-1/+1
| | | | | | | | privcmd_ioctl returns EINVAL if the type is not supported. This fixes the guest booting issue caused by C/S 20791. Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com> Signed-off-by: Jan Beulich <jbeulich@novell.com>
* libxc: use new (replacement) mmap-batch ioctlKeir Fraser2010-01-131-4/+129
| | | | | | | | | | | | | | | | | | | | Replace all calls to xc_map_foreign_batch() where the caller doesn't look at the passed in array to check for errors by calls to xc_map_foreign_pages(). Replace all remaining calls by such to the newly introduced xc_map_foreign_bulk(). As a sideband modification (needed while writing the patch to ensure they're unused) eliminate unused parameters to uncanonicalize_pagetable() and xc_map_foreign_batch_single(). Also unmap live_p2m_frame_list earlier in map_and_save_p2m_table(), reducing the peak amount of virtual address space required. All supported OSes other than Linux continue to use the old ioctl for the time being. Also change libxc's MAJOR to 4.0 to reflect the API change. Signed-off-by: Jan Beulich <jbeulich@novell.com>
* Support for -EAGAIN from xc_gnttab_map_grant_ref.Keir Fraser2009-12-171-1/+7
| | | | Signed-off-by: Grzegorz Milos <Grzegorz.Milos@citrix.com>
* libxc support of memory paging.Keir Fraser2009-12-171-1/+44
| | | | | | | | | | | | | libxc accepts the new return code from privcmd mmap, which indicates a page being mapped is actually paged out. Spin until the page is paged in and return as normal to the caller. This allows memory paging to work transparently with existing tools. Since libxc runs in user-space, as does the pager, both processes will be scheduled and run. This enables the page to be paged in without needing to spin in kernel mode (which would cause a dead-lock). Signed-off-by: Patrick Colp <Patrick.Colp@citrix.com>
* General code clean-up of xc_linux.c.Keir Fraser2009-12-171-89/+72
| | | | Signed-off-by: Patrick Colp <Patrick.Colp@citrix.com>
* libxc: fix a few memory leaksKeir Fraser2009-10-231-2/+8
| | | | | | | running qemu with valgrind I found I couple of small memory leaks in libxc, this patch fixes them. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
* libxenctrl: Build fix after gnttab_v2 changes.Keir Fraser2009-10-071-6/+6
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* Introduce a grant_entry_v2 structure.Keir Fraser2009-10-071-1/+31
| | | | Signed-off-by: Steven Smith <steven.smith@citrix.com>
* Rename the struct grant_entry to struct grant_entry_v1, so that itKeir Fraser2009-10-071-3/+3
| | | | | | isn't in the way when we introduce struct grant_entry_v2. Signed-off-by: Steven Smith <steven.smith@citrix.com>
* libxc: Use a single mmap interface to LinuxKeir Fraser2009-07-201-50/+21
| | | | | | | | Modify xc_map_foreign_range and xc_map_foreign_ranges to call mmap_map_foreign_batch. This eliminates the need for multiple privcmd mmap ioctls. Now only IOCTL_PRIVCMD_MMAPBATCH is required. Signed-off-by: Patrick Colp <Patrick.Colp@citrix.com>
* libxc: Add a function to map a domain's grant table.Keir Fraser2009-06-011-0/+105
| | | | Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
* libxc: Fix after xc_map_foreign_ranges() patch.Keir Fraser2008-07-241-6/+6
| | | | | Must munmap() region after loading elf image. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* libxc: Clean up xc_map_foreign_ranges() interface to hide theKeir Fraser2008-07-231-4/+29
| | | | | | | underlying mmap() invocation. From: Christoph Egger <Christoph.Egger@amd.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* libxc: add xc_gnttab_map_domain_grant_refs.Keir Fraser2008-07-211-2/+21
| | | | | | | xc_gnttab_map_domain_grant_refs permits to simply map several pages from the same domain. Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
* libxc: Variable-size gntdev supportKeir Fraser2008-03-181-1/+14
| | | | | | | | This patch adds the ability to set the number of slots that may be used for mapping grant references, using the gntdev user-space grant reference mapping driver. Signed-off-by: Derek Murray <Derek.Murray@cl.cam.ac.uk>
* qemu: more verbose on failures.Keir Fraser2007-11-161-3/+10
| | | | Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>