aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2022-02-22 13:07:32 +0000
committerPeter Maydell <peter.maydell@linaro.org>2022-02-22 13:07:32 +0000
commit5abccc7922ca5291327b0a1e84ace526d97c633b (patch)
treeab8a35d147f5b5ed55205247e9eda5f5632d2731
parent922268067fe4181d6edcfccd689e908e4d1243ad (diff)
parent975592f5523fdf8708e4b53da937cf4805b1b79a (diff)
downloadqemu-5abccc7922ca5291327b0a1e84ace526d97c633b.zip
qemu-5abccc7922ca5291327b0a1e84ace526d97c633b.tar.gz
qemu-5abccc7922ca5291327b0a1e84ace526d97c633b.tar.bz2
Merge remote-tracking branch 'remotes/thuth-gitlab/tags/pull-request-2022-02-21' into staging
* Improve virtio-net failover test * Some small fixes for the qtests * Misc header cleanups by Philippe # gpg: Signature made Mon 21 Feb 2022 11:40:37 GMT # gpg: using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5 # gpg: issuer "thuth@redhat.com" # 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/thuth-gitlab/tags/pull-request-2022-02-21: (25 commits) hw/tricore: Remove unused and incorrect header hw/m68k/mcf: Add missing 'exec/hwaddr.h' header exec/exec-all: Move 'qemu/log.h' include in units requiring it softmmu/runstate: Clean headers linux-user: Add missing "qemu/timer.h" include target: Add missing "qemu/timer.h" include core/ptimers: Remove unnecessary 'sysemu/cpus.h' include exec/ramblock: Add missing includes qtest: Add missing 'hw/qdev-core.h' include hw/acpi/memory_hotplug: Remove unused 'hw/acpi/pc-hotplug.h' header hw/remote: Add missing include hw/tpm: Clean includes scripts: Remove the old switch-timer-api script tests/qtest: failover: migration abort test with failover off tests/qtest: failover: test migration if the guest doesn't support failover tests/qtest: failover: check migration with failover off tests/qtest: failover: check missing guest feature tests/qtest: failover: check the feature is correctly provided tests/qtest: failover: use a macro for check_one_card() tests/qtest: failover: clean up pathname of tests ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--bsd-user/signal.c1
-rw-r--r--hw/acpi/memory_hotplug.c1
-rw-r--r--hw/arm/omap1.c1
-rw-r--r--hw/core/ptimer.c1
-rw-r--r--hw/display/omap_dss.c1
-rw-r--r--hw/gpio/omap_gpio.c1
-rw-r--r--hw/input/tsc210x.c1
-rw-r--r--hw/remote/proxy-memory-listener.c1
-rw-r--r--hw/tpm/tpm_crb.c1
-rw-r--r--hw/tpm/tpm_ppi.c4
-rw-r--r--hw/tpm/tpm_ppi.h4
-rw-r--r--include/exec/exec-all.h2
-rw-r--r--include/exec/ramblock.h2
-rw-r--r--include/hw/m68k/mcf.h1
-rw-r--r--include/hw/tricore/triboard.h1
-rw-r--r--linux-user/i386/cpu_loop.c1
-rw-r--r--linux-user/ppc/cpu_loop.c1
-rw-r--r--monitor/misc.c1
-rw-r--r--plugins/api.c1
-rwxr-xr-xscripts/switch-timer-api178
-rw-r--r--softmmu/qtest.c1
-rw-r--r--softmmu/runstate.c3
-rw-r--r--target/alpha/helper.c2
-rw-r--r--target/arm/cpu.c1
-rw-r--r--target/arm/helper.c2
-rw-r--r--target/arm/m_helper.c1
-rw-r--r--target/arm/mte_helper.c1
-rw-r--r--target/avr/helper.c1
-rw-r--r--target/cris/helper.c1
-rw-r--r--target/hexagon/internal.h2
-rw-r--r--target/hexagon/translate.h1
-rw-r--r--target/hppa/cpu.c1
-rw-r--r--target/hppa/helper.c2
-rw-r--r--target/hppa/mem_helper.c1
-rw-r--r--target/hppa/op_helper.c1
-rw-r--r--target/i386/helper.c1
-rw-r--r--target/i386/tcg/int_helper.c1
-rw-r--r--target/i386/tcg/misc_helper.c1
-rw-r--r--target/i386/tcg/sysemu/seg_helper.c1
-rw-r--r--target/i386/tcg/sysemu/svm_helper.c1
-rw-r--r--target/m68k/op_helper.c1
-rw-r--r--target/microblaze/cpu.c1
-rw-r--r--target/microblaze/mmu.c1
-rw-r--r--target/microblaze/op_helper.c1
-rw-r--r--target/mips/tcg/exception.c1
-rw-r--r--target/mips/tcg/sysemu/special_helper.c1
-rw-r--r--target/mips/tcg/translate.h1
-rw-r--r--target/openrisc/interrupt.c1
-rw-r--r--target/openrisc/mmu.c1
-rw-r--r--target/ppc/excp_helper.c1
-rw-r--r--target/ppc/misc_helper.c1
-rw-r--r--target/riscv/csr.c1
-rw-r--r--target/s390x/tcg/excp_helper.c1
-rw-r--r--target/s390x/tcg/mem_helper.c1
-rw-r--r--target/sparc/helper.c1
-rw-r--r--target/sparc/ldst_helper.c1
-rw-r--r--target/sparc/mmu_helper.c1
-rw-r--r--target/tricore/helper.c2
-rw-r--r--target/xtensa/dbg_helper.c1
-rw-r--r--target/xtensa/exc_helper.c1
-rw-r--r--target/xtensa/fpu_helper.c1
-rw-r--r--target/xtensa/helper.c1
-rw-r--r--target/xtensa/mmu_helper.c1
-rw-r--r--target/xtensa/win_helper.c1
-rw-r--r--tests/qtest/device-plug-test.c20
-rw-r--r--tests/qtest/drive_del-test.c35
-rw-r--r--tests/qtest/erst-test.c2
-rw-r--r--tests/qtest/fdc-test.c2
-rw-r--r--tests/qtest/hd-geo-test.c16
-rw-r--r--tests/qtest/i440fx-test.c2
-rw-r--r--tests/qtest/ide-test.c16
-rw-r--r--tests/qtest/ivshmem-test.c7
-rw-r--r--tests/qtest/vhost-user-test.c2
-rw-r--r--tests/qtest/virtio-net-failover.c671
74 files changed, 733 insertions, 296 deletions
diff --git a/bsd-user/signal.c b/bsd-user/signal.c
index 0bc6d2e..8a36b69 100644
--- a/bsd-user/signal.c
+++ b/bsd-user/signal.c
@@ -19,6 +19,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/log.h"
#include "qemu.h"
#include "signal-common.h"
#include "trace.h"
diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c
index a581a21..0a7e89a 100644
--- a/hw/acpi/memory_hotplug.c
+++ b/hw/acpi/memory_hotplug.c
@@ -1,6 +1,5 @@
#include "qemu/osdep.h"
#include "hw/acpi/memory_hotplug.h"
-#include "hw/acpi/pc-hotplug.h"
#include "hw/mem/pc-dimm.h"
#include "hw/qdev-core.h"
#include "migration/vmstate.h"
diff --git a/hw/arm/omap1.c b/hw/arm/omap1.c
index 9852c2a..f693faa 100644
--- a/hw/arm/omap1.c
+++ b/hw/arm/omap1.c
@@ -18,6 +18,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/log.h"
#include "qemu/error-report.h"
#include "qemu/main-loop.h"
#include "qapi/error.h"
diff --git a/hw/core/ptimer.c b/hw/core/ptimer.c
index 6ba19fd..eb5ba1a 100644
--- a/hw/core/ptimer.c
+++ b/hw/core/ptimer.c
@@ -14,7 +14,6 @@
#include "sysemu/cpu-timers.h"
#include "sysemu/qtest.h"
#include "block/aio.h"
-#include "sysemu/cpus.h"
#include "hw/clock.h"
#define DELTA_ADJUST 1
diff --git a/hw/display/omap_dss.c b/hw/display/omap_dss.c
index 21fde58..8c0e9ee 100644
--- a/hw/display/omap_dss.c
+++ b/hw/display/omap_dss.c
@@ -19,6 +19,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/log.h"
#include "hw/hw.h"
#include "hw/irq.h"
#include "ui/console.h"
diff --git a/hw/gpio/omap_gpio.c b/hw/gpio/omap_gpio.c
index e25084b..bd0841d 100644
--- a/hw/gpio/omap_gpio.c
+++ b/hw/gpio/omap_gpio.c
@@ -19,6 +19,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/log.h"
#include "hw/irq.h"
#include "hw/qdev-properties.h"
#include "hw/arm/omap.h"
diff --git a/hw/input/tsc210x.c b/hw/input/tsc210x.c
index 182d372..b0d5c2d 100644
--- a/hw/input/tsc210x.c
+++ b/hw/input/tsc210x.c
@@ -20,6 +20,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/log.h"
#include "hw/hw.h"
#include "audio/audio.h"
#include "qemu/timer.h"
diff --git a/hw/remote/proxy-memory-listener.c b/hw/remote/proxy-memory-listener.c
index 882c9b4..0e893f3 100644
--- a/hw/remote/proxy-memory-listener.c
+++ b/hw/remote/proxy-memory-listener.c
@@ -16,6 +16,7 @@
#include "exec/cpu-common.h"
#include "exec/ram_addr.h"
#include "qapi/error.h"
+#include "qemu/error-report.h"
#include "hw/remote/mpqemu-link.h"
#include "hw/remote/proxy-memory-listener.h"
diff --git a/hw/tpm/tpm_crb.c b/hw/tpm/tpm_crb.c
index 58ebd14..aa9c00a 100644
--- a/hw/tpm/tpm_crb.c
+++ b/hw/tpm/tpm_crb.c
@@ -18,6 +18,7 @@
#include "qemu/module.h"
#include "qapi/error.h"
+#include "exec/address-spaces.h"
#include "hw/qdev-properties.h"
#include "hw/pci/pci_ids.h"
#include "hw/acpi/tpm.h"
diff --git a/hw/tpm/tpm_ppi.c b/hw/tpm/tpm_ppi.c
index 274e9aa..6dbb9f4 100644
--- a/hw/tpm/tpm_ppi.c
+++ b/hw/tpm/tpm_ppi.c
@@ -14,9 +14,9 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
-#include "cpu.h"
#include "sysemu/memory_mapping.h"
#include "migration/vmstate.h"
+#include "hw/qdev-core.h"
#include "hw/acpi/tpm.h"
#include "tpm_ppi.h"
#include "trace.h"
@@ -44,7 +44,7 @@ void tpm_ppi_reset(TPMPPI *tpmppi)
}
}
-void tpm_ppi_init(TPMPPI *tpmppi, struct MemoryRegion *m,
+void tpm_ppi_init(TPMPPI *tpmppi, MemoryRegion *m,
hwaddr addr, Object *obj)
{
tpmppi->buf = qemu_memalign(qemu_real_host_page_size,
diff --git a/hw/tpm/tpm_ppi.h b/hw/tpm/tpm_ppi.h
index 6f773c2..bf5d4a3 100644
--- a/hw/tpm/tpm_ppi.h
+++ b/hw/tpm/tpm_ppi.h
@@ -12,7 +12,7 @@
#ifndef TPM_TPM_PPI_H
#define TPM_TPM_PPI_H
-#include "exec/address-spaces.h"
+#include "exec/memory.h"
typedef struct TPMPPI {
MemoryRegion ram;
@@ -29,7 +29,7 @@ typedef struct TPMPPI {
* Register the TPM PPI memory region at @addr on the given address
* space for the object @obj.
**/
-void tpm_ppi_init(TPMPPI *tpmppi, struct MemoryRegion *m,
+void tpm_ppi_init(TPMPPI *tpmppi, MemoryRegion *m,
hwaddr addr, Object *obj);
/**
diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
index 35d8e93..227e10b 100644
--- a/include/exec/exec-all.h
+++ b/include/exec/exec-all.h
@@ -40,8 +40,6 @@ typedef ram_addr_t tb_page_addr_t;
#define TB_PAGE_ADDR_FMT RAM_ADDR_FMT
#endif
-#include "qemu/log.h"
-
void gen_intermediate_code(CPUState *cpu, TranslationBlock *tb, int max_insns);
void restore_state_to_opc(CPUArchState *env, TranslationBlock *tb,
target_ulong *data);
diff --git a/include/exec/ramblock.h b/include/exec/ramblock.h
index 664701b..6cbedf9 100644
--- a/include/exec/ramblock.h
+++ b/include/exec/ramblock.h
@@ -21,6 +21,8 @@
#ifndef CONFIG_USER_ONLY
#include "cpu-common.h"
+#include "qemu/rcu.h"
+#include "exec/ramlist.h"
struct RAMBlock {
struct rcu_head rcu;
diff --git a/include/hw/m68k/mcf.h b/include/hw/m68k/mcf.h
index decf17c..8cbd587 100644
--- a/include/hw/m68k/mcf.h
+++ b/include/hw/m68k/mcf.h
@@ -2,6 +2,7 @@
#define HW_MCF_H
/* Motorola ColdFire device prototypes. */
+#include "exec/hwaddr.h"
#include "target/m68k/cpu-qom.h"
/* mcf_uart.c */
diff --git a/include/hw/tricore/triboard.h b/include/hw/tricore/triboard.h
index f3844be..094c8bd 100644
--- a/include/hw/tricore/triboard.h
+++ b/include/hw/tricore/triboard.h
@@ -21,7 +21,6 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "hw/boards.h"
-#include "hw/arm/boot.h"
#include "sysemu/sysemu.h"
#include "exec/address-spaces.h"
#include "qom/object.h"
diff --git a/linux-user/i386/cpu_loop.c b/linux-user/i386/cpu_loop.c
index 29dfd7c..90bffc1 100644
--- a/linux-user/i386/cpu_loop.c
+++ b/linux-user/i386/cpu_loop.c
@@ -20,6 +20,7 @@
#include "qemu/osdep.h"
#include "qemu-common.h"
#include "qemu.h"
+#include "qemu/timer.h"
#include "user-internals.h"
#include "cpu_loop-common.h"
#include "signal-common.h"
diff --git a/linux-user/ppc/cpu_loop.c b/linux-user/ppc/cpu_loop.c
index 38097b0..c5d8099 100644
--- a/linux-user/ppc/cpu_loop.c
+++ b/linux-user/ppc/cpu_loop.c
@@ -20,6 +20,7 @@
#include "qemu/osdep.h"
#include "qemu-common.h"
#include "qemu.h"
+#include "qemu/timer.h"
#include "user-internals.h"
#include "cpu_loop-common.h"
#include "signal-common.h"
diff --git a/monitor/misc.c b/monitor/misc.c
index a3a6e47..b1839cb 100644
--- a/monitor/misc.c
+++ b/monitor/misc.c
@@ -41,6 +41,7 @@
#include "disas/disas.h"
#include "sysemu/balloon.h"
#include "qemu/timer.h"
+#include "qemu/log.h"
#include "sysemu/hw_accel.h"
#include "sysemu/runstate.h"
#include "authz/list.h"
diff --git a/plugins/api.c b/plugins/api.c
index 91e0c70..7bf71b1 100644
--- a/plugins/api.c
+++ b/plugins/api.c
@@ -36,6 +36,7 @@
#include "qemu/osdep.h"
#include "qemu/plugin.h"
+#include "qemu/log.h"
#include "tcg/tcg.h"
#include "exec/exec-all.h"
#include "exec/ram_addr.h"
diff --git a/scripts/switch-timer-api b/scripts/switch-timer-api
deleted file mode 100755
index 41736d1..0000000
--- a/scripts/switch-timer-api
+++ /dev/null
@@ -1,178 +0,0 @@
-#!/usr/bin/env perl
-
-use strict;
-use warnings;
-use Getopt::Long;
-use FindBin;
-
-my @legacy = qw(qemu_clock_ptr qemu_get_clock_ns qemu_get_clock_ms qemu_register_clock_reset_notifier qemu_unregister_clock_reset_notifier qemu_new_timer qemu_free_timer qemu_del_timer qemu_mod_timer_ns qemu_mod_timer qemu_run_timers qemu_new_timer_ns qemu_new_timer_us qemu_new_timer_ms);
-my $legacyre = '\b('.join('|', @legacy).')\b';
-my $option_git;
-my $option_dryrun;
-my $option_quiet;
-my $option_rtc;
-my $suffix=".tmp.$$";
-my @files;
-my $getfiles = 'git grep -l -E \'\b((host|rt|vm|rtc)_clock\b|qemu_\w*timer)\' | egrep \'\.[ch]$\' | egrep -v \'qemu-timer\.c$|include/qemu/timer\.h$\'';
-
-sub Syntax
-{
- print STDERR <<STOP;
-Usage: $FindBin::Script [options] FILE ...
-
-Translate each FILE to the new QEMU timer API. If no files
-are passed, a reasonable guess is taken.
-
-Options:
- -q, --quiet Do not show warnings etc
- -d, --dry-run Do a dry run
- -g, --git Generate a git commit for each change
- -r, --rtc Only fix up rtc usage
- -h, --help Print this message
-
-STOP
-return;
-}
-
-sub ParseOptions
-{
- if (!GetOptions (
- "dry-run|d" => \$option_dryrun,
- "git|g" => \$option_git,
- "quiet|q" => \$option_quiet,
- "rtc|r" => \$option_rtc,
- "help|h" => sub { Syntax(); exit(0); }
- ))
- {
- Syntax();
- die "Bad options";
- }
-
- if ($#ARGV >=0)
- {
- @files = @ARGV;
- }
- else
- {
- @files = split(/\s+/, `$getfiles`);
- }
-
- foreach my $file (@files)
- {
- die "Cannot find $file" unless (-f $file && -r $file);
- }
-}
-
-sub DoWarn
-{
- my $text = shift @_;
- my $line = shift @_;
- return if ($option_quiet);
- chomp ($line);
- print STDERR "$text\n";
- print STDERR "$line\n\n";
-}
-
-sub Process
-{
- my $ifn = shift @_;
- my $ofn = $ifn.$suffix;
-
- my $intext;
- my $outtext;
- my $linenum = 0;
-
- open my $input, "<", $ifn || die "Cannot open $ifn for read: $!";
-
- while (<$input>)
- {
- my $line = $_;
- $intext .= $line;
- $linenum++;
-
- # fix the specific uses
- unless ($option_rtc)
- {
- $line =~ s/\bqemu_new_timer(_[num]s)\s*\((vm_|rt_|host_)clock\b/timer_new$1(XXX_$2clock/g;
- $line =~ s/\bqemu_new_timer\s*\((vm_|rt_|host_)clock\b/timer_new(XXX_$1clock/g;
- $line =~ s/\bqemu_get_clock(_[num]s)\s*\((vm_|rt_|host_)clock\b/qemu_clock_get$1(XXX_$2clock/g;
- }
-
- # rtc is different
- $line =~ s/\bqemu_new_timer(_[num]s)\s*\(rtc_clock\b/timer_new$1(rtc_clock/g;
- $line =~ s/\bqemu_new_timer\s*\(rtc_clock\b/timer_new(rtc_clock/g;
- $line =~ s/\bqemu_get_clock(_[num]s)\s*\(rtc_clock\b/qemu_clock_get$1(rtc_clock/g;
- $line =~ s/\bqemu_register_clock_reset_notifier\s*\(rtc_clock\b/qemu_register_clock_reset_notifier(qemu_clock_ptr(rtc_clock)/g;
-
- unless ($option_rtc)
- {
- # fix up comments
- $line =~ s/\b(vm_|rt_|host_)clock\b/XXX_$1clock/g if ($line =~ m,^[/ ]+\*,);
-
- # spurious fprintf error reporting
- $line =~ s/: qemu_new_timer_ns failed/: timer_new_ns failed/g;
-
- # these have just changed name
- $line =~ s/\bqemu_mod_timer\b/timer_mod/g;
- $line =~ s/\bqemu_mod_timer_(ns|us|ms)\b/timer_mod_$1/g;
- $line =~ s/\bqemu_free_timer\b/timer_free/g;
- $line =~ s/\bqemu_del_timer\b/timer_del/g;
- }
-
- # fix up rtc_clock
- $line =~ s/QEMUClock \*rtc_clock;/QEMUClockType rtc_clock;/g;
- $line =~ s/\brtc_clock = (vm_|rt_|host_)clock\b/rtc_clock = XXX_$1clock/g;
-
- unless ($option_rtc)
- {
- # replace any more general uses
- $line =~ s/\b(vm_|rt_|host_)clock\b/qemu_clock_ptr(XXX_$1clock)/g;
- }
-
- # fix up the place holders
- $line =~ s/\bXXX_vm_clock\b/QEMU_CLOCK_VIRTUAL/g;
- $line =~ s/\bXXX_rt_clock\b/QEMU_CLOCK_REALTIME/g;
- $line =~ s/\bXXX_host_clock\b/QEMU_CLOCK_HOST/g;
-
- unless ($option_rtc)
- {
- DoWarn("$ifn:$linenum WARNING: timer $1 not fixed up", $line) if ($line =~ /\b((vm_|rt_|host_)clock)\b/);
- DoWarn("$ifn:$linenum WARNING: function $1 not fixed up", $line) if ($line =~ /\b(qemu_new_timer\w+)\b/);
- DoWarn("$ifn:$linenum WARNING: legacy function $1 remains", $line) if ($line =~ /$legacyre/o);
- }
-
- $outtext .= $line;
- }
-
- close $input;
-
- if ($intext ne $outtext)
- {
- print STDERR "Patching $ifn\n" unless ($option_quiet);
- unless ($option_dryrun)
- {
- open my $output, ">", $ofn || die "Cannot open $ofn for write: $!";
- print $output $outtext;
- close $output;
- rename ($ofn, $ifn) || die "Cannot rename temp file to $ifn: $!";
- return 1;
- }
- }
- return 0;
-}
-
-sub DoCommit
-{
- my $file = shift @_;
- open (my $git, "| git commit -F - $file") || die "Cannot run git commit on $file: $!";
- print $git "timers api: use new timer api in $file\n\nConvert $file to use new timer API.\nThis is an automated commit made by scripts/switch-timer-api\n";
- close ($git);
-}
-
-ParseOptions;
-
-foreach my $file (@files)
-{
- my $changed = Process ($file);
- DoCommit($file) if ($changed && $option_git);
-}
diff --git a/softmmu/qtest.c b/softmmu/qtest.c
index 72751e1..8b7cb6a 100644
--- a/softmmu/qtest.c
+++ b/softmmu/qtest.c
@@ -19,6 +19,7 @@
#include "chardev/char-fe.h"
#include "exec/ioport.h"
#include "exec/memory.h"
+#include "hw/qdev-core.h"
#include "hw/irq.h"
#include "qemu/accel.h"
#include "sysemu/cpu-timers.h"
diff --git a/softmmu/runstate.c b/softmmu/runstate.c
index 10d9b73..e0d869b 100644
--- a/softmmu/runstate.c
+++ b/softmmu/runstate.c
@@ -30,7 +30,6 @@
#include "crypto/cipher.h"
#include "crypto/init.h"
#include "exec/cpu-common.h"
-#include "exec/exec-all.h"
#include "exec/gdbstub.h"
#include "hw/boards.h"
#include "migration/misc.h"
@@ -43,7 +42,9 @@
#include "qapi/qapi-events-run-state.h"
#include "qemu-common.h"
#include "qemu/error-report.h"
+#include "qemu/log.h"
#include "qemu/job.h"
+#include "qemu/log.h"
#include "qemu/module.h"
#include "qemu/plugin.h"
#include "qemu/sockets.h"
diff --git a/target/alpha/helper.c b/target/alpha/helper.c
index b7e7f73..dcaa2d0 100644
--- a/target/alpha/helper.c
+++ b/target/alpha/helper.c
@@ -18,7 +18,7 @@
*/
#include "qemu/osdep.h"
-
+#include "qemu/log.h"
#include "cpu.h"
#include "exec/exec-all.h"
#include "fpu/softfloat-types.h"
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index a4a229a..c085dc1 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -20,6 +20,7 @@
#include "qemu/osdep.h"
#include "qemu/qemu-print.h"
+#include "qemu/timer.h"
#include "qemu-common.h"
#include "target/arm/idau.h"
#include "qemu/module.h"
diff --git a/target/arm/helper.c b/target/arm/helper.c
index b5f8098..7bf50fd 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -8,6 +8,7 @@
#include "qemu/osdep.h"
#include "qemu/units.h"
+#include "qemu/log.h"
#include "target/arm/idau.h"
#include "trace.h"
#include "cpu.h"
@@ -15,6 +16,7 @@
#include "exec/helper-proto.h"
#include "qemu/host-utils.h"
#include "qemu/main-loop.h"
+#include "qemu/timer.h"
#include "qemu/bitops.h"
#include "qemu/crc32c.h"
#include "qemu/qemu-print.h"
diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c
index b11e927..648a3b3 100644
--- a/target/arm/m_helper.c
+++ b/target/arm/m_helper.c
@@ -19,6 +19,7 @@
#include "qemu/bitops.h"
#include "qemu/crc32c.h"
#include "qemu/qemu-print.h"
+#include "qemu/log.h"
#include "exec/exec-all.h"
#include <zlib.h> /* For crc32 */
#include "semihosting/semihost.h"
diff --git a/target/arm/mte_helper.c b/target/arm/mte_helper.c
index e09b7e4..d11a8c7 100644
--- a/target/arm/mte_helper.c
+++ b/target/arm/mte_helper.c
@@ -18,6 +18,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/log.h"
#include "cpu.h"
#include "internals.h"
#include "exec/exec-all.h"
diff --git a/target/avr/helper.c b/target/avr/helper.c
index 981c29d..c27f702 100644
--- a/target/avr/helper.c
+++ b/target/avr/helper.c
@@ -19,6 +19,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/log.h"
#include "cpu.h"
#include "hw/core/tcg-cpu-ops.h"
#include "exec/exec-all.h"
diff --git a/target/cris/helper.c b/target/cris/helper.c
index a0d6ecd..91e4aeb 100644
--- a/target/cris/helper.c
+++ b/target/cris/helper.c
@@ -19,6 +19,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/log.h"
#include "cpu.h"
#include "hw/core/tcg-cpu-ops.h"
#include "mmu.h"
diff --git a/target/hexagon/internal.h b/target/hexagon/internal.h
index 82ac304..b1bfadc 100644
--- a/target/hexagon/internal.h
+++ b/target/hexagon/internal.h
@@ -18,6 +18,8 @@
#ifndef HEXAGON_INTERNAL_H
#define HEXAGON_INTERNAL_H
+#include "qemu/log.h"
+
/*
* Change HEX_DEBUG to 1 to turn on debugging output
*/
diff --git a/target/hexagon/translate.h b/target/hexagon/translate.h
index fccfb94..a245172 100644
--- a/target/hexagon/translate.h
+++ b/target/hexagon/translate.h
@@ -19,6 +19,7 @@
#define HEXAGON_TRANSLATE_H
#include "qemu/bitmap.h"
+#include "qemu/log.h"
#include "cpu.h"
#include "exec/translator.h"
#include "tcg/tcg-op.h"
diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c
index 37b763f..5f46ba8 100644
--- a/target/hppa/cpu.c
+++ b/target/hppa/cpu.c
@@ -21,6 +21,7 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu/qemu-print.h"
+#include "qemu/timer.h"
#include "cpu.h"
#include "qemu/module.h"
#include "exec/exec-all.h"
diff --git a/target/hppa/helper.c b/target/hppa/helper.c
index 1ccff57..e2758d8 100644
--- a/target/hppa/helper.c
+++ b/target/hppa/helper.c
@@ -18,7 +18,7 @@
*/
#include "qemu/osdep.h"
-
+#include "qemu/log.h"
#include "cpu.h"
#include "fpu/softfloat.h"
#include "exec/exec-all.h"
diff --git a/target/hppa/mem_helper.c b/target/hppa/mem_helper.c
index bf07445..5046cc8 100644
--- a/target/hppa/mem_helper.c
+++ b/target/hppa/mem_helper.c
@@ -18,6 +18,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/log.h"
#include "cpu.h"
#include "exec/exec-all.h"
#include "exec/helper-proto.h"
diff --git a/target/hppa/op_helper.c b/target/hppa/op_helper.c
index b0dec4e..2810361 100644
--- a/target/hppa/op_helper.c
+++ b/target/hppa/op_helper.c
@@ -18,6 +18,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/log.h"
#include "cpu.h"
#include "exec/exec-all.h"
#include "exec/helper-proto.h"
diff --git a/target/i386/helper.c b/target/i386/helper.c
index a431504..fa409e9 100644
--- a/target/i386/helper.c
+++ b/target/i386/helper.c
@@ -27,6 +27,7 @@
#include "sysemu/hw_accel.h"
#include "monitor/monitor.h"
#endif
+#include "qemu/log.h"
void cpu_sync_bndcs_hflags(CPUX86State *env)
{
diff --git a/target/i386/tcg/int_helper.c b/target/i386/tcg/int_helper.c
index 87fa728..599ac96 100644
--- a/target/i386/tcg/int_helper.c
+++ b/target/i386/tcg/int_helper.c
@@ -18,6 +18,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/log.h"
#include "cpu.h"
#include "exec/exec-all.h"
#include "qemu/host-utils.h"
diff --git a/target/i386/tcg/misc_helper.c b/target/i386/tcg/misc_helper.c
index 5769db5..24a0eaa 100644
--- a/target/i386/tcg/misc_helper.c
+++ b/target/i386/tcg/misc_helper.c
@@ -18,6 +18,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/log.h"
#include "cpu.h"
#include "exec/helper-proto.h"
#include "exec/exec-all.h"
diff --git a/target/i386/tcg/sysemu/seg_helper.c b/target/i386/tcg/sysemu/seg_helper.c
index 824b9a5..2c9bd00 100644
--- a/target/i386/tcg/sysemu/seg_helper.c
+++ b/target/i386/tcg/sysemu/seg_helper.c
@@ -19,6 +19,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/log.h"
#include "cpu.h"
#include "exec/helper-proto.h"
#include "exec/cpu_ldst.h"
diff --git a/target/i386/tcg/sysemu/svm_helper.c b/target/i386/tcg/sysemu/svm_helper.c
index 6d39611..2b6f450 100644
--- a/target/i386/tcg/sysemu/svm_helper.c
+++ b/target/i386/tcg/sysemu/svm_helper.c
@@ -18,6 +18,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/log.h"
#include "cpu.h"
#include "exec/helper-proto.h"
#include "exec/exec-all.h"
diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c
index acbd473..8decc61 100644
--- a/target/m68k/op_helper.c
+++ b/target/m68k/op_helper.c
@@ -17,6 +17,7 @@
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#include "qemu/osdep.h"
+#include "qemu/log.h"
#include "cpu.h"
#include "exec/helper-proto.h"
#include "exec/exec-all.h"
diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c
index b9c888b..aed200d 100644
--- a/target/microblaze/cpu.c
+++ b/target/microblaze/cpu.c
@@ -22,6 +22,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/log.h"
#include "qapi/error.h"
#include "cpu.h"
#include "qemu/module.h"
diff --git a/target/microblaze/mmu.c b/target/microblaze/mmu.c
index cc40f27..7565197 100644
--- a/target/microblaze/mmu.c
+++ b/target/microblaze/mmu.c
@@ -19,6 +19,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/log.h"
#include "cpu.h"
#include "exec/exec-all.h"
diff --git a/target/microblaze/op_helper.c b/target/microblaze/op_helper.c
index 58d6335..5b745d0 100644
--- a/target/microblaze/op_helper.c
+++ b/target/microblaze/op_helper.c
@@ -19,6 +19,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/log.h"
#include "cpu.h"
#include "exec/helper-proto.h"
#include "qemu/host-utils.h"
diff --git a/target/mips/tcg/exception.c b/target/mips/tcg/exception.c
index 7b3026b..0b21e08 100644
--- a/target/mips/tcg/exception.c
+++ b/target/mips/tcg/exception.c
@@ -19,6 +19,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/log.h"
#include "cpu.h"
#include "internal.h"
#include "exec/helper-proto.h"
diff --git a/target/mips/tcg/sysemu/special_helper.c b/target/mips/tcg/sysemu/special_helper.c
index 2a2afb4..f4f8fe8 100644
--- a/target/mips/tcg/sysemu/special_helper.c
+++ b/target/mips/tcg/sysemu/special_helper.c
@@ -19,6 +19,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/log.h"
#include "cpu.h"
#include "exec/helper-proto.h"
#include "exec/exec-all.h"
diff --git a/target/mips/tcg/translate.h b/target/mips/tcg/translate.h
index ae01515..9997fe2 100644
--- a/target/mips/tcg/translate.h
+++ b/target/mips/tcg/translate.h
@@ -8,6 +8,7 @@
#ifndef TARGET_MIPS_TRANSLATE_H
#define TARGET_MIPS_TRANSLATE_H
+#include "qemu/log.h"
#include "exec/translator.h"
#define MIPS_DEBUG_DISAS 0
diff --git a/target/openrisc/interrupt.c b/target/openrisc/interrupt.c
index 19223e3..e5724f5 100644
--- a/target/openrisc/interrupt.c
+++ b/target/openrisc/interrupt.c
@@ -18,6 +18,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/log.h"
#include "cpu.h"
#include "exec/exec-all.h"
#include "exec/gdbstub.h"
diff --git a/target/openrisc/mmu.c b/target/openrisc/mmu.c
index e561ef2..d7e1320 100644
--- a/target/openrisc/mmu.c
+++ b/target/openrisc/mmu.c
@@ -19,6 +19,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/log.h"
#include "cpu.h"
#include "exec/exec-all.h"
#include "exec/gdbstub.h"
diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c
index f44b9da..6538c56 100644
--- a/target/ppc/excp_helper.c
+++ b/target/ppc/excp_helper.c
@@ -18,6 +18,7 @@
*/
#include "qemu/osdep.h"
#include "qemu/main-loop.h"
+#include "qemu/log.h"
#include "cpu.h"
#include "exec/exec-all.h"
#include "internal.h"
diff --git a/target/ppc/misc_helper.c b/target/ppc/misc_helper.c
index 29e73a6..06aa716 100644
--- a/target/ppc/misc_helper.c
+++ b/target/ppc/misc_helper.c
@@ -18,6 +18,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/log.h"
#include "cpu.h"
#include "exec/exec-all.h"
#include "exec/helper-proto.h"
diff --git a/target/riscv/csr.c b/target/riscv/csr.c
index fe2c8dd..a938760 100644
--- a/target/riscv/csr.c
+++ b/target/riscv/csr.c
@@ -19,6 +19,7 @@
#include "qemu/osdep.h"
#include "qemu/log.h"
+#include "qemu/timer.h"
#include "cpu.h"
#include "qemu/main-loop.h"
#include "exec/exec-all.h"
diff --git a/target/s390x/tcg/excp_helper.c b/target/s390x/tcg/excp_helper.c
index 4e7648f..be6c966 100644
--- a/target/s390x/tcg/excp_helper.c
+++ b/target/s390x/tcg/excp_helper.c
@@ -19,6 +19,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/log.h"
#include "cpu.h"
#include "s390x-internal.h"
#include "exec/helper-proto.h"
diff --git a/target/s390x/tcg/mem_helper.c b/target/s390x/tcg/mem_helper.c
index 406578d..b5523ef 100644
--- a/target/s390x/tcg/mem_helper.c
+++ b/target/s390x/tcg/mem_helper.c
@@ -19,6 +19,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/log.h"
#include "cpu.h"
#include "s390x-internal.h"
#include "tcg_s390x.h"
diff --git a/target/sparc/helper.c b/target/sparc/helper.c
index c7bcaa3..c4358bb 100644
--- a/target/sparc/helper.c
+++ b/target/sparc/helper.c
@@ -20,6 +20,7 @@
#include "qemu/osdep.h"
#include "cpu.h"
#include "exec/exec-all.h"
+#include "qemu/timer.h"
#include "qemu/host-utils.h"
#include "exec/helper-proto.h"
diff --git a/target/sparc/ldst_helper.c b/target/sparc/ldst_helper.c
index a3e1cf9..ec4fae7 100644
--- a/target/sparc/ldst_helper.c
+++ b/target/sparc/ldst_helper.c
@@ -18,6 +18,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/log.h"
#include "cpu.h"
#include "tcg/tcg.h"
#include "exec/helper-proto.h"
diff --git a/target/sparc/mmu_helper.c b/target/sparc/mmu_helper.c
index f266838..346a6df 100644
--- a/target/sparc/mmu_helper.c
+++ b/target/sparc/mmu_helper.c
@@ -18,6 +18,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/log.h"
#include "cpu.h"
#include "exec/exec-all.h"
#include "qemu/qemu-print.h"
diff --git a/target/tricore/helper.c b/target/tricore/helper.c
index c5e997f..1db3280 100644
--- a/target/tricore/helper.c
+++ b/target/tricore/helper.c
@@ -16,7 +16,7 @@
*/
#include "qemu/osdep.h"
-
+#include "qemu/log.h"
#include "cpu.h"
#include "exec/exec-all.h"
#include "fpu/softfloat-helpers.h"
diff --git a/target/xtensa/dbg_helper.c b/target/xtensa/dbg_helper.c
index be1f811..ce2a820 100644
--- a/target/xtensa/dbg_helper.c
+++ b/target/xtensa/dbg_helper.c
@@ -26,6 +26,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/log.h"
#include "qemu/main-loop.h"
#include "cpu.h"
#include "exec/helper-proto.h"
diff --git a/target/xtensa/exc_helper.c b/target/xtensa/exc_helper.c
index 9bc7f50..d4823a6 100644
--- a/target/xtensa/exc_helper.c
+++ b/target/xtensa/exc_helper.c
@@ -26,6 +26,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/log.h"
#include "qemu/main-loop.h"
#include "cpu.h"
#include "exec/helper-proto.h"
diff --git a/target/xtensa/fpu_helper.c b/target/xtensa/fpu_helper.c
index ba3c29d..d2a10cc 100644
--- a/target/xtensa/fpu_helper.c
+++ b/target/xtensa/fpu_helper.c
@@ -26,6 +26,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/log.h"
#include "qemu/main-loop.h"
#include "cpu.h"
#include "exec/helper-proto.h"
diff --git a/target/xtensa/helper.c b/target/xtensa/helper.c
index 29d216e..e0a9caa 100644
--- a/target/xtensa/helper.c
+++ b/target/xtensa/helper.c
@@ -26,6 +26,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/log.h"
#include "cpu.h"
#include "exec/exec-all.h"
#include "exec/gdbstub.h"
diff --git a/target/xtensa/mmu_helper.c b/target/xtensa/mmu_helper.c
index 57e319a..fa66e8e 100644
--- a/target/xtensa/mmu_helper.c
+++ b/target/xtensa/mmu_helper.c
@@ -26,6 +26,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/log.h"
#include "qemu/main-loop.h"
#include "qemu/qemu-print.h"
#include "qemu/units.h"
diff --git a/target/xtensa/win_helper.c b/target/xtensa/win_helper.c
index f6f96a6..5a15553 100644
--- a/target/xtensa/win_helper.c
+++ b/target/xtensa/win_helper.c
@@ -26,6 +26,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/log.h"
#include "qemu/main-loop.h"
#include "cpu.h"
#include "exec/helper-proto.h"
diff --git a/tests/qtest/device-plug-test.c b/tests/qtest/device-plug-test.c
index ad79bd4..404a92e 100644
--- a/tests/qtest/device-plug-test.c
+++ b/tests/qtest/device-plug-test.c
@@ -63,7 +63,15 @@ static void wait_device_deleted_event(QTestState *qtest, const char *id)
static void test_pci_unplug_request(void)
{
- QTestState *qtest = qtest_initf("-device virtio-mouse-pci,id=dev0");
+ const char *arch = qtest_get_arch();
+ const char *machine_addition = "";
+
+ if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
+ machine_addition = "-machine pc";
+ }
+
+ QTestState *qtest = qtest_initf("%s -device virtio-mouse-pci,id=dev0",
+ machine_addition);
/*
* Request device removal. As the guest is not running, the request won't
@@ -79,8 +87,16 @@ static void test_pci_unplug_request(void)
static void test_pci_unplug_json_request(void)
{
+ const char *arch = qtest_get_arch();
+ const char *machine_addition = "";
+
+ if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
+ machine_addition = "-machine pc";
+ }
+
QTestState *qtest = qtest_initf(
- "-device '{\"driver\": \"virtio-mouse-pci\", \"id\": \"dev0\"}'");
+ "%s -device '{\"driver\": \"virtio-mouse-pci\", \"id\": \"dev0\"}'",
+ machine_addition);
/*
* Request device removal. As the guest is not running, the request won't
diff --git a/tests/qtest/drive_del-test.c b/tests/qtest/drive_del-test.c
index 8d08ee9..0cc18df 100644
--- a/tests/qtest/drive_del-test.c
+++ b/tests/qtest/drive_del-test.c
@@ -235,14 +235,21 @@ static void test_drive_del_device_del(void)
static void test_cli_device_del(void)
{
QTestState *qts;
+ const char *arch = qtest_get_arch();
+ const char *machine_addition = "";
+
+ if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
+ machine_addition = "-machine pc";
+ }
/*
* -drive/-device and device_del. Start with a drive used by a
* device that unplugs after reset.
*/
- qts = qtest_initf("-drive if=none,id=drive0,file=null-co://,"
+ qts = qtest_initf("%s -drive if=none,id=drive0,file=null-co://,"
"file.read-zeroes=on,format=raw"
" -device virtio-blk-%s,drive=drive0,id=dev0",
+ machine_addition,
qvirtio_get_dev_type());
device_del(qts, true);
@@ -266,13 +273,19 @@ static void test_empty_device_del(void)
static void test_device_add_and_del(void)
{
QTestState *qts;
+ const char *arch = qtest_get_arch();
+ const char *machine_addition = "";
+
+ if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
+ machine_addition = "-machine pc";
+ }
/*
* -drive/device_add and device_del. Start with a drive used by a
* device that unplugs after reset.
*/
- qts = qtest_init("-drive if=none,id=drive0,file=null-co://,"
- "file.read-zeroes=on,format=raw");
+ qts = qtest_initf("%s -drive if=none,id=drive0,file=null-co://,"
+ "file.read-zeroes=on,format=raw", machine_addition);
device_add(qts);
device_del(qts, true);
@@ -284,8 +297,14 @@ static void test_device_add_and_del(void)
static void test_drive_add_device_add_and_del(void)
{
QTestState *qts;
+ const char *arch = qtest_get_arch();
+ const char *machine_addition = "";
+
+ if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
+ machine_addition = "-machine pc";
+ }
- qts = qtest_init("");
+ qts = qtest_init(machine_addition);
/*
* drive_add/device_add and device_del. The drive is used by a
@@ -302,8 +321,14 @@ static void test_drive_add_device_add_and_del(void)
static void test_blockdev_add_device_add_and_del(void)
{
QTestState *qts;
+ const char *arch = qtest_get_arch();
+ const char *machine_addition = "";
+
+ if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
+ machine_addition = "-machine pc";
+ }
- qts = qtest_init("");
+ qts = qtest_init(machine_addition);
/*
* blockdev_add/device_add and device_del. The it drive is used by a
diff --git a/tests/qtest/erst-test.c b/tests/qtest/erst-test.c
index c6a0ae4..f94cd8d 100644
--- a/tests/qtest/erst-test.c
+++ b/tests/qtest/erst-test.c
@@ -75,7 +75,7 @@ static inline uint64_t in_reg64(ERSTState *s, unsigned reg)
uint64_t res;
res = qpci_io_readq(s->dev, s->reg_bar, reg);
- g_test_message("*%s -> %016llx", name, (unsigned long long)res);
+ g_test_message("*%s -> %016" PRIx64, name, res);
return res;
}
diff --git a/tests/qtest/fdc-test.c b/tests/qtest/fdc-test.c
index 8f6eee8..b0d4001 100644
--- a/tests/qtest/fdc-test.c
+++ b/tests/qtest/fdc-test.c
@@ -598,7 +598,7 @@ int main(int argc, char **argv)
/* Run the tests */
g_test_init(&argc, &argv, NULL);
- qtest_start("-device floppy,id=floppy0");
+ qtest_start("-machine pc -device floppy,id=floppy0");
qtest_irq_intercept_in(global_qtest, "ioapic");
qtest_add_func("/fdc/cmos", test_cmos);
qtest_add_func("/fdc/no_media_on_start", test_no_media_on_start);
diff --git a/tests/qtest/hd-geo-test.c b/tests/qtest/hd-geo-test.c
index 771eaa7..64023c0 100644
--- a/tests/qtest/hd-geo-test.c
+++ b/tests/qtest/hd-geo-test.c
@@ -178,9 +178,15 @@ static int append_arg(int argc, char *argv[], int argv_sz, char *arg)
static int setup_common(char *argv[], int argv_sz)
{
+ int new_argc;
memset(cur_ide, 0, sizeof(cur_ide));
- return append_arg(0, argv, argv_sz,
- g_strdup("-nodefaults"));
+ new_argc = append_arg(0, argv, argv_sz,
+ g_strdup("-nodefaults"));
+ new_argc = append_arg(new_argc, argv, argv_sz,
+ g_strdup("-machine"));
+ new_argc = append_arg(new_argc, argv, argv_sz,
+ g_strdup("pc"));
+ return new_argc;
}
static void setup_mbr(int img_idx, MBRcontents mbr)
@@ -697,7 +703,7 @@ static void test_override(TestArgs *args, CHSResult expected[])
joined_args = g_strjoinv(" ", args->argv);
- qts = qtest_init(joined_args);
+ qts = qtest_initf("-machine pc %s", joined_args);
fw_cfg = pc_fw_cfg_init(qts);
read_bootdevices(fw_cfg, expected);
@@ -833,7 +839,7 @@ static void test_override_scsi_hot_unplug(void)
joined_args = g_strjoinv(" ", args->argv);
- qts = qtest_init(joined_args);
+ qts = qtest_initf("-machine pc %s", joined_args);
fw_cfg = pc_fw_cfg_init(qts);
read_bootdevices(fw_cfg, expected);
@@ -893,7 +899,7 @@ static void test_override_virtio_hot_unplug(void)
joined_args = g_strjoinv(" ", args->argv);
- qts = qtest_init(joined_args);
+ qts = qtest_initf("-machine pc %s", joined_args);
fw_cfg = pc_fw_cfg_init(qts);
read_bootdevices(fw_cfg, expected);
diff --git a/tests/qtest/i440fx-test.c b/tests/qtest/i440fx-test.c
index 1f57d96..6d7d4d8 100644
--- a/tests/qtest/i440fx-test.c
+++ b/tests/qtest/i440fx-test.c
@@ -35,7 +35,7 @@ static QPCIBus *test_start_get_bus(const TestData *s)
{
char *cmdline;
- cmdline = g_strdup_printf("-smp %d", s->num_cpus);
+ cmdline = g_strdup_printf("-machine pc -smp %d", s->num_cpus);
qtest_start(cmdline);
g_free(cmdline);
return qpci_new_pc(global_qtest, NULL);
diff --git a/tests/qtest/ide-test.c b/tests/qtest/ide-test.c
index 3f8081e..19de3b4 100644
--- a/tests/qtest/ide-test.c
+++ b/tests/qtest/ide-test.c
@@ -128,10 +128,11 @@ static char debug_path[] = "/tmp/qtest-blkdebug.XXXXXX";
static QTestState *ide_test_start(const char *cmdline_fmt, ...)
{
QTestState *qts;
+ g_autofree char *full_fmt = g_strdup_printf("-machine pc %s", cmdline_fmt);
va_list ap;
va_start(ap, cmdline_fmt);
- qts = qtest_vinitf(cmdline_fmt, ap);
+ qts = qtest_vinitf(full_fmt, ap);
va_end(ap);
pc_alloc_init(&guest_malloc, qts, 0);
@@ -701,7 +702,7 @@ static void test_flush(void)
free_pci_device(dev);
}
-static void test_retry_flush(const char *machine)
+static void test_pci_retry_flush(void)
{
QTestState *qts;
QPCIDevice *dev;
@@ -790,16 +791,6 @@ static void test_flush_empty_drive(void)
ide_test_quit(qts);
}
-static void test_pci_retry_flush(void)
-{
- test_retry_flush("pc");
-}
-
-static void test_isa_retry_flush(void)
-{
- test_retry_flush("isapc");
-}
-
typedef struct Read10CDB {
uint8_t opcode;
uint8_t flags;
@@ -1050,7 +1041,6 @@ int main(int argc, char **argv)
qtest_add_func("/ide/flush/nodev", test_flush_nodev);
qtest_add_func("/ide/flush/empty_drive", test_flush_empty_drive);
qtest_add_func("/ide/flush/retry_pci", test_pci_retry_flush);
- qtest_add_func("/ide/flush/retry_isa", test_isa_retry_flush);
qtest_add_func("/ide/cdrom/pio", test_cdrom_pio);
qtest_add_func("/ide/cdrom/pio_large", test_cdrom_pio_large);
diff --git a/tests/qtest/ivshmem-test.c b/tests/qtest/ivshmem-test.c
index fe94dd3..4e8af42 100644
--- a/tests/qtest/ivshmem-test.c
+++ b/tests/qtest/ivshmem-test.c
@@ -385,7 +385,12 @@ static void test_ivshmem_hotplug(void)
QTestState *qts;
const char *arch = qtest_get_arch();
- qts = qtest_init("-object memory-backend-ram,size=1M,id=mb1");
+ if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
+ qts = qtest_init("-object memory-backend-ram,size=1M,id=mb1"
+ " -machine pc");
+ } else {
+ qts = qtest_init("-object memory-backend-ram,size=1M,id=mb1");
+ }
qtest_qmp_device_add(qts, "ivshmem-plain", "iv1",
"{'addr': %s, 'memdev': 'mb1'}",
diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c
index 2a4568c..ee30f54 100644
--- a/tests/qtest/vhost-user-test.c
+++ b/tests/qtest/vhost-user-test.c
@@ -42,7 +42,7 @@
#define QEMU_CMD_MEMFD " -m %d -object memory-backend-memfd,id=mem,size=%dM," \
" -numa node,memdev=mem"
#define QEMU_CMD_CHR " -chardev socket,id=%s,path=%s%s"
-#define QEMU_CMD_NETDEV " -netdev vhost-user,id=hs0,chardev=%s,vhostforce"
+#define QEMU_CMD_NETDEV " -netdev vhost-user,id=hs0,chardev=%s,vhostforce=on"
#define HUGETLBFS_MAGIC 0x958458f6
diff --git a/tests/qtest/virtio-net-failover.c b/tests/qtest/virtio-net-failover.c
index 22ad54b..80292ee 100644
--- a/tests/qtest/virtio-net-failover.c
+++ b/tests/qtest/virtio-net-failover.c
@@ -18,6 +18,8 @@
#include "libqos/virtio-pci.h"
#include "hw/pci/pci.h"
+#define VIRTIO_NET_F_STANDBY 62
+
#define ACPI_PCIHP_ADDR_ICH9 0x0cc0
#define PCI_EJ_BASE 0x0008
#define PCI_SEL_BASE 0x0010
@@ -224,31 +226,85 @@ static char *get_mac(QTestState *qts, const char *name)
return mac;
}
-static void check_one_card(QTestState *qts, bool present,
- const char *id, const char *mac)
+#define check_one_card(qts, present, id, mac) \
+do { \
+ QDict *device; \
+ QDict *bus; \
+ char *addr; \
+ bus = get_bus(qts, 0); \
+ device = find_device(bus, id); \
+ if (present) { \
+ char *path; \
+ g_assert_nonnull(device); \
+ qobject_unref(device); \
+ path = g_strdup_printf("/machine/peripheral/%s", id); \
+ addr = get_mac(qts, path); \
+ g_free(path); \
+ g_assert_cmpstr(mac, ==, addr); \
+ g_free(addr); \
+ } else { \
+ g_assert_null(device); \
+ } \
+ qobject_unref(bus); \
+} while (0)
+
+static QDict *get_failover_negociated_event(QTestState *qts)
{
- QDict *device;
- QDict *bus;
- char *addr;
+ QDict *resp;
+ QDict *data;
- bus = get_bus(qts, 0);
- device = find_device(bus, id);
- if (present) {
- char *path;
+ resp = qtest_qmp_eventwait_ref(qts, "FAILOVER_NEGOTIATED");
+ g_assert(qdict_haskey(resp, "data"));
- g_assert_nonnull(device);
- qobject_unref(device);
+ data = qdict_get_qdict(resp, "data");
+ g_assert(qdict_haskey(data, "device-id"));
+ qobject_ref(data);
+ qobject_unref(resp);
- path = g_strdup_printf("/machine/peripheral/%s", id);
- addr = get_mac(qts, path);
- g_free(path);
- g_assert_cmpstr(mac, ==, addr);
- g_free(addr);
- } else {
- g_assert_null(device);
+ return data;
+}
+
+static QVirtioPCIDevice *start_virtio_net_internal(QTestState *qts,
+ int bus, int slot,
+ uint64_t *features)
+{
+ QVirtioPCIDevice *dev;
+ QPCIAddress addr;
+
+ addr.devfn = QPCI_DEVFN((bus << 5) + slot, 0);
+ dev = virtio_pci_new(pcibus, &addr);
+ g_assert_nonnull(dev);
+ qvirtio_pci_device_enable(dev);
+ qvirtio_start_device(&dev->vdev);
+ *features &= qvirtio_get_features(&dev->vdev);
+ qvirtio_set_features(&dev->vdev, *features);
+ qvirtio_set_driver_ok(&dev->vdev);
+ return dev;
+}
+
+static QVirtioPCIDevice *start_virtio_net(QTestState *qts, int bus, int slot,
+ const char *id, bool failover)
+{
+ QVirtioPCIDevice *dev;
+ uint64_t features;
+
+ features = ~(QVIRTIO_F_BAD_FEATURE |
+ (1ull << VIRTIO_RING_F_INDIRECT_DESC) |
+ (1ull << VIRTIO_RING_F_EVENT_IDX));
+
+ dev = start_virtio_net_internal(qts, bus, slot, &features);
+
+ g_assert(!!(features & (1ull << VIRTIO_NET_F_STANDBY)) == failover);
+
+ if (failover) {
+ QDict *resp;
+
+ resp = get_failover_negociated_event(qts);
+ g_assert_cmpstr(qdict_get_str(resp, "device-id"), ==, id);
+ qobject_unref(resp);
}
- qobject_unref(bus);
+ return dev;
}
static void test_on(void)
@@ -259,6 +315,7 @@ static void test_on(void)
"-netdev user,id=hs0 "
"-device virtio-net,bus=root0,id=standby0,"
"failover=on,netdev=hs0,mac="MAC_STANDBY0" "
+ "-netdev user,id=hs1 "
"-device virtio-net,bus=root1,id=primary0,"
"failover_pair_id=standby0,netdev=hs1,mac="MAC_PRIMARY0,
2);
@@ -272,6 +329,7 @@ static void test_on(void)
static void test_on_mismatch(void)
{
QTestState *qts;
+ QVirtioPCIDevice *vdev;
qts = machine_start(BASE_MACHINE
"-netdev user,id=hs0 "
@@ -285,12 +343,19 @@ static void test_on_mismatch(void)
check_one_card(qts, true, "standby0", MAC_STANDBY0);
check_one_card(qts, true, "primary0", MAC_PRIMARY0);
+ vdev = start_virtio_net(qts, 1, 0, "standby0", true);
+
+ check_one_card(qts, true, "standby0", MAC_STANDBY0);
+ check_one_card(qts, true, "primary0", MAC_PRIMARY0);
+
+ qos_object_destroy((QOSGraphObject *)vdev);
machine_stop(qts);
}
static void test_off(void)
{
QTestState *qts;
+ QVirtioPCIDevice *vdev;
qts = machine_start(BASE_MACHINE
"-netdev user,id=hs0 "
@@ -304,56 +369,46 @@ static void test_off(void)
check_one_card(qts, true, "standby0", MAC_STANDBY0);
check_one_card(qts, true, "primary0", MAC_PRIMARY0);
+ vdev = start_virtio_net(qts, 1, 0, "standby0", false);
+
+ check_one_card(qts, true, "standby0", MAC_STANDBY0);
+ check_one_card(qts, true, "primary0", MAC_PRIMARY0);
+
+ qos_object_destroy((QOSGraphObject *)vdev);
machine_stop(qts);
}
-static QDict *get_failover_negociated_event(QTestState *qts)
+static void test_enabled(void)
{
- QDict *resp;
- QDict *data;
-
- resp = qtest_qmp_eventwait_ref(qts, "FAILOVER_NEGOTIATED");
- g_assert(qdict_haskey(resp, "data"));
-
- data = qdict_get_qdict(resp, "data");
- g_assert(qdict_haskey(data, "device-id"));
- qobject_ref(data);
- qobject_unref(resp);
+ QTestState *qts;
+ QVirtioPCIDevice *vdev;
- return data;
-}
+ qts = machine_start(BASE_MACHINE
+ "-netdev user,id=hs0 "
+ "-device virtio-net,bus=root0,id=standby0,"
+ "failover=on,netdev=hs0,mac="MAC_STANDBY0" "
+ "-netdev user,id=hs1 "
+ "-device virtio-net,bus=root1,id=primary0,"
+ "failover_pair_id=standby0,netdev=hs1,mac="MAC_PRIMARY0" ",
+ 2);
-static QVirtioPCIDevice *start_virtio_net(QTestState *qts, int bus, int slot,
- const char *id)
-{
- QVirtioPCIDevice *dev;
- uint64_t features;
- QPCIAddress addr;
- QDict *resp;
+ check_one_card(qts, true, "standby0", MAC_STANDBY0);
+ check_one_card(qts, false, "primary0", MAC_PRIMARY0);
- addr.devfn = QPCI_DEVFN((bus << 5) + slot, 0);
- dev = virtio_pci_new(pcibus, &addr);
- g_assert_nonnull(dev);
- qvirtio_pci_device_enable(dev);
- qvirtio_start_device(&dev->vdev);
- features = qvirtio_get_features(&dev->vdev);
- features = features & ~(QVIRTIO_F_BAD_FEATURE |
- (1ull << VIRTIO_RING_F_INDIRECT_DESC) |
- (1ull << VIRTIO_RING_F_EVENT_IDX));
- qvirtio_set_features(&dev->vdev, features);
- qvirtio_set_driver_ok(&dev->vdev);
+ vdev = start_virtio_net(qts, 1, 0, "standby0", true);
- resp = get_failover_negociated_event(qts);
- g_assert_cmpstr(qdict_get_str(resp, "device-id"), ==, id);
- qobject_unref(resp);
+ check_one_card(qts, true, "standby0", MAC_STANDBY0);
+ check_one_card(qts, true, "primary0", MAC_PRIMARY0);
- return dev;
+ qos_object_destroy((QOSGraphObject *)vdev);
+ machine_stop(qts);
}
-static void test_enabled(void)
+static void test_guest_off(void)
{
QTestState *qts;
QVirtioPCIDevice *vdev;
+ uint64_t features;
qts = machine_start(BASE_MACHINE
"-netdev user,id=hs0 "
@@ -367,10 +422,15 @@ static void test_enabled(void)
check_one_card(qts, true, "standby0", MAC_STANDBY0);
check_one_card(qts, false, "primary0", MAC_PRIMARY0);
- vdev = start_virtio_net(qts, 1, 0, "standby0");
+ features = ~(QVIRTIO_F_BAD_FEATURE |
+ (1ull << VIRTIO_RING_F_INDIRECT_DESC) |
+ (1ull << VIRTIO_RING_F_EVENT_IDX) |
+ (1ull << VIRTIO_NET_F_STANDBY));
+
+ vdev = start_virtio_net_internal(qts, 1, 0, &features);
check_one_card(qts, true, "standby0", MAC_STANDBY0);
- check_one_card(qts, true, "primary0", MAC_PRIMARY0);
+ check_one_card(qts, false, "primary0", MAC_PRIMARY0);
qos_object_destroy((QOSGraphObject *)vdev);
machine_stop(qts);
@@ -390,7 +450,7 @@ static void test_hotplug_1(void)
check_one_card(qts, true, "standby0", MAC_STANDBY0);
check_one_card(qts, false, "primary0", MAC_PRIMARY0);
- vdev = start_virtio_net(qts, 1, 0, "standby0");
+ vdev = start_virtio_net(qts, 1, 0, "standby0", true);
check_one_card(qts, true, "standby0", MAC_STANDBY0);
check_one_card(qts, false, "primary0", MAC_PRIMARY0);
@@ -432,7 +492,7 @@ static void test_hotplug_1_reverse(void)
check_one_card(qts, true, "standby0", MAC_STANDBY0);
check_one_card(qts, true, "primary0", MAC_PRIMARY0);
- vdev = start_virtio_net(qts, 1, 0, "standby0");
+ vdev = start_virtio_net(qts, 1, 0, "standby0", true);
check_one_card(qts, true, "standby0", MAC_STANDBY0);
check_one_card(qts, true, "primary0", MAC_PRIMARY0);
@@ -463,7 +523,7 @@ static void test_hotplug_2(void)
check_one_card(qts, true, "standby0", MAC_STANDBY0);
check_one_card(qts, false, "primary0", MAC_PRIMARY0);
- vdev = start_virtio_net(qts, 1, 0, "standby0");
+ vdev = start_virtio_net(qts, 1, 0, "standby0", true);
check_one_card(qts, true, "standby0", MAC_STANDBY0);
check_one_card(qts, false, "primary0", MAC_PRIMARY0);
@@ -519,7 +579,7 @@ static void test_hotplug_2_reverse(void)
check_one_card(qts, true, "standby0", MAC_STANDBY0);
check_one_card(qts, true, "primary0", MAC_PRIMARY0);
- vdev = start_virtio_net(qts, 1, 0, "standby0");
+ vdev = start_virtio_net(qts, 1, 0, "standby0", true);
check_one_card(qts, true, "standby0", MAC_STANDBY0);
check_one_card(qts, true, "primary0", MAC_PRIMARY0);
@@ -584,7 +644,7 @@ static void test_migrate_out(gconstpointer opaque)
check_one_card(qts, true, "standby0", MAC_STANDBY0);
check_one_card(qts, false, "primary0", MAC_PRIMARY0);
- vdev = start_virtio_net(qts, 1, 0, "standby0");
+ vdev = start_virtio_net(qts, 1, 0, "standby0", true);
check_one_card(qts, true, "standby0", MAC_STANDBY0);
check_one_card(qts, false, "primary0", MAC_PRIMARY0);
@@ -755,6 +815,364 @@ static void test_migrate_in(gconstpointer opaque)
machine_stop(qts);
}
+static void test_off_migrate_out(gconstpointer opaque)
+{
+ QTestState *qts;
+ QDict *resp, *args, *ret;
+ g_autofree gchar *uri = g_strdup_printf("exec: cat > %s", (gchar *)opaque);
+ const gchar *status;
+ QVirtioPCIDevice *vdev;
+
+ qts = machine_start(BASE_MACHINE
+ "-netdev user,id=hs0 "
+ "-netdev user,id=hs1 ",
+ 2);
+
+ check_one_card(qts, false, "standby0", MAC_STANDBY0);
+ check_one_card(qts, false, "primary0", MAC_PRIMARY0);
+
+ qtest_qmp_device_add(qts, "virtio-net", "standby0",
+ "{'bus': 'root0',"
+ "'failover': 'off',"
+ "'netdev': 'hs0',"
+ "'mac': '"MAC_STANDBY0"'}");
+
+ check_one_card(qts, true, "standby0", MAC_STANDBY0);
+ check_one_card(qts, false, "primary0", MAC_PRIMARY0);
+
+ qtest_qmp_device_add(qts, "virtio-net", "primary0",
+ "{'bus': 'root1',"
+ "'failover_pair_id': 'standby0',"
+ "'netdev': 'hs1',"
+ "'rombar': 0,"
+ "'romfile': '',"
+ "'mac': '"MAC_PRIMARY0"'}");
+
+ check_one_card(qts, true, "standby0", MAC_STANDBY0);
+ check_one_card(qts, true, "primary0", MAC_PRIMARY0);
+
+ vdev = start_virtio_net(qts, 1, 0, "standby0", false);
+
+ check_one_card(qts, true, "standby0", MAC_STANDBY0);
+ check_one_card(qts, true, "primary0", MAC_PRIMARY0);
+
+ args = qdict_from_jsonf_nofail("{}");
+ g_assert_nonnull(args);
+ qdict_put_str(args, "uri", uri);
+
+ resp = qtest_qmp(qts, "{ 'execute': 'migrate', 'arguments': %p}", args);
+ g_assert(qdict_haskey(resp, "return"));
+ qobject_unref(resp);
+
+ while (true) {
+ ret = migrate_status(qts);
+
+ status = qdict_get_str(ret, "status");
+ if (strcmp(status, "completed") == 0) {
+ qobject_unref(ret);
+ break;
+ }
+ g_assert_cmpstr(status, !=, "failed");
+ g_assert_cmpstr(status, !=, "cancelling");
+ g_assert_cmpstr(status, !=, "cancelled");
+ qobject_unref(ret);
+ }
+
+ qtest_qmp_eventwait(qts, "STOP");
+
+ qos_object_destroy((QOSGraphObject *)vdev);
+ machine_stop(qts);
+}
+
+static void test_off_migrate_in(gconstpointer opaque)
+{
+ QTestState *qts;
+ QDict *resp, *args, *ret;
+ g_autofree gchar *uri = g_strdup_printf("exec: cat %s", (gchar *)opaque);
+
+ qts = machine_start(BASE_MACHINE
+ "-netdev user,id=hs0 "
+ "-netdev user,id=hs1 "
+ "-incoming defer ",
+ 2);
+
+ check_one_card(qts, false, "standby0", MAC_STANDBY0);
+ check_one_card(qts, false, "primary0", MAC_PRIMARY0);
+
+ qtest_qmp_device_add(qts, "virtio-net", "standby0",
+ "{'bus': 'root0',"
+ "'failover': 'off',"
+ "'netdev': 'hs0',"
+ "'mac': '"MAC_STANDBY0"'}");
+
+ check_one_card(qts, true, "standby0", MAC_STANDBY0);
+ check_one_card(qts, false, "primary0", MAC_PRIMARY0);
+
+ qtest_qmp_device_add(qts, "virtio-net", "primary0",
+ "{'bus': 'root1',"
+ "'failover_pair_id': 'standby0',"
+ "'netdev': 'hs1',"
+ "'rombar': 0,"
+ "'romfile': '',"
+ "'mac': '"MAC_PRIMARY0"'}");
+
+ check_one_card(qts, true, "standby0", MAC_STANDBY0);
+ check_one_card(qts, true, "primary0", MAC_PRIMARY0);
+
+ args = qdict_from_jsonf_nofail("{}");
+ g_assert_nonnull(args);
+ qdict_put_str(args, "uri", uri);
+
+ resp = qtest_qmp(qts, "{ 'execute': 'migrate-incoming', 'arguments': %p}",
+ args);
+ g_assert(qdict_haskey(resp, "return"));
+ qobject_unref(resp);
+
+ resp = get_migration_event(qts);
+ g_assert_cmpstr(qdict_get_str(resp, "status"), ==, "setup");
+ qobject_unref(resp);
+
+ check_one_card(qts, true, "standby0", MAC_STANDBY0);
+ check_one_card(qts, true, "primary0", MAC_PRIMARY0);
+
+ qtest_qmp_eventwait(qts, "RESUME");
+
+ ret = migrate_status(qts);
+ g_assert_cmpstr(qdict_get_str(ret, "status"), ==, "completed");
+ qobject_unref(ret);
+
+ machine_stop(qts);
+}
+
+static void test_guest_off_migrate_out(gconstpointer opaque)
+{
+ QTestState *qts;
+ QDict *resp, *args, *ret;
+ g_autofree gchar *uri = g_strdup_printf("exec: cat > %s", (gchar *)opaque);
+ const gchar *status;
+ QVirtioPCIDevice *vdev;
+ uint64_t features;
+
+ qts = machine_start(BASE_MACHINE
+ "-netdev user,id=hs0 "
+ "-netdev user,id=hs1 ",
+ 2);
+
+ check_one_card(qts, false, "standby0", MAC_STANDBY0);
+ check_one_card(qts, false, "primary0", MAC_PRIMARY0);
+
+ qtest_qmp_device_add(qts, "virtio-net", "standby0",
+ "{'bus': 'root0',"
+ "'failover': 'on',"
+ "'netdev': 'hs0',"
+ "'mac': '"MAC_STANDBY0"'}");
+
+ check_one_card(qts, true, "standby0", MAC_STANDBY0);
+ check_one_card(qts, false, "primary0", MAC_PRIMARY0);
+
+ qtest_qmp_device_add(qts, "virtio-net", "primary0",
+ "{'bus': 'root1',"
+ "'failover_pair_id': 'standby0',"
+ "'netdev': 'hs1',"
+ "'rombar': 0,"
+ "'romfile': '',"
+ "'mac': '"MAC_PRIMARY0"'}");
+
+ check_one_card(qts, true, "standby0", MAC_STANDBY0);
+ check_one_card(qts, false, "primary0", MAC_PRIMARY0);
+
+ features = ~(QVIRTIO_F_BAD_FEATURE |
+ (1ull << VIRTIO_RING_F_INDIRECT_DESC) |
+ (1ull << VIRTIO_RING_F_EVENT_IDX) |
+ (1ull << VIRTIO_NET_F_STANDBY));
+
+ vdev = start_virtio_net_internal(qts, 1, 0, &features);
+
+ check_one_card(qts, true, "standby0", MAC_STANDBY0);
+ check_one_card(qts, false, "primary0", MAC_PRIMARY0);
+
+ args = qdict_from_jsonf_nofail("{}");
+ g_assert_nonnull(args);
+ qdict_put_str(args, "uri", uri);
+
+ resp = qtest_qmp(qts, "{ 'execute': 'migrate', 'arguments': %p}", args);
+ g_assert(qdict_haskey(resp, "return"));
+ qobject_unref(resp);
+
+ while (true) {
+ ret = migrate_status(qts);
+
+ status = qdict_get_str(ret, "status");
+ if (strcmp(status, "completed") == 0) {
+ qobject_unref(ret);
+ break;
+ }
+ g_assert_cmpstr(status, !=, "failed");
+ g_assert_cmpstr(status, !=, "cancelling");
+ g_assert_cmpstr(status, !=, "cancelled");
+ qobject_unref(ret);
+ }
+
+ qtest_qmp_eventwait(qts, "STOP");
+
+ check_one_card(qts, true, "standby0", MAC_STANDBY0);
+ check_one_card(qts, false, "primary0", MAC_PRIMARY0);
+
+ qos_object_destroy((QOSGraphObject *)vdev);
+ machine_stop(qts);
+}
+
+static void test_guest_off_migrate_in(gconstpointer opaque)
+{
+ QTestState *qts;
+ QDict *resp, *args, *ret;
+ g_autofree gchar *uri = g_strdup_printf("exec: cat %s", (gchar *)opaque);
+
+ qts = machine_start(BASE_MACHINE
+ "-netdev user,id=hs0 "
+ "-netdev user,id=hs1 "
+ "-incoming defer ",
+ 2);
+
+ check_one_card(qts, false, "standby0", MAC_STANDBY0);
+ check_one_card(qts, false, "primary0", MAC_PRIMARY0);
+
+ qtest_qmp_device_add(qts, "virtio-net", "standby0",
+ "{'bus': 'root0',"
+ "'failover': 'on',"
+ "'netdev': 'hs0',"
+ "'mac': '"MAC_STANDBY0"'}");
+
+ check_one_card(qts, true, "standby0", MAC_STANDBY0);
+ check_one_card(qts, false, "primary0", MAC_PRIMARY0);
+
+ qtest_qmp_device_add(qts, "virtio-net", "primary0",
+ "{'bus': 'root1',"
+ "'failover_pair_id': 'standby0',"
+ "'netdev': 'hs1',"
+ "'rombar': 0,"
+ "'romfile': '',"
+ "'mac': '"MAC_PRIMARY0"'}");
+
+ check_one_card(qts, true, "standby0", MAC_STANDBY0);
+ check_one_card(qts, false, "primary0", MAC_PRIMARY0);
+
+ args = qdict_from_jsonf_nofail("{}");
+ g_assert_nonnull(args);
+ qdict_put_str(args, "uri", uri);
+
+ resp = qtest_qmp(qts, "{ 'execute': 'migrate-incoming', 'arguments': %p}",
+ args);
+ g_assert(qdict_haskey(resp, "return"));
+ qobject_unref(resp);
+
+ resp = get_migration_event(qts);
+ g_assert_cmpstr(qdict_get_str(resp, "status"), ==, "setup");
+ qobject_unref(resp);
+
+ check_one_card(qts, true, "standby0", MAC_STANDBY0);
+ check_one_card(qts, false, "primary0", MAC_PRIMARY0);
+
+ qtest_qmp_eventwait(qts, "RESUME");
+
+ ret = migrate_status(qts);
+ g_assert_cmpstr(qdict_get_str(ret, "status"), ==, "completed");
+ qobject_unref(ret);
+
+ machine_stop(qts);
+}
+
+static void test_migrate_guest_off_abort(gconstpointer opaque)
+{
+ QTestState *qts;
+ QDict *resp, *args, *ret;
+ g_autofree gchar *uri = g_strdup_printf("exec: cat > %s", (gchar *)opaque);
+ const gchar *status;
+ QVirtioPCIDevice *vdev;
+ uint64_t features;
+
+ qts = machine_start(BASE_MACHINE
+ "-netdev user,id=hs0 "
+ "-netdev user,id=hs1 ",
+ 2);
+
+ check_one_card(qts, false, "standby0", MAC_STANDBY0);
+ check_one_card(qts, false, "primary0", MAC_PRIMARY0);
+
+ qtest_qmp_device_add(qts, "virtio-net", "standby0",
+ "{'bus': 'root0',"
+ "'failover': 'on',"
+ "'netdev': 'hs0',"
+ "'mac': '"MAC_STANDBY0"'}");
+
+ check_one_card(qts, true, "standby0", MAC_STANDBY0);
+ check_one_card(qts, false, "primary0", MAC_PRIMARY0);
+
+ qtest_qmp_device_add(qts, "virtio-net", "primary0",
+ "{'bus': 'root1',"
+ "'failover_pair_id': 'standby0',"
+ "'netdev': 'hs1',"
+ "'rombar': 0,"
+ "'romfile': '',"
+ "'mac': '"MAC_PRIMARY0"'}");
+
+ check_one_card(qts, true, "standby0", MAC_STANDBY0);
+ check_one_card(qts, false, "primary0", MAC_PRIMARY0);
+
+ features = ~(QVIRTIO_F_BAD_FEATURE |
+ (1ull << VIRTIO_RING_F_INDIRECT_DESC) |
+ (1ull << VIRTIO_RING_F_EVENT_IDX) |
+ (1ull << VIRTIO_NET_F_STANDBY));
+
+ vdev = start_virtio_net_internal(qts, 1, 0, &features);
+
+ check_one_card(qts, true, "standby0", MAC_STANDBY0);
+ check_one_card(qts, false, "primary0", MAC_PRIMARY0);
+
+ args = qdict_from_jsonf_nofail("{}");
+ g_assert_nonnull(args);
+ qdict_put_str(args, "uri", uri);
+
+ resp = qtest_qmp(qts, "{ 'execute': 'migrate', 'arguments': %p}", args);
+ g_assert(qdict_haskey(resp, "return"));
+ qobject_unref(resp);
+
+ while (true) {
+ ret = migrate_status(qts);
+
+ status = qdict_get_str(ret, "status");
+ if (strcmp(status, "active") == 0) {
+ qobject_unref(ret);
+ break;
+ }
+ g_assert_cmpstr(status, !=, "failed");
+ qobject_unref(ret);
+ }
+
+ resp = qtest_qmp(qts, "{ 'execute': 'migrate_cancel' }");
+ g_assert(qdict_haskey(resp, "return"));
+ qobject_unref(resp);
+
+ while (true) {
+ ret = migrate_status(qts);
+
+ status = qdict_get_str(ret, "status");
+ if (strcmp(status, "cancelled") == 0) {
+ qobject_unref(ret);
+ break;
+ }
+ g_assert_cmpstr(status, !=, "failed");
+ g_assert_cmpstr(status, !=, "active");
+ qobject_unref(ret);
+ }
+
+ check_one_card(qts, true, "standby0", MAC_STANDBY0);
+ check_one_card(qts, false, "primary0", MAC_PRIMARY0);
+
+ qos_object_destroy((QOSGraphObject *)vdev);
+ machine_stop(qts);
+}
+
static void test_migrate_abort_wait_unplug(gconstpointer opaque)
{
QTestState *qts;
@@ -780,7 +1198,7 @@ static void test_migrate_abort_wait_unplug(gconstpointer opaque)
check_one_card(qts, true, "standby0", MAC_STANDBY0);
check_one_card(qts, false, "primary0", MAC_PRIMARY0);
- vdev = start_virtio_net(qts, 1, 0, "standby0");
+ vdev = start_virtio_net(qts, 1, 0, "standby0", true);
check_one_card(qts, true, "standby0", MAC_STANDBY0);
check_one_card(qts, false, "primary0", MAC_PRIMARY0);
@@ -870,7 +1288,7 @@ static void test_migrate_abort_active(gconstpointer opaque)
check_one_card(qts, true, "standby0", MAC_STANDBY0);
check_one_card(qts, false, "primary0", MAC_PRIMARY0);
- vdev = start_virtio_net(qts, 1, 0, "standby0");
+ vdev = start_virtio_net(qts, 1, 0, "standby0", true);
check_one_card(qts, true, "standby0", MAC_STANDBY0);
check_one_card(qts, false, "primary0", MAC_PRIMARY0);
@@ -938,6 +1356,91 @@ static void test_migrate_abort_active(gconstpointer opaque)
machine_stop(qts);
}
+static void test_migrate_off_abort(gconstpointer opaque)
+{
+ QTestState *qts;
+ QDict *resp, *args, *ret;
+ g_autofree gchar *uri = g_strdup_printf("exec: cat > %s", (gchar *)opaque);
+ const gchar *status;
+ QVirtioPCIDevice *vdev;
+
+ qts = machine_start(BASE_MACHINE
+ "-netdev user,id=hs0 "
+ "-netdev user,id=hs1 ",
+ 2);
+
+ check_one_card(qts, false, "standby0", MAC_STANDBY0);
+ check_one_card(qts, false, "primary0", MAC_PRIMARY0);
+
+ qtest_qmp_device_add(qts, "virtio-net", "standby0",
+ "{'bus': 'root0',"
+ "'failover': 'off',"
+ "'netdev': 'hs0',"
+ "'mac': '"MAC_STANDBY0"'}");
+
+ check_one_card(qts, true, "standby0", MAC_STANDBY0);
+ check_one_card(qts, false, "primary0", MAC_PRIMARY0);
+
+ vdev = start_virtio_net(qts, 1, 0, "standby0", false);
+
+ check_one_card(qts, true, "standby0", MAC_STANDBY0);
+ check_one_card(qts, false, "primary0", MAC_PRIMARY0);
+
+ qtest_qmp_device_add(qts, "virtio-net", "primary0",
+ "{'bus': 'root1',"
+ "'failover_pair_id': 'standby0',"
+ "'netdev': 'hs1',"
+ "'rombar': 0,"
+ "'romfile': '',"
+ "'mac': '"MAC_PRIMARY0"'}");
+
+ check_one_card(qts, true, "standby0", MAC_STANDBY0);
+ check_one_card(qts, true, "primary0", MAC_PRIMARY0);
+
+ args = qdict_from_jsonf_nofail("{}");
+ g_assert_nonnull(args);
+ qdict_put_str(args, "uri", uri);
+
+ resp = qtest_qmp(qts, "{ 'execute': 'migrate', 'arguments': %p}", args);
+ g_assert(qdict_haskey(resp, "return"));
+ qobject_unref(resp);
+
+ while (true) {
+ ret = migrate_status(qts);
+
+ status = qdict_get_str(ret, "status");
+ if (strcmp(status, "active") == 0) {
+ qobject_unref(ret);
+ break;
+ }
+ g_assert_cmpstr(status, !=, "failed");
+ qobject_unref(ret);
+ }
+
+ resp = qtest_qmp(qts, "{ 'execute': 'migrate_cancel' }");
+ g_assert(qdict_haskey(resp, "return"));
+ qobject_unref(resp);
+
+ while (true) {
+ ret = migrate_status(qts);
+
+ status = qdict_get_str(ret, "status");
+ if (strcmp(status, "cancelled") == 0) {
+ qobject_unref(ret);
+ break;
+ }
+ g_assert_cmpstr(status, !=, "failed");
+ g_assert_cmpstr(status, !=, "active");
+ qobject_unref(ret);
+ }
+
+ check_one_card(qts, true, "standby0", MAC_STANDBY0);
+ check_one_card(qts, true, "primary0", MAC_PRIMARY0);
+
+ qos_object_destroy((QOSGraphObject *)vdev);
+ machine_stop(qts);
+}
+
static void test_migrate_abort_timeout(gconstpointer opaque)
{
QTestState *qts;
@@ -964,7 +1467,7 @@ static void test_migrate_abort_timeout(gconstpointer opaque)
check_one_card(qts, true, "standby0", MAC_STANDBY0);
check_one_card(qts, false, "primary0", MAC_PRIMARY0);
- vdev = start_virtio_net(qts, 1, 0, "standby0");
+ vdev = start_virtio_net(qts, 1, 0, "standby0", true);
check_one_card(qts, true, "standby0", MAC_STANDBY0);
check_one_card(qts, false, "primary0", MAC_PRIMARY0);
@@ -1075,7 +1578,7 @@ static void test_multi_out(gconstpointer opaque)
check_one_card(qts, false, "standby1", MAC_STANDBY1);
check_one_card(qts, false, "primary1", MAC_PRIMARY1);
- vdev0 = start_virtio_net(qts, 1, 0, "standby0");
+ vdev0 = start_virtio_net(qts, 1, 0, "standby0", true);
check_one_card(qts, true, "standby0", MAC_STANDBY0);
check_one_card(qts, true, "primary0", MAC_PRIMARY0);
@@ -1106,7 +1609,7 @@ static void test_multi_out(gconstpointer opaque)
check_one_card(qts, true, "standby1", MAC_STANDBY1);
check_one_card(qts, false, "primary1", MAC_PRIMARY1);
- vdev1 = start_virtio_net(qts, 3, 0, "standby1");
+ vdev1 = start_virtio_net(qts, 3, 0, "standby1", true);
check_one_card(qts, true, "standby0", MAC_STANDBY0);
check_one_card(qts, true, "primary0", MAC_PRIMARY0);
@@ -1315,6 +1818,7 @@ int main(int argc, char **argv)
g_assert_true(ret >= 0);
close(ret);
+ /* parameters tests */
qtest_add_func("failover-virtio-net/params/error/id", test_error_id);
qtest_add_func("failover-virtio-net/params/error/pcie", test_error_pcie);
qtest_add_func("failover-virtio-net/params/on", test_on);
@@ -1322,16 +1826,33 @@ int main(int argc, char **argv)
test_on_mismatch);
qtest_add_func("failover-virtio-net/params/off", test_off);
qtest_add_func("failover-virtio-net/params/enabled", test_enabled);
- qtest_add_func("failover-virtio-net/hotplug_1", test_hotplug_1);
- qtest_add_func("failover-virtio-net/hotplug_1_reverse",
+ qtest_add_func("failover-virtio-net/params/guest_off", test_guest_off);
+
+ /* hotplug tests */
+ qtest_add_func("failover-virtio-net/hotplug/1", test_hotplug_1);
+ qtest_add_func("failover-virtio-net/hotplug/1_reverse",
test_hotplug_1_reverse);
- qtest_add_func("failover-virtio-net/hotplug_2", test_hotplug_2);
- qtest_add_func("failover-virtio-net/hotplug_2_reverse",
+ qtest_add_func("failover-virtio-net/hotplug/2", test_hotplug_2);
+ qtest_add_func("failover-virtio-net/hotplug/2_reverse",
test_hotplug_2_reverse);
- qtest_add_data_func("failover-virtio-net/migrate/out", tmpfile,
+
+ /* migration tests */
+ qtest_add_data_func("failover-virtio-net/migrate/on/out", tmpfile,
test_migrate_out);
- qtest_add_data_func("failover-virtio-net/migrate/in", tmpfile,
+ qtest_add_data_func("failover-virtio-net/migrate/on/in", tmpfile,
test_migrate_in);
+ qtest_add_data_func("failover-virtio-net/migrate/off/out", tmpfile,
+ test_off_migrate_out);
+ qtest_add_data_func("failover-virtio-net/migrate/off/in", tmpfile,
+ test_off_migrate_in);
+ qtest_add_data_func("failover-virtio-net/migrate/off/abort", tmpfile,
+ test_migrate_off_abort);
+ qtest_add_data_func("failover-virtio-net/migrate/guest_off/out", tmpfile,
+ test_guest_off_migrate_out);
+ qtest_add_data_func("failover-virtio-net/migrate/guest_off/in", tmpfile,
+ test_guest_off_migrate_in);
+ qtest_add_data_func("failover-virtio-net/migrate/guest_off/abort", tmpfile,
+ test_migrate_guest_off_abort);
qtest_add_data_func("failover-virtio-net/migrate/abort/wait-unplug",
tmpfile, test_migrate_abort_wait_unplug);
qtest_add_data_func("failover-virtio-net/migrate/abort/active", tmpfile,
@@ -1340,9 +1861,9 @@ int main(int argc, char **argv)
qtest_add_data_func("failover-virtio-net/migrate/abort/timeout",
tmpfile, test_migrate_abort_timeout);
}
- qtest_add_data_func("failover-virtio-net/multi/out",
+ qtest_add_data_func("failover-virtio-net/migrate/multi/out",
tmpfile, test_multi_out);
- qtest_add_data_func("failover-virtio-net/multi/in",
+ qtest_add_data_func("failover-virtio-net/migrate/multi/in",
tmpfile, test_multi_in);
ret = g_test_run();