tools: libxc: flush data cache after loading images into guest memory
authorIan Campbell <ian.campbell@citrix.com>
Fri, 13 Dec 2013 08:21:51 +0000 (08:21 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Mon, 16 Dec 2013 13:31:38 +0000 (13:31 +0000)
commita0035ecc0d82c1d4dcd5e429e2fcc3192d89747a
tree819fad2e3edb55c7dfb0419410b1d5940551fd97
parentdf34300fdbb63dffa32e2b158ab5c34fdd0facb5
tools: libxc: flush data cache after loading images into guest memory

On ARM guest OSes are started with MMU and Caches disables (as they are on
native) however caching is enabled in the domain running the builder and
therefore we must flush the cache as we load the blobs, otherwise when the
guest starts running it may not see them. The dom0 build in the hypervisor has
the same requirements and already does the right thing.

The mechanism for performing a cache flush from userspace is OS specific, so
implement this as a new osdep hook:

 - On 32-bit ARM Linux provides a system call to flush the cache.
 - On 64-bit ARM Linux the processor is configured to allow cache flushes
   directly from userspace.
 - Non-Linux platforms will need to provide their own implementation. If
   similar mechanisms are not available then a new privcmd ioctl should be a
   suitable alternative.

No cache maintenance is required on x86, so provide a stub for all non-Linux
platforms which returns success on x86 only and log an error otherwise.

This fixes guest building on Xgene which has a very large L3 cache and so is
particularly susceptible to this problem. It has also been observed
sporadically on midway.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Andre Przywara <andre.przywara@calxeda.com>
Cc: Pranavkumar Sawargaonkar <psawargaonkar@apm.com>
Cc: Anup Patel <apatel@apm.com>
tools/libxc/xc_dom_armzimageloader.c
tools/libxc/xc_dom_binloader.c
tools/libxc/xc_dom_core.c
tools/libxc/xc_linux_osdep.c
tools/libxc/xc_minios.c
tools/libxc/xc_netbsd.c
tools/libxc/xc_private.c
tools/libxc/xc_private.h
tools/libxc/xc_solaris.c
tools/libxc/xenctrl_osdep_ENOSYS.c
tools/libxc/xenctrlosdep.h