- Move qtest accel code to accel/qtest.c, get rid of AccelClass->available

- Test TCG interpreter in gitlab-ci
 - Small improvements to the configure script
 - Use object_initialize_child in hw/pci-host
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJcyxXGAAoJEC7Z13T+cC21jZQP/2bw+RNUCDZJv7Mjs9gWeVnW
 zmawUAw70jJdIGWVRV6uD0sHWnQxu0ejbyN/u10sNIsnN36l/orSW9oqbZ8wmGDt
 GX1do1h6lyXrB9AeIn5eMMQh9ST60fqeHw7cGGF5Smd1y32gjVzkpVBT/+i73UZA
 SU9cyvkO9J735WX+5EHWwa5w4sOfuxq/gIU963KSJI+nFwF41e6MlRRgpO80bW6V
 fxq+uz27O+Lfkeis7WFwlNIMwDc4KSKeVBJdWrXj5/ANCB4AOiAy+NsUyf06N3Zh
 yd6oLWFDTrzkdKEkLBsEoosQLOf2tiRR5/5No0jbwl7tsqru5s6yPkdy3OLEA/QE
 YHd5rwwrqKIisLnjdndDD8zsdnKf9rUF8MqrE/bqwn5LxCr1vppavj0DzIYhfgVD
 esWKQ9egkyRMfSc4Ri1fxkM99SnJPUzZcbTAlOzBH/KvsqDNjuHOVMM/8/wREglR
 9ZkQTS9MT9L7MHSB0/jBLC59jI0TYSH+LqBzKWJT75Nv3/Ux0wd/6xZSzn5glpMs
 YwU/Bs/J0iohcKDj2S7puXwOQPBtIWr8xbCc6VPw+uYuhktw3/z0S/nJYV1DR1Xg
 1I9qTxkEgq5LlISGWKb0KoNWVnkH19d9RbKxXqJH1TZOu1xacOLyxh8fTsiUd9hN
 0GCvIWKUlzbZdQj7qU+g
 =KQkZ
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2019-05-02' into staging

- Move qtest accel code to accel/qtest.c, get rid of AccelClass->available
- Test TCG interpreter in gitlab-ci
- Small improvements to the configure script
- Use object_initialize_child in hw/pci-host

# gpg: Signature made Thu 02 May 2019 17:07:34 BST
# gpg:                using RSA key 2ED9D774FE702DB5
# gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full]
# gpg:                 aka "Thomas Huth <thuth@redhat.com>" [full]
# gpg:                 aka "Thomas Huth <huth@tuxfamily.org>" [full]
# gpg:                 aka "Thomas Huth <th.huth@posteo.de>" [unknown]
# Primary key fingerprint: 27B8 8847 EEE0 2501 18F3  EAB9 2ED9 D774 FE70 2DB5

* remotes/huth-gitlab/tags/pull-request-2019-05-02:
  hw/pci-host: Use object_initialize_child for correct reference counting
  configure: Relax check for libseccomp
  configure: Remove old *-config-devices.mak.d files when running configure
  configure: Add -Wno-typedef-redefinition to CFLAGS (for Clang)
  accel: Remove unused AccelClass::available field
  qtest: Don't compile qtest accel on non-POSIX systems
  qtest: Move accel code to accel/qtest.c
  gitlab-ci.yml: Test the TCG interpreter in a CI pipeline

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2019-05-02 17:17:09 +01:00
commit f62d632f43
13 changed files with 88 additions and 82 deletions

View File

@ -71,3 +71,18 @@ build-clang:
ppc-softmmu s390x-softmmu x86_64-softmmu arm-linux-user"
- make -j2
- make -j2 check
build-tci:
script:
- TARGETS="aarch64 alpha arm hppa m68k microblaze moxie ppc64 s390x x86_64"
- ./configure --enable-tcg-interpreter
--target-list="$(for tg in $TARGETS; do echo -n ${tg}'-softmmu '; done)"
- make -j2
- make tests/boot-serial-test tests/cdrom-test tests/pxe-test
- for tg in $TARGETS ; do
export QTEST_QEMU_BINARY="${tg}-softmmu/qemu-system-${tg}" ;
./tests/boot-serial-test || exit 1 ;
./tests/cdrom-test || exit 1 ;
done
- QTEST_QEMU_BINARY="x86_64-softmmu/qemu-system-x86_64" ./tests/pxe-test
- QTEST_QEMU_BINARY="s390x-softmmu/qemu-system-s390x" ./tests/pxe-test -m slow

View File

