[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 1/3] tools: Make qemu-xen-traditional build optional.



Now that we have upstream qemu people may want to avoid building this extra
code.

There is a little bit of trickery in stubdom/configure.ac to ensure that the
ioemu stubdom is only built if qemu-traditional is enabled.

libxl will return an error if a caller tries to build a domain using
qemu-xen-traditional when this support was disabled at build time. Since
qemu-xen-traditional has been historically tightly bound to the Xen releases I
don't see any value in supporting "3rd party" provision of
qemu-xen-traditional.

We also do not want/need this on ARM therefore default is on for x86 and off
otherwise.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Cc: roger.pau@xxxxxxxxxx
Cc: ian.jackson@xxxxxxxxxx
---
 Makefile                   |   22 ++++---
 config/Tools.mk.in         |    1 +
 stubdom/Makefile           |    6 ++-
 stubdom/configure          |  152 ++++++++++++++++++++++++++++++++++++++++----
 stubdom/configure.ac       |   24 +++++++-
 tools/Makefile             |    2 +-
 tools/config.h.in          |    3 +
 tools/configure            |   31 +++++++++
 tools/configure.ac         |   16 +++++
 tools/libxl/libxl_create.c |   14 ++++
 10 files changed, 247 insertions(+), 24 deletions(-)

diff --git a/Makefile b/Makefile
index 5a7107e..a936fbe 100644
--- a/Makefile
+++ b/Makefile
@@ -73,8 +73,19 @@ install-xen:
 install-tools:
        $(MAKE) -C tools install
 
+ifeq ($(CONFIG_QEMU_TRAD),y)
+QEMU_TRAD_DIR_TGT := tools/qemu-xen-traditional-dir
+
+tools/qemu-xen-traditional-dir:
+       $(MAKE) -C tools qemu-xen-traditional-dir-find
+
+.PHONY: tools/qemu-xen-traditional-dir-force-update
+tools/qemu-xen-traditional-dir-force-update:
+       $(MAKE) -C tools qemu-xen-traditional-dir-force-update
+endif
+
 ifeq ($(CONFIG_IOEMU),y)
-install-tools: tools/qemu-xen-traditional-dir tools/qemu-xen-dir
+install-tools: $(QEMU_TRAD_DIR_TARGET) tools/qemu-xen-dir
 endif
 
 .PHONY: install-kernels
@@ -82,19 +93,12 @@ install-kernels:
        for i in $(XKERNELS) ; do $(MAKE) $$i-install || exit 1; done
 
 .PHONY: install-stubdom
-install-stubdom: tools/qemu-xen-traditional-dir install-tools
+install-stubdom: $(QEMU_TRAD_DIR_TARGET) install-tools
        $(MAKE) -C stubdom install
 ifeq (x86_64,$(XEN_TARGET_ARCH))
        XEN_TARGET_ARCH=x86_32 $(MAKE) -C stubdom install-grub
 endif
 
-tools/qemu-xen-traditional-dir:
-       $(MAKE) -C tools qemu-xen-traditional-dir-find
-
-.PHONY: tools/qemu-xen-traditional-dir-force-update
-tools/qemu-xen-traditional-dir-force-update:
-       $(MAKE) -C tools qemu-xen-traditional-dir-force-update
-
 tools/qemu-xen-dir:
        $(MAKE) -C tools qemu-xen-dir-find
 
diff --git a/config/Tools.mk.in b/config/Tools.mk.in
index 5e2c6d8..2e80a93 100644
--- a/config/Tools.mk.in
+++ b/config/Tools.mk.in
@@ -52,6 +52,7 @@ CONFIG_LOMOUNT      := @lomount@
 CONFIG_OVMF         := @ovmf@
 CONFIG_ROMBIOS      := @rombios@
 CONFIG_SEABIOS      := @seabios@
+CONFIG_QEMU_TRAD    := @qemu_traditional@
 
 #System options
 CONFIG_SYSTEM_LIBAIO:= @system_aio@
diff --git a/stubdom/Makefile b/stubdom/Makefile
index 35295f0..19f2228 100644
--- a/stubdom/Makefile
+++ b/stubdom/Makefile
@@ -264,6 +264,10 @@ $(CROSS_ROOT): cross-newlib cross-zlib cross-libpci
 
 QEMU_ROOT := $(shell if [ -d "$(CONFIG_QEMU)" ]; then echo "$(CONFIG_QEMU)"; 
else echo .; fi)
 
+ifneq ($(filter ioemu,$(STUBDOM_TARGETS)),)
+IOEMU_LINKFARM_TARGET := ioemu/linkfarm.stamp
+endif
+
 ifeq ($(QEMU_ROOT),.)
 $(XEN_ROOT)/tools/qemu-xen-traditional-dir:
        $(MAKE) DESTDIR= -C $(XEN_ROOT)/tools qemu-xen-traditional-dir-find
