qemu-e2k/hw/display
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
..
Makefile.objs virtio-gpu: add 3d mode and virgl rendering support. 2015-10-08 10:31:35 +02:00
ads7846.c ssi: Move ssi.h into a separate directory 2016-01-21 14:15:03 +00:00
blizzard.c blizzard: do not depend on VGA internals 2015-01-15 10:44:13 +03:00
blizzard_template.h display: avoid multi-statement macro 2014-01-31 14:47:33 +00:00
cg3.c hw: do not pass NULL to memory_region_init from instance_init 2015-10-09 15:25:56 +02:00
cirrus_vga.c cirrus_vga: QOMify 2015-05-19 11:40:01 +02:00
cirrus_vga_rop.h cirrus: Fix host CPU blits 2014-07-11 10:17:02 +02:00
cirrus_vga_rop2.h hw: move private headers to hw/ subdirectories. 2013-04-08 18:13:16 +02:00
exynos4210_fimd.c maint: avoid useless "if (foo) free(foo)" pattern 2015-09-11 10:21:38 +03:00
framebuffer.c framebuffer: set DIRTY_MEMORY_VGA on RAM that is used for the framebuffer 2015-07-24 13:57:45 +02:00
framebuffer.h framebuffer: set DIRTY_MEMORY_VGA on RAM that is used for the framebuffer 2015-07-24 13:57:45 +02:00
g364fb.c qerror: Move #include out of qerror.h 2015-06-22 18:20:40 +02:00
jazz_led.c ui/curses: Fix color attribute of monitor for curses 2016-01-08 12:20:07 +01:00
milkymist-tmu2.c ui/opengl: Reduce build required libraries for opengl 2015-11-03 10:13:42 +01:00
milkymist-vgafb.c framebuffer: set DIRTY_MEMORY_VGA on RAM that is used for the framebuffer 2015-07-24 13:57:45 +02:00
milkymist-vgafb_template.h milkymist-vgafb: swap pixel data in source buffer 2014-02-04 19:34:30 +01:00
omap_dss.c arm: Use g_new() & friends where that makes obvious sense 2015-09-07 10:39:27 +01:00
omap_lcd_template.h arm: explicitly mark device loads as little-endian 2015-12-17 13:37:13 +00:00
omap_lcdc.c arm: Use g_new() & friends where that makes obvious sense 2015-09-07 10:39:27 +01:00
pl110.c framebuffer: set DIRTY_MEMORY_VGA on RAM that is used for the framebuffer 2015-07-24 13:57:45 +02:00
pl110_template.h display: avoid multi-statement macro 2014-01-31 14:47:33 +00:00
pxa2xx_lcd.c arm: explicitly mark device loads as little-endian 2015-12-17 13:37:13 +00:00
pxa2xx_template.h display: avoid multi-statement macro 2014-01-31 14:47:33 +00:00
qxl-logger.c hw/display/qxl-logger.c: Constify some variable 2015-06-23 20:23:39 +03:00
qxl-render.c typofixes - v4 2015-09-11 10:45:43 +03:00
qxl.c qxl: Use g_new() & friends where that makes obvious sense 2015-11-06 15:42:38 +03:00
qxl.h qxl: allow to specify head limit to qxl driver 2015-07-16 17:31:05 +02:00
sm501.c Fix bad error handling after memory_region_init_ram() 2015-09-18 14:39:29 +02:00
sm501_template.h hw: use ld_p/st_p instead of ld_raw/st_raw 2014-06-05 16:04:17 +02:00
ssd0303.c savevm: Remove all the unneeded version_minimum_id_old (arm) 2014-05-13 16:09:35 +01:00
ssd0323.c ssi: Move ssi.h into a separate directory 2016-01-21 14:15:03 +00:00
tc6393xb.c Fix bad error handling after memory_region_init_ram() 2015-09-18 14:39:29 +02:00
tc6393xb_template.h display: avoid multi-statement macro 2014-01-31 14:47:33 +00:00
tcx.c hw/display/tcx: Remove superfluous OBJECT() typecasts 2015-11-06 15:42:38 +03:00
vga-helpers.h vga: Rename vga_template.h to vga-helpers.h 2014-09-30 13:34:09 +02:00
vga-isa-mm.c vga: allow non-global vmstate 2014-04-28 10:21:55 +02:00
vga-isa.c isa: remove isa_mem_base variable 2015-02-13 14:09:28 +00:00
vga-pci.c virtio-vga: add virtio gpu device with vga compatibility 2015-06-12 10:13:23 +02:00
vga.c ui/curses: Fix color attribute of monitor for curses 2016-01-08 12:20:07 +01:00
vga.h hw: move private headers to hw/ subdirectories. 2013-04-08 18:13:16 +02:00
vga_int.h virtio-vga: add virtio gpu device with vga compatibility 2015-06-12 10:13:23 +02:00
virtio-gpu-3d.c virtio-gpu: add 3d mode and virgl rendering support. 2015-10-08 10:31:35 +02:00
virtio-gpu-pci.c virtio-gpu: change licence from GPLv2 to GPLv2+ 2015-10-08 10:31:35 +02:00
virtio-gpu.c linux-headers: update from kvm/next 2015-12-17 15:24:34 +01:00
virtio-vga.c virtio-gpu: use virtio_instance_init_common, fixup properties 2015-07-07 11:23:18 +02:00
vmware_vga.c vmsvga: more cursor checks 2015-10-20 09:26:36 +02:00
xenfb.c xen: Switch uses of xc_map_foreign_{pages,bulk} to use libxenforeignmemory API. 2016-01-26 17:19:35 +00:00