aboutsummaryrefslogtreecommitdiff
path: root/xen-hvm.c
AgeCommit message (Collapse)AuthorFilesLines
2015-06-23Merge remote-tracking branch 'remotes/sstabellini/tags/xen-220615-3' into ↵Peter Maydell1-24/+0
staging xen-220615, more SOB lines # gpg: Signature made Tue Jun 23 17:19:08 2015 BST using RSA key ID 70E1AE90 # gpg: Good signature from "Stefano Stabellini <stefano.stabellini@eu.citrix.com>" * remotes/sstabellini/tags/xen-220615-3: Revert "xen-hvm: increase maxmem before calling xc_domain_populate_physmap" xen/pass-through: constify some static data xen/pass-through: log errno values rather than function return ones xen/pass-through: ROM BAR handling adjustments xen/pass-through: fold host PCI command register writes Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-06-23Revert "xen-hvm: increase maxmem before calling xc_domain_populate_physmap"Stefano Stabellini1-24/+0
This reverts commit c1d322e6048796296555dd36fdd102d7fa2f50bf. The original commit fixes a bug when assigning a large number of devices which require option roms to a guest. (One known configuration that needs extra memory is having more than 4 emulated NICs assigned. Three or fewer NICs seems to work without this functionality.) However, by unilaterally increasing maxmem, it introduces two problems. First, now libxl's calculation of the required maxmem during migration is broken -- any guest which exercised this functionality will fail on migration. (Guests which have the default number of devices are not affected.) Secondly, it makes it impossible for a higher-level toolstack or administer to predict how much memory a VM will actually use, making it much more difficult to effectively use all of the memory on a machine. Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2015-06-05memory: prepare for multiple bits in the dirty log maskPaolo Bonzini1-7/+13
When the dirty log mask will also cover other bits than DIRTY_MEMORY_VGA, some listeners may be interested in the overall zero/non-zero value of the dirty log mask; others may be interested in the value of single bits. For this reason, always call log_start/log_stop if bits have respectively appeared or disappeared, and pass the old and new values of the dirty log mask so that listeners can distinguish the kinds of change. For example, KVM checks if dirty logging used to be completely disabled (in log_start) or is now completely disabled (in log_stop). On the other hand, Xen has to check manually if DIRTY_MEMORY_VGA changed, since that is the only bit it cares about. Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-06-05memory: differentiate memory_region_is_logging and ↵Paolo Bonzini1-1/+1
memory_region_get_dirty_log_mask For now memory regions only track DIRTY_MEMORY_VGA individually, but this will change soon. To support this, split memory_region_is_logging in two functions: one that returns a given bit from dirty_log_mask, and one that returns the entire mask. memory_region_is_logging gets an extra parameter so that the compiler flags misuse. While VGA-specific users (including the Xen listener!) will want to keep checking that bit, KVM and vhost check for "any bit except migration" (because migration is handled via the global start/stop listener callbacks). Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
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>