aboutsummaryrefslogtreecommitdiff
path: root/xen-hvm.c
AgeCommit message (Collapse)AuthorFilesLines
2015-01-20Xen: Use the ioreq-server API when availablePaul Durrant1-22/+138
The ioreq-server API added to Xen 4.5 offers better security than the existing Xen/QEMU interface because the shared pages that are used to pass emulation request/results back and forth are removed from the guest's memory space before any requests are serviced. This prevents the guest from mapping these pages (they are in a well known location) and attempting to attack QEMU by synthesizing its own request structures. Hence, this patch modifies configure to detect whether the API is available, and adds the necessary code to use the API if it is. Signed-off-by: Paul Durrant <paul.durrant@citrix.com> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2015-01-13xen-hvm: increase maxmem before calling xc_domain_populate_physmapStefano Stabellini1-0/+24
Increase maxmem before calling xc_domain_populate_physmap_exact to avoid the risk of running out of guest memory. This way we can also avoid complex memory calculations in libxl at domain construction time. This patch fixes an abort() when assigning more than 4 NICs to a VM. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Don Slutz <dslutz@verizon.com>
2014-11-11xen-hvm: Remove redundant variable 'xstate'Chen Gang1-2/+1
In xen_hvm_change_state_handler(), we can pass 'opaque' with type cast to xen_main_loop_prepare() directly, there's no need to use additional variable for it. Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2014-10-30xen-hvm.c: Add support for Xen access to vmportDon Slutz1-5/+103
This adds synchronisation of the 6 vcpu registers (only 32bits of them) that vmport.c needs between Xen and QEMU. This is to avoid a 2nd and 3rd exchange between QEMU and Xen to fetch and put these 6 vcpu registers used by the code in vmport.c and vmmouse.c The registers are passed in the new shared page provided by HVM_PARAM_VMPORT_REGS_PFN. Add new array to XenIOState that allows selection of current_cpu by vcpu id. Now pass XenIOState to handle_ioreq(). Add new routines regs_to_cpu(), regs_from_cpu(), and handle_vmport_ioreq(). Signed-off-by: Don Slutz <dslutz@verizon.com> Reviewed-by: Paul Durrant <paul.durrant@citrix.com> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2014-09-20xen-hvm.c: Always return -1 when failure occurs in xen_hvm_init()Chen Gang1-5/+4
When failure occurs, it need to use "return -1" instead of exit(1), so an upper layer has a chance to print failure information, too. For simplicity, in xen_hvm_init(), also use '-1' instead of all '-errno', since all related upper callers always exit(1) on failure. It is not a normal function, it does not release related resources when return -1, so need give related comments for it. It passes common check: "./configure --enable-xen && make && make check" "echo $? == 0" Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2014-09-09memory: add parameter errp to memory_region_init_ramHu Tao1-1/+2
Add parameter errp to memory_region_init_ram and update all call sites to pass in &error_abort. Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-08-28xen: hvm: Abstract away memory region name refPeter Crosthwaite1-3/+6
The mr->name field is removed. This slipped through compile testing. Fix. Reviewed-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-08-28xen-hvm: Constify stringPeter Crosthwaite1-2/+2
It's constant, and sourced from existing const strings. Avoid dodgy casts by converting to const. Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Reviewed-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-08-01xen: fix usage of ENODATARoger Pau Monne1-2/+5
ENODATA doesn't exist on FreeBSD, so ENODATA errors returned by the hypervisor are translated to ENOENT. Also, the error code is returned in errno if the call returns -1, so compare the error code with the value in errno instead of the value returned by the function. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Cc: xen-devel@lists.xenproject.org Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Cc: Anthony Perard <anthony.perard@citrix.com>
2014-07-18Fix new typos in comments (found by codespell)Stefan Weil1-1/+1
arbitary -> arbitrary basicly -> basically Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2014-07-07xen: build on ARMStefano Stabellini1-1/+1
Collection of fixes to build QEMU with Xen support on ARM: - use xenstore_read_fe_uint64 to retrieve the page-ref (xenfb); - use xen_pfn_t instead of unsigned long in xenfb; - unsigned long/xenpfn_t in xen_remove_from_physmap; - in xen-mapcache.c use HOST_LONG_BITS to check for QEMU's address space size. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2014-06-23xen-hvm: Handle machine opt max-ram-below-4gDon Slutz1-12/+23
This is the xen part of "pc & q35: Add new machine opt max-ram-below-4g" Note: this machine option cannot be used to increase the amount of ram below 4G. Signed-off-by: Don Slutz <dslutz@verizon.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-06-23xen-hvm: Fix xen_hvm_init() to adjust pc memory layoutDon Slutz1-10/+14
This is just below_4g_mem_size and above_4g_mem_size which is used later in QEMU. Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Don Slutz <dslutz@verizon.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-06-11xen: replace ffsl with ctzlNatanael Copa1-1/+1
ffsl is a GNU extension and not available in musl libc. See also commit fbeadf50 (bitops: unify bitops_ffsl with the one in host-utils.h, call it bitops_ctzl) on why ctzl should be used instead of ffsl. Signed-off-by: Natanael Copa <ncopa@alpinelinux.org> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> [PMM: rebased to accommodate file rename to xen-hvm.c] Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-05-07pass an inclusive address range to xc_domain_pin_memory_cacheattrStefano Stabellini1-1/+1
xc_domain_pin_memory_cacheattr expects an inclusive address range: adjust the parameters. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2014-05-07xen: factor out common functionsWei Liu1-0/+1129
So common functions used by both HVM and PV are factored out from xen-all.c to xen-common.c. Finally rename xen-all.c to xen-hvm.c, as those functions are only useful to HVM guest. Create *-stub files and modify Makefile.target to reflect the changes. Signed-off-by: Wei Liu <wei.liu2@citrix.com> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>