aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc
Commit message (Collapse)AuthorAgeFilesLines
* tools: VM generation ID save/restore and migrate.Paul Durrant2011-12-166-6/+73
| | | | | | | | | | | | | | | Add code to track the address of the VM generation ID buffer across a save/restore or migrate, and increment it as necessary. The address of the buffer is written into xenstore by hvmloader at boot time. It must be read from xenstore by the caller of xc_domain_save() and then written back again by the caller of xc_domain_restore(). Note that the changes to xc_save.c and xc_restore.c are merely sufficient for them to build. Signed-off-by: Paul Durrant <paul.durrant@citrix.com> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* Fix types used in xc_memshr_* functionsAndres Lagar-Cavilla2012-01-102-21/+21
| | | | | | | | | | | | | Currently the memshr functions use uint32_t for the domid. This actually leads to a funny domid_t -> uint32_t -> domid_t sequence of casts. This patch updates the API functions to be domid_t in the first place. No tools need to be modified with this patch, the casts were implicit. Signed-off-by: Adin Scannell <adin@scannell.ca> Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org> Acked-by: Ian Jackson <ian.jackson.citrix.com> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* libxc: Only retry mapping pages when ENOENT is returnedAndres Lagar-Cavilla2012-01-101-1/+1
| | | | | | | | | | | If the return value from the ioctl() is not ENOENT, it's possible that err[i] will not be updated and libxc will just loop forever. Although it's unlikely that err[i] would not be updated after the ioctl() gets through at least once, it's better to be defensive. Signed-off-by: Adin Scannell <adin@scannell.ca> Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* X86: Prepare PCID/INVPCID for hvmLiu, Jinsong2011-12-061-0/+2
| | | | | | | | | | This patch is used to prepare exposing PCID/INVPCID features to hvm guest. The specific exposure result depend on hvm paging mode (hap/shadow), which would be handled at next patch. Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com> Committed-by: Keir Fraser <keir@xen.org>
* X86: Disable PCID/INVPCID for pvLiu, Jinsong2011-12-062-0/+3
| | | | | | | This patch disable PCID/INVPCID for pv. Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com> Committed-by: Keir Fraser <keir@xen.org>
* X86: expose Intel new features to pv/hvmLiu, Jinsong2011-12-062-4/+18
| | | | | | | | | | Intel recently release some new features, including FMA/AVX2/BMI1/BMI2/LZCNT/MOVBE. Refer to http://software.intel.com/file/36945 This patch expose these new features to pv and hvm. Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com> Committed-by: Keir Fraser <keir@xen.org>
* tools/libxc: Fix x86_32 build breakage in previous changeset.Keir Fraser2011-12-021-1/+1
| | | | Signed-off-by: Keir Fraser <keir@xen.org>
* tools/x86_64: Fix cpuid() inline asm to not clobber stack's red zoneKeir Fraser2011-12-021-9/+9
| | | | | | | | | | Pushing stuff onto the stack on x86-64 when we do not specify -mno-red-zone is unsafe. Since the complicated asm is due to register pressure on i386, we simply implement an all-new simpler alternative for x86-64. Signed-off-by: Keir Fraser <keir@xen.org> Acked-by: Jan Beulich <jbeulich@novell.com>
* x86/mm: remove 0x55 debug pattern from M2P tableTim Deegan2011-12-022-12/+7
| | | | | | | | It's not really any more useful than explicitly setting new M2P entries to the invalid value. Signed-off-by: Tim Deegan <tim@xen.org> Committed-by: Keir Fraser <keir@xen.org>
* libxc: Fix checks on grant notify argumentsDaniel De Graaf2011-12-011-3/+3
| | | | | | | | | | | The notify offset and event channels are both unsigned variables, so testing for >= 0 will not correctly detect the use of -1 to indicate the field is unused. Remove the useless comparison and replace with correct range checks or comparisons to -1. Reported-by: Anil Madhavapeddy <anil@recoil.org> Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* Tools: Libxc wrappers to automatically fill in page oud page contents on prepareAndres Lagar-Cavilla2011-12-013-2/+27
| | | | | | Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Tim Deegan <tim@xen.org>
* tools/libxc: Remus Checkpoint CompressionShriram Rajagopalan2011-12-017-11/+1015
| | | | | | | | | | | | | | | | | Instead of sending dirty pages of guest memory as-is, use a simple compression algorithm that sends a RLE-encoded XOR of the page against its last sent copy. A small LRU cache is used to hold recently dirtied pages. Pagetable pages are sent as-is, as they are canonicalized at sender side and uncanonicalized at receiver. [ Fixed up a conflict in sg_save_restore.h. I had to increase the ID values used from -11 and -12 to -12 and -13 because -11 had been taken by ..._HVM_VIRIDIAN in the meantime. -iwj ] Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca> Acked-by: Brendan Cully <brendan@cs.ubc.ca> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* tools/libxc: introduce xc_memalign in xc_{minios,linux,solaris,netbsd}.cShriram Rajagopalan2011-12-016-6/+35
| | | | | | | | | | | 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>
* Tools: Add libxc wrapper for p2m audit domctlAndres Lagar-Cavilla2011-12-012-0/+49
| | | | | | Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Tim Deegan <tim@xen.org>
* Tools: When passing no bitmap for the shadow log dirty bitmap clean up, we ↵Andres Lagar-Cavilla2011-12-011-0/+2
| | | | | | | | | | | should not get EFAULT This is due to a stale check for guest_handle_null in the hypervisor, which doesn't necessarily work with the hypercall buffers. Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Tim Deegan <tim@xen.org>
* Fix save/restore for HVM domains with viridian=1Paul Durrant2011-11-253-0/+27
| | | | | | | | | | | | | xc_domain_save/restore currently pay no attention to HVM_PARAM_VIRIDIAN which results in an HVM domain running a recent version on Windows (post-Vista) locking up on a domain restore due to EOIs (done via a viridian MSR write) being silently dropped. This patch adds an extra save entry for the viridian parameter and also adds code in the viridian kernel module to catch attempted use of viridian functionality when the HVM parameter has not been set. Signed-off-by: Paul Durrant <paul.durrant@citrix.com> Committed-by: Keir Fraser <keir@xen.org>
* libxc: add bitmap_clear functionOlaf Hering2011-11-201-0/+6
| | | | | Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* hvmloader: Move acpi_enabled out of hvm_info_table into xenstorePaul Durrant2011-11-181-1/+0
| | | | | | | | | Since hvmloader has a xentore client, use a platform key in xenstore to indicate whether ACPI is enabled or not rather than the shared hvm_info_table structure. Signed-off-by: Paul Durrant <paul.durrant@citrix.com> Committed-by: Keir Fraser <keir@xen.org>
* elf: Fix Elf64 types and structs to match the specification.Keir Fraser2011-11-161-1/+1
| | | | | | | | The layouts were actually correct, but the type names were a bit messed up. Original patch by Volker Eckert <volker.eckert@citrix.com> Signed-off-by: Keir Fraser <keir@xen.org>
* tools/build: Introduce {PREPEND,APPEND}_{LIB,INCLUDES}Roger Pau Monne2011-11-141-3/+3
| | | | | | | | | | | | | | | | | | | | | | | Create two new variables called APPEND_ and PREPEND_ to add compile flags at the beginning or at the end of the search path. Added a new semantic for user defined compile flags, here is the list of possible options: PREPEND_LIB: add libraries to the search path before xen (before xen installation folders). PREPEND_INCLUDES: add headers to the search path before xen (before xen installation folders). APPEND_LIB: add libraries to the search path at the end (after all xen installation folders have been added). APPEND_INCLUDES: add libraries to the search path at the end (after all xen installation folders have been added). EXTRA_INCLUDES and EXTRA_LIB can still be used, and they will have the same effect as PREPEND_INCLUDES and PREPEND_LIB. Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* xen: provide pse36 cpuid bitTim Deegan2011-11-031-3/+7
| | | | | | | | | | | Provide pse36 cpuid bit if guest runs in 32bit PAE or in long mode. Hyper-V refuses to start as the "cpu does not provide required hw features" if it does not find the pse36 cpuid bits. Signed-off-by: Christoph Egger <Christoph.Egger@amd.com> Acked-by: Tim Deegan <tim@xen.org> Committed-by: Tim Deegan <tim@xen.org>
* x86 pm: provide CC7/PC2 residencyYang Zhang2011-10-252-0/+4
| | | | | | | | | Sandy bridge introduces new MSR to get cc7/pc2 residency (core C-state 7/package C-state 2). Print the cc7/pc2 residency when on sandy bridge platform. Signed-off-by: Yang Zhang <yang.z.zhang@intel.com> Committed-by: Keir Fraser <keir@xen.org>
* libxc: osdep: report missing backends in common codeIan Campbell2011-10-133-6/+16
| | | | | | | | | | | Backends were inconsistent about reporting and it's a pain to edit them all when adding a new class of osdep. Signed-off-by: Ian Campbell <Ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson.citrix.com> Committed-by: Ian Jackson <ian.jackson.citrix.com> --- Requires Daniel De Graaf's "libxc: add xc_gntshr_* functions"
* libxc: add xc_gntshr_* functionsDaniel De Graaf2011-10-065-0/+200
| | | | | | | | | These functions and the xc_gntshr device (/dev/xen/gntalloc on linux) allow applications to create pages shared with other domains. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxc: add xc_gnttab_map_grant_ref_notifyDaniel De Graaf2011-10-065-120/+115
| | | | | | | | | | | | | | | Normally, when a userspace process mapping a grant crashes, the domain providing the reference receives no indication that its peer has crashed, possibly leading to unexpected freezes or timeouts. This function provides a notification of the unmap by signalling an event channel and/or clearing a specific byte in the page. This also unifies the 3 very similar grant-mapping osdep interfaces into a single function instead of introducing yet another minor variation. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* xenpaging: track number of paged pages in struct domainOlaf Hering2011-09-262-0/+2
| | | | | | | | | | | | | | | The toolstack should know how many pages are paged-out at a given point in time so it could make smarter decisions about how many pages should be paged or ballooned. Add a new member to xen_domctl_getdomaininfo and bump interface version. Use the new member in xc_dominfo_t. The SONAME of libxc should be changed if this patch gets applied. Signed-off-by: Olaf Hering <olaf@aepfle.de> Acked-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Tim Deegan <tim@xen.org> Committed-by: Tim Deegan <tim@xen.org>
* PCI multi-seg: adjust domctl interfaceJan Beulich2011-09-221-8/+8
| | | | | | | Again, a couple of directly related functions at once get adjusted to account for the segment number. Signed-off-by: Jan Beulich <jbeulich@suse.com>
* mem_event: use different ringbuffers for share, paging and accessOlaf Hering2011-09-166-37/+59
| | | | | | | | | | | | | | | | | | | | | | | Up to now a single ring buffer was used for mem_share, xenpaging and xen-access. Each helper would have to cooperate and pull only its own requests from the ring. Unfortunately this was not implemented. And even if it was, it would make the whole concept fragile because a crash or early exit of one helper would stall the others. What happend up to now is that active xenpaging + memory_sharing would push memsharing requests in the buffer. xenpaging is not prepared for such requests. This patch creates an independet ring buffer for mem_share, xenpaging and xen-access and adds also new functions to enable xenpaging and xen-access. The xc_mem_event_enable/xc_mem_event_disable functions will be removed. The various XEN_DOMCTL_MEM_EVENT_* macros were cleaned up. Due to the removal the API changed, so the SONAME will be changed too. Signed-off-by: Olaf Hering <olaf@aepfle.de> Acked-by: Tim Deegan <tim@xen.org> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Tim Deegan <tim@xen.org>
* libxc: Enable cpuid performance counter leaf for HVMJuergen Gross2011-09-151-0/+1
| | | | | | | | In HVM domains the usable performance counters can be checked automatically only, if cpuid leaf 0x0000000a is accessible. Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* add privileged (dom0) kernel feature indicationJan Beulich2011-07-231-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | With our switching away from supporting 32-bit Dom0 operation, users complained that attempts (perhaps due to lack of knowledge of that change) to boot the no longer privileged kernel in Dom0 resulted in apparently silent failure. To make the mismatch explicit and visible, add dom0 feature flag that the kernel can set to indicate operation as dom0 is supported. Due to the way elf_xen_parse_features() worked up to now (getting fixed here), adding features indications to the old, string based ELF note would make the respective kernel unusable on older hypervisors. For that reason, a new ELF Note is being introduced that allows specifying supported features as a bit array instead (with features unknown to the hypervisor simply ignored, as now also done by elf_xen_parse_features(), whereas here unknown kernel-required features still keep the kernel [and hence VM] from booting). Introduce and use elf_note_numeric_array() to be forward compatible (or else an old hypervisor wouldn't be able to parse kernel specified features occupying more than 64 bits - thanks, Ian!). Signed-off-by: Jan Beulich <jbeulich@novell.com>
* nestedsvm: Support TSC Rate MSRChristoph Egger2011-07-161-1/+1
| | | | | | | | | | | | | | | | | | | | Support TSC Rate MSR and enable TSC scaling for nested virtualization. With it, guest VMs don't need take #VMEXIT to calculate a translated TSC value when it is running under TSC emulation mode. I measured native performance of the rdtsc instruction in the l2 guest with xen-on-xen and both host and and l1 guest run under TSC emulation mode. TSC scaling just needs MSR emulation and correct tsc offset calculation to be done and thus can be emulated also on older hardware. In this case rdtsc instruction is intercepted and handled by the host directly and safes the cost of a full VMRUN/VMEXIT emulation cycle. Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
* libxc: remove obsolete comment.Ian Campbell2011-07-161-4/+0
| | | | | | Seems to predate Xen 3.0... Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
* xen/libxc: Clean up pv_cpuid switch statements.Keir Fraser2011-07-161-5/+5
| | | | Signed-off-by: Keir Fraser <keir@xen.org>
* xen/libxc: set CPUID topology leaf as unsupported for PV guestsDavid Vrabel2011-07-161-0/+1
| | | | | | | | | | | | | | | The result of a CPUID Extended Topology Enumeration leaf for PV guests is invalid as the level in ECX is ignored. This can cause some guests to loop endlessly when trying to enumerate the topology. Since the physical topology isn't useful to PV guests set the topology leaf as unsupported. Guests affected include Linux kernels prior 2.6.32 where a workaround was applied ("xen: mask extended topology info in cpu", 82d6469916c6fcfa345636a49004c9d1753905d1). Signed-off-by: David Vrabel <david.vrabel@citrix.com>
* Revert 23664:3e3c0a8be9f9Keir Fraser2011-07-081-9/+0
|
* add privileged/unprivileged kernel feature indicationJan Beulich2011-07-081-0/+9
| | | | | | | | | | | | | With our switching away from supporting 32-bit Dom0 operation, users complained that attempts (perhaps due to lack of knowledge of that change) to boot the no longer privileged kernel in Dom0 resulted in apparently silent failure. To make the mismatch explicit and visible, add feature flags that the kernel can set to indicate operation in what modes it supports. For backward compatibility, absence of both feature flags is taken to indicate a kernel that may be capable of operating in both modes. Signed-off-by: Jan Beulich <jbeulich@novell.com>
* libxc: Squash xc_e820.h (and delete) into xenctrl.hKonrad Rzeszutek Wilk2011-06-284-42/+17
| | | | | | | | | | | | | | .. as there is no need to keep that internal header file anymore. We export two functions xc_domain_[set|get]_memory_map which depend on the 'struct e820entry' defined in 'xc_e820.h'. We move the contents of the 'xc_e820.h' to the 'xenctrl.h' fixing compiler errors when applications outside the Xen tree are trying to compile against the libraries. Tested-by: Daniel Castro <evil.dani@gmail.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* tools: merge several bitop functions into xc_bitops.hOlaf Hering2011-06-105-108/+78
| | | | | | | | | | | | | | | | | | | | | | | | Bitmaps are used in save/restore, xenpaging and blktap2. Merge the code into a private xc_bitops.h file. All users are single threaded, so locking is not an issue. The array of bits is handled as volatile because the x86 save/restore code passes the bitmap to the hypervisor which in turn modifies the bitmap. blktap2 uses a private bitmap. There was a possible overflow in the bitmap_size() function, the remainder was not considered. ia64 save/restore uses a bitmap to send the number of vcpus to the host. x86 save/restore uses a bitmap to track dirty pages. This bitmap is shared with the hypervisor. An unused function count_bits() was removed and a new bitmap_size() function is now used. xenpaging uses 3 private bitmaps to track the gfns which are in paged-out state. It had a copy of some Linux bitops.h, which is now obsolete. Also the BITS_PER_LONG macro was hardcoded to 64 which made it impossible to run 32bit tools on a 64bit host. Wether this works at all has to be tested, yet. Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* Enable RDWRGSFS feature support for HVM guestsYang, Wei2011-06-151-1/+2
| | | | | | | Write/read FS/GS base instructions enable user level code to read/write FS & GS segment base registers for thread local storage. Signed-off-by: Yang, Wei <wei.y.yang@intel.com>
* x86: Pass through ERMS CPUID feature for HVM and PV guestsYang, Wei2011-06-142-2/+5
| | | | | | | | | This patch exposes ERMS feature to HVM and PV guests. The REP MOVSB/STOSB instruction can enhance fast strings attempts to move as much of the data with larger size load/stores as possible. Signed-off-by: Yang, Wei <wei.y.yang@intel.com>
* x86/hvm: Make DRNG feature visible in CPUIDYang, Wei2011-06-142-0/+2
| | | | | | | | | This patch exposes DRNG feature to HVM guests. The RDRAND instruction can provide software with sequences of random numbers generated from white noise. Signed-off-by: Yang, Wei <wei.y.yang@intel.com>
* x86/hvm: add SMEP support to HVM guestTim Deegan2011-06-062-0/+9
| | | | | | | | | | | | | | | Intel new CPU supports SMEP (Supervisor Mode Execution Protection). SMEP prevents software operating with CPL < 3 (supervisor mode) from fetching instructions from any linear address with a valid translation for which the U/S flag (bit 2) is 1 in every paging-structure entry controlling the translation for the linear address. This patch adds SMEP support to HVM guest. Signed-off-by: Yang Wei <wei.y.yang@intel.com> Signed-off-by: Shan Haitao <haitao.shan@intel.com> Signed-off-by: Li Xin <xin.li@intel.com> Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
* nestedsvm: Support DecodeassistChristoph Egger2011-06-081-1/+2
| | | | | | Offer l1 guest to use decode assist if available in hardware. Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
* libxc: Don't refer to meaningless 'word offsets' in xc_cpufeature.hKeir Fraser2011-06-031-6/+6
| | | | Signed-off-by: Keir Fraser <keir@xen.org>
* libxc: Simplify and clean up xc_cpufeature.hKeir Fraser2011-06-022-117/+98
| | | | | | | | * Remove Linux-private defns with no direct relation to CPUID * Remove word offsets into Linux-defined cpu_caps array * Hard tabs -> soft tabs Signed-off-by: Keir Fraser <keir@xen.org>
* x86: Hide CPUID leaf 7 from PV guests.Keir Fraser2011-06-022-1/+12
| | | | | | Except for the whitelisted FSGSBASE feature. Signed-off-by: Keir Fraser <keir@xen.org>
* tools: Introduce "allocate-only" page type for migrationGeorge Dunlap2011-05-262-21/+31
| | | | | | | | | | | | | | | | | | To detect presence of superpages on the receiver side, we need to have strings of sequential pfns sent across on the first iteration through the memory. However, as we go through the memory, more and more of it will be marked dirty, making it wasteful to send those pages. This patch introduces a new PFINFO type, "XALLOC". Like PFINFO_XTAB, it indicates that there is no corresponding page present in the subsquent page buffer. However, unlike PFINFO_XTAB, it contains a pfn which should be allocated. This new type is only used for migration; but it's placed in xen/public/domctl.h so that the value isn't reused. Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* tools: Save superpages in the same batch, to make detection easierGeorge Dunlap2011-05-261-0/+12
| | | | | | | | | | | On the first time through (when pfns are mostly allocated on the receiving side), try to keep superpages together in the same batch by ending a batch early if we see the first page of a potential superpage and there isn't enough room in the batch for a full superpage. Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* tools: libxc: Detect superpages on domain restoreGeorge Dunlap2011-05-261-16/+106
| | | | | | | | | | | | When receiving pages, look for contiguous 2-meg aligned regions and attempt to allocate a superpage for that region, falling back to 4k pages if the allocation fails. (Minor conflict fixed up. -iwj) Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* Rename inj_msi -> inject_msiKeir Fraser2011-05-261-3/+3
| | | | Signed-off-by: Keir Fraser <keir@xen.org>