@@ -289,7 +293,7 @@ ioemu/linkfarm.stamp:
        touch ioemu/linkfarm.stamp
 endif
 
-mk-headers-$(XEN_TARGET_ARCH): ioemu/linkfarm.stamp
+mk-headers-$(XEN_TARGET_ARCH): $(IOEMU_LINKFARM_TARGET)
        mkdir -p include/xen && \
           ln -sf $(wildcard $(XEN_ROOT)/xen/include/public/*.h) include/xen && 
\
           ln -sf $(addprefix $(XEN_ROOT)/xen/include/public/,arch-x86 hvm io 
xsm) include/xen && \
diff --git a/stubdom/configure b/stubdom/configure
index 3da2677..81eff6d 100755
--- a/stubdom/configure
+++ b/stubdom/configure
@@ -562,6 +562,7 @@ LIBOBJS
 STUBDOM_INSTALL
 STUBDOM_BUILD
 STUBDOM_TARGETS
+ioemu
 vtpmmgr
 vtpm
 TPMEMU_VERSION
@@ -603,7 +604,14 @@ xenstore
 grub
 caml
 c
-ioemu
+host_os
+host_vendor
+host_cpu
+host
+build_os
+build_vendor
+build_cpu
+build
 target_alias
 host_alias
 build_alias
@@ -652,6 +660,7 @@ enable_pv_grub
 enable_xenstore_stubdom
 enable_vtpm_stubdom
 enable_vtpmmgr_stubdom
+enable_qemu_traditional
 enable_debug
 enable_extfiles
 '
@@ -1271,6 +1280,10 @@ Fine tuning of the installation directories:
 _ACEOF
 
   cat <<\_ACEOF
+
+System types:
+  --build=BUILD     configure for building on BUILD [guessed]
+  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
 _ACEOF
 fi
 
@@ -1284,7 +1297,7 @@ Optional Features:
   --disable-option-checking  ignore unrecognized --enable/--with options
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
-  --disable-ioemu-stubdom Build and install ioemu-stubdom (default is ENABLED)
+  --enable-ioemu-stubdom  Build and install ioemu-stubdom
   --enable-c-stubdom      Build and install c-stubdom (default is DISABLED)
   --enable-caml-stubdom   Build and install caml-stubdom (default is DISABLED)
   --disable-pv-grub       Build and install pv-grub (default is ENABLED)
@@ -1294,6 +1307,7 @@ Optional Features:
   --enable-vtpm-stubdom   Build and install vtpm-stubdom
   --enable-vtpmmgr-stubdom
                           Build and install vtpmmgr-stubdom
+
   --disable-debug         Disable debug build of stubdom (default is ENABLED)
   --disable-extfiles      Use xen extfiles repository for libraries (default
                           is ENABLED)
@@ -1821,6 +1835,78 @@ ac_configure="$SHELL $ac_aux_dir/configure"  # Please 
don't use this var.
 
 
 
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+  as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
+$as_echo_n "checking build system type... " >&6; }
+if test "${ac_cv_build+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+  as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+  as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" 
"$LINENO" 5
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if test "${ac_cv_host+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "x$host_alias" = x; then
+  ac_cv_host=$ac_cv_build
+else
+  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" 
"$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+
 # M4 Macro includes
 
 
@@ -1887,20 +1973,10 @@ fi
 fi
 
 
-else
-
-
-ioemu=y
-STUBDOM_TARGETS="$STUBDOM_TARGETS ioemu"
-STUBDOM_BUILD="$STUBDOM_BUILD ioemu-stubdom"
-STUBDOM_INSTALL="$STUBDOM_INSTALL install-ioemu"
-
-
 fi
 
 
 
-
 # Check whether --enable-c-stubdom was given.
 if test "${enable_c_stubdom+set}" = set; then :
   enableval=$enable_c_stubdom;
@@ -2115,6 +2191,39 @@ fi
 
 
 
+# Check whether --enable-qemu-traditional was given.
+if test "${enable_qemu_traditional+set}" = set; then :
+  enableval=$enable_qemu_traditional;
+else
+
+    case "$host_cpu" in
+        i[3456]86|x86_64)
+           enable_qemu_traditional="yes";;
+        *) enable_qemu_traditional="no";;
+    esac
+
+fi
+
+if test "x$enable_qemu_traditional" = "xyes"; then :
+
+    qemu_traditional=y
+else
+
+    qemu_traditional=n
+
+fi
+if test "x$ioemu" = "x"; then :
+
+    ioemu=$qemu_traditional
+
+fi
+echo "x$ioemu$qemu_traditional"
+if test "x$ioemu$qemu_traditional" = "xyn"; then :
+
+    as_fn_error $? "IOEMU stubdomain requires qemu-traditional" "$LINENO" 5
+
+fi
+
 
 # Check whether --enable-debug was given.
 if test "${enable_debug+set}" = set; then :
@@ -3474,6 +3583,25 @@ fi
 
 
 
+if test "x$ioemu" = "xy" || test "x$ioemu" = "x"; then :
+
+
+ioemu=y
+STUBDOM_TARGETS="$STUBDOM_TARGETS ioemu"
+STUBDOM_BUILD="$STUBDOM_BUILD ioemu-stubdom"
+STUBDOM_INSTALL="$STUBDOM_INSTALL install-ioemu"
+
+
+else
+
+
+ioemu=n
+
+
+fi
+
+
+
 
 
 
diff --git a/stubdom/configure.ac b/stubdom/configure.ac
index 90fc94f..6468203 100644
--- a/stubdom/configure.ac
+++ b/stubdom/configure.ac
@@ -8,6 +8,8 @@ AC_CONFIG_SRCDIR([../extras/mini-os/kernel.c])
 AC_CONFIG_FILES([../config/Stubdom.mk])
 AC_CONFIG_AUX_DIR([../])
 
+AC_CANONICAL_HOST
+
 # M4 Macro includes
 m4_include([../m4/stubdom.m4])
 m4_include([../m4/features.m4])
@@ -16,7 +18,7 @@ m4_include([../m4/depends.m4])
 m4_include([../m4/fetcher.m4])
 
 # Enable/disable stub domains
-AX_STUBDOM_DEFAULT_ENABLE([ioemu-stubdom], [ioemu])
+AX_STUBDOM_CONDITIONAL([ioemu-stubdom], [ioemu])
 AX_STUBDOM_DEFAULT_DISABLE([c-stubdom], [c])
 AX_STUBDOM_DEFAULT_DISABLE([caml-stubdom], [caml])
 AX_STUBDOM_DEFAULT_ENABLE([pv-grub], [grub])
@@ -24,6 +26,25 @@ AX_STUBDOM_DEFAULT_ENABLE([xenstore-stubdom], [xenstore])
 AX_STUBDOM_CONDITIONAL([vtpm-stubdom], [vtpm])
 AX_STUBDOM_CONDITIONAL([vtpmmgr-stubdom], [vtpmmgr])
 
+AC_ARG_ENABLE([qemu-traditional],,,[
+    case "$host_cpu" in
+        i[[3456]]86|x86_64)
+           enable_qemu_traditional="yes";;
+        *) enable_qemu_traditional="no";;
+    esac
+])
+AS_IF([test "x$enable_qemu_traditional" = "xyes"], [
+    qemu_traditional=y],[
+    qemu_traditional=n
+])
+AS_IF([test "x$ioemu" = "x"], [
+    ioemu=$qemu_traditional
+])
+echo "x$ioemu$qemu_traditional"
+AS_IF([test "x$ioemu$qemu_traditional" = "xyn"], [
+    AC_MSG_ERROR(IOEMU stubdomain requires qemu-traditional)
+])
+
 AX_ARG_DEFAULT_ENABLE([debug], [Disable debug build of stubdom])
 AX_ARG_DEFAULT_ENABLE([extfiles], [Use xen extfiles repository for libraries])
 
@@ -55,6 +76,7 @@ AX_STUBDOM_AUTO_DEPENDS([vtpmmgr], [vtpm])
 #Conditionally enable these stubdoms based on the presense of dependencies
 AX_STUBDOM_CONDITIONAL_FINISH([vtpm-stubdom], [vtpm])
 AX_STUBDOM_CONDITIONAL_FINISH([vtpmmgr-stubdom], [vtpmmgr])
+AX_STUBDOM_CONDITIONAL_FINISH([ioemu-stubdom], [ioemu])
 
 AX_STUBDOM_FINISH
 AC_OUTPUT()
diff --git a/tools/Makefile b/tools/Makefile
index e44a3e9..cee4229 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -34,7 +34,7 @@ SUBDIRS-$(CONFIG_Linux) += libvchan
 
 # do not recurse in to a dir we are about to delete
 ifneq "$(MAKECMDGOALS)" "distclean"
-SUBDIRS-$(CONFIG_IOEMU) += qemu-xen-traditional-dir
+SUBDIRS-$(CONFIG_QEMU_TRAD) += qemu-xen-traditional-dir
 SUBDIRS-$(CONFIG_IOEMU) += qemu-xen-dir
 endif
 
diff --git a/tools/config.h.in b/tools/config.h.in
index a67910b..1f91319 100644
--- a/tools/config.h.in
+++ b/tools/config.h.in
@@ -15,6 +15,9 @@
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
+/* Qemu traditional enabled */
+#undef HAVE_QEMU_TRADITIONAL
+
 /* Define to 1 if you have the <stdint.h> header file. */
 #undef HAVE_STDINT_H
 
diff --git a/tools/configure b/tools/configure
index 079646c..8638210 100755
--- a/tools/configure
+++ b/tools/configure
@@ -654,6 +654,7 @@ APPEND_LIB
 APPEND_INCLUDES
 PREPEND_LIB
 PREPEND_INCLUDES
+qemu_traditional
 debug
 seabios
 rombios
@@ -734,6 +735,7 @@ enable_ovmf
 enable_rombios
 enable_seabios
 enable_debug
+enable_qemu_traditional
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1394,6 +1396,9 @@ Optional Features:
   --disable-rombios       Disable ROM BIOS (default is ENABLED)
   --disable-seabios       Disable SeaBIOS (default is ENABLED)
   --disable-debug         Disable debug build of tools (default is ENABLED)
+  --enable-qemu-traditional
+                          Enable qemu traditional device model, (DEFAULT is on
+                          for x86, otherwise off)
 
 Some influential environment variables:
   CC          C compiler command
@@ -3654,6 +3659,32 @@ debug=$ax_cv_debug
 
 
 
+# Check whether --enable-qemu-traditional was given.
+if test "${enable_qemu_traditional+set}" = set; then :
+  enableval=$enable_qemu_traditional;
+else
+
+    case "$host_cpu" in
+        i[3456]86|x86_64)
+           enable_qemu_traditional="yes";;
+        *) enable_qemu_traditional="no";;
+    esac
+
+fi
+
+if test "x$enable_qemu_traditional" = "xyes"; then :
+
+
+$as_echo "#define HAVE_QEMU_TRADITIONAL 1" >>confdefs.h
+
+    qemu_traditional=y
+else
+
+    qemu_traditional=n
+
+fi
+
+
 
 
 
