Merge remote-tracking branch 'pmaydell/configury.next' into staging

# By Paolo Bonzini (4) and others
# Via Peter Maydell
* pmaydell/configury.next:
  ppc: Remove CONFIG_FDT conditionals
  microblaze: Remove CONFIG_FDT conditionals
  arm: Remove CONFIG_FDT conditionals
  configure: Require libfdt for arm, ppc, microblaze softmmu targets
  configure: dtc: Probe for libfdt_env.h
  build: drop TARGET_TYPE
  main: use TARGET_ARCH only for the target-specific #define
  build: do not use TARGET_ARCH
  build: rename TARGET_ARCH2 to TARGET_NAME
  Add a stp file for usage from build directory

Message-id: 1371221594-11556-1-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
Anthony Liguori 2013-06-17 08:57:56 -05:00
commit 38aea177d9
18 changed files with 87 additions and 159 deletions

View file

@ -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)
@ -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-name=$(TARGET_NAME) \
--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-name=$(TARGET_NAME) \
--target-type=$(TARGET_TYPE) \
< $< > $@," GEN $(TARGET_DIR)$(QEMU_PROG).stp")
else
stap:
endif
@ -93,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
@ -118,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)/
@ -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

View file

@ -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 */
};
@ -1093,7 +1093,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;
}

View file

@ -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);

60
configure vendored
View file

@ -2486,9 +2486,31 @@ 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
cat > $TMPC << EOF
#include <libfdt_env.h>
int main(void) { return 0; }
EOF
if compile_prog "" "$fdt_libs" ; then
@ -4083,10 +4105,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 +4118,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 +4146,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)
@ -4243,17 +4265,15 @@ 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_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_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 +4284,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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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 \
<trace-events >qemu.stp
== Trace event properties ==

View file

@ -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)

View file

@ -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;
}

View file

@ -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;
}

View file

@ -34,9 +34,7 @@
#include "hw/ppc/spapr_vio.h"
#include "hw/ppc/xics.h"
#ifdef CONFIG_FDT
#include <libfdt.h>
#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 */

View file

@ -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;
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*
* Copyright IBM Corp. 2008
* Authors: Hollis Blanchard <hollisb@us.ibm.com>
*
*/
#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 */

View file

@ -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");

View file

@ -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:

View file

@ -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
@ -94,8 +88,9 @@ case $line in
TARGET_ABI_DIR=*)
# do nothing
;;
TARGET_ARCH2=*)
# do nothing
TARGET_NAME=*)
target_name=${line#*=}
echo "#define TARGET_NAME \"$target_name\""
;;
TARGET_DIRS=*)
# do nothing

View file

@ -46,9 +46,9 @@ def error_opt(msg = None):
--check-backend Check if the given backend is valid.
--binary <path> Full path to QEMU binary.
--target-type <type> QEMU emulator target type ('system' or 'user').
--target-arch <arch> QEMU emulator target arch.
--target-name <name> QEMU emulator target name.
--probe-prefix <prefix> Prefix for dtrace probe names
(default: qemu-<target-type>-<target-arch>).\
(default: qemu-<target-type>-<target-name>).\
""" % {
"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,