@@ -2,9 +2,6 @@ XEN_ROOT = $(CURDIR)/../../..
include $(XEN_ROOT)/tools/Rules.mk
SRCS-y += xc_altp2m.c
-SRCS-y += xc_core.c
-SRCS-$(CONFIG_X86) += xc_core_x86.c
-SRCS-$(CONFIG_ARM) += xc_core_arm.c
SRCS-y += xc_cpupool.c
SRCS-y += xc_domain.c
SRCS-y += xc_evtchn.c
@@ -19,8 +19,6 @@
* Copyright (c) 2003, K A Fraser.
*/
-#include "xc_private.h"
-#include "xc_core.h"
#include "xc_private.h"
#include <xen/memory.h>
#include <xen/hvm/hvm_op.h>
@@ -467,6 +467,18 @@ void *xc_vm_event_enable(xc_interface *xch, uint32_t domain_id, int param,
int do_dm_op(xc_interface *xch, uint32_t domid, unsigned int nr_bufs, ...);
+#if defined (__i386__) || defined (__x86_64__)
+static inline int xc_core_arch_auto_translated_physmap(const xc_dominfo_t *info)
+{
+ return info->hvm;
+}
+#elif defined (__arm__) || defined(__aarch64__)
+static inline int xc_core_arch_auto_translated_physmap(const xc_dominfo_t *info)
+{
+ return 1;
+}
+#endif
+
#endif /* __XC_PRIVATE_H__ */
/*
@@ -24,6 +24,9 @@ SRCS-y += xg_offline_page.c
else
SRCS-y += xg_nomigrate.c
endif
+SRCS-y += xg_core.c
+SRCS-$(CONFIG_X86) += xg_core_x86.c
+SRCS-$(CONFIG_ARM) += xg_core_arm.c
CFLAGS += -I$(XEN_libxenctrl)
similarity index 99%
rename from tools/libs/ctrl/xc_core.c
rename to tools/libs/guest/xg_core.c
@@ -61,7 +61,7 @@
*/
#include "xc_private.h"
-#include "xc_core.h"
+#include "xg_core.h"
#include <stdlib.h>
#include <unistd.h>
similarity index 97%
rename from tools/libs/ctrl/xc_core.h
rename to tools/libs/guest/xg_core.h
@@ -131,7 +131,6 @@ struct xc_core_memory_map {
uint64_t size;
};
typedef struct xc_core_memory_map xc_core_memory_map_t;
-int xc_core_arch_auto_translated_physmap(const xc_dominfo_t *info);
struct xc_core_arch_context;
int xc_core_arch_memory_map_get(xc_interface *xch,
struct xc_core_arch_context *arch_ctxt,
@@ -152,9 +151,9 @@ int xc_core_arch_get_scratch_gpfn(xc_interface *xch, uint32_t domid,
#if defined (__i386__) || defined (__x86_64__)
-# include "xc_core_x86.h"
+# include "xg_core_x86.h"
#elif defined (__arm__) || defined(__aarch64__)
-# include "xc_core_arm.h"
+# include "xg_core_arm.h"
#else
# error "unsupported architecture"
#endif
similarity index 96%
rename from tools/libs/ctrl/xc_core_arm.c
rename to tools/libs/guest/xg_core_arm.c
@@ -17,7 +17,7 @@
*/
#include "xc_private.h"
-#include "xc_core.h"
+#include "xg_core.h"
#include <xen-tools/libs.h>
@@ -31,12 +31,6 @@ xc_core_arch_gpfn_may_present(struct xc_core_arch_context *arch_ctxt,
return 0;
}
-int
-xc_core_arch_auto_translated_physmap(const xc_dominfo_t *info)
-{
- return 1;
-}
-
int
xc_core_arch_memory_map_get(xc_interface *xch, struct xc_core_arch_context *unused,
xc_dominfo_t *info, shared_info_any_t *live_shinfo,
similarity index 100%
rename from tools/libs/ctrl/xc_core_arm.h
rename to tools/libs/guest/xg_core_arm.h
similarity index 99%
rename from tools/libs/ctrl/xc_core_x86.c
rename to tools/libs/guest/xg_core_x86.c
@@ -19,7 +19,7 @@
#include <inttypes.h>
#include "xc_private.h"
-#include "xc_core.h"
+#include "xg_core.h"
#include <xen/hvm/e820.h>
int
@@ -33,12 +33,6 @@ xc_core_arch_gpfn_may_present(struct xc_core_arch_context *arch_ctxt,
return 1;
}
-int
-xc_core_arch_auto_translated_physmap(const xc_dominfo_t *info)
-{
- return info->hvm;
-}
-
int
xc_core_arch_memory_map_get(xc_interface *xch, struct xc_core_arch_context *unused,
xc_dominfo_t *info, shared_info_any_t *live_shinfo,
similarity index 100%
rename from tools/libs/ctrl/xc_core_x86.h
rename to tools/libs/guest/xg_core_x86.h
@@ -31,7 +31,7 @@
#include <zlib.h>
#include "xg_private.h"
-#include "xc_core.h"
+#include "xg_core.h"
#include <xen/hvm/params.h>
#include <xen/grant_table.h>
@@ -20,7 +20,7 @@
*/
#include "xg_private.h"
-#include "xc_core.h"
+#include "xg_core.h"
int xc_unmap_domain_meminfo(xc_interface *xch, struct xc_domain_meminfo *minfo)
{
@@ -25,7 +25,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <sys/time.h>
-#include <xc_core.h>
+#include <xg_core.h>
#include "xc_private.h"
#include "xg_private.h"
@@ -21,7 +21,7 @@
#include <xen/foreign/x86_32.h>
#include <xen/foreign/x86_64.h>
#include <xen/hvm/params.h>
-#include "xc_core.h"
+#include "xg_core.h"
static int modify_returncode(xc_interface *xch, uint32_t domid)
{
The functionality in xc_core* should be part of libxenguest instead of libxenctrl. Users are already either in libxenguest, or in xl. There is one single exception: xc_core_arch_auto_translated_physmap() is being used by xc_domain_memory_mapping(), which is used by qemu. So leave the xc_core_arch_auto_translated_physmap() functionality in libxenctrl. This will make it easier to merge common functionality of xc_core* and xg_sr_save*. Signed-off-by: Juergen Gross <jgross@suse.com> --- tools/libs/ctrl/Makefile | 3 --- tools/libs/ctrl/xc_domain.c | 2 -- tools/libs/ctrl/xc_private.h | 12 ++++++++++++ tools/libs/guest/Makefile | 3 +++ tools/libs/{ctrl/xc_core.c => guest/xg_core.c} | 2 +- tools/libs/{ctrl/xc_core.h => guest/xg_core.h} | 5 ++--- .../libs/{ctrl/xc_core_arm.c => guest/xg_core_arm.c} | 8 +------- .../libs/{ctrl/xc_core_arm.h => guest/xg_core_arm.h} | 0 .../libs/{ctrl/xc_core_x86.c => guest/xg_core_x86.c} | 8 +------- .../libs/{ctrl/xc_core_x86.h => guest/xg_core_x86.h} | 0 tools/libs/guest/xg_dom_boot.c | 2 +- tools/libs/guest/xg_domain.c | 2 +- tools/libs/guest/xg_offline_page.c | 2 +- tools/libs/guest/xg_resume.c | 2 +- 14 files changed, 24 insertions(+), 27 deletions(-) rename tools/libs/{ctrl/xc_core.c => guest/xg_core.c} (99%) rename tools/libs/{ctrl/xc_core.h => guest/xg_core.h} (97%) rename tools/libs/{ctrl/xc_core_arm.c => guest/xg_core_arm.c} (96%) rename tools/libs/{ctrl/xc_core_arm.h => guest/xg_core_arm.h} (100%) rename tools/libs/{ctrl/xc_core_x86.c => guest/xg_core_x86.c} (99%) rename tools/libs/{ctrl/xc_core_x86.h => guest/xg_core_x86.h} (100%)