diff --git a/tools/configure.ac b/tools/configure.ac
index 4f5e688..5b5f7f6 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -60,6 +60,22 @@ AX_ARG_DEFAULT_ENABLE([rombios], [Disable ROM BIOS])
 AX_ARG_DEFAULT_ENABLE([seabios], [Disable SeaBIOS])
 AX_ARG_DEFAULT_ENABLE([debug], [Disable debug build of tools])
 
+AC_ARG_ENABLE([qemu-traditional],
+    AS_HELP_STRING([--enable-qemu-traditional],
+                   [Enable qemu traditional device model, (DEFAULT is on for 
x86, otherwise off)]),,[
+    case "$host_cpu" in
+        i[[3456]]86|x86_64)
+           enable_qemu_traditional="yes";;
+        *) enable_qemu_traditional="no";;
+    esac
+])
+AS_IF([test "x$enable_qemu_traditional" = "xyes"], [
+AC_DEFINE([HAVE_QEMU_TRADITIONAL], [1], [Qemu traditional enabled])
+    qemu_traditional=y],[
+    qemu_traditional=n
+])
+AC_SUBST(qemu_traditional)
+
 AC_ARG_VAR([PREPEND_INCLUDES],
     [List of include folders to prepend to CFLAGS (without -I)])
 AC_ARG_VAR([PREPEND_LIB],
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index 0c32d0b..e4c614b 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -107,8 +107,14 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
     if (!b_info->device_model_version) {
         if (b_info->type == LIBXL_DOMAIN_TYPE_HVM) {
             if (libxl_defbool_val(b_info->device_model_stubdomain)) {
+#ifdef HAVE_QEMU_TRADITIONAL
                 b_info->device_model_version =
                     LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL;
+#else
+                LOG(ERROR, "device model stubdomains require 
\"qemu-xen-traditional\", "
+                    "but they were disabled at compile time");
+                return ERROR_INVAL;
+#endif
             } else {
                 b_info->device_model_version = libxl__default_device_model(gc);
             }
@@ -138,6 +144,14 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
         }
     }
 
+#ifndef HAVE_QEMU_TRADITIONAL
+    if (b_info->device_model_version
+            == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL) {
+        LOG(ERROR, "\"qemu-xen-traditional\" disabled at compile time");
+        return ERROR_INVAL;
+    }
+#endif
+
     if (b_info->blkdev_start == NULL)
         b_info->blkdev_start = libxl__strdup(NOGC, "xvda");
 
-- 
1.7.2.5


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.