@ -2035,6 +2035,7 @@ M: Laurent Vivier <lvivier@redhat.com>
R: Paolo Bonzini <pbonzini@redhat.com>
S: Maintained
F: qtest.c
F: accel/qtest.c
F: tests/libqtest.*
F: tests/libqos/
F: tests/*-test.c

View File

@ -1,4 +1,5 @@
obj-$(CONFIG_SOFTMMU) += accel.o
obj-$(call land,$(CONFIG_SOFTMMU),$(CONFIG_POSIX)) += qtest.o
obj-$(CONFIG_KVM) += kvm/
obj-$(CONFIG_TCG) += tcg/
obj-y += stubs/

View File

@ -107,11 +107,6 @@ void configure_accelerator(MachineState *ms, const char *progname)
if (!acc) {
continue;
}
if (acc->available && !acc->available()) {
printf("%s not supported for this target\n",
acc->name);
continue;
}
ret = accel_init_machine(acc, ms);
if (ret < 0) {
init_failed = true;

54
accel/qtest.c Normal file
View File

@ -0,0 +1,54 @@
/*
* QTest accelerator code
*
* Copyright IBM, Corp. 2011
*
* Authors:
* Anthony Liguori <aliguori@us.ibm.com>
*
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
*
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu/module.h"
#include "qemu/option.h"
#include "qemu/config-file.h"
#include "sysemu/accel.h"
#include "sysemu/qtest.h"
#include "sysemu/cpus.h"
static int qtest_init_accel(MachineState *ms)
{
QemuOpts *opts = qemu_opts_create(qemu_find_opts("icount"), NULL, 0,
&error_abort);
qemu_opt_set(opts, "shift", "0", &error_abort);
configure_icount(opts, &error_abort);
qemu_opts_del(opts);
return 0;
}
static void qtest_accel_class_init(ObjectClass *oc, void *data)
{
AccelClass *ac = ACCEL_CLASS(oc);
ac->name = "QTest";
ac->init_machine = qtest_init_accel;
ac->allowed = &qtest_allowed;
}
#define TYPE_QTEST_ACCEL ACCEL_CLASS_NAME("qtest")
static const TypeInfo qtest_accel_type = {
.name = TYPE_QTEST_ACCEL,
.parent = TYPE_ACCEL,
.class_init = qtest_accel_class_init,
};
static void qtest_type_init(void)
{
type_register_static(&qtest_accel_type);
}
type_init(qtest_type_init);

33
configure vendored
View File

@ -1818,6 +1818,9 @@ EOF
exit 0
fi
# Remove old dependency files to make sure that they get properly regenerated
rm -f *-config-devices.mak.d
if ! has $python; then
error_exit "Python not found. Use --python=/path/to/python"
fi
@ -1908,7 +1911,7 @@ gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_
gcc_flags="-Wno-missing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
gcc_flags="-Wendif-labels -Wno-shift-negative-value $gcc_flags"
gcc_flags="-Wno-initializer-overrides -Wexpansion-to-defined $gcc_flags"
gcc_flags="-Wno-string-plus-int $gcc_flags"
gcc_flags="-Wno-string-plus-int -Wno-typedef-redefinition $gcc_flags"
# Note that we do not add -Werror to gcc_flags here, because that would
# enable it for all configure tests. If a configure test failed due
# to -Werror this would just silently disable some features,
@ -2371,36 +2374,16 @@ fi
##########################################
# libseccomp check
libseccomp_minver="2.2.0"
if test "$seccomp" != "no" ; then
case "$cpu" in
i386|x86_64|mips)
;;
arm|aarch64)
libseccomp_minver="2.2.3"
;;
ppc|ppc64|s390x)
libseccomp_minver="2.3.0"
;;
*)
libseccomp_minver=""
;;
esac
if test "$libseccomp_minver" != "" &&
$pkg_config --atleast-version=$libseccomp_minver libseccomp ; then
libseccomp_minver="2.3.0"
if $pkg_config --atleast-version=$libseccomp_minver libseccomp ; then
seccomp_cflags="$($pkg_config --cflags libseccomp)"
seccomp_libs="$($pkg_config --libs libseccomp)"
seccomp="yes"
else
if test "$seccomp" = "yes" ; then
if test "$libseccomp_minver" != "" ; then
feature_not_found "libseccomp" \
"Install libseccomp devel >= $libseccomp_minver"
else
feature_not_found "libseccomp" \
"libseccomp is not supported for host cpu $cpu"
fi
feature_not_found "libseccomp" \
"Install libseccomp devel >= $libseccomp_minver"
fi
seccomp="no"
fi

View File

@ -721,8 +721,8 @@ static void designware_pcie_host_init(Object *obj)
DesignwarePCIEHost *s = DESIGNWARE_PCIE_HOST(obj);
DesignwarePCIERoot *root = &s->root;
object_initialize(root, sizeof(*root), TYPE_DESIGNWARE_PCIE_ROOT);
object_property_add_child(obj, "root", OBJECT(root), NULL);
object_initialize_child(obj, "root", root, sizeof(*root),
TYPE_DESIGNWARE_PCIE_ROOT, &error_abort, NULL);
qdev_prop_set_int32(DEVICE(root), "addr", PCI_DEVFN(0, 0));
qdev_prop_set_bit(DEVICE(root), "multifunction", false);
}

View File

@ -29,6 +29,7 @@
* http://www.firmware.org/1275/practice/imap/imap0_9d.pdf
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "hw/hw.h"
#include "hw/pci-host/gpex.h"
@ -120,8 +121,8 @@ static void gpex_host_initfn(Object *obj)
GPEXHost *s = GPEX_HOST(obj);
GPEXRootState *root = &s->gpex_root;
object_initialize(root, sizeof(*root), TYPE_GPEX_ROOT_DEVICE);
object_property_add_child(obj, "gpex_root", OBJECT(root), NULL);
object_initialize_child(obj, "gpex_root", root, sizeof(*root),
TYPE_GPEX_ROOT_DEVICE, &error_abort, NULL);
qdev_prop_set_int32(DEVICE(root), "addr", PCI_DEVFN(0, 0));
qdev_prop_set_bit(DEVICE(root), "multifunction", false);
}

View File

@ -216,8 +216,8 @@ static void q35_host_initfn(Object *obj)
memory_region_init_io(&phb->data_mem, obj, &pci_host_data_le_ops, phb,
"pci-conf-data", 4);
object_initialize(&s->mch, sizeof(s->mch), TYPE_MCH_PCI_DEVICE);
object_property_add_child(OBJECT(s), "mch", OBJECT(&s->mch), NULL);
object_initialize_child(OBJECT(s), "mch", &s->mch, sizeof(s->mch),
TYPE_MCH_PCI_DEVICE, &error_abort, NULL);
qdev_prop_set_int32(DEVICE(&s->mch), "addr", PCI_DEVFN(0, 0));
qdev_prop_set_bit(DEVICE(&s->mch), "multifunction", false);
/* mch's object_initialize resets the default value, set it again */

