diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2016-09-06 13:33:17 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2016-09-06 13:33:17 +0100 |
commit | 085c9150195b383cb978351e12d24df9ba129ae9 (patch) | |
tree | 39569dd54ded58068aae78957dccc913ca077782 /tests | |
parent | 30e7d092b26146eb2abb77e0a0952aea012e36bf (diff) | |
parent | 6546d0dba6c211c1a3eac1252a4f50a0c151a08a (diff) | |
download | qemu-085c9150195b383cb978351e12d24df9ba129ae9.zip qemu-085c9150195b383cb978351e12d24df9ba129ae9.tar.gz qemu-085c9150195b383cb978351e12d24df9ba129ae9.tar.bz2 |
Merge remote-tracking branch 'remotes/ehabkost/tags/x86-pull-request' into staging
x86 and memory backends queue, 2016-09-05
This includes a few features that were submitted just after hard
freeze, and a bug fix for memory backend initialization ordering.
# gpg: Signature made Mon 05 Sep 2016 20:50:14 BST
# gpg: using RSA key 0x2807936F984DC5A6
# gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>"
# Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF D1AA 2807 936F 984D C5A6
* remotes/ehabkost/tags/x86-pull-request:
vl: Delay initialization of memory backends
vhost-user-test: Use libqos instead of pxe-virtio.rom
target-i386: Add more Intel AVX-512 instructions support
exec: Ensure the only one cpu_index allocation method is used
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.include | 2 | ||||
-rw-r--r-- | tests/vhost-user-test.c | 37 |
2 files changed, 35 insertions, 4 deletions
diff --git a/tests/Makefile.include b/tests/Makefile.include index 14be491..03382b5 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -622,7 +622,7 @@ tests/usb-hcd-ehci-test$(EXESUF): tests/usb-hcd-ehci-test.o $(libqos-usb-obj-y) tests/usb-hcd-xhci-test$(EXESUF): tests/usb-hcd-xhci-test.o $(libqos-usb-obj-y) tests/pc-cpu-test$(EXESUF): tests/pc-cpu-test.o tests/postcopy-test$(EXESUF): tests/postcopy-test.o -tests/vhost-user-test$(EXESUF): tests/vhost-user-test.o qemu-char.o qemu-timer.o $(qtest-obj-y) $(test-io-obj-y) +tests/vhost-user-test$(EXESUF): tests/vhost-user-test.o qemu-char.o qemu-timer.o $(qtest-obj-y) $(test-io-obj-y) $(libqos-virtio-obj-y) tests/qemu-iotests/socket_scm_helper$(EXESUF): tests/qemu-iotests/socket_scm_helper.o tests/test-qemu-opts$(EXESUF): tests/test-qemu-opts.o $(test-util-obj-y) tests/test-write-threshold$(EXESUF): tests/test-write-threshold.o $(test-block-obj-y) diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 27b10c1..b89a551 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -16,8 +16,13 @@ #include "qemu/sockets.h" #include "sysemu/char.h" #include "sysemu/sysemu.h" +#include "libqos/libqos.h" +#include "libqos/pci-pc.h" +#include "libqos/virtio-pci.h" #include <linux/vhost.h> +#include <linux/virtio_ids.h> +#include <linux/virtio_net.h> #include <sys/vfs.h> /* GLIB version compatibility flags */ @@ -29,14 +34,13 @@ #define HAVE_MONOTONIC_TIME #endif -#define QEMU_CMD_ACCEL " -machine accel=tcg" #define QEMU_CMD_MEM " -m %d -object memory-backend-file,id=mem,size=%dM,"\ "mem-path=%s,share=on -numa node,memdev=mem" #define QEMU_CMD_CHR " -chardev socket,id=%s,path=%s%s" #define QEMU_CMD_NETDEV " -netdev vhost-user,id=net0,chardev=%s,vhostforce" -#define QEMU_CMD_NET " -device virtio-net-pci,netdev=net0,romfile=./pc-bios/pxe-virtio.rom" +#define QEMU_CMD_NET " -device virtio-net-pci,netdev=net0" -#define QEMU_CMD QEMU_CMD_ACCEL QEMU_CMD_MEM QEMU_CMD_CHR \ +#define QEMU_CMD QEMU_CMD_MEM QEMU_CMD_CHR \ QEMU_CMD_NETDEV QEMU_CMD_NET #define HUGETLBFS_MAGIC 0x958458f6 @@ -136,6 +140,30 @@ typedef struct TestServer { static const char *tmpfs; static const char *root; +static void init_virtio_dev(TestServer *s) +{ + QPCIBus *bus; + QVirtioPCIDevice *dev; + uint32_t features; + + bus = qpci_init_pc(); + g_assert_nonnull(bus); + + dev = qvirtio_pci_device_find(bus, VIRTIO_ID_NET); + g_assert_nonnull(dev); + + qvirtio_pci_device_enable(dev); + qvirtio_reset(&qvirtio_pci, &dev->vdev); + qvirtio_set_acknowledge(&qvirtio_pci, &dev->vdev); + qvirtio_set_driver(&qvirtio_pci, &dev->vdev); + + features = qvirtio_get_features(&qvirtio_pci, &dev->vdev); + features = features & VIRTIO_NET_F_MAC; + qvirtio_set_features(&qvirtio_pci, &dev->vdev, features); + + qvirtio_set_driver_ok(&qvirtio_pci, &dev->vdev); +} + static void wait_for_fds(TestServer *s) { gint64 end_time; @@ -548,6 +576,7 @@ static void test_migrate(void) from = qtest_start(cmd); g_free(cmd); + init_virtio_dev(s); wait_for_fds(s); size = get_log_size(s); g_assert_cmpint(size, ==, (2 * 1024 * 1024) / (VHOST_LOG_PAGE * 8)); @@ -662,6 +691,7 @@ static void test_reconnect_subprocess(void) qtest_start(cmd); g_free(cmd); + init_virtio_dev(s); wait_for_fds(s); wait_for_rings_started(s, 2); @@ -728,6 +758,7 @@ int main(int argc, char **argv) s = qtest_start(qemu_cmd); g_free(qemu_cmd); + init_virtio_dev(server); qtest_add_data_func("/vhost-user/read-guest-mem", server, read_guest_mem); qtest_add_func("/vhost-user/migrate", test_migrate); |