tools: libxc: flush data cache after loading images into guest memory

Enterprise / Virtualization / Xen - Ian Campbell [] - 16 December 2013 07:31 UTC

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.

a0035ec tools: libxc: flush data cache after loading images into guest memory
tools/libxc/xc_dom_armzimageloader.c | 1 +
tools/libxc/xc_dom_binloader.c | 1 +
tools/libxc/xc_dom_core.c | 2 ++
tools/libxc/xc_linux_osdep.c | 41 ++++++++++++++++++++++++++++++++++
tools/libxc/xc_minios.c | 12 ++++++++++
tools/libxc/xc_netbsd.c | 14 ++++++++++++
tools/libxc/xc_private.c | 5 +++++
tools/libxc/xc_private.h | 3 +++
tools/libxc/xc_solaris.c | 14 ++++++++++++
tools/libxc/xenctrl_osdep_ENOSYS.c | 9 ++++++++
tools/libxc/xenctrlosdep.h | 1 +
11 files changed, 103 insertions(+)


  • Share