View File

@ -149,8 +149,8 @@ static void xilinx_pcie_host_init(Object *obj)
XilinxPCIEHost *s = XILINX_PCIE_HOST(obj);
XilinxPCIERoot *root = &s->root;
object_initialize(root, sizeof(*root), TYPE_XILINX_PCIE_ROOT);
object_property_add_child(obj, "root", OBJECT(root), NULL);
object_initialize_child(obj, "root", root, sizeof(*root),
TYPE_XILINX_PCIE_ROOT, &error_abort, NULL);
qdev_prop_set_int32(DEVICE(root), "addr", PCI_DEVFN(0, 0));
qdev_prop_set_bit(DEVICE(root), "multifunction", false);
}

View File

@ -38,7 +38,6 @@ typedef struct AccelClass {
const char *opt_name;
const char *name;
int (*available)(void);
int (*init_machine)(MachineState *ms);
void (*setup_post)(MachineState *ms, AccelState *accel);
bool *allowed;

View File

@ -27,13 +27,4 @@ bool qtest_driver(void);
void qtest_init(const char *qtest_chrdev, const char *qtest_log, Error **errp);
static inline int qtest_available(void)
{
#ifdef CONFIG_POSIX
return 1;
#else
return 0;
#endif
}
#endif

34
qtest.c
View File

@ -749,16 +749,6 @@ static void qtest_event(void *opaque, int event)
}
}
static int qtest_init_accel(MachineState *ms)
{
QemuOpts *opts = qemu_opts_create(qemu_find_opts("icount"), NULL, 0,
&error_abort);
qemu_opt_set(opts, "shift", "0", &error_abort);
configure_icount(opts, &error_abort);
qemu_opts_del(opts);
return 0;
}
void qtest_init(const char *qtest_chrdev, const char *qtest_log, Error **errp)
{
Chardev *chr;
@ -791,27 +781,3 @@ bool qtest_driver(void)
{
return qtest_chr.chr != NULL;
}
static void qtest_accel_class_init(ObjectClass *oc, void *data)
{
AccelClass *ac = ACCEL_CLASS(oc);
ac->name = "QTest";
ac->available = qtest_available;
ac->init_machine = qtest_init_accel;
ac->allowed = &qtest_allowed;
}
#define TYPE_QTEST_ACCEL ACCEL_CLASS_NAME("qtest")
static const TypeInfo qtest_accel_type = {
.name = TYPE_QTEST_ACCEL,
.parent = TYPE_ACCEL,
.class_init = qtest_accel_class_init,
};
static void qtest_type_init(void)
{
type_register_static(&qtest_accel_type);
}
type_init(qtest_type_init);