From c14518e94251c5c0857915a5cef102f23abf1e8b Mon Sep 17 00:00:00 2001 From: Alon Levy Date: Fri, 14 Jun 2013 15:19:07 +0100 Subject: [PATCH 01/10] Add a stp file for usage from build directory For systemtap the location of the process being tapped is crucial, as a result the existing stp file requires installation for use. There are now two files: $(TARGET_DIR)/$(QEMU_PROG).stp-installed: copied to $(tapdir)/$(QEMU_PROG).stp $(TARGET_DIR)/$(QEMU_PROG).stp: pointing to the built binary, usable without installation To use: stap -I $(TARGET_DIR) ... Signed-off-by: Alon Levy Acked-by: Stefan Hajnoczi Signed-off-by: Paolo Bonzini Message-id: 1370349928-20419-2-git-send-email-pbonzini@redhat.com Signed-off-by: Peter Maydell --- Makefile.target | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Makefile.target b/Makefile.target index b0be124d29..29038973d6 100644 --- a/Makefile.target +++ b/Makefile.target @@ -35,7 +35,7 @@ config-target.h: config-target.h-timestamp config-target.h-timestamp: config-target.mak ifdef CONFIG_TRACE_SYSTEMTAP -stap: $(QEMU_PROG).stp +stap: $(QEMU_PROG).stp-installed $(QEMU_PROG).stp ifdef CONFIG_USER_ONLY TARGET_TYPE=user @@ -43,14 +43,24 @@ else TARGET_TYPE=system endif -$(QEMU_PROG).stp: $(SRC_PATH)/trace-events +$(QEMU_PROG).stp-installed: $(SRC_PATH)/trace-events $(call quiet-command,$(TRACETOOL) \ --format=stap \ --backend=$(TRACE_BACKEND) \ --binary=$(bindir)/$(QEMU_PROG) \ --target-arch=$(TARGET_ARCH) \ --target-type=$(TARGET_TYPE) \ + < $< > $@," GEN $(TARGET_DIR)$(QEMU_PROG).stp-installed") + +$(QEMU_PROG).stp: $(SRC_PATH)/trace-events + $(call quiet-command,$(TRACETOOL) \ + --format=stap \ + --backend=$(TRACE_BACKEND) \ + --binary=$(realpath .)/$(QEMU_PROG) \ + --target-arch=$(TARGET_ARCH) \ + --target-type=$(TARGET_TYPE) \ < $< > $@," GEN $(TARGET_DIR)$(QEMU_PROG).stp") + else stap: endif @@ -182,7 +192,7 @@ endif endif ifdef CONFIG_TRACE_SYSTEMTAP $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset" - $(INSTALL_DATA) $(QEMU_PROG).stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset" + $(INSTALL_DATA) $(QEMU_PROG).stp-installed "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG).stp" endif GENERATED_HEADERS += config-target.h From c1799a846285764de588533e21e61167a33f5a8f Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Fri, 14 Jun 2013 15:19:07 +0100 Subject: [PATCH 02/10] build: rename TARGET_ARCH2 to TARGET_NAME Do not introduce any new use yet. Signed-off-by: Paolo Bonzini Message-id: 1370349928-20419-3-git-send-email-pbonzini@redhat.com Signed-off-by: Peter Maydell --- Makefile.target | 6 +++--- configure | 38 +++++++++++++++++++------------------- scripts/create_config | 2 +- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Makefile.target b/Makefile.target index 29038973d6..fcc880bd2a 100644 --- a/Makefile.target +++ b/Makefile.target @@ -15,14 +15,14 @@ QEMU_CFLAGS+=-I$(SRC_PATH)/include ifdef CONFIG_USER_ONLY # user emulator name -QEMU_PROG=qemu-$(TARGET_ARCH2) +QEMU_PROG=qemu-$(TARGET_NAME) else # system emulator name ifneq (,$(findstring -mwindows,$(libs_softmmu))) # Terminate program name with a 'w' because the linker builds a windows executable. -QEMU_PROGW=qemu-system-$(TARGET_ARCH2)w$(EXESUF) +QEMU_PROGW=qemu-system-$(TARGET_NAME)w$(EXESUF) endif # windows executable -QEMU_PROG=qemu-system-$(TARGET_ARCH2)$(EXESUF) +QEMU_PROG=qemu-system-$(TARGET_NAME)$(EXESUF) endif PROGS=$(QEMU_PROG) diff --git a/configure b/configure index 60b0811706..1dfa71283f 100755 --- a/configure +++ b/configure @@ -4083,10 +4083,10 @@ fi for target in $target_list; do target_dir="$target" config_target_mak=$target_dir/config-target.mak -target_arch2=`echo $target | cut -d '-' -f 1` +target_name=`echo $target | cut -d '-' -f 1` target_bigendian="no" -case "$target_arch2" in +case "$target_name" in armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or32|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb) target_bigendian=yes ;; @@ -4096,17 +4096,17 @@ target_user_only="no" target_linux_user="no" target_bsd_user="no" case "$target" in - ${target_arch2}-softmmu) + ${target_name}-softmmu) target_softmmu="yes" ;; - ${target_arch2}-linux-user) + ${target_name}-linux-user) if test "$linux" != "yes" ; then error_exit "Target '$target' is only available on a Linux host" fi target_user_only="yes" target_linux_user="yes" ;; - ${target_arch2}-bsd-user) + ${target_name}-bsd-user) if test "$bsd" != "yes" ; then error_exit "Target '$target' is only available on a BSD host" fi @@ -4124,14 +4124,14 @@ echo "# Automatically generated by configure - do not modify" > $config_target_m bflt="no" target_nptl="no" -interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"` +interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_name/g"` gdb_xml_files="" -TARGET_ARCH="$target_arch2" +TARGET_ARCH="$target_name" TARGET_BASE_ARCH="" TARGET_ABI_DIR="" -case "$target_arch2" in +case "$target_name" in i386) ;; x86_64) @@ -4246,14 +4246,14 @@ upper() { echo "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak target_arch_name="`upper $TARGET_ARCH`" echo "TARGET_$target_arch_name=y" >> $config_target_mak -echo "TARGET_ARCH2=$target_arch2" >> $config_target_mak -echo "TARGET_TYPE=TARGET_TYPE_`upper $target_arch2`" >> $config_target_mak +echo "TARGET_NAME=$target_name" >> $config_target_mak +echo "TARGET_TYPE=TARGET_TYPE_`upper $target_name`" >> $config_target_mak echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak if [ "$TARGET_ABI_DIR" = "" ]; then TARGET_ABI_DIR=$TARGET_ARCH fi echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak -case "$target_arch2" in +case "$target_name" in i386|x86_64) if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then echo "CONFIG_XEN=y" >> $config_target_mak @@ -4264,17 +4264,17 @@ case "$target_arch2" in ;; *) esac -case "$target_arch2" in +case "$target_name" in arm|i386|x86_64|ppcemb|ppc|ppc64|s390x) # Make sure the target and host cpus are compatible if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \ - \( "$target_arch2" = "$cpu" -o \ - \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \ - \( "$target_arch2" = "ppc64" -a "$cpu" = "ppc" \) -o \ - \( "$target_arch2" = "ppc" -a "$cpu" = "ppc64" \) -o \ - \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc64" \) -o \ - \( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \ - \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then + \( "$target_name" = "$cpu" -o \ + \( "$target_name" = "ppcemb" -a "$cpu" = "ppc" \) -o \ + \( "$target_name" = "ppc64" -a "$cpu" = "ppc" \) -o \ + \( "$target_name" = "ppc" -a "$cpu" = "ppc64" \) -o \ + \( "$target_name" = "ppcemb" -a "$cpu" = "ppc64" \) -o \ + \( "$target_name" = "x86_64" -a "$cpu" = "i386" \) -o \ + \( "$target_name" = "i386" -a "$cpu" = "x86_64" \) \) ; then echo "CONFIG_KVM=y" >> $config_target_mak if test "$vhost_net" = "yes" ; then echo "CONFIG_VHOST_NET=y" >> $config_target_mak diff --git a/scripts/create_config b/scripts/create_config index 258513a887..6461ef6059 100755 --- a/scripts/create_config +++ b/scripts/create_config @@ -94,7 +94,7 @@ case $line in TARGET_ABI_DIR=*) # do nothing ;; - TARGET_ARCH2=*) + TARGET_NAME=*) # do nothing ;; TARGET_DIRS=*) From b9a7b74f77619d3e7fb3834fbdcd3bde036ac399 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 4 Jun 2013 14:45:26 +0200 Subject: [PATCH 03/10] build: do not use TARGET_ARCH TARGET_ARCH is generally wrong to use, there are better variables provided in config-target.mak. The right one is usually TARGET_NAME (previously TARGET_ARCH2), but for bsd-user we can also use TARGET_ABI_DIR for consistency with linux-user. Signed-off-by: Paolo Bonzini Message-id: 1370349928-20419-4-git-send-email-pbonzini@redhat.com Signed-off-by: Peter Maydell --- Makefile.target | 8 ++++---- docs/tracing.txt | 2 +- scripts/tracetool.py | 18 +++++++++--------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Makefile.target b/Makefile.target index fcc880bd2a..9a4985213b 100644 --- a/Makefile.target +++ b/Makefile.target @@ -48,7 +48,7 @@ $(QEMU_PROG).stp-installed: $(SRC_PATH)/trace-events --format=stap \ --backend=$(TRACE_BACKEND) \ --binary=$(bindir)/$(QEMU_PROG) \ - --target-arch=$(TARGET_ARCH) \ + --target-name=$(TARGET_NAME) \ --target-type=$(TARGET_TYPE) \ < $< > $@," GEN $(TARGET_DIR)$(QEMU_PROG).stp-installed") @@ -57,7 +57,7 @@ $(QEMU_PROG).stp: $(SRC_PATH)/trace-events --format=stap \ --backend=$(TRACE_BACKEND) \ --binary=$(realpath .)/$(QEMU_PROG) \ - --target-arch=$(TARGET_ARCH) \ + --target-name=$(TARGET_NAME) \ --target-type=$(TARGET_TYPE) \ < $< > $@," GEN $(TARGET_DIR)$(QEMU_PROG).stp") @@ -103,7 +103,7 @@ endif #CONFIG_LINUX_USER ifdef CONFIG_BSD_USER -QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH) +QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ABI_DIR) obj-y += bsd-user/ obj-y += gdbstub.o user-exec.o @@ -128,7 +128,7 @@ obj-$(CONFIG_XEN) += xen-all.o xen-mapcache.o obj-$(CONFIG_NO_XEN) += xen-stub.o # Hardware support -ifeq ($(TARGET_ARCH), sparc64) +ifeq ($(TARGET_NAME), sparc64) obj-y += hw/sparc64/ else obj-y += hw/$(TARGET_BASE_ARCH)/ diff --git a/docs/tracing.txt b/docs/tracing.txt index 60ff9c5e6e..bfc261bcaf 100644 --- a/docs/tracing.txt +++ b/docs/tracing.txt @@ -225,7 +225,7 @@ probes: scripts/tracetool --dtrace --stap \ --binary path/to/qemu-binary \ --target-type system \ - --target-arch x86_64 \ + --target-name x86_64 \ qemu.stp == Trace event properties == diff --git a/scripts/tracetool.py b/scripts/tracetool.py index a79ec0f096..5f4890f3ab 100755 --- a/scripts/tracetool.py +++ b/scripts/tracetool.py @@ -46,9 +46,9 @@ def error_opt(msg = None): --check-backend Check if the given backend is valid. --binary Full path to QEMU binary. --target-type QEMU emulator target type ('system' or 'user'). - --target-arch QEMU emulator target arch. + --target-name QEMU emulator target name. --probe-prefix Prefix for dtrace probe names - (default: qemu--).\ + (default: qemu--).\ """ % { "script" : _SCRIPT, "backends" : backend_descr, @@ -66,7 +66,7 @@ def main(args): _SCRIPT = args[0] long_opts = [ "backend=", "format=", "help", "list-backends", "check-backend" ] - long_opts += [ "binary=", "target-type=", "target-arch=", "probe-prefix=" ] + long_opts += [ "binary=", "target-type=", "target-name=", "probe-prefix=" ] try: opts, args = getopt.getopt(args[1:], "", long_opts) @@ -78,7 +78,7 @@ def main(args): arg_format = "" binary = None target_type = None - target_arch = None + target_name = None probe_prefix = None for opt, arg in opts: if opt == "--help": @@ -100,8 +100,8 @@ def main(args): binary = arg elif opt == '--target-type': target_type = arg - elif opt == '--target-arch': - target_arch = arg + elif opt == '--target-name': + target_name = arg elif opt == '--probe-prefix': probe_prefix = arg @@ -122,11 +122,11 @@ def main(args): error_opt("--binary is required for SystemTAP tapset generator") if probe_prefix is None and target_type is None: error_opt("--target-type is required for SystemTAP tapset generator") - if probe_prefix is None and target_arch is None: - error_opt("--target-arch is required for SystemTAP tapset generator") + if probe_prefix is None and target_name is None: + error_opt("--target-name is required for SystemTAP tapset generator") if probe_prefix is None: - probe_prefix = ".".join([ "qemu", target_type, target_arch ]) + probe_prefix = ".".join([ "qemu", target_type, target_name ]) try: tracetool.generate(sys.stdin, arg_format, arg_backend, From 2e59915d4375b632964c0594799fd5876958eda6 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 4 Jun 2013 14:45:27 +0200 Subject: [PATCH 04/10] main: use TARGET_ARCH only for the target-specific #define Everything else needs to match the executable name, which is TARGET_NAME. Before: $ sh4eb-linux-user/qemu-sh4eb --help usage: qemu-sh4 [options] program [arguments...] Linux CPU emulator (compiled for sh4 emulation) After: $ sh4eb-linux-user/qemu-sh4eb --help usage: qemu-sh4eb [options] program [arguments...] Linux CPU emulator (compiled for sh4eb emulation) Signed-off-by: Paolo Bonzini Message-id: 1370349928-20419-5-git-send-email-pbonzini@redhat.com Signed-off-by: Peter Maydell --- arch_init.c | 2 +- bsd-user/main.c | 6 +++--- configure | 1 - linux-user/main.c | 6 +++--- scripts/create_config | 13 ++++--------- 5 files changed, 11 insertions(+), 17 deletions(-) diff --git a/arch_init.c b/arch_init.c index 5d32ecf23a..23ca953cb5 100644 --- a/arch_init.c +++ b/arch_init.c @@ -123,7 +123,7 @@ static struct defconfig_file { bool userconfig; } default_config_files[] = { { CONFIG_QEMU_CONFDIR "/qemu.conf", true }, - { CONFIG_QEMU_CONFDIR "/target-" TARGET_ARCH ".conf", true }, + { CONFIG_QEMU_CONFDIR "/target-" TARGET_NAME ".conf", true }, { NULL }, /* end of list */ }; diff --git a/bsd-user/main.c b/bsd-user/main.c index 0da3ab9e21..572f13afe4 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -670,8 +670,8 @@ void cpu_loop(CPUSPARCState *env) static void usage(void) { - printf("qemu-" TARGET_ARCH " version " QEMU_VERSION ", Copyright (c) 2003-2008 Fabrice Bellard\n" - "usage: qemu-" TARGET_ARCH " [options] program [arguments...]\n" + printf("qemu-" TARGET_NAME " version " QEMU_VERSION ", Copyright (c) 2003-2008 Fabrice Bellard\n" + "usage: qemu-" TARGET_NAME " [options] program [arguments...]\n" "BSD CPU emulator (compiled for %s emulation)\n" "\n" "Standard options:\n" @@ -706,7 +706,7 @@ static void usage(void) "Note that if you provide several changes to single variable\n" "last change will stay in effect.\n" , - TARGET_ARCH, + TARGET_NAME, interp_prefix, x86_stack_size); exit(1); diff --git a/configure b/configure index 1dfa71283f..46a2173c1f 100755 --- a/configure +++ b/configure @@ -4243,7 +4243,6 @@ upper() { echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]' } -echo "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak target_arch_name="`upper $TARGET_ARCH`" echo "TARGET_$target_arch_name=y" >> $config_target_mak echo "TARGET_NAME=$target_name" >> $config_target_mak diff --git a/linux-user/main.c b/linux-user/main.c index b97b8cfd33..21725a4971 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -3339,7 +3339,7 @@ static void handle_arg_strace(const char *arg) static void handle_arg_version(const char *arg) { - printf("qemu-" TARGET_ARCH " version " QEMU_VERSION QEMU_PKGVERSION + printf("qemu-" TARGET_NAME " version " QEMU_VERSION QEMU_PKGVERSION ", Copyright (c) 2003-2008 Fabrice Bellard\n"); exit(0); } @@ -3400,8 +3400,8 @@ static void usage(void) int maxarglen; int maxenvlen; - printf("usage: qemu-" TARGET_ARCH " [options] program [arguments...]\n" - "Linux CPU emulator (compiled for " TARGET_ARCH " emulation)\n" + printf("usage: qemu-" TARGET_NAME " [options] program [arguments...]\n" + "Linux CPU emulator (compiled for " TARGET_NAME " emulation)\n" "\n" "Options and associated environment variables:\n" "\n"); diff --git a/scripts/create_config b/scripts/create_config index 6461ef6059..b1adbf5897 100755 --- a/scripts/create_config +++ b/scripts/create_config @@ -77,16 +77,10 @@ case $line in value=${line#*=} echo "#define $name $value" ;; - TARGET_ARCH=*) # configuration - target_arch=${line#*=} - echo "#define TARGET_ARCH \"$target_arch\"" - ;; TARGET_BASE_ARCH=*) # configuration target_base_arch=${line#*=} - if [ "$target_base_arch" != "$target_arch" ]; then - base_arch_name=`echo $target_base_arch | LC_ALL=C tr '[a-z]' '[A-Z]'` - echo "#define TARGET_$base_arch_name 1" - fi + base_arch_name=`echo $target_base_arch | LC_ALL=C tr '[a-z]' '[A-Z]'` + echo "#define TARGET_$base_arch_name 1" ;; TARGET_XML_FILES=*) # do nothing @@ -95,7 +89,8 @@ case $line in # do nothing ;; TARGET_NAME=*) - # do nothing + target_name=${line#*=} + echo "#define TARGET_NAME \"$target_name\"" ;; TARGET_DIRS=*) # do nothing From c02a9552a4c89f2fdf23defe1d2c13b834ae3a4a Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 4 Jun 2013 14:45:28 +0200 Subject: [PATCH 05/10] build: drop TARGET_TYPE Just use the TARGET_NAME free string. Signed-off-by: Paolo Bonzini Reviewed-by: Eric Blake Message-id: 1370349928-20419-6-git-send-email-pbonzini@redhat.com Signed-off-by: Peter Maydell --- arch_init.c | 2 +- configure | 1 - qapi-schema.json | 18 +----------------- 3 files changed, 2 insertions(+), 19 deletions(-) diff --git a/arch_init.c b/arch_init.c index 23ca953cb5..699c92735f 100644 --- a/arch_init.c +++ b/arch_init.c @@ -1094,7 +1094,7 @@ TargetInfo *qmp_query_target(Error **errp) { TargetInfo *info = g_malloc0(sizeof(*info)); - info->arch = TARGET_TYPE; + info->arch = g_strdup(TARGET_NAME); return info; } diff --git a/configure b/configure index 46a2173c1f..8732185f07 100755 --- a/configure +++ b/configure @@ -4246,7 +4246,6 @@ upper() { target_arch_name="`upper $TARGET_ARCH`" echo "TARGET_$target_arch_name=y" >> $config_target_mak echo "TARGET_NAME=$target_name" >> $config_target_mak -echo "TARGET_TYPE=TARGET_TYPE_`upper $target_name`" >> $config_target_mak echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak if [ "$TARGET_ABI_DIR" = "" ]; then TARGET_ABI_DIR=$TARGET_ARCH diff --git a/qapi-schema.json b/qapi-schema.json index 5ad6894738..a80ee405d1 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -3012,22 +3012,6 @@ ## { 'command': 'query-fdsets', 'returns': ['FdsetInfo'] } -## -# @TargetType -# -# Target CPU emulation type -# -# These parameters correspond to the softmmu binary CPU name that is currently -# running. -# -# Since: 1.2.0 -## -{ 'enum': 'TargetType', - 'data': [ 'alpha', 'arm', 'cris', 'i386', 'lm32', 'm68k', 'microblazeel', - 'microblaze', 'mips64el', 'mips64', 'mipsel', 'mips', 'moxie', - 'or32', 'ppc64', 'ppcemb', 'ppc', 's390x', 'sh4eb', 'sh4', - 'sparc64', 'sparc', 'unicore32', 'x86_64', 'xtensaeb', 'xtensa' ] } - ## # @TargetInfo: # @@ -3038,7 +3022,7 @@ # Since: 1.2.0 ## { 'type': 'TargetInfo', - 'data': { 'arch': 'TargetType' } } + 'data': { 'arch': 'str' } } ## # @query-target: From 96ce65457690561417ae8e6f0e85f3c6f135018b Mon Sep 17 00:00:00 2001 From: Peter Crosthwaite Date: Mon, 27 May 2013 14:20:57 +1000 Subject: [PATCH 06/10] configure: dtc: Probe for libfdt_env.h Currently QEMU provides a local clone of the file libfdt_env.h in /include. This file is supposed to come with the libfdt package and is only needed for broken installs of libfdt. Now that we have submodule dtc, just ignore these broken installs and prompt for the dtc submodule install instead. QEMU's local libfdt_env.h is removed accordingly. Manifests as a bug when building QEMU with modern libfdt. The new version of libfdt does not compile when QEMUs libfdt_env.h takes precedence over the hosts. Signed-off-by: Peter Crosthwaite Reviewed-by: Peter Maydell Acked-by: David Gibson Signed-off-by: Kim Phillips Acked-by: Paolo Bonzini Message-id: 9b6a3a52e3f46cfbc1ded9ab56385ec045e46705.1369628289.git.peter.crosthwaite@xilinx.com Signed-off-by: Peter Maydell --- configure | 2 ++ include/libfdt_env.h | 36 ------------------------------------ 2 files changed, 2 insertions(+), 36 deletions(-) delete mode 100644 include/libfdt_env.h diff --git a/configure b/configure index 8732185f07..31b778337e 100755 --- a/configure +++ b/configure @@ -2488,7 +2488,9 @@ fi # fdt probe if test "$fdt" != "no" ; then fdt_libs="-lfdt" + # explicitly check for libfdt_env.h as it is missing in some stable installs cat > $TMPC << EOF +#include int main(void) { return 0; } EOF if compile_prog "" "$fdt_libs" ; then diff --git a/include/libfdt_env.h b/include/libfdt_env.h deleted file mode 100644 index 3667d4cb3a..0000000000 --- a/include/libfdt_env.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2, as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - * - * Copyright IBM Corp. 2008 - * Authors: Hollis Blanchard - * - */ - -#ifndef _LIBFDT_ENV_H -#define _LIBFDT_ENV_H - -#include "qemu/bswap.h" - -#ifdef HOST_WORDS_BIGENDIAN -#define fdt32_to_cpu(x) (x) -#define cpu_to_fdt32(x) (x) -#define fdt64_to_cpu(x) (x) -#define cpu_to_fdt64(x) (x) -#else -#define fdt32_to_cpu(x) bswap32(x) -#define cpu_to_fdt32(x) bswap32(x) -#define fdt64_to_cpu(x) bswap64(x) -#define cpu_to_fdt64(x) bswap64(x) -#endif - -#endif /* _LIBFDT_ENV_H */ From e169e1e1ae1e75c522f932554890fb0f2f3e9999 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Fri, 24 May 2013 16:26:54 +0100 Subject: [PATCH 07/10] configure: Require libfdt for arm, ppc, microblaze softmmu targets A number of our softmmu targets (PPC, ARM, Microblaze) now more or less require flattened device tree support for various board models to work correctly. Make libfdt mandatory if the target list includes these, rather than building unhelpful half-functional binaries. Signed-off-by: Peter Maydell Reviewed-by: Edgar E. Iglesias Reviewed-by: Peter Crosthwaite Tested-by: Edgar E. Iglesias Message-id: 1369409217-7553-2-git-send-email-peter.maydell@linaro.org --- configure | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/configure b/configure index 31b778337e..ad32f87b8e 100755 --- a/configure +++ b/configure @@ -2486,6 +2486,26 @@ fi ########################################## # fdt probe +# fdt support is mandatory for at least some target architectures, +# so insist on it if we're building those system emulators. +fdt_required=no +for target in $target_list; do + case $target in + arm*-softmmu|ppc*-softmmu|microblaze*-softmmu) + fdt_required=yes + ;; + esac +done + +if test "$fdt_required" = "yes"; then + if test "$fdt" = "no"; then + error_exit "fdt disabled but some requested targets require it." \ + "You can turn off fdt only if you also disable all the system emulation" \ + "targets which need it (by specifying a cut down --target-list)." + fi + fdt=yes +fi + if test "$fdt" != "no" ; then fdt_libs="-lfdt" # explicitly check for libfdt_env.h as it is missing in some stable installs From 298c3833dba62512659ab550c3daa1e6d8faec94 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Fri, 24 May 2013 16:26:55 +0100 Subject: [PATCH 08/10] arm: Remove CONFIG_FDT conditionals Now that we know we're compiling with libfdt, we can remove the CONFIG_FDT conditionals. Signed-off-by: Peter Maydell Reviewed-by: Edgar E. Iglesias Reviewed-by: Peter Crosthwaite Tested-by: Edgar E. Iglesias Message-id: 1369409217-7553-3-git-send-email-peter.maydell@linaro.org --- hw/arm/boot.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/hw/arm/boot.c b/hw/arm/boot.c index f451529fce..defcf15097 100644 --- a/hw/arm/boot.c +++ b/hw/arm/boot.c @@ -227,7 +227,6 @@ static void set_kernel_args_old(const struct arm_boot_info *info) static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo) { -#ifdef CONFIG_FDT uint32_t *mem_reg_property; uint32_t mem_reg_propsize; void *fdt = NULL; @@ -308,12 +307,6 @@ static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo) cpu_physical_memory_write(addr, fdt, size); return 0; - -#else - fprintf(stderr, "Device tree requested, " - "but qemu was compiled without fdt support\n"); - return -1; -#endif } static void do_cpu_reset(void *opaque) From 564720219a0863625e9989fd258ccc57a616550f Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Fri, 24 May 2013 16:26:56 +0100 Subject: [PATCH 09/10] microblaze: Remove CONFIG_FDT conditionals Now that we know we're compiling with libfdt we can remove the CONFIG_FDT conditionals. Signed-off-by: Peter Maydell Reviewed-by: Edgar E. Iglesias Reviewed-by: Peter Crosthwaite Tested-by: Edgar E. Iglesias Message-id: 1369409217-7553-4-git-send-email-peter.maydell@linaro.org --- hw/microblaze/boot.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/hw/microblaze/boot.c b/hw/microblaze/boot.c index e543d886b8..3f1d70ef9b 100644 --- a/hw/microblaze/boot.c +++ b/hw/microblaze/boot.c @@ -61,7 +61,6 @@ static int microblaze_load_dtb(hwaddr addr, const char *dtb_filename) { int fdt_size; -#ifdef CONFIG_FDT void *fdt = NULL; int r; @@ -81,17 +80,6 @@ static int microblaze_load_dtb(hwaddr addr, } cpu_physical_memory_write(addr, fdt, fdt_size); -#else - /* We lack libfdt so we cannot manipulate the fdt. Just pass on the blob - to the kernel. */ - if (dtb_filename) { - fdt_size = load_image_targphys(dtb_filename, addr, 0x10000); - } - if (kernel_cmdline) { - fprintf(stderr, - "Warning: missing libfdt, cannot pass cmdline to kernel!\n"); - } -#endif return fdt_size; } From 187f1bcb9ce8e3cd3f634dd5405f9e5ed02b38ce Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Fri, 24 May 2013 16:26:57 +0100 Subject: [PATCH 10/10] ppc: Remove CONFIG_FDT conditionals Now that we know we're compiling with libfdt we can remove the CONFIG_FDT conditionals. Signed-off-by: Peter Maydell Reviewed-by: Edgar E. Iglesias Reviewed-by: Peter Crosthwaite Tested-by: Edgar E. Iglesias Message-id: 1369409217-7553-5-git-send-email-peter.maydell@linaro.org --- default-configs/ppc-softmmu.mak | 2 +- default-configs/ppc64-softmmu.mak | 4 ++-- default-configs/ppcemb-softmmu.mak | 2 +- hw/ppc/ppc440_bamboo.c | 2 -- hw/ppc/spapr_vio.c | 6 ------ hw/ppc/virtex_ml507.c | 18 ------------------ 6 files changed, 4 insertions(+), 30 deletions(-) diff --git a/default-configs/ppc-softmmu.mak b/default-configs/ppc-softmmu.mak index cc3587f721..bcaa52fb10 100644 --- a/default-configs/ppc-softmmu.mak +++ b/default-configs/ppc-softmmu.mak @@ -42,6 +42,6 @@ CONFIG_I8259=y CONFIG_XILINX=y CONFIG_XILINX_ETHLITE=y CONFIG_OPENPIC=y -CONFIG_E500=$(CONFIG_FDT) +CONFIG_E500=y # For PReP CONFIG_MC146818RTC=y diff --git a/default-configs/ppc64-softmmu.mak b/default-configs/ppc64-softmmu.mak index 884ea8a1cd..8b7874ea6a 100644 --- a/default-configs/ppc64-softmmu.mak +++ b/default-configs/ppc64-softmmu.mak @@ -42,8 +42,8 @@ CONFIG_I8259=y CONFIG_XILINX=y CONFIG_XILINX_ETHLITE=y CONFIG_OPENPIC=y -CONFIG_PSERIES=$(CONFIG_FDT) -CONFIG_E500=$(CONFIG_FDT) +CONFIG_PSERIES=y +CONFIG_E500=y # For pSeries CONFIG_PCI_HOTPLUG=y # For PReP diff --git a/default-configs/ppcemb-softmmu.mak b/default-configs/ppcemb-softmmu.mak index be93e03ce2..61920ffe63 100644 --- a/default-configs/ppcemb-softmmu.mak +++ b/default-configs/ppcemb-softmmu.mak @@ -37,6 +37,6 @@ CONFIG_I8259=y CONFIG_XILINX=y CONFIG_XILINX_ETHLITE=y CONFIG_OPENPIC=y -CONFIG_E500=$(CONFIG_FDT) +CONFIG_E500=y # For PReP CONFIG_MC146818RTC=y diff --git a/hw/ppc/ppc440_bamboo.c b/hw/ppc/ppc440_bamboo.c index a55e7170cc..b0c1c027d4 100644 --- a/hw/ppc/ppc440_bamboo.c +++ b/hw/ppc/ppc440_bamboo.c @@ -58,7 +58,6 @@ static int bamboo_load_device_tree(hwaddr addr, const char *kernel_cmdline) { int ret = -1; -#ifdef CONFIG_FDT uint32_t mem_reg_property[] = { 0, 0, cpu_to_be32(ramsize) }; char *filename; int fdt_size; @@ -115,7 +114,6 @@ static int bamboo_load_device_tree(hwaddr addr, g_free(fdt); out: -#endif return ret; } diff --git a/hw/ppc/spapr_vio.c b/hw/ppc/spapr_vio.c index 1405c3202c..304f3168f7 100644 --- a/hw/ppc/spapr_vio.c +++ b/hw/ppc/spapr_vio.c @@ -34,9 +34,7 @@ #include "hw/ppc/spapr_vio.h" #include "hw/ppc/xics.h" -#ifdef CONFIG_FDT #include -#endif /* CONFIG_FDT */ /* #define DEBUG_SPAPR */ @@ -94,7 +92,6 @@ VIOsPAPRDevice *spapr_vio_find_by_reg(VIOsPAPRBus *bus, uint32_t reg) return NULL; } -#ifdef CONFIG_FDT static int vio_make_devnode(VIOsPAPRDevice *dev, void *fdt) { @@ -159,7 +156,6 @@ static int vio_make_devnode(VIOsPAPRDevice *dev, return node_off; } -#endif /* CONFIG_FDT */ /* * CRQ handling @@ -570,7 +566,6 @@ static void spapr_vio_register_types(void) type_init(spapr_vio_register_types) -#ifdef CONFIG_FDT static int compare_reg(const void *p1, const void *p2) { VIOsPAPRDevice const *dev1, *dev2; @@ -655,4 +650,3 @@ int spapr_populate_chosen_stdout(void *fdt, VIOsPAPRBus *bus) return ret; } -#endif /* CONFIG_FDT */ diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c index 1b4ce760e6..709a707243 100644 --- a/hw/ppc/virtex_ml507.c +++ b/hw/ppc/virtex_ml507.c @@ -141,7 +141,6 @@ static int xilinx_load_device_tree(hwaddr addr, { char *path; int fdt_size; -#ifdef CONFIG_FDT void *fdt; int r; @@ -162,23 +161,6 @@ static int xilinx_load_device_tree(hwaddr addr, if (r < 0) fprintf(stderr, "couldn't set /chosen/bootargs\n"); cpu_physical_memory_write(addr, fdt, fdt_size); -#else - /* We lack libfdt so we cannot manipulate the fdt. Just pass on the blob - to the kernel. */ - fdt_size = load_image_targphys("ppc.dtb", addr, 0x10000); - if (fdt_size < 0) { - path = qemu_find_file(QEMU_FILE_TYPE_BIOS, BINARY_DEVICE_TREE_FILE); - if (path) { - fdt_size = load_image_targphys(path, addr, 0x10000); - g_free(path); - } - } - - if (kernel_cmdline) { - fprintf(stderr, - "Warning: missing libfdt, cannot pass cmdline to kernel!\n"); - } -#endif return fdt_size; }