qemu-e2k/hw
Ian Campbell e0cb42ae4b xen: Switch uses of xc_map_foreign_{pages,bulk} to use libxenforeignmemory API.
In Xen 4.7 we are refactoring parts libxenctrl into a number of
separate libraries which will provide backward and forward API and ABI
compatiblity.

One such library will be libxenforeignmemory which provides access to
privileged foreign mappings and which will provide an interface
equivalent to xc_map_foreign_{pages,bulk}.

The new xenforeignmemory_map() function behaves like
xc_map_foreign_pages() when the err argument is NULL and like
xc_map_foreign_bulk() when err is non-NULL, which maps into the shim
here onto checking err == NULL and calling the appropriate old
function.

Note that xenforeignmemory_map() takes the number of pages before the
arrays themselves, in order to support potentially future use of
variable-length-arrays in the prototype (in the future, when Xen's
baseline toolchain requirements are new enough to ensure VLAs are
supported).

In preparation for adding support for libxenforeignmemory add support
to the <=4.0 and <=4.6 compat code in xen_common.h to allow us to
switch to using the new API. These shims will disappear for versions
of Xen which include libxenforeignmemory.

Since libxenforeignmemory will have its own handle type but for <= 4.6
the functionality is provided by using a libxenctrl handle we
introduce a new global xen_fmem alongside the existing xen_xc. In fact
we make xen_fmem a pointer to the existing xen_xc, which then works
correctly with both <=4.0 (xc handle is an int) and <=4.6 (xc handle
is a pointer). In the latter case xen_fmem is actually a double
indirect pointer, but it all falls out in the wash.

Unlike libxenctrl libxenforeignmemory has an explicit unmap function,
rather than just specifying that munmap should be used, so the unmap
paths are updated to use xenforeignmemory_unmap, which is a shim for
munmap on these versions of xen. The mappings in xen-hvm.c do not
appear to be unmapped (which makes sense for a qemu-dm process)

In fb_disconnect this results in a change from simply mmap over the
existing mapping (with an implicit munmap) to expliclty unmapping with
xenforeignmemory_unmap and then mapping the required anonymous memory
in the same hole. I don't think this is a problem since any other
thread which was racily touching this region would already be running
the risk of hitting the mapping halfway through the call. If this is
thought to be a problem then we could consider adding an extra API to
the libxenforeignmemory interface to replace a foreign mapping with
anonymous shared memory, but I'd prefer not to.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2016-01-26 17:19:35 +00:00
..
9pfs 9pfs: use error_report() instead of fprintf(stderr) 2016-01-22 15:12:17 +01:00
acpi trivial patches for 2016-01-11 2016-01-11 12:56:58 +00:00
alpha isa: Clean up error handling around isa_bus_new() 2016-01-13 11:58:59 +01:00
arm hw/arm/virt: Add always-on property to the virt board timer 2016-01-21 14:15:07 +00:00
audio
block xen: Switch to libxengnttab interface for compat shims. 2016-01-26 17:19:28 +00:00
bt bt: avoid unintended sign extension 2015-12-04 09:39:55 +03:00
char xen: Switch uses of xc_map_foreign_{pages,bulk} to use libxenforeignmemory API. 2016-01-26 17:19:35 +00:00
core fdc: Add fallback option 2016-01-25 14:35:23 -05:00
cpu
cris
display xen: Switch uses of xc_map_foreign_{pages,bulk} to use libxenforeignmemory API. 2016-01-26 17:19:35 +00:00
dma hw/dma/xilinx_axidma: remove dead code 2016-01-11 15:52:18 +00:00
gpio omap: Don't use hw_error() in device init() methods 2016-01-13 11:58:58 +01:00
i2c omap: Don't use hw_error() in device init() methods 2016-01-13 11:58:58 +01:00
i386 fdc: add drive type qapi enum 2016-01-25 14:35:23 -05:00
ide ide: Correct the CHS 'cyls_max' limit to be 65535 2016-01-25 14:34:40 -05:00
input qapi: Change munging of CamelCase enum values 2015-12-17 08:21:28 +01:00
intc arm_gic: Update ID registers based on revision 2016-01-21 14:15:08 +00:00
ipack
ipmi fpu: Replace int32 typedef with int32_t 2016-01-22 15:09:21 +00:00
isa isa: Clean up inappropriate hw_error() 2016-01-13 15:15:57 +01:00
lm32
m68k hw: Don't use hw_error() for machine initialization errors 2016-01-13 11:58:58 +01:00
mem nvdimm: implement NVDIMM device abstract 2015-12-22 18:39:20 +02:00
microblaze ssi: Move ssi.h into a separate directory 2016-01-21 14:15:03 +00:00
mips mips: Clean up includes 2016-01-23 14:30:04 +00:00
misc fpu: Replace uint32 typedef with uint32_t 2016-01-22 15:09:21 +00:00
moxie
net xen: Switch to libxengnttab interface for compat shims. 2016-01-26 17:19:28 +00:00
nvram fw_cfg: replace ioport data read with generic method 2015-12-15 11:46:13 +01:00
openrisc
pci
pci-bridge hw/pxb: introduce pxb-pcie expander for PCIe machines 2015-12-22 17:45:13 +02:00
pci-host isa: Clean up error handling around isa_bus_new() 2016-01-13 11:58:59 +01:00
pcmcia
ppc fpu: Replace uint32 typedef with uint32_t 2016-01-22 15:09:21 +00:00
s390x Error reporting patches for 2016-01-13 2016-01-14 13:07:38 +00:00
scsi SCSI device: fix to incomplete QOMify 2016-01-15 18:58:01 +01:00
sd ssi: Move ssi.h into a separate directory 2016-01-21 14:15:03 +00:00
sh4 SH PCI Host: convert to realize() 2016-01-11 11:39:28 +03:00
smbios Use error_fatal to simplify obvious fatal errors 2016-01-13 11:58:58 +01:00
sparc
sparc64 target-sparc: Convert to VMStateDescription 2016-01-16 12:01:23 +00:00
ssi xilinx_spips: Separate the state struct into a header 2016-01-21 14:15:03 +00:00
timer arm_mptimer: Don't use hw_error() in realize() method 2016-01-13 11:58:58 +01:00
tpm qemu-char: delete send_all/recv_all helper methods 2016-01-15 18:58:01 +01:00
tricore
unicore32 hw: Don't use hw_error() for machine initialization errors 2016-01-13 11:58:58 +01:00
usb error: Use error_prepend() where it makes obvious sense 2016-01-13 15:16:17 +01:00
vfio vfio/pci: Lazy PBA emulation 2016-01-19 11:33:42 -07:00
virtio VirtFS update: 2016-01-12 17:37:22 +00:00
watchdog
xen xen: Switch uses of xc_map_foreign_{pages,bulk} to use libxenforeignmemory API. 2016-01-26 17:19:35 +00:00
xenpv xen: fix usage of xc_domain_create in domain builder 2015-11-13 17:38:06 +00:00
xtensa
Makefile.objs Add a base IPMI interface 2015-12-22 18:39:19 +02:00