Misc patches for 2019-12-16
Subsystems (2)
The following changes since commit 084a398bf8aa7634738e6c6c0103236ee1b3b72f:
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging (2019-12-13 18:14:07 +0000)
are available in the git repository at:
git://github.com/bonzini/qemu.git tags/for-upstream
for you to fetch changes up to cfba0eb1146e7ccf839df29fd99cb90dd3c7640a:
colo: fix return without releasing RCU (2019-12-16 17:25:46 +0100)
----------------------------------------------------------------
* More uses of RCU_READ_LOCK_GUARD (Dave, myself)
* QOM doc improvments (Greg)
* Cleanups from the Meson conversion (Marc-André)
* Support for multiple -accel options (myself)
* Many x86 machine cleanup (Philippe, myself)
* tests/migration-test cleanup (Juan)
----------------------------------------------------------------
Dr. David Alan Gilbert (3):
kvm: Reallocate dirty_bmap when we change a slot
hyperv: Use auto rcu_read macros
qsp: Use WITH_RCU_READ_LOCK_GUARD
Greg Kurz (1):
object: Improve documentation of interfaces
Juan Quintela (10):
migration-test: Create cmd_soure and cmd_target
migration-test: Move hide_stderr to common commandline
migration-test: Move -machine to common commandline
migration-test: Move memory size to common commandline
migration-test: Move shmem handling to common commandline
migration-test: Move -name handling to common commandline
migration-test: Move -serial handling to common commandline
migration-test: Move -incomming handling to common commandline
migration-test: Rename cmd_src/dst to arch_source/arch_target
migration-test: Use a struct for test_migrate_start parameters
Marc-André Lureau (7):
build-sys: build vhost-user-gpu only if CONFIG_TOOLS
migration: fix maybe-uninitialized warning
monitor: fix maybe-uninitialized
vhost-user-scsi: fix printf format warning
os-posix: simplify os_find_datadir
tests: skip block layer tests if !CONFIG_TOOLS
configure: simplify vhost condition with Kconfig
Paolo Bonzini (35):
memory: do not look at current_machine->accel
vl: move icount configuration earlier
tcg: move qemu_tcg_configure to accel/tcg/tcg-all.c
vl: extract accelerator option processing to a separate function
vl: merge -accel processing into configure_accelerators
accel: compile accel/accel.c just once
vl: introduce object_parse_property_opt
vl: configure accelerators from -accel options
vl: warn for unavailable accelerators, clarify messages
qom: introduce object_register_sugar_prop
qom: add object_new_with_class
accel: pass object to accel_init_machine
tcg: convert "-accel threads" to a QOM property
tcg: add "-accel tcg,tb-size" and deprecate "-tb-size"
xen: convert "-machine igd-passthru" to an accelerator property
kvm: convert "-machine kvm_shadow_mem" to an accelerator property
kvm: introduce kvm_kernel_irqchip_* functions
kvm: convert "-machine kernel_irqchip" to an accelerator property
Makefile: remove unused variables
build-sys: do not include Windows SLIRP dependencies in $LIBS
libvixl: remove per-target compiler flags
crypto: move common bits for all emulators to libqemuutil
stubs: replace stubs with lnot if applicable
configure: set $PYTHON to a full path
i386: conditionally compile more files
fw_cfg: allow building without other devices
hw: replace hw/i386/pc.h with a header just for the i8259
pci-stub: add more MSI functions
x86: move SMM property to X86MachineState
x86: move more x86-generic functions out of PC files
acpi: move PC stubs out of stubs/
pc: stubify x86 iommu
hw/isa/isa-bus: cleanup irq functions
memory: use RCU_READ_LOCK_GUARD
colo: fix return without releasing RCU
Philippe Mathieu-Daudé (6):
hw/i386/pc: Convert DPRINTF() to trace events
hw/i386: De-duplicate gsi_handler() to remove kvm_pc_gsi_handler() hw/i386: Simplify ioapic_init_gsi()
hw/i386/pc: Use TYPE_PORT92 instead of hardcoded string hw/i386/pc: Inline port92_init()
hw/i386/pc: Extract the port92 device
Kconfig.host | 5 + Makefile | 14 +- Makefile.objs | 6 +- Makefile.target | 2 - accel/Makefile.objs | 2 +- accel/accel.c | 73 +----- accel/kvm/kvm-all.c | 161 ++++++++++-- accel/tcg/tcg-all.c | 149 ++++++++++- configure | 10 +- contrib/vhost-user-scsi/vhost-user-scsi.c | 2 +- cpus.c | 72 ----- crypto/Makefile.objs | 13 +- disas/libvixl/Makefile.objs | 11 +- hw/acpi/Makefile.objs | 3 +- .../pc_madt_cpu_entry.c => hw/acpi/acpi-x86-stub.c | 0 hw/alpha/alpha_sys.h | 3 +- hw/alpha/dp264.c | 1 + hw/core/machine.c | 141 ---------- hw/hppa/hppa_sys.h | 3 +- hw/hppa/machine.c | 1 + hw/hyperv/hyperv.c | 22 +- hw/i386/Kconfig | 6 + hw/i386/Makefile.objs | 10 +- hw/i386/acpi-build.c | 1 + hw/i386/fw_cfg.c | 8 +- hw/i386/fw_cfg.h | 2 + hw/i386/kvm/Makefile.objs | 6 +- hw/i386/kvm/i8259.c | 1 + hw/i386/kvm/ioapic.c | 14 +- hw/i386/microvm.c | 4 +- hw/i386/pc.c | 291 +-------------------- hw/i386/pc_piix.c | 6 +- hw/i386/pc_q35.c | 2 +- hw/i386/port92.c | 126 +++++++++ hw/i386/trace-events | 8 + hw/i386/x86-iommu-stub.c | 34 +++ hw/i386/x86.c | 154 ++++++++++- hw/input/pckbd.c | 1 - hw/intc/Kconfig | 2 + hw/intc/apic.c | 2 +- hw/intc/i8259.c | 2 +- hw/intc/i8259_common.c | 2 +- hw/intc/ioapic.c | 3 +- hw/isa/i82378.c | 2 +- hw/isa/isa-bus.c | 11 +- hw/isa/lpc_ich9.c | 1 - hw/isa/piix4.c | 2 +- hw/mips/gt64xxx_pci.c | 2 +- hw/mips/mips_fulong2e.c | 2 +- hw/mips/mips_jazz.c | 2 +- hw/mips/mips_r4k.c | 2 +- hw/pci-host/bonito.c | 1 - hw/pci-host/prep.c | 2 +- hw/pci/pci-stub.c | 27 ++ hw/ppc/e500.c | 5 +- hw/ppc/spapr_irq.c | 16 +- hw/virtio/Kconfig | 3 + hw/virtio/Makefile.objs | 4 +- hw/xen/xen-common.c | 18 ++ hw/xen/xen_pt.c | 2 + include/exec/memory.h | 3 +- include/hw/boards.h | 7 - include/hw/i386/pc.h | 32 +-- include/hw/i386/x86.h | 23 ++ include/hw/intc/i8259.h | 12 + include/hw/isa/i8259_internal.h | 2 +- include/hw/isa/isa.h | 8 +- include/qom/object.h | 23 +- include/sysemu/accel.h | 4 +- include/sysemu/cpus.h | 2 - include/sysemu/kvm.h | 8 +- memory.c | 5 +- migration/ram.c | 53 ++-- monitor/misc.c | 3 +- os-posix.c | 41 +-- qemu-deprecated.texi | 6 + qemu-options.hx | 30 ++- qom/object.c | 28 +- stubs/Makefile.objs | 1 - target/arm/kvm.c | 8 +- target/i386/cpu.c | 8 +- target/i386/kvm.c | 11 +- target/i386/machine.c | 2 +- target/i386/monitor.c | 1 - target/mips/kvm.c | 2 +- target/ppc/kvm.c | 2 +- target/s390x/cpu_models.c | 4 +- target/s390x/kvm.c | 2 +- tests/Makefile.include | 4 +- tests/arm-cpu-features.c | 4 +- tests/bios-tables-test.c | 16 +- tests/boot-serial-test.c | 4 +- tests/cdrom-test.c | 2 +- tests/libqtest.c | 4 +- tests/migration-test.c | 264 ++++++++++--------- tests/pflash-cfi02-test.c | 4 +- tests/pnv-xscom-test.c | 4 +- tests/prom-env-test.c | 2 +- tests/pxe-test.c | 2 +- tests/vmgenid-test.c | 2 +- util/Makefile.objs | 3 +- util/qsp.c | 22 +- vl.c | 225 +++++++++++----- 103 files changed, 1298 insertions(+), 1076 deletions(-) rename stubs/pc_madt_cpu_entry.c => hw/acpi/acpi-x86-stub.c (100%) create mode 100644 hw/i386/port92.c create mode 100644 hw/i386/x86-iommu-stub.c create mode 100644 include/hw/intc/i8259.h
Signature · 1 line
1.8.3.1
[PULL 01/62] kvm: Reallocate dirty_bmap when we change a slot
From: "Dr. David Alan Gilbert" <[email protected]>
kvm_set_phys_mem can be called to reallocate a slot by something the guest does (e.g. writing to PAM and other chipset registers). This can happen in the middle of a migration, and if we're unlucky it can now happen between the split 'sync' and 'clear'; the clear
asserts if there's no bmap to clear. Recreate the bmap whenever
we change the slot, keeping the clear path happy.
Typically this is triggered by the guest rebooting during a migrate.
Corresponds to:
https://bugzilla.redhat.com/show_bug.cgi?id=1772774
https://bugzilla.redhat.com/show_bug.cgi?id=1771032
--- accel/kvm/kvm-all.c | 44 +++++++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 15 deletions(-)
accel/kvm/kvm-all.c +29 -15
@@ -518,6 +518,27 @@ static int kvm_get_dirty_pages_log_range(MemoryRegionSection *section,#define ALIGN (x, y) (((x)+(y)-1) & ~((y)-1)) +/* Allocate the dirty bitmap for a slot */ +static void kvm_memslot_init_dirty_bitmap (KVMSlot *mem) +{ +/* +* XXX bad kernel interface alert +* For dirty bitmap, kernel allocates array of size aligned to +* bits-per-long. But for case when the kernel is 64bits and +* the userspace is 32bits, userspace can't align to the same +* bits-per-long, since sizeof(long) is different between kernel +* and user space. This way, userspace will provide buffer which +* may be 4 bytes less than the kernel will use, resulting in +* userspace memory corruption (which is not detectable by valgrind +* too, in most cases). +* So for now, let's align to 64 instead of HOST_LONG_BITS here, in +* a hope that sizeof(long) won't become >8 any time soon. +*/ +hwaddr bitmap_size =ALIGN (((mem->memory_size) >>TARGET_PAGE_BITS ), +/*HOST_LONG_BITS*/ 64 ) /8 ; + mem->dirty_bmap =g_malloc0 (bitmap_size); +} +/** * kvm_physical_sync_dirty_bitmap - Sync dirty bitmap from kernel space *
@@ -550,23 +571,9 @@ static int kvm_physical_sync_dirty_bitmap(KVMMemoryListener *kml, goto out; } -/* XXX bad kernel interface alert -* For dirty bitmap, kernel allocates array of size aligned to -* bits-per-long. But for case when the kernel is 64bits and -* the userspace is 32bits, userspace can't align to the same -* bits-per-long, since sizeof(long) is different between kernel -* and user space. This way, userspace will provide buffer which -* may be 4 bytes less than the kernel will use, resulting in -* userspace memory corruption (which is not detectable by valgrind -* too, in most cases). -* So for now, let's align to 64 instead of HOST_LONG_BITS here, in -* a hope that sizeof(long) won't become >8 any time soon. -*/ if (!mem->dirty_bmap) { -hwaddr bitmap_size =ALIGN (((mem->memory_size) >>TARGET_PAGE_BITS ), -/*HOST_LONG_BITS*/ 64 ) /8 ;/* Allocate on the first log_sync, once and for all */ - mem->dirty_bmap =g_malloc0 (bitmap_size); +kvm_memslot_init_dirty_bitmap (mem); } d.dirty_bitmap = mem->dirty_bmap;
@@ -1067,6 +1074,13 @@ static void kvm_set_phys_mem(KVMMemoryListener *kml, mem->ram = ram; mem->flags =kvm_mem_flags (mr); +if (mem->flags &KVM_MEM_LOG_DIRTY_PAGES ) { +/* +* Reallocate the bmap; it means it doesn't disappear in +* middle of a migrate. +*/ +kvm_memslot_init_dirty_bitmap (mem); + } err =kvm_set_user_memory_region (kml, mem, true);if (err) { fprintf(stderr, "%s: error registering slot: %s\n", __func__,
Signature · 1 line
1.8.3.1
[PULL 02/62] migration-test: Create cmd_soure and cmd_target
In reply to Paolo BonziniFrom: Juan Quintela <[email protected]>
We are repeating almost everything for each machine while creating the command line for migration. And once for source and another for destination. We start putting there opts_src and opts_dst.
--- tests/migration-test.c | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-)
tests/migration-test.c +25 -19
@@ -557,6 +557,7 @@ static int test_migrate_start(QTestState **from, QTestState **to, const char *opts_dst) {gchar *cmd_src, *cmd_dst; +gchar *cmd_source, *cmd_target;char *bootpath =NULL ;char *extra_opts =NULL ;char *shmem_path =NULL ;
@@ -584,16 +585,16 @@ static int test_migrate_start(QTestState **from, QTestState **to, cmd_src =g_strdup_printf ("-machine accel=%s -m 150M" " -name source,debug-threads=on" " -serial file:%s/src_serial" -" -drive file=%s,format=raw %s %s" , +" -drive file=%s,format=raw %s" , accel, tmpfs, bootpath, - extra_opts ? extra_opts :"" , opts_src); + extra_opts ? extra_opts :"" ); cmd_dst =g_strdup_printf ("-machine accel=%s -m 150M" " -name target,debug-threads=on" " -serial file:%s/dest_serial" " -drive file=%s,format=raw" -" -incoming %s %s %s" , +" -incoming %s %s" , accel, tmpfs, bootpath, uri, - extra_opts ? extra_opts :"" , opts_dst); + extra_opts ? extra_opts :"" ); start_address =X86_TEST_MEM_START ; end_address =X86_TEST_MEM_END ; }else if (g_str_equal (arch,"s390x" )) {
@@ -601,15 +602,15 @@ static int test_migrate_start(QTestState **from, QTestState **to, extra_opts = use_shmem ?get_shmem_opts ("128M" , shmem_path) :NULL ; cmd_src =g_strdup_printf ("-machine accel=%s -m 128M" " -name source,debug-threads=on" -" -serial file:%s/src_serial -bios %s %s %s" , +" -serial file:%s/src_serial -bios %s %s" , accel, tmpfs, bootpath, - extra_opts ? extra_opts :"" , opts_src); + extra_opts ? extra_opts :"" ); cmd_dst =g_strdup_printf ("-machine accel=%s -m 128M" " -name target,debug-threads=on" " -serial file:%s/dest_serial -bios %s" -" -incoming %s %s %s" , +" -incoming %s %s" , accel, tmpfs, bootpath, uri, - extra_opts ? extra_opts :"" , opts_dst); + extra_opts ? extra_opts :"" ); start_address =S390_TEST_MEM_START ; end_address =S390_TEST_MEM_END ; }else if (strcmp (arch,"ppc64" ) ==0 ) {
@@ -620,15 +621,14 @@ static int test_migrate_start(QTestState **from, QTestState **to," -prom-env 'use-nvramrc?=true' -prom-env " "'nvramrc=hex .\" _\" begin %x %x " "do i c@ 1 + i c! 1000 +loop .\" B\" 0 " -"until' %s %s" , accel, tmpfs, end_address, - start_address, extra_opts ? extra_opts :"" , - opts_src); +"until' %s" , accel, tmpfs, end_address, + start_address, extra_opts ? extra_opts : ""); cmd_dst =g_strdup_printf ("-machine accel=%s,vsmt=8 -m 256M" " -name target,debug-threads=on" " -serial file:%s/dest_serial" -" -incoming %s %s %s" , +" -incoming %s %s" , accel, tmpfs, uri, - extra_opts ? extra_opts :"" , opts_dst); + extra_opts ? extra_opts :"" ); start_address =PPC_TEST_MEM_START ; end_address =PPC_TEST_MEM_END ;
@@ -638,16 +638,16 @@ static int test_migrate_start(QTestState **from, QTestState **to, cmd_src =g_strdup_printf ("-machine virt,accel=%s,gic-version=max " "-name vmsource,debug-threads=on -cpu max " "-m 150M -serial file:%s/src_serial " -"-kernel %s %s %s" , +"-kernel %s %s" , accel, tmpfs, bootpath, - extra_opts ? extra_opts :"" , opts_src); + extra_opts ? extra_opts :"" ); cmd_dst =g_strdup_printf ("-machine virt,accel=%s,gic-version=max " "-name vmdest,debug-threads=on -cpu max " "-m 150M -serial file:%s/dest_serial " "-kernel %s " -"-incoming %s %s %s" , +"-incoming %s %s" , accel, tmpfs, bootpath, uri, - extra_opts ? extra_opts :"" , opts_dst); + extra_opts ? extra_opts :"" ); start_address =ARM_TEST_MEM_START ; end_address =ARM_TEST_MEM_END ;
@@ -671,11 +671,17 @@ static int test_migrate_start(QTestState **from, QTestState **to, cmd_dst = tmp; } - *from =qtest_init (cmd_src); + cmd_source =g_strdup_printf ("%s %s" , + cmd_src, opts_src);g_free (cmd_src); + *from =qtest_init (cmd_source); +g_free (cmd_source); - *to =qtest_init (cmd_dst); + cmd_target =g_strdup_printf ("%s %s" , + cmd_dst, opts_dst);g_free (cmd_dst); + *to =qtest_init (cmd_target); +g_free (cmd_target);/* * Remove shmem file immediately to avoid memory leak in test failed case.
Signature · 1 line
1.8.3.1
[PULL 05/62] migration-test: Move memory size to common commandline
In reply to Paolo BonziniFrom: Juan Quintela <[email protected]>
--- tests/migration-test.c | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-)
tests/migration-test.c +25 -19
@@ -565,6 +565,7 @@ static int test_migrate_start(QTestState **from, QTestState **to,const char *arch =qtest_get_arch ();const char *machine_type;const char *machine_args; +const char *memory_size; opts_src = opts_src ? opts_src :"" ; opts_dst = opts_dst ? opts_dst :"" ;
@@ -585,15 +586,14 @@ static int test_migrate_start(QTestState **from, QTestState **to,init_bootfile (bootpath, x86_bootsect,sizeof (x86_bootsect)); machine_type ="" ; machine_args ="" ; - extra_opts = use_shmem ?get_shmem_opts ("150M" , shmem_path) :NULL ; - cmd_src =g_strdup_printf ("-m 150M" -" -name source,debug-threads=on" + memory_size ="150M" ; + extra_opts = use_shmem ?get_shmem_opts (memory_size, shmem_path) :NULL ; + cmd_src =g_strdup_printf (" -name source,debug-threads=on" " -serial file:%s/src_serial" " -drive file=%s,format=raw %s" , tmpfs, bootpath, extra_opts ? extra_opts :"" ); - cmd_dst = g_strdup_printf("-m 150M" - " -name target,debug-threads=on" + cmd_dst = g_strdup_printf(" -name target,debug-threads=on" " -serial file:%s/dest_serial" " -drive file=%s,format=raw" " -incoming %s %s",
@@ -605,14 +605,13 @@ static int test_migrate_start(QTestState **from, QTestState **to,init_bootfile (bootpath, s390x_elf,sizeof (s390x_elf)); machine_type ="" ; machine_args ="" ; - extra_opts = use_shmem ?get_shmem_opts ("128M" , shmem_path) :NULL ; - cmd_src =g_strdup_printf ("-m 128M" -" -name source,debug-threads=on" + memory_size ="128M" ; + extra_opts = use_shmem ?get_shmem_opts (memory_size, shmem_path) :NULL ; + cmd_src =g_strdup_printf (" -name source,debug-threads=on" " -serial file:%s/src_serial -bios %s %s" , tmpfs, bootpath, extra_opts ? extra_opts :"" ); - cmd_dst = g_strdup_printf("-m 128M" - " -name target,debug-threads=on" + cmd_dst = g_strdup_printf(" -name target,debug-threads=on" " -serial file:%s/dest_serial -bios %s" " -incoming %s %s", tmpfs, bootpath, uri,
@@ -622,8 +621,9 @@ static int test_migrate_start(QTestState **from, QTestState **to, }else if (strcmp (arch,"ppc64" ) ==0 ) { machine_type ="" ; machine_args =",vsmt=8" ; - extra_opts = use_shmem ?get_shmem_opts ("256M" , shmem_path) :NULL ; - cmd_src =g_strdup_printf ("-m 256M -nodefaults" + memory_size ="256M" ; + extra_opts = use_shmem ?get_shmem_opts (memory_size, shmem_path) :NULL ; + cmd_src =g_strdup_printf ("-nodefaults" " -name source,debug-threads=on" " -serial file:%s/src_serial" " -prom-env 'use-nvramrc?=true' -prom-env "
@@ -631,8 +631,7 @@ static int test_migrate_start(QTestState **from, QTestState **to,"do i c@ 1 + i c! 1000 +loop .\" B\" 0 " "until' %s" , tmpfs, end_address, start_address, extra_opts ? extra_opts : ""); - cmd_dst = g_strdup_printf("-m 256M" - " -name target,debug-threads=on" + cmd_dst = g_strdup_printf(" -name target,debug-threads=on" " -serial file:%s/dest_serial" " -incoming %s %s", tmpfs, uri,
@@ -644,14 +643,15 @@ static int test_migrate_start(QTestState **from, QTestState **to,init_bootfile (bootpath, aarch64_kernel,sizeof (aarch64_kernel)); machine_type ="virt," ; machine_args ="gic-version=max" ; - extra_opts = use_shmem ?get_shmem_opts ("150M" , shmem_path) :NULL ; + memory_size ="150M" ; + extra_opts = use_shmem ?get_shmem_opts (memory_size, shmem_path) :NULL ; cmd_src =g_strdup_printf ("-name vmsource,debug-threads=on -cpu max " -"-m 150M -serial file:%s/src_serial " +"-serial file:%s/src_serial " "-kernel %s %s" , tmpfs, bootpath, extra_opts ? extra_opts :"" ); cmd_dst = g_strdup_printf("-name vmdest,debug-threads=on -cpu max " - "-m 150M -serial file:%s/dest_serial " + "-serial file:%s/dest_serial " "-kernel %s " "-incoming %s %s", tmpfs, bootpath, uri,
@@ -674,15 +674,21 @@ static int test_migrate_start(QTestState **from, QTestState **to, ignore_stderr ="" ; } - cmd_source =g_strdup_printf ("-machine %saccel=kvm:tcg%s %s %s %s" , + cmd_source =g_strdup_printf ("-machine %saccel=kvm:tcg%s " +"-m %s " +"%s %s %s" , machine_type, machine_args, + memory_size, cmd_src, opts_src, ignore_stderr);g_free (cmd_src); *from =qtest_init (cmd_source);g_free (cmd_source); - cmd_target =g_strdup_printf ("-machine %saccel=kvm:tcg%s %s %s %s" , + cmd_target =g_strdup_printf ("-machine %saccel=kvm:tcg%s " +"-m %s " +"%s %s %s" , machine_type, machine_args, + memory_size, cmd_dst, opts_dst, ignore_stderr);g_free (cmd_dst); *to =qtest_init (cmd_target);
Signature · 1 line
1.8.3.1
[PULL 06/62] migration-test: Move shmem handling to common commandline
In reply to Paolo BonziniFrom: Juan Quintela <[email protected]>
--- tests/migration-test.c | 76 ++++++++++++++++++++++---------------------------- 1 file changed, 34 insertions(+), 42 deletions(-)
tests/migration-test.c +34 -42
@@ -380,13 +380,6 @@ static void cleanup(const char *filename)g_free (path); } -static char *get_shmem_opts (const char *mem_size,const char *shmem_path) -{ -return g_strdup_printf ("-object memory-backend-file,id=mem0,size=%s" -",mem-path=%s,share=on -numa node,memdev=mem0" , - mem_size, shmem_path); -} -static char *SocketAddress_to_str (SocketAddress *addr) {switch (addr->type) {
@@ -560,8 +553,8 @@ static int test_migrate_start(QTestState **from, QTestState **to,gchar *cmd_source, *cmd_target;const gchar *ignore_stderr;char *bootpath =NULL ; -char *extra_opts =NULL ; -char *shmem_path =NULL ; +char *shmem_opts; +char *shmem_path;const char *arch =qtest_get_arch ();const char *machine_type;const char *machine_args;
@@ -575,7 +568,6 @@ static int test_migrate_start(QTestState **from, QTestState **to,g_test_skip ("/dev/shm is not supported" );return -1 ; } - shmem_path =g_strdup_printf ("/dev/shm/qemu-%d" ,getpid ()); } got_stop = false;
@@ -587,18 +579,15 @@ static int test_migrate_start(QTestState **from, QTestState **to, machine_type ="" ; machine_args ="" ; memory_size ="150M" ; - extra_opts = use_shmem ?get_shmem_opts (memory_size, shmem_path) :NULL ; cmd_src =g_strdup_printf (" -name source,debug-threads=on" " -serial file:%s/src_serial" -" -drive file=%s,format=raw %s" , - tmpfs, bootpath, - extra_opts ? extra_opts :"" ); +" -drive file=%s,format=raw" , + tmpfs, bootpath); cmd_dst =g_strdup_printf (" -name target,debug-threads=on" " -serial file:%s/dest_serial" " -drive file=%s,format=raw" -" -incoming %s %s" , - tmpfs, bootpath, uri, - extra_opts ? extra_opts :"" ); +" -incoming %s" , + tmpfs, bootpath, uri); start_address =X86_TEST_MEM_START ; end_address =X86_TEST_MEM_END ; }else if (g_str_equal (arch,"s390x" )) {
@@ -606,36 +595,31 @@ static int test_migrate_start(QTestState **from, QTestState **to, machine_type ="" ; machine_args ="" ; memory_size ="128M" ; - extra_opts = use_shmem ?get_shmem_opts (memory_size, shmem_path) :NULL ; cmd_src =g_strdup_printf (" -name source,debug-threads=on" -" -serial file:%s/src_serial -bios %s %s" , - tmpfs, bootpath, - extra_opts ? extra_opts :"" ); +" -serial file:%s/src_serial -bios %s" , + tmpfs, bootpath); cmd_dst =g_strdup_printf (" -name target,debug-threads=on" " -serial file:%s/dest_serial -bios %s" -" -incoming %s %s" , - tmpfs, bootpath, uri, - extra_opts ? extra_opts :"" ); +" -incoming %s" , + tmpfs, bootpath, uri); start_address =S390_TEST_MEM_START ; end_address =S390_TEST_MEM_END ; }else if (strcmp (arch,"ppc64" ) ==0 ) { machine_type ="" ; machine_args =",vsmt=8" ; memory_size ="256M" ; - extra_opts = use_shmem ?get_shmem_opts (memory_size, shmem_path) :NULL ; cmd_src =g_strdup_printf ("-nodefaults" " -name source,debug-threads=on" " -serial file:%s/src_serial" " -prom-env 'use-nvramrc?=true' -prom-env " "'nvramrc=hex .\" _\" begin %x %x " "do i c@ 1 + i c! 1000 +loop .\" B\" 0 " -"until' %s" , tmpfs, end_address, - start_address, extra_opts ? extra_opts :"" ); +"until'" , tmpfs, end_address, + start_address); cmd_dst =g_strdup_printf (" -name target,debug-threads=on" " -serial file:%s/dest_serial" -" -incoming %s %s" , - tmpfs, uri, - extra_opts ? extra_opts :"" ); +" -incoming %s" , + tmpfs, uri); start_address =PPC_TEST_MEM_START ; end_address =PPC_TEST_MEM_END ;
@@ -644,18 +628,15 @@ static int test_migrate_start(QTestState **from, QTestState **to, machine_type ="virt," ; machine_args ="gic-version=max" ; memory_size ="150M" ; - extra_opts = use_shmem ?get_shmem_opts (memory_size, shmem_path) :NULL ; cmd_src =g_strdup_printf ("-name vmsource,debug-threads=on -cpu max " "-serial file:%s/src_serial " -"-kernel %s %s" , - tmpfs, bootpath, - extra_opts ? extra_opts :"" ); +"-kernel %s" , + tmpfs, bootpath); cmd_dst =g_strdup_printf ("-name vmdest,debug-threads=on -cpu max " "-serial file:%s/dest_serial " "-kernel %s " -"-incoming %s %s" , - tmpfs, bootpath, uri, - extra_opts ? extra_opts :"" ); +"-incoming %s" , + tmpfs, bootpath, uri); start_address =ARM_TEST_MEM_START ; end_address =ARM_TEST_MEM_END ;
@@ -666,7 +647,6 @@ static int test_migrate_start(QTestState **from, QTestState **to, }g_free (bootpath); -g_free (extra_opts);if (hide_stderr) { ignore_stderr ="2>/dev/null" ;
@@ -674,26 +654,38 @@ static int test_migrate_start(QTestState **from, QTestState **to, ignore_stderr ="" ; } +if (use_shmem) { + shmem_path =g_strdup_printf ("/dev/shm/qemu-%d" ,getpid ()); + shmem_opts =g_strdup_printf ( +"-object memory-backend-file,id=mem0,size=%s" +",mem-path=%s,share=on -numa node,memdev=mem0" , + memory_size, shmem_path); + }else { + shmem_path =NULL ; + shmem_opts =g_strdup ("" ); + } + cmd_source =g_strdup_printf ("-machine %saccel=kvm:tcg%s " "-m %s " -"%s %s %s" , +"%s %s %s %s" , machine_type, machine_args, memory_size, - cmd_src, opts_src, ignore_stderr); + cmd_src, shmem_opts, opts_src, ignore_stderr);g_free (cmd_src); *from =qtest_init (cmd_source);g_free (cmd_source); cmd_target =g_strdup_printf ("-machine %saccel=kvm:tcg%s " "-m %s " -"%s %s %s" , +"%s %s %s %s" , machine_type, machine_args, memory_size, - cmd_dst, opts_dst, ignore_stderr); + cmd_dst, shmem_opts, opts_dst, ignore_stderr);g_free (cmd_dst); *to =qtest_init (cmd_target);g_free (cmd_target); +g_free (shmem_opts);/* * Remove shmem file immediately to avoid memory leak in test failed case. * It's valid becase QEMU has already opened this file
Signature · 1 line
1.8.3.1
[PULL 13/62] vl: move icount configuration earlier
In reply to Paolo BonziniOnce qemu_tcg_configure is turned into a QOM property setter, it will not be able to set a default value for mttcg_enabled. Setting the default will move to the TCG instance_init function, which currently runs before "-icount" is processed.
However, it is harmless to do configure_icount for all accelerators; we will just fail later if a non-TCG accelerator is selected. So do that.
--- vl.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
vl.c +11 -7
@@ -2825,6 +2825,12 @@ static void user_register_global_props(void) global_init_func, NULL, NULL); } +static int do_configure_icount (void *opaque,QemuOpts *opts,Error **errp) +{ +configure_icount (opts, errp); +return 0 ; +} +int main (int argc,char **argv,char **envp) {int i;
@@ -4142,6 +4148,8 @@ int main(int argc, char **argv, char **envp)* Note: uses machine properties such as kernel-irqchip, must run * after machine_set_property(). */ +qemu_opts_foreach (qemu_find_opts ("icount" ), + do_configure_icount,NULL , &error_fatal);configure_accelerator (current_machine, argv[0 ]);/*
@@ -4227,13 +4235,9 @@ int main(int argc, char **argv, char **envp)qemu_spice_init ();cpu_ticks_init (); -if (icount_opts) { -if (!tcg_enabled ()) { -error_report ("-icount is not allowed with hardware virtualization" ); -exit (1 ); - } -configure_icount (icount_opts, &error_abort); -qemu_opts_del (icount_opts); +if (use_icount && !(tcg_enabled () ||qtest_enabled ())) { +error_report ("-icount is not allowed with hardware virtualization" ); +exit (1 ); }if (tcg_enabled ()) {
Signature · 1 line
1.8.3.1
[PULL 03/62] migration-test: Move hide_stderr to common commandline
In reply to Paolo BonziniFrom: Juan Quintela <[email protected]>
--- tests/migration-test.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-)
tests/migration-test.c +8 -12
@@ -558,6 +558,7 @@ static int test_migrate_start(QTestState **from, QTestState **to, {gchar *cmd_src, *cmd_dst;gchar *cmd_source, *cmd_target; +const gchar *ignore_stderr;char *bootpath =NULL ;char *extra_opts =NULL ;char *shmem_path =NULL ;
@@ -661,24 +662,19 @@ static int test_migrate_start(QTestState **from, QTestState **to,g_free (extra_opts);if (hide_stderr) { -gchar *tmp; - tmp =g_strdup_printf ("%s 2>/dev/null" , cmd_src); -g_free (cmd_src); - cmd_src = tmp; - - tmp =g_strdup_printf ("%s 2>/dev/null" , cmd_dst); -g_free (cmd_dst); - cmd_dst = tmp; + ignore_stderr ="2>/dev/null" ; + }else { + ignore_stderr ="" ; } - cmd_source =g_strdup_printf ("%s %s" , - cmd_src, opts_src); + cmd_source =g_strdup_printf ("%s %s %s" , + cmd_src, opts_src, ignore_stderr);g_free (cmd_src); *from =qtest_init (cmd_source);g_free (cmd_source); - cmd_target =g_strdup_printf ("%s %s" , - cmd_dst, opts_dst); + cmd_target =g_strdup_printf ("%s %s %s" , + cmd_dst, opts_dst, ignore_stderr);g_free (cmd_dst); *to =qtest_init (cmd_target);g_free (cmd_target);
Signature · 1 line
1.8.3.1
[PULL 07/62] migration-test: Move -name handling to common commandline
In reply to Paolo BonziniFrom: Juan Quintela <[email protected]>
--- tests/migration-test.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-)
tests/migration-test.c +9 -13
@@ -579,12 +579,10 @@ static int test_migrate_start(QTestState **from, QTestState **to, machine_type ="" ; machine_args ="" ; memory_size ="150M" ; - cmd_src =g_strdup_printf (" -name source,debug-threads=on" -" -serial file:%s/src_serial" + cmd_src =g_strdup_printf (" -serial file:%s/src_serial" " -drive file=%s,format=raw" , tmpfs, bootpath); - cmd_dst =g_strdup_printf (" -name target,debug-threads=on" -" -serial file:%s/dest_serial" + cmd_dst =g_strdup_printf (" -serial file:%s/dest_serial" " -drive file=%s,format=raw" " -incoming %s" , tmpfs, bootpath, uri);
@@ -595,11 +593,9 @@ static int test_migrate_start(QTestState **from, QTestState **to, machine_type ="" ; machine_args ="" ; memory_size ="128M" ; - cmd_src =g_strdup_printf (" -name source,debug-threads=on" -" -serial file:%s/src_serial -bios %s" , + cmd_src =g_strdup_printf (" -serial file:%s/src_serial -bios %s" , tmpfs, bootpath); - cmd_dst =g_strdup_printf (" -name target,debug-threads=on" -" -serial file:%s/dest_serial -bios %s" + cmd_dst =g_strdup_printf (" -serial file:%s/dest_serial -bios %s" " -incoming %s" , tmpfs, bootpath, uri); start_address =S390_TEST_MEM_START ;
@@ -609,15 +605,13 @@ static int test_migrate_start(QTestState **from, QTestState **to, machine_args =",vsmt=8" ; memory_size ="256M" ; cmd_src =g_strdup_printf ("-nodefaults" -" -name source,debug-threads=on" " -serial file:%s/src_serial" " -prom-env 'use-nvramrc?=true' -prom-env " "'nvramrc=hex .\" _\" begin %x %x " "do i c@ 1 + i c! 1000 +loop .\" B\" 0 " "until'" , tmpfs, end_address, start_address); - cmd_dst =g_strdup_printf (" -name target,debug-threads=on" -" -serial file:%s/dest_serial" + cmd_dst =g_strdup_printf (" -serial file:%s/dest_serial" " -incoming %s" , tmpfs, uri);
@@ -628,11 +622,11 @@ static int test_migrate_start(QTestState **from, QTestState **to, machine_type ="virt," ; machine_args ="gic-version=max" ; memory_size ="150M" ; - cmd_src =g_strdup_printf ("-name vmsource,debug-threads=on -cpu max " + cmd_src =g_strdup_printf ("-cpu max " "-serial file:%s/src_serial " "-kernel %s" , tmpfs, bootpath); - cmd_dst = g_strdup_printf("-name vmdest,debug-threads=on -cpu max " + cmd_dst = g_strdup_printf("-cpu max " "-serial file:%s/dest_serial " "-kernel %s " "-incoming %s",
@@ -666,6 +660,7 @@ static int test_migrate_start(QTestState **from, QTestState **to, } cmd_source = g_strdup_printf("-machine %saccel=kvm:tcg%s " + "-name source,debug-threads=on " "-m %s " "%s %s %s %s", machine_type, machine_args,
@@ -676,6 +671,7 @@ static int test_migrate_start(QTestState **from, QTestState **to,g_free (cmd_source); cmd_target = g_strdup_printf("-machine %saccel=kvm:tcg%s " + "-name target,debug-threads=on " "-m %s " "%s %s %s %s", machine_type, machine_args,
Signature · 1 line
1.8.3.1
[PULL 04/62] migration-test: Move -machine to common commandline
In reply to Paolo BonziniFrom: Juan Quintela <[email protected]>
--- tests/migration-test.c | 51 +++++++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 21 deletions(-)
tests/migration-test.c +30 -21
@@ -563,7 +563,8 @@ static int test_migrate_start(QTestState **from, QTestState **to,char *extra_opts =NULL ;char *shmem_path =NULL ;const char *arch =qtest_get_arch (); -const char *accel ="kvm:tcg" ; +const char *machine_type; +const char *machine_args; opts_src = opts_src ? opts_src :"" ; opts_dst = opts_dst ? opts_dst :"" ;
@@ -582,72 +583,78 @@ static int test_migrate_start(QTestState **from, QTestState **to,/* the assembled x86 boot sector should be exactly one sector large */ assert (sizeof (x86_bootsect) ==512 );init_bootfile (bootpath, x86_bootsect,sizeof (x86_bootsect)); + machine_type ="" ; + machine_args ="" ; extra_opts = use_shmem ?get_shmem_opts ("150M" , shmem_path) :NULL ; - cmd_src =g_strdup_printf ("-machine accel=%s -m 150M" + cmd_src =g_strdup_printf ("-m 150M" " -name source,debug-threads=on" " -serial file:%s/src_serial" " -drive file=%s,format=raw %s" , - accel, tmpfs, bootpath, + tmpfs, bootpath, extra_opts ? extra_opts :"" ); - cmd_dst =g_strdup_printf ("-machine accel=%s -m 150M" + cmd_dst =g_strdup_printf ("-m 150M" " -name target,debug-threads=on" " -serial file:%s/dest_serial" " -drive file=%s,format=raw" " -incoming %s %s" , - accel, tmpfs, bootpath, uri, + tmpfs, bootpath, uri, extra_opts ? extra_opts :"" ); start_address =X86_TEST_MEM_START ; end_address =X86_TEST_MEM_END ; }else if (g_str_equal (arch,"s390x" )) {init_bootfile (bootpath, s390x_elf,sizeof (s390x_elf)); + machine_type ="" ; + machine_args ="" ; extra_opts = use_shmem ?get_shmem_opts ("128M" , shmem_path) :NULL ; - cmd_src =g_strdup_printf ("-machine accel=%s -m 128M" + cmd_src =g_strdup_printf ("-m 128M" " -name source,debug-threads=on" " -serial file:%s/src_serial -bios %s %s" , - accel, tmpfs, bootpath, + tmpfs, bootpath, extra_opts ? extra_opts :"" ); - cmd_dst =g_strdup_printf ("-machine accel=%s -m 128M" + cmd_dst =g_strdup_printf ("-m 128M" " -name target,debug-threads=on" " -serial file:%s/dest_serial -bios %s" " -incoming %s %s" , - accel, tmpfs, bootpath, uri, + tmpfs, bootpath, uri, extra_opts ? extra_opts :"" ); start_address =S390_TEST_MEM_START ; end_address =S390_TEST_MEM_END ; }else if (strcmp (arch,"ppc64" ) ==0 ) { + machine_type ="" ; + machine_args =",vsmt=8" ; extra_opts = use_shmem ?get_shmem_opts ("256M" , shmem_path) :NULL ; - cmd_src =g_strdup_printf ("-machine accel=%s,vsmt=8 -m 256M -nodefaults" + cmd_src =g_strdup_printf ("-m 256M -nodefaults" " -name source,debug-threads=on" " -serial file:%s/src_serial" " -prom-env 'use-nvramrc?=true' -prom-env " "'nvramrc=hex .\" _\" begin %x %x " "do i c@ 1 + i c! 1000 +loop .\" B\" 0 " -"until' %s" , accel, tmpfs, end_address, +"until' %s" , tmpfs, end_address, start_address, extra_opts ? extra_opts :"" ); - cmd_dst =g_strdup_printf ("-machine accel=%s,vsmt=8 -m 256M" + cmd_dst =g_strdup_printf ("-m 256M" " -name target,debug-threads=on" " -serial file:%s/dest_serial" " -incoming %s %s" , - accel, tmpfs, uri, + tmpfs, uri, extra_opts ? extra_opts :"" ); start_address =PPC_TEST_MEM_START ; end_address =PPC_TEST_MEM_END ; }else if (strcmp (arch,"aarch64" ) ==0 ) {init_bootfile (bootpath, aarch64_kernel,sizeof (aarch64_kernel)); + machine_type ="virt," ; + machine_args ="gic-version=max" ; extra_opts = use_shmem ?get_shmem_opts ("150M" , shmem_path) :NULL ; - cmd_src =g_strdup_printf ("-machine virt,accel=%s,gic-version=max " -"-name vmsource,debug-threads=on -cpu max " + cmd_src =g_strdup_printf ("-name vmsource,debug-threads=on -cpu max " "-m 150M -serial file:%s/src_serial " "-kernel %s %s" , - accel, tmpfs, bootpath, + tmpfs, bootpath, extra_opts ? extra_opts :"" ); - cmd_dst =g_strdup_printf ("-machine virt,accel=%s,gic-version=max " -"-name vmdest,debug-threads=on -cpu max " + cmd_dst =g_strdup_printf ("-name vmdest,debug-threads=on -cpu max " "-m 150M -serial file:%s/dest_serial " "-kernel %s " "-incoming %s %s" , - accel, tmpfs, bootpath, uri, + tmpfs, bootpath, uri, extra_opts ? extra_opts :"" ); start_address =ARM_TEST_MEM_START ;
@@ -667,13 +674,15 @@ static int test_migrate_start(QTestState **from, QTestState **to, ignore_stderr ="" ; } - cmd_source =g_strdup_printf ("%s %s %s" , + cmd_source =g_strdup_printf ("-machine %saccel=kvm:tcg%s %s %s %s" , + machine_type, machine_args, cmd_src, opts_src, ignore_stderr);g_free (cmd_src); *from =qtest_init (cmd_source);g_free (cmd_source); - cmd_target =g_strdup_printf ("%s %s %s" , + cmd_target =g_strdup_printf ("-machine %saccel=kvm:tcg%s %s %s %s" , + machine_type, machine_args, cmd_dst, opts_dst, ignore_stderr);g_free (cmd_dst); *to =qtest_init (cmd_target);
Signature · 1 line
1.8.3.1
[PULL 08/62] migration-test: Move -serial handling to common commandline
In reply to Paolo BonziniFrom: Juan Quintela <[email protected]>
--- tests/migration-test.c | 41 ++++++++++++++++------------------------- 1 file changed, 16 insertions(+), 25 deletions(-)
tests/migration-test.c +16 -25
@@ -579,13 +579,10 @@ static int test_migrate_start(QTestState **from, QTestState **to, machine_type ="" ; machine_args ="" ; memory_size ="150M" ; - cmd_src =g_strdup_printf (" -serial file:%s/src_serial" -" -drive file=%s,format=raw" , - tmpfs, bootpath); - cmd_dst =g_strdup_printf (" -serial file:%s/dest_serial" -" -drive file=%s,format=raw" + cmd_src =g_strdup_printf ("-drive file=%s,format=raw" , bootpath); + cmd_dst =g_strdup_printf ("-drive file=%s,format=raw" " -incoming %s" , - tmpfs, bootpath, uri); + bootpath, uri); start_address =X86_TEST_MEM_START ; end_address =X86_TEST_MEM_END ; }else if (g_str_equal (arch,"s390x" )) {
@@ -593,28 +590,22 @@ static int test_migrate_start(QTestState **from, QTestState **to, machine_type ="" ; machine_args ="" ; memory_size ="128M" ; - cmd_src =g_strdup_printf (" -serial file:%s/src_serial -bios %s" , - tmpfs, bootpath); - cmd_dst =g_strdup_printf (" -serial file:%s/dest_serial -bios %s" + cmd_src =g_strdup_printf ("-bios %s" , bootpath); + cmd_dst =g_strdup_printf ("-bios %s" " -incoming %s" , - tmpfs, bootpath, uri); + bootpath, uri); start_address =S390_TEST_MEM_START ; end_address =S390_TEST_MEM_END ; }else if (strcmp (arch,"ppc64" ) ==0 ) { machine_type ="" ; machine_args =",vsmt=8" ; memory_size ="256M" ; - cmd_src =g_strdup_printf ("-nodefaults" -" -serial file:%s/src_serial" -" -prom-env 'use-nvramrc?=true' -prom-env " + cmd_src =g_strdup_printf ("-nodefaults " +"-prom-env 'use-nvramrc?=true' -prom-env " "'nvramrc=hex .\" _\" begin %x %x " "do i c@ 1 + i c! 1000 +loop .\" B\" 0 " -"until'" , tmpfs, end_address, - start_address); - cmd_dst =g_strdup_printf (" -serial file:%s/dest_serial" -" -incoming %s" , - tmpfs, uri); - +"until'" , end_address, start_address); + cmd_dst =g_strdup_printf (" -incoming %s" , uri); start_address =PPC_TEST_MEM_START ; end_address =PPC_TEST_MEM_END ; }else if (strcmp (arch,"aarch64" ) ==0 ) {
@@ -623,14 +614,12 @@ static int test_migrate_start(QTestState **from, QTestState **to, machine_args ="gic-version=max" ; memory_size ="150M" ; cmd_src =g_strdup_printf ("-cpu max " -"-serial file:%s/src_serial " "-kernel %s" , - tmpfs, bootpath); + bootpath); cmd_dst =g_strdup_printf ("-cpu max " -"-serial file:%s/dest_serial " "-kernel %s " "-incoming %s" , - tmpfs, bootpath, uri); + bootpath, uri); start_address =ARM_TEST_MEM_START ; end_address =ARM_TEST_MEM_END ;
@@ -661,10 +650,11 @@ static int test_migrate_start(QTestState **from, QTestState **to, cmd_source =g_strdup_printf ("-machine %saccel=kvm:tcg%s " "-name source,debug-threads=on " +"-serial file:%s/src_serial " "-m %s " "%s %s %s %s" , machine_type, machine_args, - memory_size, + tmpfs, memory_size, cmd_src, shmem_opts, opts_src, ignore_stderr);g_free (cmd_src); *from =qtest_init (cmd_source);
@@ -673,9 +663,10 @@ static int test_migrate_start(QTestState **from, QTestState **to, cmd_target =g_strdup_printf ("-machine %saccel=kvm:tcg%s " "-name target,debug-threads=on " "-m %s " +"-serial file:%s/dest_serial " "%s %s %s %s" , machine_type, machine_args, - memory_size, + tmpfs, memory_size, cmd_dst, shmem_opts, opts_dst, ignore_stderr);g_free (cmd_dst); *to =qtest_init (cmd_target);
Signature · 1 line
1.8.3.1
[PULL 11/62] migration-test: Use a struct for test_migrate_start parameters
In reply to Paolo BonziniFrom: Juan Quintela <[email protected]>
It has two bools and two strings, it is very difficult to remember which does what. And it makes very difficult to add new parameters as we need to modify all the callers.
--- tests/migration-test.c | 118 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 78 insertions(+), 40 deletions(-)
tests/migration-test.c +78 -40
@@ -544,10 +544,31 @@ static void migrate_postcopy_start(QTestState *from, QTestState *to)qtest_qmp_eventwait (to,"RESUME" ); } +typedef struct { +bool hide_stderr; +bool use_shmem; +char *opts_source; +char *opts_target; +}MigrateStart ; + +static MigrateStart *migrate_start_new (void ) +{ +MigrateStart *args =g_new0 (MigrateStart,1 ); + + args->opts_source =g_strdup ("" ); + args->opts_target =g_strdup ("" ); +return args; +} + +static void migrate_start_destroy (MigrateStart *args) +{ +g_free (args->opts_source); +g_free (args->opts_target); +g_free (args); +} +static int test_migrate_start (QTestState **from,QTestState **to, -const char *uri,bool hide_stderr, -bool use_shmem,const char *opts_src, -const char *opts_dst) +const char *uri,MigrateStart *args) {gchar *arch_source, *arch_target;gchar *cmd_source, *cmd_target;
@@ -560,10 +581,7 @@ static int test_migrate_start(QTestState **from, QTestState **to,const char *machine_args;const char *memory_size; - opts_src = opts_src ? opts_src :"" ; - opts_dst = opts_dst ? opts_dst :"" ; - -if (use_shmem) { +if (args->use_shmem) {if (!g_file_test ("/dev/shm" ,G_FILE_TEST_IS_DIR )) {g_test_skip ("/dev/shm is not supported" );return -1 ;
@@ -623,13 +641,13 @@ static int test_migrate_start(QTestState **from, QTestState **to,g_free (bootpath); -if (hide_stderr) { +if (args->hide_stderr) { ignore_stderr ="2>/dev/null" ; }else { ignore_stderr ="" ; } -if (use_shmem) { +if (args->use_shmem) { shmem_path =g_strdup_printf ("/dev/shm/qemu-%d" ,getpid ()); shmem_opts =g_strdup_printf ( "-object memory-backend-file,id=mem0,size=%s"
@@ -647,7 +665,7 @@ static int test_migrate_start(QTestState **from, QTestState **to,"%s %s %s %s" , machine_type, machine_args, memory_size, tmpfs, - arch_source, shmem_opts, opts_src, + arch_source, shmem_opts, args->opts_source, ignore_stderr);g_free (arch_source); *from =qtest_init (cmd_source);
@@ -661,18 +679,19 @@ static int test_migrate_start(QTestState **from, QTestState **to,"%s %s %s %s" , machine_type, machine_args, memory_size, tmpfs, uri, - arch_target, shmem_opts, opts_dst, - ignore_stderr); + arch_target, shmem_opts, + args->opts_target, ignore_stderr);g_free (arch_target); *to =qtest_init (cmd_target);g_free (cmd_target); +migrate_start_destroy (args);g_free (shmem_opts);/* * Remove shmem file immediately to avoid memory leak in test failed case. * It's valid becase QEMU has already opened this file */ -if (use_shmem) { +if (args->use_shmem) {unlink (shmem_path);g_free (shmem_path); }
@@ -762,13 +781,13 @@ static void test_deprecated(void) }static int migrate_postcopy_prepare (QTestState **from_ptr, -QTestState **to_ptr, -bool hide_error) +QTestState **to_ptr, +MigrateStart *args) {char *uri =g_strdup_printf ("unix:%s/migsocket" , tmpfs);QTestState *from, *to; -if (test_migrate_start (&from, &to, uri, hide_error, false,NULL ,NULL )) { +if (test_migrate_start (&from, &to, uri, args)) {return -1 ; }
@@ -813,9 +832,10 @@ static void migrate_postcopy_complete(QTestState *from, QTestState *to)static void test_postcopy (void ) { +MigrateStart *args =migrate_start_new ();QTestState *from, *to; -if (migrate_postcopy_prepare (&from, &to, false)) { +if (migrate_postcopy_prepare (&from, &to, args)) {return ; }migrate_postcopy_start (from, to);
@@ -824,10 +844,13 @@ static void test_postcopy(void)static void test_postcopy_recovery (void ) { +MigrateStart *args =migrate_start_new ();QTestState *from, *to;char *uri; -if (migrate_postcopy_prepare (&from, &to, true)) { + args->hide_stderr = true; + +if (migrate_postcopy_prepare (&from, &to, args)) {return ; }
@@ -910,9 +933,12 @@ static void wait_for_migration_fail(QTestState *from, bool allow_active)static void test_baddest (void ) { +MigrateStart *args =migrate_start_new ();QTestState *from, *to; -if (test_migrate_start (&from, &to,"tcp:0:0" , true, false,NULL ,NULL )) { + args->hide_stderr = true; + +if (test_migrate_start (&from, &to,"tcp:0:0" , args)) {return ; }migrate (from,"tcp:0:0" ,"{}" );
@@ -923,9 +949,10 @@ static void test_baddest(void)static void test_precopy_unix (void ) {char *uri =g_strdup_printf ("unix:%s/migsocket" , tmpfs); +MigrateStart *args =migrate_start_new ();QTestState *from, *to; -if (test_migrate_start (&from, &to, uri, false, false,NULL ,NULL )) { +if (test_migrate_start (&from, &to, uri, args)) {return ; }
@@ -1001,9 +1028,10 @@ static void test_ignore_shared(void)static void test_xbzrle (const char *uri) { +MigrateStart *args =migrate_start_new ();QTestState *from, *to; -if (test_migrate_start (&from, &to, uri, false, false,NULL ,NULL )) { +if (test_migrate_start (&from, &to, uri, args)) {return ; }
@@ -1052,11 +1080,11 @@ static void test_xbzrle_unix(void)static void test_precopy_tcp (void ) { +MigrateStart *args =migrate_start_new ();char *uri;QTestState *from, *to; -if (test_migrate_start (&from, &to,"tcp:127.0.0.1:0" , false, false, -NULL ,NULL )) { +if (test_migrate_start (&from, &to,"tcp:127.0.0.1:0" , args)) {return ; }
@@ -1096,13 +1124,14 @@ static void test_precopy_tcp(void)static void test_migrate_fd_proto (void ) { +MigrateStart *args =migrate_start_new ();QTestState *from, *to;int ret;int pair[2 ];QDict *rsp;const char *error_desc; -if (test_migrate_start (&from, &to,"defer" , false, false,NULL ,NULL )) { +if (test_migrate_start (&from, &to,"defer" , args)) {return ; }
@@ -1178,15 +1207,12 @@ static void test_migrate_fd_proto(void)test_migrate_end (from, to, true); } -static void do_test_validate_uuid (const char *uuid_arg_src, -const char *uuid_arg_dst, -bool should_fail,bool hide_stderr) +static void do_test_validate_uuid (MigrateStart *args,bool should_fail) {char *uri =g_strdup_printf ("unix:%s/migsocket" , tmpfs);QTestState *from, *to; -if (test_migrate_start (&from, &to, uri, hide_stderr, false, - uuid_arg_src, uuid_arg_dst)) { +if (test_migrate_start (&from, &to, uri, args)) {return ; }
@@ -1216,33 +1242,45 @@ static void do_test_validate_uuid(const char *uuid_arg_src,static void test_validate_uuid (void ) { -do_test_validate_uuid ("-uuid 11111111-1111-1111-1111-111111111111" , -"-uuid 11111111-1111-1111-1111-111111111111" , - false, false); +MigrateStart *args =migrate_start_new (); + + args->opts_source =g_strdup ("-uuid 11111111-1111-1111-1111-111111111111" ); + args->opts_target =g_strdup ("-uuid 11111111-1111-1111-1111-111111111111" ); +do_test_validate_uuid (args, false); }static void test_validate_uuid_error (void ) { -do_test_validate_uuid ("-uuid 11111111-1111-1111-1111-111111111111" , -"-uuid 22222222-2222-2222-2222-222222222222" , - true, true); +MigrateStart *args =migrate_start_new (); + + args->opts_source =g_strdup ("-uuid 11111111-1111-1111-1111-111111111111" ); + args->opts_target =g_strdup ("-uuid 22222222-2222-2222-2222-222222222222" ); + args->hide_stderr = true; +do_test_validate_uuid (args, true); }static void test_validate_uuid_src_not_set (void ) { -do_test_validate_uuid (NULL ,"-uuid 11111111-1111-1111-1111-111111111111" , - false, true); +MigrateStart *args =migrate_start_new (); + + args->opts_target =g_strdup ("-uuid 22222222-2222-2222-2222-222222222222" ); + args->hide_stderr = true; +do_test_validate_uuid (args, false); }static void test_validate_uuid_dst_not_set (void ) { -do_test_validate_uuid ("-uuid 11111111-1111-1111-1111-111111111111" ,NULL , - false, true); +MigrateStart *args =migrate_start_new (); + + args->opts_source =g_strdup ("-uuid 11111111-1111-1111-1111-111111111111" ); + args->hide_stderr = true; +do_test_validate_uuid (args, false); }static void test_migrate_auto_converge (void ) {char *uri =g_strdup_printf ("unix:%s/migsocket" , tmpfs); +MigrateStart *args =migrate_start_new ();QTestState *from, *to;int64_t remaining, percentage;
@@ -1261,7 +1299,7 @@ static void test_migrate_auto_converge(void)*/ const int64_t expected_threshold = max_bandwidth * downtime_limit /1000 ; -if (test_migrate_start (&from, &to, uri, false, false,NULL ,NULL )) { +if (test_migrate_start (&from, &to, uri, args)) {return ; }
Signature · 1 line
1.8.3.1
[PULL 18/62] vl: introduce object_parse_property_opt
In reply to Paolo BonziniWe will reuse the parsing loop of machine_set_property soon for "-accel", but we do not want the "_" -> "-" conversion since "-accel" can just standardize on dashes. We will also add a bunch of legacy option handling to keep the QOM machine object clean. Extract the loop into a separate function, and keep the legacy handling in machine_set_property.
--- vl.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-)
vl.c +20 -15
@@ -2615,27 +2615,17 @@ static MachineClass *select_machine(void)return machine_class; } -static int machine_set_property (void *opaque, -const char *name,const char *value, -Error **errp) +static int object_parse_property_opt (Object *obj, +const char *name,const char *value, +const char *skip,Error **errp) { -Object *obj =OBJECT (opaque);Error *local_err =NULL ; -char *p, *qom_name; -if (strcmp (name,"type" ) ==0 ) { +if (g_str_equal (name, skip)) {return 0 ; } - qom_name =g_strdup (name); -for (p = qom_name; *p; p++) { -if (*p =='_' ) { - *p ='-' ; - } - } - -object_property_parse (obj, value, qom_name, &local_err); -g_free (qom_name); +object_property_parse (obj, value, name, &local_err);if (local_err) {error_propagate (errp, local_err);
@@ -2645,6 +2635,21 @@ static int machine_set_property(void *opaque,return 0 ; } +static int machine_set_property (void *opaque, +const char *name,const char *value, +Error **errp) +{ + g_autofree char *qom_name = g_strdup(name); +char *p; + +for (p = qom_name; *p; p++) { +if (*p =='_' ) { + *p ='-' ; + } + } + +return object_parse_property_opt (opaque, name, value,"type" , errp); +}/* * Initial object creation happens before all other
Signature · 1 line
1.8.3.1
[PULL 09/62] migration-test: Move -incomming handling to common commandline
In reply to Paolo BonziniFrom: Juan Quintela <[email protected]>
--- tests/migration-test.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-)
tests/migration-test.c +8 -15
@@ -580,9 +580,7 @@ static int test_migrate_start(QTestState **from, QTestState **to, machine_args ="" ; memory_size ="150M" ; cmd_src =g_strdup_printf ("-drive file=%s,format=raw" , bootpath); - cmd_dst =g_strdup_printf ("-drive file=%s,format=raw" -" -incoming %s" , - bootpath, uri); + cmd_dst =g_strdup (cmd_src); start_address =X86_TEST_MEM_START ; end_address =X86_TEST_MEM_END ; }else if (g_str_equal (arch,"s390x" )) {
@@ -591,9 +589,7 @@ static int test_migrate_start(QTestState **from, QTestState **to, machine_args ="" ; memory_size ="128M" ; cmd_src =g_strdup_printf ("-bios %s" , bootpath); - cmd_dst =g_strdup_printf ("-bios %s" -" -incoming %s" , - bootpath, uri); + cmd_dst =g_strdup (cmd_src); start_address =S390_TEST_MEM_START ; end_address =S390_TEST_MEM_END ; }else if (strcmp (arch,"ppc64" ) ==0 ) {
@@ -605,7 +601,7 @@ static int test_migrate_start(QTestState **from, QTestState **to,"'nvramrc=hex .\" _\" begin %x %x " "do i c@ 1 + i c! 1000 +loop .\" B\" 0 " "until'", end_address, start_address); - cmd_dst =g_strdup_printf (" -incoming %s" , uri); + cmd_dst =g_strdup ("" ); start_address =PPC_TEST_MEM_START ; end_address =PPC_TEST_MEM_END ; }else if (strcmp (arch,"aarch64" ) ==0 ) {
@@ -616,11 +612,7 @@ static int test_migrate_start(QTestState **from, QTestState **to, cmd_src =g_strdup_printf ("-cpu max " "-kernel %s" , bootpath); - cmd_dst =g_strdup_printf ("-cpu max " -"-kernel %s " -"-incoming %s" , - bootpath, uri); - + cmd_dst =g_strdup (cmd_src); start_address =ARM_TEST_MEM_START ; end_address =ARM_TEST_MEM_END ;
@@ -650,11 +642,11 @@ static int test_migrate_start(QTestState **from, QTestState **to, cmd_source =g_strdup_printf ("-machine %saccel=kvm:tcg%s " "-name source,debug-threads=on " -"-serial file:%s/src_serial " "-m %s " +"-serial file:%s/src_serial " "%s %s %s %s" , machine_type, machine_args, - tmpfs, memory_size, + memory_size, tmpfs, cmd_src, shmem_opts, opts_src, ignore_stderr);g_free (cmd_src); *from =qtest_init (cmd_source);
@@ -664,9 +656,10 @@ static int test_migrate_start(QTestState **from, QTestState **to,"-name target,debug-threads=on " "-m %s " "-serial file:%s/dest_serial " +"-incoming %s " "%s %s %s %s" , machine_type, machine_args, - tmpfs, memory_size, + memory_size, tmpfs, uri, cmd_dst, shmem_opts, opts_dst, ignore_stderr);g_free (cmd_dst); *to =qtest_init (cmd_target);
Signature · 1 line
1.8.3.1
[PULL 17/62] accel: compile accel/accel.c just once
In reply to Paolo BonziniNow that accel/accel.c does not use CONFIG_TCG or CONFIG_KVM anymore, it need not be compiled once for every softmmu target.
--- Makefile.objs | 1 + accel/Makefile.objs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
Makefile.objs +1 -0
@@ -55,6 +55,7 @@ common-obj-$(CONFIG_POSIX) += os-posix.o common-obj-$(CONFIG_LINUX) += fsdev/ +common-obj-y += accel/ common-obj-y += migration/ common-obj-y += audio/
accel/Makefile.objs +1 -1
@@ -1,4 +1,4 @@ -obj-$(CONFIG_SOFTMMU) += accel.o +common-obj-$(CONFIG_SOFTMMU) += accel.o obj-$(call land,$(CONFIG_SOFTMMU),$(CONFIG_POSIX)) += qtest.o obj-$(CONFIG_KVM) += kvm/ obj-$(CONFIG_TCG) += tcg/
Signature · 1 line
1.8.3.1
[PULL 14/62] tcg: move qemu_tcg_configure to accel/tcg/tcg-all.c
In reply to Paolo BonziniMove everything related to mttcg_enabled in accel/tcg/tcg-all.c, which will make even more sense when "thread" becomes a QOM property.
For now, initializing mttcg_enabled in the instance_init function prepares for the next patch, which will only invoke qemu_tcg_configure when the command line includes a -accel option.
--- accel/tcg/tcg-all.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++ cpus.c | 72 ---------------------------------------------- 2 files changed, 83 insertions(+), 72 deletions(-)
accel/tcg/tcg-all.c +83 -0
@@ -30,6 +30,11 @@#include "cpu.h" #include "sysemu/cpus.h" #include "qemu/main-loop.h" +#include "tcg/tcg.h" +#include "include/qapi/error.h" +#include "include/qemu/error-report.h" +#include "include/hw/boards.h" +#include "qemu/option.h" unsigned long tcg_tb_size;
@@ -58,6 +63,53 @@ static void tcg_handle_interrupt(CPUState *cpu, int mask) } } +/* +* We default to false if we know other options have been enabled +* which are currently incompatible with MTTCG. Otherwise when each +* guest (target) has been updated to support: +* - atomic instructions +* - memory ordering primitives (barriers) +* they can set the appropriate CONFIG flags in ${target}-softmmu.mak +* +* Once a guest architecture has been converted to the new primitives +* there are two remaining limitations to check. +* +* - The guest can't be oversized (e.g. 64 bit guest on 32 bit host) +* - The host must have a stronger memory order than the guest +* +* It may be possible in future to support strong guests on weak hosts +* but that will require tagging all load/stores in a guest with their +* implicit memory order requirements which would likely slow things +* down a lot. +*/ + +static bool check_tcg_memory_orders_compatible (void ) +{ +#if defined(TCG_GUEST_DEFAULT_MO ) && defined(TCG_TARGET_DEFAULT_MO ) +return (TCG_GUEST_DEFAULT_MO & ~TCG_TARGET_DEFAULT_MO ) ==0 ; +#else +return false; +#endif +} + +static bool default_mttcg_enabled (void ) +{ +if (use_icount ||TCG_OVERSIZED_GUEST ) { +return false; + }else { +#ifdef TARGET_SUPPORTS_MTTCG +return check_tcg_memory_orders_compatible (); +#else +return false; +#endif + } +} + +static void tcg_accel_instance_init (Object *obj) +{ + mttcg_enabled =default_mttcg_enabled (); +} +static int tcg_init (MachineState *ms) {tcg_exec_init (tcg_tb_size *1024 *1024 );
@@ -65,6 +117,36 @@ static int tcg_init(MachineState *ms)return 0 ; } +void qemu_tcg_configure (QemuOpts *opts,Error **errp) +{ +const char *t =qemu_opt_get (opts,"thread" ); +if (!t) { +return ; + } +if (strcmp (t,"multi" ) ==0 ) { +if (TCG_OVERSIZED_GUEST ) { +error_setg (errp,"No MTTCG when guest word size > hosts" ); + }else if (use_icount) { +error_setg (errp,"No MTTCG when icount is enabled" ); + }else { +#ifndef TARGET_SUPPORTS_MTTCG +warn_report ("Guest not yet converted to MTTCG - " +"you may get unexpected results" ); +#endif +if (!check_tcg_memory_orders_compatible ()) { +warn_report ("Guest expects a stronger memory ordering " +"than the host provides" ); +error_printf ("This may cause strange/hard to debug errors\n" ); + } + mttcg_enabled = true; + } + }else if (strcmp (t,"single" ) ==0 ) { + mttcg_enabled = false; + }else { +error_setg (errp,"Invalid 'thread' setting %s" , t); + } +} +static void tcg_accel_class_init (ObjectClass *oc,void *data) {AccelClass *ac =ACCEL_CLASS (oc);
@@ -78,6 +160,7 @@ static void tcg_accel_class_init(ObjectClass *oc, void *data)static const TypeInfo tcg_accel_type = { .name =TYPE_TCG_ACCEL , .parent =TYPE_ACCEL , + .instance_init = tcg_accel_instance_init, .class_init = tcg_accel_class_init, };
cpus.c +0 -72
78 lines not on this page · raw message
Signature · 1 line
1.8.3.1
[PULL 19/62] vl: configure accelerators from -accel options
In reply to Paolo BonziniDrop the "accel" property from MachineState, and instead desugar "-machine accel=" to a list of "-accel" options.
This has a semantic change due to removing merge_lists from -accel. For example:
- "-accel kvm -accel tcg" all but ignored "-accel kvm". This is a bugfix.
- "-accel kvm -accel thread=single" ignored "thread=single", since it applied the option to KVM. Now it fails due to not specifying the accelerator on "-accel thread=single".
- "-accel tcg -accel thread=single" chose single-threaded TCG, while now it will fail due to not specifying the accelerator on "-accel thread=single".
Also, "-machine accel" and "-accel" become incompatible.
--- hw/core/machine.c | 21 ----------- include/hw/boards.h | 1 - tests/arm-cpu-features.c | 4 +- tests/bios-tables-test.c | 16 ++++---- tests/boot-serial-test.c | 4 +- tests/cdrom-test.c | 2 +- tests/libqtest.c | 4 +- tests/migration-test.c | 23 +++++------- tests/pflash-cfi02-test.c | 4 +- tests/pnv-xscom-test.c | 4 +- tests/prom-env-test.c | 2 +- tests/pxe-test.c | 2 +- tests/vmgenid-test.c | 2 +- vl.c | 93 +++++++++++++++++++++++++++-------------------- 14 files changed, 85 insertions(+), 97 deletions(-)
hw/core/machine.c +0 -21
@@ -178,21 +178,6 @@ GlobalProperty hw_compat_2_1[] = { };const size_t hw_compat_2_1_len =G_N_ELEMENTS (hw_compat_2_1); -static char *machine_get_accel (Object *obj,Error **errp) -{ -MachineState *ms =MACHINE (obj); - -return g_strdup (ms->accel); -} - -static void machine_set_accel (Object *obj,const char *value,Error **errp) -{ -MachineState *ms =MACHINE (obj); - -g_free (ms->accel); - ms->accel =g_strdup (value); -} -static void machine_set_kernel_irqchip (Object *obj,Visitor *v,const char *name,void *opaque,Error **errp)
@@ -813,11 +798,6 @@ static void machine_class_init(ObjectClass *oc, void *data) mc->numa_mem_align_shift =23 ; mc->numa_auto_assign_ram = numa_default_auto_assign_ram; -object_class_property_add_str (oc,"accel" , - machine_get_accel, machine_set_accel, &error_abort); -object_class_property_set_description (oc,"accel" , -"Accelerator list" , &error_abort); -object_class_property_add (oc,"kernel-irqchip" ,"on|off|split" ,NULL , machine_set_kernel_irqchip,NULL ,NULL , &error_abort);
@@ -976,7 +956,6 @@ static void machine_finalize(Object *obj) {MachineState *ms =MACHINE (obj); -g_free (ms->accel);g_free (ms->kernel_filename);g_free (ms->initrd_filename);g_free (ms->kernel_cmdline);
include/hw/boards.h +0 -1
@@ -275,7 +275,6 @@ struct MachineState {/*< public >*/ -char *accel;bool kernel_irqchip_allowed;bool kernel_irqchip_required;bool kernel_irqchip_split;
tests/arm-cpu-features.c +2 -2
@@ -20,8 +20,8 @@*/ #define SVE_MAX_VQ 16 -#define MACHINE "-machine virt,gic-version=max,accel=tcg " -#define MACHINE_KVM "-machine virt,gic-version=max,accel=kvm:tcg " +#define MACHINE "-machine virt,gic-version=max -accel tcg " +#define MACHINE_KVM "-machine virt,gic-version=max -accel kvm -accel tcg "#define QUERY_HEAD "{ 'execute': 'query-cpu-model-expansion', " \ " 'arguments': { 'type': 'full', "#define QUERY_TAIL "}}"
tests/bios-tables-test.c +8 -8
@@ -51,7 +51,7 @@#define ACPI_REBUILD_EXPECTED_AML "TEST_ACPI_REBUILD_AML" typedef struct { - const char *accel; + bool tcg_only; const char *machine; const char *variant; const char *uefi_fl1;
@@ -607,19 +607,19 @@ static void test_acpi_one(const char *params, test_data *data)* TODO: convert '-drive if=pflash' to new syntax (see e33763be7cd3) * when arm/virt boad starts to support it. */ - args =g_strdup_printf ("-machine %s,accel=%s -nodefaults -nographic " + args =g_strdup_printf ("-machine %s %s -accel tcg -nodefaults -nographic " "-drive if=pflash,format=raw,file=%s,readonly " "-drive if=pflash,format=raw,file=%s,snapshot=on -cdrom %s %s" , - data->machine, data->accel ? data->accel :"kvm:tcg" , + data->machine, data->tcg_only ?"" :"-accel kvm" , data->uefi_fl1, data->uefi_fl2, data->cd, params ? params :"" ); }else {/* Disable kernel irqchip to be able to override apic irq0. */ - args =g_strdup_printf ("-machine %s,accel=%s,kernel-irqchip=off " + args =g_strdup_printf ("-machine %s,kernel-irqchip=off %s -accel tcg " "-net none -display none %s " "-drive id=hd0,if=none,file=%s,format=raw " "-device ide-hd,drive=hd0 " , - data->machine, data->accel ? data->accel :"kvm:tcg" , + data->machine, data->tcg_only ?"" :"-accel kvm" , params ? params :"" , disk); }
@@ -904,7 +904,7 @@ static void test_acpi_virt_tcg_memhp(void) {test_data data = { .machine ="virt" , - .accel ="tcg" , + .tcg_only = true, .uefi_fl1 ="pc-bios/edk2-aarch64-code.fd" , .uefi_fl2 ="pc-bios/edk2-arm-vars.fd" , .cd ="tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2" ,
@@ -929,7 +929,7 @@ static void test_acpi_virt_tcg_numamem(void) {test_data data = { .machine ="virt" , - .accel ="tcg" , + .tcg_only = true, .uefi_fl1 ="pc-bios/edk2-aarch64-code.fd" , .uefi_fl2 ="pc-bios/edk2-arm-vars.fd" , .cd ="tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2" ,
@@ -951,7 +951,7 @@ static void test_acpi_virt_tcg(void) {test_data data = { .machine ="virt" , - .accel ="tcg" , + .tcg_only = true, .uefi_fl1 ="pc-bios/edk2-aarch64-code.fd" , .uefi_fl2 ="pc-bios/edk2-arm-vars.fd" , .cd ="tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2" ,
tests/boot-serial-test.c +2 -2
@@ -215,9 +215,9 @@ static void test_machine(const void *data)* Make sure that this test uses tcg if available: It is used as a * fast-enough smoketest for that. */ - qts =qtest_initf ("%s %s -M %s,accel=tcg:kvm -no-shutdown " + qts =qtest_initf ("%s %s -M %s -no-shutdown " "-chardev file,id=serial0,path=%s " -"-serial chardev:serial0 %s" , +"-serial chardev:serial0 -accel tcg -accel kvm %s" , codeparam, code ? codetmp :"" , test->machine, serialtmp, test->extra);if (code) {
tests/cdrom-test.c +1 -1
@@ -120,7 +120,7 @@ static void test_cdboot(gconstpointer data) {QTestState *qts; - qts =qtest_initf ("-M accel=kvm:tcg -no-shutdown %s%s" , (const char *)data, + qts =qtest_initf ("-accel kvm -accel tcg -no-shutdown %s%s" , (const char *)data, isoimage);boot_sector_test (qts);qtest_quit (qts);
tests/libqtest.c +2 -2
@@ -241,9 +241,9 @@ QTestState *qtest_init_without_qmp_handshake(const char *extra_args)"-qtest-log %s " "-chardev socket,path=%s,id=char0 " "-mon chardev=char0,mode=control " -"-accel qtest " "-display none " -"%s" , qemu_binary, socket_path, +"%s" +" -accel qtest" , qemu_binary, socket_path,getenv ("QTEST_LOG" ) ?"/dev/fd/2" :"/dev/null" , qmp_socket_path, extra_args ?: "");
tests/migration-test.c +9 -14
@@ -577,8 +577,7 @@ static int test_migrate_start(QTestState **from, QTestState **to,char *shmem_opts;char *shmem_path;const char *arch =qtest_get_arch (); -const char *machine_type; -const char *machine_args; +const char *machine_opts =NULL ;const char *memory_size;if (args->use_shmem) {
@@ -594,8 +593,6 @@ static int test_migrate_start(QTestState **from, QTestState **to,/* the assembled x86 boot sector should be exactly one sector large */ assert (sizeof (x86_bootsect) ==512 );init_bootfile (bootpath, x86_bootsect,sizeof (x86_bootsect)); - machine_type ="" ; - machine_args ="" ; memory_size ="150M" ; arch_source =g_strdup_printf ("-drive file=%s,format=raw" , bootpath); arch_target =g_strdup (arch_source);
@@ -603,16 +600,13 @@ static int test_migrate_start(QTestState **from, QTestState **to, end_address =X86_TEST_MEM_END ; }else if (g_str_equal (arch,"s390x" )) {init_bootfile (bootpath, s390x_elf,sizeof (s390x_elf)); - machine_type ="" ; - machine_args ="" ; memory_size ="128M" ; arch_source =g_strdup_printf ("-bios %s" , bootpath); arch_target =g_strdup (arch_source); start_address =S390_TEST_MEM_START ; end_address =S390_TEST_MEM_END ; }else if (strcmp (arch,"ppc64" ) ==0 ) { - machine_type ="" ; - machine_args =",vsmt=8" ; + machine_opts ="vsmt=8" ; memory_size ="256M" ; arch_source =g_strdup_printf ("-nodefaults " "-prom-env 'use-nvramrc?=true' -prom-env "
@@ -624,8 +618,7 @@ static int test_migrate_start(QTestState **from, QTestState **to, end_address =PPC_TEST_MEM_END ; }else if (strcmp (arch,"aarch64" ) ==0 ) {init_bootfile (bootpath, aarch64_kernel,sizeof (aarch64_kernel)); - machine_type ="virt," ; - machine_args ="gic-version=max" ; + machine_opts ="virt,gic-version=max" ; memory_size ="150M" ; arch_source = g_strdup_printf("-cpu max " "-kernel %s",
@@ -658,12 +651,13 @@ static int test_migrate_start(QTestState **from, QTestState **to, shmem_opts =g_strdup ("" ); } - cmd_source =g_strdup_printf ("-machine %saccel=kvm:tcg%s " + cmd_source =g_strdup_printf ("-accel kvm -accel tcg%s%s " "-name source,debug-threads=on " "-m %s " "-serial file:%s/src_serial " "%s %s %s %s" , - machine_type, machine_args, + machine_opts ?" -machine " :"" , + machine_opts ? machine_opts :"" , memory_size, tmpfs, arch_source, shmem_opts, args->opts_source, ignore_stderr);
@@ -671,13 +665,14 @@ static int test_migrate_start(QTestState **from, QTestState **to, *from =qtest_init (cmd_source);g_free (cmd_source); - cmd_target =g_strdup_printf ("-machine %saccel=kvm:tcg%s " + cmd_target =g_strdup_printf ("-accel kvm -accel tcg%s%s " "-name target,debug-threads=on " "-m %s " "-serial file:%s/dest_serial " "-incoming %s " "%s %s %s %s" , - machine_type, machine_args, + machine_opts ?" -machine " :"" , + machine_opts ? machine_opts :"" , memory_size, tmpfs, uri, arch_target, shmem_opts, args->opts_target, ignore_stderr);
tests/pflash-cfi02-test.c +2 -2
@@ -260,7 +260,7 @@ static void test_geometry(const void *opaque) {const FlashConfig *config = opaque;QTestState *qtest; - qtest =qtest_initf ("-M musicpal,accel=qtest" + qtest =qtest_initf ("-M musicpal" " -drive if=pflash,file=%s,format=raw,copy-on-read" /* Device geometry properties. */ " -global driver=cfi.pflash02,"
@@ -580,7 +580,7 @@ static void test_cfi_in_autoselect(const void *opaque) {const FlashConfig *config = opaque;QTestState *qtest; - qtest =qtest_initf ("-M musicpal,accel=qtest" + qtest =qtest_initf ("-M musicpal" " -drive if=pflash,file=%s,format=raw,copy-on-read" , image_path);FlashConfig explicit_config =expand_config_defaults (config);
tests/pnv-xscom-test.c +2 -2
@@ -84,7 +84,7 @@ static void test_cfam_id(const void *data) machine ="powernv9" ; } - qts =qtest_initf ("-M %s,accel=tcg -cpu %s" , + qts =qtest_initf ("-M %s -accel tcg -cpu %s" , machine, chip->cpu_model);test_xscom_cfam_id (qts, chip);qtest_quit (qts);
@@ -125,7 +125,7 @@ static void test_core(const void *data) machine ="powernv9" ; } - qts =qtest_initf ("-M %s,accel=tcg -cpu %s" , + qts =qtest_initf ("-M %s -accel tcg -cpu %s" , machine, chip->cpu_model);test_xscom_core (qts, chip);qtest_quit (qts);
tests/prom-env-test.c +1 -1
@@ -57,7 +57,7 @@ static void test_machine(const void *machine)" -machine cap-cfpc=broken,cap-sbbc=broken,cap-ibs=broken" ; } - qts =qtest_initf ("-M %s,accel=tcg %s -prom-env 'use-nvramrc?=true' " + qts =qtest_initf ("-M %s -accel tcg %s -prom-env 'use-nvramrc?=true' " "-prom-env 'nvramrc=%x %x l!' " , (const char *)machine, extra_args,MAGIC ,ADDRESS );check_guest_memory (qts);
tests/pxe-test.c +1 -1
@@ -74,7 +74,7 @@ static void test_pxe_one(const testdef_t *test, bool ipv6) } args = g_strdup_printf( - "-machine %s,accel=kvm:tcg -nodefaults -boot order=n " + "-accel kvm -accel tcg -machine %s -nodefaults -boot order=n " "-netdev user,id=" NETNAME ",tftp=./,bootfile=%s,ipv4=%s,ipv6=%s " "-device %s,bootindex=1,netdev=" NETNAME " %s", test->machine, disk, ipv6 ? "off" : "on", ipv6 ? "on" : "off",
tests/vmgenid-test.c +1 -1
@@ -109,7 +109,7 @@ static void read_guid_from_monitor(QTestState *qts, QemuUUID *guid)static char disk[] ="tests/vmgenid-test-disk-XXXXXX" ;#define GUID_CMD (guid) \ - "-machine accel=kvm:tcg " \ + "-accel kvm -accel tcg " \ "-device vmgenid,id=testvgid,guid=%s " \ "-drive id=hd0,if=none,file=%s,format=raw " \ "-device ide-hd,drive=hd0 ", guid, disk
vl.c +54 -39
150 lines not on this page · raw message
Signature · 1 line
1.8.3.1
[PULL 10/62] migration-test: Rename cmd_src/dst to arch_source/arch_target
In reply to Paolo BonziniFrom: Juan Quintela <[email protected]>
This explains better what they do and avoid confussino with command_src/target.
--- tests/migration-test.c | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-)
tests/migration-test.c +21 -19
@@ -549,7 +549,7 @@ static int test_migrate_start(QTestState **from, QTestState **to, bool use_shmem, const char *opts_src, const char *opts_dst) { - gchar *cmd_src, *cmd_dst; + gchar *arch_source, *arch_target;gchar *cmd_source, *cmd_target;const gchar *ignore_stderr;char *bootpath =NULL ;
@@ -579,8 +579,8 @@ static int test_migrate_start(QTestState **from, QTestState **to, machine_type ="" ; machine_args ="" ; memory_size ="150M" ; - cmd_src =g_strdup_printf ("-drive file=%s,format=raw" , bootpath); - cmd_dst =g_strdup (cmd_src); + arch_source =g_strdup_printf ("-drive file=%s,format=raw" , bootpath); + arch_target =g_strdup (arch_source); start_address =X86_TEST_MEM_START ; end_address =X86_TEST_MEM_END ; }else if (g_str_equal (arch,"s390x" )) {
@@ -588,20 +588,20 @@ static int test_migrate_start(QTestState **from, QTestState **to, machine_type ="" ; machine_args ="" ; memory_size ="128M" ; - cmd_src =g_strdup_printf ("-bios %s" , bootpath); - cmd_dst =g_strdup (cmd_src); + arch_source =g_strdup_printf ("-bios %s" , bootpath); + arch_target =g_strdup (arch_source); start_address =S390_TEST_MEM_START ; end_address =S390_TEST_MEM_END ; }else if (strcmp (arch,"ppc64" ) ==0 ) { machine_type ="" ; machine_args =",vsmt=8" ; memory_size ="256M" ; - cmd_src =g_strdup_printf ("-nodefaults " -"-prom-env 'use-nvramrc?=true' -prom-env " -"'nvramrc=hex .\" _\" begin %x %x " -"do i c@ 1 + i c! 1000 +loop .\" B\" 0 " -"until'" , end_address, start_address); - cmd_dst =g_strdup ("" ); + arch_source =g_strdup_printf ("-nodefaults " +"-prom-env 'use-nvramrc?=true' -prom-env " +"'nvramrc=hex .\" _\" begin %x %x " +"do i c@ 1 + i c! 1000 +loop .\" B\" 0 " +"until'" , end_address, start_address); + arch_target =g_strdup ("" ); start_address =PPC_TEST_MEM_START ; end_address =PPC_TEST_MEM_END ; }else if (strcmp (arch,"aarch64" ) ==0 ) {
@@ -609,10 +609,10 @@ static int test_migrate_start(QTestState **from, QTestState **to, machine_type ="virt," ; machine_args ="gic-version=max" ; memory_size ="150M" ; - cmd_src =g_strdup_printf ("-cpu max " -"-kernel %s" , - bootpath); - cmd_dst =g_strdup (cmd_src); + arch_source =g_strdup_printf ("-cpu max " +"-kernel %s" , + bootpath); + arch_target =g_strdup (arch_source); start_address =ARM_TEST_MEM_START ; end_address =ARM_TEST_MEM_END ;
@@ -647,8 +647,9 @@ static int test_migrate_start(QTestState **from, QTestState **to,"%s %s %s %s" , machine_type, machine_args, memory_size, tmpfs, - cmd_src, shmem_opts, opts_src, ignore_stderr); -g_free (cmd_src); + arch_source, shmem_opts, opts_src, + ignore_stderr); +g_free (arch_source); *from =qtest_init (cmd_source);g_free (cmd_source);
@@ -660,8 +661,9 @@ static int test_migrate_start(QTestState **from, QTestState **to,"%s %s %s %s" , machine_type, machine_args, memory_size, tmpfs, uri, - cmd_dst, shmem_opts, opts_dst, ignore_stderr); -g_free (cmd_dst); + arch_target, shmem_opts, opts_dst, + ignore_stderr); +g_free (arch_target); *to =qtest_init (cmd_target);g_free (cmd_target);
Signature · 1 line
1.8.3.1
[PULL 21/62] qom: introduce object_register_sugar_prop
In reply to Paolo BonziniSimilar to the existing "-rtc driftfix" option, we will convert some legacy "-machine" command line options to global properties on accelerators. Because accelerators are not devices, we cannot use qdev_prop_register_global. Instead, provide a slot in the generic object_compat_props arrays for command line syntactic sugar.
--- include/qom/object.h | 1 + qom/object.c | 23 +++++++++++++++++++++-- vl.c | 10 +++------- 3 files changed, 25 insertions(+), 9 deletions(-)
include/qom/object.h +1 -0
@@ -679,6 +679,7 @@ void object_apply_global_props(Object *obj, const GPtrArray *props, Error **errp);void object_set_machine_compat_props (GPtrArray *compat_props);void object_set_accelerator_compat_props (GPtrArray *compat_props); +void object_register_sugar_prop (const char *driver,const char *prop,const char *value);void object_apply_compat_props (Object *obj);/**
qom/object.c +21 -2
@@ -414,10 +414,29 @@ void object_apply_global_props(Object *obj, const GPtrArray *props, Error **errp* Global property defaults * Slot 0: accelerator's global property defaults * Slot 1: machine's global property defaults +* Slot 2: global properties from legacy command line option * Each is a GPtrArray of of GlobalProperty. * Applied in order, later entries override earlier ones. */ -static GPtrArray *object_compat_props[2 ]; +static GPtrArray *object_compat_props[3 ]; + +/* +* Retrieve @GPtrArray for global property defined with options +* other than "-global". These are generally used for syntactic +* sugar and legacy command line options. +*/ +void object_register_sugar_prop (const char *driver,const char *prop,const char *value) +{ +GlobalProperty *g; +if (!object_compat_props[2 ]) { + object_compat_props[2 ] =g_ptr_array_new (); + } + g =g_new (GlobalProperty,1 ); + g->driver =g_strdup (driver); + g->property =g_strdup (prop); + g->value =g_strdup (value); +g_ptr_array_add (object_compat_props[2 ], g); +}/* * Set machine's global property defaults to @compat_props.
@@ -445,7 +464,7 @@ void object_apply_compat_props(Object *obj)for (i =0 ; i <ARRAY_SIZE (object_compat_props); i++) {object_apply_global_props (obj, object_compat_props[i], - &error_abort); + i ==2 ? &error_fatal : &error_abort); } }
vl.c +3 -7
@@ -897,13 +897,9 @@ static void configure_rtc(QemuOpts *opts) value =qemu_opt_get (opts,"driftfix" );if (value) {if (!strcmp (value,"slew" )) { -static GlobalProperty slew_lost_ticks = { - .driver ="mc146818rtc" , - .property ="lost_tick_policy" , - .value ="slew" , - }; - -qdev_prop_register_global (&slew_lost_ticks); +object_register_sugar_prop ("mc146818rtc" , +"lost_tick_policy" , +"slew" ); }else if (!strcmp (value,"none" )) {/* discard is default */ }else {
Signature · 1 line
1.8.3.1
[PULL 16/62] vl: merge -accel processing into configure_accelerators
In reply to Paolo BonziniThe next step is to move the parsing of "-machine accel=..." into vl.c, unifying it with the configure_accelerators() function that has just been introduced. This way, we will be able to desugar it into multiple "-accel" options, without polluting accel/accel.c.
The CONFIG_TCG and CONFIG_KVM symbols are not available in vl.c, but we can use accel_find instead to find their value at runtime. Once we know that the binary has one of TCG or KVM, the default accelerator can be expressed simply as "tcg:kvm", because TCG never fails to initialize.
--- accel/accel.c | 69 ++------------------------------------------------ include/sysemu/accel.h | 4 ++- vl.c | 64 ++++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 64 insertions(+), 73 deletions(-)
accel/accel.c +2 -67
@@ -28,13 +28,7 @@#include "hw/boards.h" #include "sysemu/arch_init.h" #include "sysemu/sysemu.h" -#include "sysemu/kvm.h" -#include "sysemu/qtest.h" -#include "hw/xen/xen.h" #include "qom/object.h" -#include "qemu/error-report.h" -#include "qemu/option.h" -#include "qapi/error.h" static const TypeInfo accel_type = { .name =TYPE_ACCEL ,
@@ -44,7 +38,7 @@ static const TypeInfo accel_type = { };/* Lookup AccelClass from opt_name. Returns NULL if not found */ -static AccelClass *accel_find (const char *opt_name) +AccelClass *accel_find (const char *opt_name) {char *class_name =g_strdup_printf (ACCEL_CLASS_NAME ("%s" ), opt_name);AccelClass *ac =ACCEL_CLASS (object_class_by_name (class_name));
@@ -52,7 +46,7 @@ static AccelClass *accel_find(const char *opt_name)return ac; } -static int accel_init_machine (AccelClass *acc,MachineState *ms) +int accel_init_machine (AccelClass *acc,MachineState *ms) {ObjectClass *oc =OBJECT_CLASS (acc);const char *cname =object_class_get_name (oc);
@@ -71,65 +65,6 @@ static int accel_init_machine(AccelClass *acc, MachineState *ms)return ret; } -void configure_accelerator (MachineState *ms,const char *progname) -{ -const char *accel; -char **accel_list, **tmp; -int ret; -bool accel_initialised = false; -bool init_failed = false; -AccelClass *acc =NULL ; - - accel =qemu_opt_get (qemu_get_machine_opts (),"accel" ); -if (accel ==NULL ) { -/* Select the default accelerator */ -int pnlen =strlen (progname); -if (pnlen >=3 &&g_str_equal (&progname[pnlen -3 ],"kvm" )) { -/* If the program name ends with "kvm", we prefer KVM */ - accel ="kvm:tcg" ; - }else { -#if defined(CONFIG_TCG ) - accel ="tcg" ; -#elif defined(CONFIG_KVM ) - accel ="kvm" ; -#else -error_report ("No accelerator selected and" -" no default accelerator available" ); -exit (1 ); -#endif - } - } - - accel_list =g_strsplit (accel,":" ,0 ); - -for (tmp = accel_list; !accel_initialised && tmp && *tmp; tmp++) { - acc =accel_find (*tmp); -if (!acc) { -continue ; - } - ret =accel_init_machine (acc, ms); -if (ret <0 ) { - init_failed = true; -error_report ("failed to initialize %s: %s" , - acc->name,strerror (-ret)); - }else { - accel_initialised = true; - } - } -g_strfreev (accel_list); - -if (!accel_initialised) { -if (!init_failed) { -error_report ("-machine accel=%s: No accelerator found" , accel); - } -exit (1 ); - } - -if (init_failed) { -error_report ("Back to %s accelerator" , acc->name); - } -} -void accel_setup_post (MachineState *ms) {AccelState *accel = ms->accelerator;
include/sysemu/accel.h +3 -1
@@ -66,7 +66,9 @@ typedef struct AccelClass {extern unsigned long tcg_tb_size; -void configure_accelerator (MachineState *ms,const char *progname); +AccelClass *accel_find (const char *opt_name); +int accel_init_machine (AccelClass *acc,MachineState *ms); +/* Called just before os_setup_post (ie just before drop OS privs) */ void accel_setup_post (MachineState *ms);
vl.c +59 -5
83 lines not on this page · raw message
Signature · 1 line
1.8.3.1
[PULL 24/62] tcg: convert "-accel threads" to a QOM property
In reply to Paolo BonziniReplace the ad-hoc qemu_tcg_configure with generic code invoking QOM property getters and setters. More properties (and thus more valid -accel suboptions) will be added in the next patches, which will move accelerator-related "-machine" options to accelerators.
--- accel/tcg/tcg-all.c | 52 +++++++++++++++++++++++++++++++++++++-------------- include/sysemu/cpus.h | 2 -- vl.c | 32 ++++++++++++++++--------------- 3 files changed, 55 insertions(+), 31 deletions(-)
accel/tcg/tcg-all.c +38 -14
@@ -34,7 +34,17 @@#include "include/qapi/error.h" #include "include/qemu/error-report.h" #include "include/hw/boards.h" -#include "qemu/option.h" + +typedef struct TCGState { +AccelState parent_obj; + +bool mttcg_enabled; +}TCGState ; + +#define TYPE_TCG_ACCEL ACCEL_CLASS_NAME("tcg") + +#define TCG_STATE (obj) \ + OBJECT_CHECK(TCGState, (obj), TYPE_TCG_ACCEL)unsigned long tcg_tb_size;
@@ -107,23 +117,33 @@ static bool default_mttcg_enabled(void)static void tcg_accel_instance_init (Object *obj) { - mttcg_enabled =default_mttcg_enabled (); +TCGState *s =TCG_STATE (obj); + + s->mttcg_enabled =default_mttcg_enabled (); }static int tcg_init (MachineState *ms) { +TCGState *s =TCG_STATE (current_machine->accelerator); +tcg_exec_init (tcg_tb_size *1024 *1024 ); cpu_interrupt_handler = tcg_handle_interrupt; + mttcg_enabled = s->mttcg_enabled;return 0 ; } -void qemu_tcg_configure (QemuOpts *opts,Error **errp) +static char *tcg_get_thread (Object *obj,Error **errp) { -const char *t =qemu_opt_get (opts,"thread" ); -if (!t) { -return ; - } -if (strcmp (t,"multi" ) ==0 ) { +TCGState *s =TCG_STATE (obj); + +return g_strdup (s->mttcg_enabled ?"multi" :"single" ); +} + +static void tcg_set_thread (Object *obj,const char *value,Error **errp) +{ +TCGState *s =TCG_STATE (obj); + +if (strcmp (value,"multi" ) ==0 ) {if (TCG_OVERSIZED_GUEST ) {error_setg (errp,"No MTTCG when guest word size > hosts" ); }else if (use_icount) {
@@ -138,12 +158,12 @@ void qemu_tcg_configure(QemuOpts *opts, Error **errp) "than the host provides");error_printf ("This may cause strange/hard to debug errors\n" ); } - mttcg_enabled = true; + s->mttcg_enabled = true; } - }else if (strcmp (t,"single" ) ==0 ) { - mttcg_enabled = false; + }else if (strcmp (value,"single" ) ==0 ) { + s->mttcg_enabled = false; }else { -error_setg (errp,"Invalid 'thread' setting %s" , t); +error_setg (errp,"Invalid 'thread' setting %s" , value); } }
@@ -153,15 +173,19 @@ static void tcg_accel_class_init(ObjectClass *oc, void *data) ac->name ="tcg" ; ac->init_machine = tcg_init; ac->allowed = &tcg_allowed; -} -#define TYPE_TCG_ACCEL ACCEL_CLASS_NAME("tcg") +object_class_property_add_str (oc,"thread" , + tcg_get_thread, + tcg_set_thread, +NULL ); +}static const TypeInfo tcg_accel_type = { .name =TYPE_TCG_ACCEL , .parent =TYPE_ACCEL , .instance_init = tcg_accel_instance_init, .class_init = tcg_accel_class_init, + .instance_size =sizeof (TCGState), };static void register_accel_types (void )
include/sysemu/cpus.h +0 -2
@@ -40,6 +40,4 @@ extern int smp_threads;void list_cpus (const char *optarg); -void qemu_tcg_configure (QemuOpts *opts,Error **errp); -#endif
vl.c +17 -15
@@ -295,17 +295,12 @@ static QemuOptsList qemu_accel_opts = { .implied_opt_name = "accel", .head = QTAILQ_HEAD_INITIALIZER(qemu_accel_opts.head), .desc = { - { - .name = "accel", - .type = QEMU_OPT_STRING, - .help = "Select the type of accelerator", - }, - { - .name = "thread", - .type = QEMU_OPT_STRING, - .help = "Enable/disable multi-threaded TCG", - }, - {/* end of list */ } +/* +* no elements => accept any +* sanity checking will happen later +* when setting accelerator properties +*/ + { } }, };
@@ -2836,6 +2831,13 @@ static int do_configure_icount(void *opaque, QemuOpts *opts, Error **errp)return 0 ; } +static int accelerator_set_property (void *opaque, +const char *name,const char *value, +Error **errp) +{ +return object_parse_property_opt (opaque, name, value,"accel" , errp); +} +static int do_configure_accelerator (void *opaque,QemuOpts *opts,Error **errp) {bool *p_init_failed = opaque;
@@ -2850,6 +2852,10 @@ static int do_configure_accelerator(void *opaque, QemuOpts *opts, Error **errp)return 0 ; } accel =ACCEL (object_new_with_class (OBJECT_CLASS (ac))); +qemu_opt_foreach (opts, accelerator_set_property, + accel, + &error_fatal); + ret =accel_init_machine (accel, current_machine);if (ret <0 ) { *p_init_failed = true;
@@ -2857,10 +2863,6 @@ static int do_configure_accelerator(void *opaque, QemuOpts *opts, Error **errp) acc, strerror(-ret));return 0 ; } - -if (tcg_enabled ()) { -qemu_tcg_configure (opts, &error_fatal); - }return 1 ; }
Signature · 1 line
1.8.3.1
[PULL 12/62] memory: do not look at current_machine->accel
In reply to Paolo Bonzini"info mtree -f" prints the wrong accelerator name if used with for example "-machine accel=kvm:tcg". The right thing to do is to fetch the name from the AccelClass, which will also work nicely once current_machine->accel stops existing.
--- memory.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
memory.c +1 -4
@@ -2979,7 +2979,6 @@ struct FlatViewInfo {bool dispatch_tree;bool owner;AccelClass *ac; -const char *ac_name; }; static void mtree_print_flatview(gpointer key, gpointer value,
@@ -3049,7 +3048,7 @@ static void mtree_print_flatview(gpointer key, gpointer value,if (fvi->ac->has_memory (current_machine, as,int128_get64 (range->addr.start),MR_SIZE (range->addr.size) +1 )) { -qemu_printf (" %s" , fvi->ac_name); +qemu_printf (" %s" , fvi->ac->name); } } }
@@ -3097,8 +3096,6 @@ void mtree_info(bool flatview, bool dispatch_tree, bool owner)if (ac->has_memory) { fvi.ac = ac; - fvi.ac_name = current_machine->accel ? current_machine->accel : -object_class_get_name (OBJECT_CLASS (ac)); }/* Gather all FVs in one table */
Signature · 1 line
1.8.3.1
[PULL 28/62] kvm: introduce kvm_kernel_irqchip_* functions
In reply to Paolo BonziniThe KVMState struct is opaque, so provide accessors for the fields that will be moved from current_machine to the accelerator. For now they just forward to the machine object, but this will change.
--- accel/kvm/kvm-all.c | 23 +++++++++++++++++++---- hw/ppc/e500.c | 5 ++--- hw/ppc/spapr_irq.c | 16 ++++------------ include/sysemu/kvm.h | 7 +++++-- target/arm/kvm.c | 8 ++++---- target/i386/kvm.c | 4 ++-- target/mips/kvm.c | 2 +- target/ppc/kvm.c | 2 +- target/s390x/kvm.c | 2 +- 9 files changed, 39 insertions(+), 30 deletions(-)
accel/kvm/kvm-all.c +19 -4
@@ -1774,7 +1774,7 @@ void kvm_irqchip_set_qemuirq_gsi(KVMState *s, qemu_irq irq, int gsi)g_hash_table_insert (s->gsimap, irq,GINT_TO_POINTER (gsi)); } -static void kvm_irqchip_create (MachineState *machine,KVMState *s) +static void kvm_irqchip_create (KVMState *s) {int ret;
@@ -1792,9 +1792,9 @@ static void kvm_irqchip_create(MachineState *machine, KVMState *s)/* First probe and see if there's a arch-specific hook to create the * in-kernel irqchip for us */ - ret =kvm_arch_irqchip_create (machine, s); + ret =kvm_arch_irqchip_create (s);if (ret ==0 ) { -if (machine_kernel_irqchip_split (machine)) { +if (kvm_kernel_irqchip_split ()) {perror ("Split IRQ chip mode not supported." );exit (1 ); }else {
@@ -2066,7 +2066,7 @@ static int kvm_init(MachineState *ms) }if (machine_kernel_irqchip_allowed (ms)) { -kvm_irqchip_create (ms, s); +kvm_irqchip_create (s); }if (kvm_eventfds_allowed) {
@@ -2983,6 +2983,21 @@ static void kvm_set_kvm_shadow_mem(Object *obj, Visitor *v, s->kvm_shadow_mem = value; } +bool kvm_kernel_irqchip_allowed (void ) +{ +return machine_kernel_irqchip_allowed (current_machine); +} + +bool kvm_kernel_irqchip_required (void ) +{ +return machine_kernel_irqchip_required (current_machine); +} + +bool kvm_kernel_irqchip_split (void ) +{ +return machine_kernel_irqchip_split (current_machine); +} +static void kvm_accel_instance_init (Object *obj) {KVMState *s =KVM_STATE (obj);
hw/ppc/e500.c +2 -3
@@ -793,7 +793,6 @@ static DeviceState *ppce500_init_mpic(PPCE500MachineState *pms, MemoryRegion *ccsr, IrqLines *irqs) { -MachineState *machine =MACHINE (pms);const PPCE500MachineClass *pmc =PPCE500_MACHINE_GET_CLASS (pms);DeviceState *dev =NULL ;SysBusDevice *s;
@@ -801,10 +800,10 @@ static DeviceState *ppce500_init_mpic(PPCE500MachineState *pms,if (kvm_enabled ()) {Error *err =NULL ; -if (machine_kernel_irqchip_allowed (machine)) { +if (kvm_kernel_irqchip_allowed ()) { dev =ppce500_init_mpic_kvm (pmc, irqs, &err); } -if (machine_kernel_irqchip_required (machine) && !dev) { +if (kvm_kernel_irqchip_required () && !dev) {error_reportf_err (err,"kernel_irqchip requested but unavailable: " );exit (1 );
hw/ppc/spapr_irq.c +4 -12
@@ -74,12 +74,11 @@ int spapr_irq_init_kvm(int (*fn)(SpaprInterruptController *, Error **), SpaprInterruptController *intc, Error **errp) { -MachineState *machine =MACHINE (qdev_get_machine ());Error *local_err =NULL ; -if (kvm_enabled () &&machine_kernel_irqchip_allowed (machine)) { +if (kvm_enabled () &&kvm_kernel_irqchip_allowed ()) {if (fn (intc, &local_err) <0 ) { -if (machine_kernel_irqchip_required (machine)) { +if (kvm_kernel_irqchip_required ()) {error_prepend (&local_err,"kernel_irqchip requested but unavailable: " );error_propagate (errp, local_err);
@@ -184,7 +183,7 @@ static int spapr_irq_check(SpaprMachineState *spapr, Error **errp)*/ if (kvm_enabled () && spapr->irq == &spapr_irq_dual && -machine_kernel_irqchip_required (machine) && +kvm_kernel_irqchip_required () &&xics_kvm_has_broken_disconnect (spapr)) {error_setg (errp,"KVM is too old to support ic-mode=dual,kernel-irqchip=on" );return -1 ;
@@ -287,20 +286,13 @@ uint32_t spapr_irq_nr_msis(SpaprMachineState *spapr)void spapr_irq_init (SpaprMachineState *spapr,Error **errp) { -MachineState *machine =MACHINE (spapr);SpaprMachineClass *smc =SPAPR_MACHINE_GET_CLASS (spapr); -if (machine_kernel_irqchip_split (machine)) { +if (kvm_enabled () &&kvm_kernel_irqchip_split ()) {error_setg (errp,"kernel_irqchip split mode not supported on pseries" );return ; } -if (!kvm_enabled () &&machine_kernel_irqchip_required (machine)) { -error_setg (errp, -"kernel_irqchip requested but only available with KVM" ); -return ; - } -if (spapr_irq_check (spapr, errp) <0 ) {return ; }
include/sysemu/kvm.h +5 -2
@@ -519,10 +519,13 @@ void kvm_pc_gsi_handler(void *opaque, int n, int level);void kvm_pc_setup_irq_routing (bool pci_enabled);void kvm_init_irq_routing (KVMState *s); +bool kvm_kernel_irqchip_allowed (void ); +bool kvm_kernel_irqchip_required (void ); +bool kvm_kernel_irqchip_split (void ); +/** * kvm_arch_irqchip_create: * @KVMState: The KVMState pointer -* @MachineState: The MachineState pointer * * Allow architectures to create an in-kernel irq chip themselves. *
@@ -530,7 +533,7 @@ void kvm_init_irq_routing(KVMState *s);* 0: irq chip was not created * > 0: irq chip was created */ -int kvm_arch_irqchip_create (MachineState *ms,KVMState *s); +int kvm_arch_irqchip_create (KVMState *s);/** * kvm_set_one_reg - set a register value in KVM via KVM_SET_ONE_REG ioctl
target/arm/kvm.c +4 -4
@@ -741,11 +741,11 @@ void kvm_arch_init_irq_routing(KVMState *s) { } -int kvm_arch_irqchip_create (MachineState *ms,KVMState *s) +int kvm_arch_irqchip_create (KVMState *s) { -if (machine_kernel_irqchip_split (ms)) { -perror ("-machine kernel_irqchip=split is not supported on ARM." ); -exit (1 ); +if (kvm_kernel_irqchip_split ()) { +perror ("-machine kernel_irqchip=split is not supported on ARM." ); +exit (1 ); }/* If we can create the VGIC using the newer device control API, we
target/i386/kvm.c +2 -2
@@ -4494,10 +4494,10 @@ void kvm_arch_init_irq_routing(KVMState *s) } } -int kvm_arch_irqchip_create (MachineState *ms,KVMState *s) +int kvm_arch_irqchip_create (KVMState *s) {int ret; -if (machine_kernel_irqchip_split (ms)) { +if (kvm_kernel_irqchip_split ()) { ret =kvm_vm_enable_cap (s,KVM_CAP_SPLIT_IRQCHIP ,0 ,24 );if (ret) { error_report("Could not enable split irqchip mode: %s",
target/mips/kvm.c +1 -1
@@ -57,7 +57,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s)return 0 ; } -int kvm_arch_irqchip_create (MachineState *ms,KVMState *s) +int kvm_arch_irqchip_create (KVMState *s) {return 0 ; }
target/ppc/kvm.c +1 -1
@@ -152,7 +152,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s)return 0 ; } -int kvm_arch_irqchip_create (MachineState *ms,KVMState *s) +int kvm_arch_irqchip_create (KVMState *s) {return 0 ; }
target/s390x/kvm.c +1 -1
@@ -374,7 +374,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s)return 0 ; } -int kvm_arch_irqchip_create (MachineState *ms,KVMState *s) +int kvm_arch_irqchip_create (KVMState *s) {return 0 ; }
Signature · 1 line
1.8.3.1
[PULL 27/62] kvm: convert "-machine kvm_shadow_mem" to an accelerator property
In reply to Paolo Bonzini--- accel/kvm/kvm-all.c | 43 +++++++++++++++++++++++++++++++++++++++++++ hw/core/machine.c | 39 --------------------------------------- include/hw/boards.h | 2 -- qemu-options.hx | 6 +++--- target/i386/kvm.c | 2 +- vl.c | 4 ++++ 6 files changed, 51 insertions(+), 45 deletions(-)
accel/kvm/kvm-all.c +43 -0
@@ -41,6 +41,7 @@#include "hw/irq.h" #include "sysemu/sev.h" #include "sysemu/balloon.h" +#include "qapi/visitor.h" #include "hw/boards.h"
@@ -92,6 +93,7 @@ struct KVMStateint max_nested_state_len;int many_ioeventfds;int intx_set_mask; +int kvm_shadow_mem;bool sync_mmu;bool manual_dirty_log_protect;/* The man page (and posix) say ioctl numbers are signed int, but
@@ -2954,6 +2956,40 @@ static bool kvm_accel_has_memory(MachineState *ms, AddressSpace *as,return false; } +static void kvm_get_kvm_shadow_mem (Object *obj,Visitor *v, +const char *name,void *opaque, +Error **errp) +{ +KVMState *s =KVM_STATE (obj); +int64_t value = s->kvm_shadow_mem; + +visit_type_int (v, name, &value, errp); +} + +static void kvm_set_kvm_shadow_mem (Object *obj,Visitor *v, +const char *name,void *opaque, +Error **errp) +{ +KVMState *s =KVM_STATE (obj); +Error *error =NULL ; +int64_t value; + +visit_type_int (v, name, &value, &error); +if (error) { +error_propagate (errp, error); +return ; + } + + s->kvm_shadow_mem = value; +} + +static void kvm_accel_instance_init (Object *obj) +{ +KVMState *s =KVM_STATE (obj); + + s->kvm_shadow_mem =-1 ; +} +static void kvm_accel_class_init (ObjectClass *oc,void *data) {AccelClass *ac =ACCEL_CLASS (oc);
@@ -2961,11 +2997,18 @@ static void kvm_accel_class_init(ObjectClass *oc, void *data) ac->init_machine = kvm_init; ac->has_memory = kvm_accel_has_memory; ac->allowed = &kvm_allowed; + +object_class_property_add (oc,"kvm-shadow-mem" ,"int" , + kvm_get_kvm_shadow_mem, kvm_set_kvm_shadow_mem, +NULL ,NULL , &error_abort); +object_class_property_set_description (oc,"kvm-shadow-mem" , +"KVM shadow MMU size" , &error_abort); }static const TypeInfo kvm_accel_type = { .name =TYPE_KVM_ACCEL , .parent =TYPE_ACCEL , + .instance_init = kvm_accel_instance_init, .class_init = kvm_accel_class_init, .instance_size =sizeof (KVMState), };
hw/core/machine.c +0 -39
@@ -216,33 +216,6 @@ static void machine_set_kernel_irqchip(Object *obj, Visitor *v, } } -static void machine_get_kvm_shadow_mem (Object *obj,Visitor *v, -const char *name,void *opaque, -Error **errp) -{ -MachineState *ms =MACHINE (obj); -int64_t value = ms->kvm_shadow_mem; - -visit_type_int (v, name, &value, errp); -} - -static void machine_set_kvm_shadow_mem (Object *obj,Visitor *v, -const char *name,void *opaque, -Error **errp) -{ -MachineState *ms =MACHINE (obj); -Error *error =NULL ; -int64_t value; - -visit_type_int (v, name, &value, &error); -if (error) { -error_propagate (errp, error); -return ; - } - - ms->kvm_shadow_mem = value; -} -static char *machine_get_kernel (Object *obj,Error **errp) {MachineState *ms =MACHINE (obj);
@@ -790,12 +763,6 @@ static void machine_class_init(ObjectClass *oc, void *data)object_class_property_set_description (oc,"kernel-irqchip" ,"Configure KVM in-kernel irqchip" , &error_abort); -object_class_property_add (oc,"kvm-shadow-mem" ,"int" , - machine_get_kvm_shadow_mem, machine_set_kvm_shadow_mem, -NULL ,NULL , &error_abort); -object_class_property_set_description (oc,"kvm-shadow-mem" , -"KVM shadow MMU size" , &error_abort); -object_class_property_add_str (oc,"kernel" , machine_get_kernel, machine_set_kernel, &error_abort); object_class_property_set_description(oc, "kernel",
@@ -897,7 +864,6 @@ static void machine_initfn(Object *obj) ms->kernel_irqchip_allowed = true; ms->kernel_irqchip_split = mc->default_kernel_irqchip_split; - ms->kvm_shadow_mem =-1 ; ms->dump_guest_core = true; ms->mem_merge = true; ms->enable_graphics = true;
@@ -968,11 +934,6 @@ bool machine_kernel_irqchip_split(MachineState *machine)return machine->kernel_irqchip_split; } -int machine_kvm_shadow_mem (MachineState *machine) -{ -return machine->kvm_shadow_mem; -} -int machine_phandle_start (MachineState *machine) {return machine->phandle_start;
include/hw/boards.h +0 -2
@@ -66,7 +66,6 @@ bool machine_usb(MachineState *machine);bool machine_kernel_irqchip_allowed (MachineState *machine);bool machine_kernel_irqchip_required (MachineState *machine);bool machine_kernel_irqchip_split (MachineState *machine); -int machine_kvm_shadow_mem (MachineState *machine);int machine_phandle_start (MachineState *machine);bool machine_dump_guest_core (MachineState *machine);bool machine_mem_merge (MachineState *machine);
@@ -278,7 +277,6 @@ struct MachineState {bool kernel_irqchip_allowed;bool kernel_irqchip_required;bool kernel_irqchip_split; -int kvm_shadow_mem;char *dtb;char *dumpdtb;int phandle_start;
qemu-options.hx +3 -3
@@ -34,7 +34,6 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \ " supported accelerators are kvm, xen, hax, hvf, whpx or tcg (default: tcg)\n" " kernel_irqchip=on|off|split controls accelerated irqchip support (default=off)\n" " vmport=on|off|auto controls emulation of vmport (default: auto)\n" - " kvm_shadow_mem=size of KVM shadow MMU in bytes\n" " dump-guest-core=on|off include guest memory in a core dump (default=on)\n" " mem-merge=on|off controls memory merge support (default: on)\n" " aes-key-wrap=on|off controls support for AES key wrapping (default=on)\n"
@@ -74,8 +73,6 @@ Controls in-kernel irqchip support for the chosen accelerator when available. Enables emulation of VMWare IO port, for vmmouse etc. auto says to select the value based on accel. For accel=xen the default is off otherwise the default is on. -@item kvm_shadow_mem=size -Defines the size of the KVM shadow MMU. @item dump-guest-core=on|off Include guest memory in a core dump. The default is on. @item mem-merge=on|off
@@ -118,6 +115,7 @@ DEF("accel", HAS_ARG, QEMU_OPTION_accel, "-accel [accel=]accelerator[,prop[=value][,...]]\n" " select accelerator (kvm, xen, hax, hvf, whpx or tcg; use 'help' for a list)\n" " igd-passthru=on|off (enable Xen integrated Intel graphics passthrough, default=off)\n" + " kvm-shadow-mem=size of KVM shadow MMU in bytes\n" " tb-size=n (TCG translation block cache size)\n" " thread=single|multi (enable multi-threaded TCG)\n", QEMU_ARCH_ALL) STEXI
@@ -131,6 +129,8 @@ fails to initialize. @item igd-passthru=on|off When Xen is in use, this option controls whether Intel integrated graphics devices can be passed through to the guest (default=off) +@item kvm-shadow-mem=size +Defines the size of the KVM shadow MMU. @item tb-size=@var{n} Controls the size (in MiB) of the TCG translation block cache. @item thread=single|multi
target/i386/kvm.c +1 -1
@@ -2163,7 +2163,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s) }qemu_register_reset (kvm_unpoison_all,NULL ); - shadow_mem =machine_kvm_shadow_mem (ms); + shadow_mem =object_property_get_int (OBJECT (s),"kvm-shadow-mem" , &error_abort);if (shadow_mem !=-1 ) { shadow_mem /=4096 ; ret =kvm_vm_ioctl (s,KVM_SET_NR_MMU_PAGES , shadow_mem);
vl.c +4 -0
@@ -2639,6 +2639,10 @@ static int machine_set_property(void *opaque,object_register_sugar_prop (ACCEL_CLASS_NAME ("xen" ), qom_name, value);return 0 ; } +if (g_str_equal (qom_name,"kvm-shadow-mem" )) { +object_register_sugar_prop (ACCEL_CLASS_NAME ("kvm" ), qom_name, value); +return 0 ; + }return object_parse_property_opt (opaque, name, value,"type" , errp); }
Signature · 1 line
1.8.3.1
[PULL 30/62] Makefile: remove unused variables
In reply to Paolo Bonzini--- Makefile | 4 ---- 1 file changed, 4 deletions(-)
Makefile +0 -4
@@ -445,10 +445,6 @@ dummy := $(call unnest-vars,, \ io-obj-y \ common-obj-y \ common-obj-m \ - ui-obj-y \ - ui-obj-m \ - audio-obj-y \ - audio-obj-m \ trace-obj-y) include $(SRC_PATH)/tests/Makefile.include
Signature · 1 line
1.8.3.1
[PULL 15/62] vl: extract accelerator option processing to a separate function
In reply to Paolo BonziniAs a first step towards supporting multiple "-accel" options, push the late processing of -icount and -accel into a new function, and use qemu_opts_foreach to retrieve -accel options instead of stashing them into globals.
--- vl.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-)
vl.c +20 -8
@@ -2831,6 +2831,25 @@ static int do_configure_icount(void *opaque, QemuOpts *opts, Error **errp)return 0 ; } +static int do_configure_accelerator (void *opaque,QemuOpts *opts,Error **errp) +{ +if (tcg_enabled ()) { +qemu_tcg_configure (opts, &error_fatal); + } +return 0 ; +} + +static void configure_accelerators (void ) +{ +qemu_opts_foreach (qemu_find_opts ("accel" ), + do_configure_accelerator,NULL , &error_fatal); + +if (use_icount && !(tcg_enabled () ||qtest_enabled ())) { +error_report ("-icount is not allowed with hardware virtualization" ); +exit (1 ); + } +} +int main (int argc,char **argv,char **envp) {int i;
@@ -4235,14 +4254,7 @@ int main(int argc, char **argv, char **envp)qemu_spice_init ();cpu_ticks_init (); -if (use_icount && !(tcg_enabled () ||qtest_enabled ())) { -error_report ("-icount is not allowed with hardware virtualization" ); -exit (1 ); - } - -if (tcg_enabled ()) { -qemu_tcg_configure (accel_opts, &error_fatal); - } +configure_accelerators ();if (default_net) {QemuOptsList *net =qemu_find_opts ("net" );
Signature · 1 line
1.8.3.1
[PULL 36/62] vhost-user-scsi: fix printf format warning
In reply to Paolo BonziniFrom: Marc-André Lureau <[email protected]>
Fixes:../contrib/vhost-user-scsi/vhost-user-scsi.c:118:57: error: format specifies
type 'unsigned char' but the argument has type 'int' [-Werror,-Wformat]
g_warning("Unable to determine cdb len (0x%02hhX)", cdb[0] >> 5);
--- contrib/vhost-user-scsi/vhost-user-scsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/vhost-user-scsi/vhost-user-scsi.c +1 -1
@@ -115,7 +115,7 @@ static int get_cdb_len(uint8_t *cdb)case 4 :return 16 ;case 5 :return 12 ; } -g_warning ("Unable to determine cdb len (0x%02hhX)" , cdb[0 ] >>5 ); +g_warning ("Unable to determine cdb len (0x%02hhX)" , (uint8_t )(cdb[0 ] >>5 ));return -1 ; }
Signature · 1 line
1.8.3.1
[PULL 32/62] build-sys: build vhost-user-gpu only if CONFIG_TOOLS
In reply to Paolo BonziniFrom: Marc-André Lureau <[email protected]>
vhost-user-gpu is always built and installed, but it is not part of the emulator proper. Cut it if --disable-tools is specified.
--- Makefile | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
Makefile +1 -5
@@ -321,14 +321,10 @@ HELPERS-y = HELPERS-$(call land,$(CONFIG_SOFTMMU),$(CONFIG_LINUX)) = qemu-bridge-helper$(EXESUF) -ifdef CONFIG_LINUX -ifdef CONFIG_VIRGL -ifdef CONFIG_GBM +ifeq ($(CONFIG_LINUX)$(CONFIG_VIRGL)$(CONFIG_GBM)$(CONFIG_TOOLS),yyyy) HELPERS-y += vhost-user-gpu$(EXESUF) vhost-user-json-y += contrib/vhost-user-gpu/50-qemu-gpu.json endif -endif -endif # Sphinx does not allow building manuals into the same directory as # the source files, so if we're doing an in-tree QEMU build we must
Signature · 1 line
1.8.3.1
[PULL 29/62] kvm: convert "-machine kernel_irqchip" to an accelerator property
In reply to Paolo Bonzini--- accel/kvm/kvm-all.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++----- hw/core/machine.c | 61 ----------------------------------------------------- include/hw/boards.h | 3 --- qemu-options.hx | 9 +++++--- vl.c | 3 ++- 5 files changed, 62 insertions(+), 73 deletions(-)
accel/kvm/kvm-all.c +54 -5
@@ -42,6 +42,8 @@#include "sysemu/sev.h" #include "sysemu/balloon.h" #include "qapi/visitor.h" +#include "qapi/qapi-types-common.h" +#include "qapi/qapi-visit-common.h" #include "hw/boards.h"
@@ -94,6 +96,9 @@ struct KVMStateint many_ioeventfds;int intx_set_mask;int kvm_shadow_mem; +bool kernel_irqchip_allowed; +bool kernel_irqchip_required; +bool kernel_irqchip_split;bool sync_mmu;bool manual_dirty_log_protect;/* The man page (and posix) say ioctl numbers are signed int, but
@@ -1794,7 +1799,7 @@ static void kvm_irqchip_create(KVMState *s)* in-kernel irqchip for us */ ret =kvm_arch_irqchip_create (s);if (ret ==0 ) { -if (kvm_kernel_irqchip_split ()) { +if (s->kernel_irqchip_split) {perror ("Split IRQ chip mode not supported." );exit (1 ); }else {
@@ -2065,7 +2070,7 @@ static int kvm_init(MachineState *ms) goto err; } -if (machine_kernel_irqchip_allowed (ms)) { +if (s->kernel_irqchip_allowed) {kvm_irqchip_create (s); }
@@ -2983,19 +2988,57 @@ static void kvm_set_kvm_shadow_mem(Object *obj, Visitor *v, s->kvm_shadow_mem = value; } +static void kvm_set_kernel_irqchip (Object *obj,Visitor *v, +const char *name,void *opaque, +Error **errp) +{ +Error *err =NULL ; +KVMState *s =KVM_STATE (obj); +OnOffSplit mode; + +visit_type_OnOffSplit (v, name, &mode, &err); +if (err) { +error_propagate (errp, err); +return ; + }else { +switch (mode) { +case ON_OFF_SPLIT_ON : + s->kernel_irqchip_allowed = true; + s->kernel_irqchip_required = true; + s->kernel_irqchip_split = false; +break ; +case ON_OFF_SPLIT_OFF : + s->kernel_irqchip_allowed = false; + s->kernel_irqchip_required = false; + s->kernel_irqchip_split = false; +break ; +case ON_OFF_SPLIT_SPLIT : + s->kernel_irqchip_allowed = true; + s->kernel_irqchip_required = true; + s->kernel_irqchip_split = true; +break ; +default : +/* The value was checked in visit_type_OnOffSplit() above. If +* we get here, then something is wrong in QEMU. +*/ +abort (); + } + } +} +bool kvm_kernel_irqchip_allowed (void ) { -return machine_kernel_irqchip_allowed (current_machine); +return kvm_state->kernel_irqchip_allowed; }bool kvm_kernel_irqchip_required (void ) { -return machine_kernel_irqchip_required (current_machine); +return kvm_state->kernel_irqchip_required; }bool kvm_kernel_irqchip_split (void ) { -return machine_kernel_irqchip_split (current_machine); +return kvm_state->kernel_irqchip_split; }static void kvm_accel_instance_init (Object *obj)
@@ -3013,6 +3056,12 @@ static void kvm_accel_class_init(ObjectClass *oc, void *data) ac->has_memory = kvm_accel_has_memory; ac->allowed = &kvm_allowed; +object_class_property_add (oc,"kernel-irqchip" ,"on|off|split" , +NULL , kvm_set_kernel_irqchip, +NULL ,NULL , &error_abort); +object_class_property_set_description (oc,"kernel-irqchip" , +"Configure KVM in-kernel irqchip" , &error_abort); +object_class_property_add (oc,"kvm-shadow-mem" ,"int" , kvm_get_kvm_shadow_mem, kvm_set_kvm_shadow_mem,NULL ,NULL , &error_abort);
hw/core/machine.c +0 -61
85 lines not on this page · raw message
include/hw/boards.h +0 -3
@@ -63,9 +63,6 @@ extern MachineState *current_machine;void machine_run_board_init (MachineState *machine);bool machine_usb (MachineState *machine); -bool machine_kernel_irqchip_allowed (MachineState *machine); -bool machine_kernel_irqchip_required (MachineState *machine); -bool machine_kernel_irqchip_split (MachineState *machine);int machine_phandle_start (MachineState *machine);bool machine_dump_guest_core (MachineState *machine);bool machine_mem_merge (MachineState *machine);
qemu-options.hx +6 -3
@@ -32,7 +32,6 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \ " selects emulated machine ('-machine help' for list)\n" " property accel=accel1[:accel2[:...]] selects accelerator\n" " supported accelerators are kvm, xen, hax, hvf, whpx or tcg (default: tcg)\n" - " kernel_irqchip=on|off|split controls accelerated irqchip support (default=off)\n" " vmport=on|off|auto controls emulation of vmport (default: auto)\n" " dump-guest-core=on|off include guest memory in a core dump (default=on)\n" " mem-merge=on|off controls memory merge support (default: on)\n"
@@ -67,8 +66,6 @@ This is used to enable an accelerator. Depending on the target architecture, kvm, xen, hax, hvf, whpx or tcg can be available. By default, tcg is used. If there is more than one accelerator specified, the next one is used if the previous one fails to initialize. -@item kernel_irqchip=on|off -Controls in-kernel irqchip support for the chosen accelerator when available. @item vmport=on|off|auto Enables emulation of VMWare IO port, for vmmouse etc. auto says to select the value based on accel. For accel=xen the default is off otherwise the default
@@ -115,6 +112,7 @@ DEF("accel", HAS_ARG, QEMU_OPTION_accel, "-accel [accel=]accelerator[,prop[=value][,...]]\n" " select accelerator (kvm, xen, hax, hvf, whpx or tcg; use 'help' for a list)\n" " igd-passthru=on|off (enable Xen integrated Intel graphics passthrough, default=off)\n" + " kernel-irqchip=on|off|split controls accelerated irqchip support (default=on)\n" " kvm-shadow-mem=size of KVM shadow MMU in bytes\n" " tb-size=n (TCG translation block cache size)\n" " thread=single|multi (enable multi-threaded TCG)\n", QEMU_ARCH_ALL)
@@ -129,6 +127,11 @@ fails to initialize. @item igd-passthru=on|off When Xen is in use, this option controls whether Intel integrated graphics devices can be passed through to the guest (default=off) +@item kernel-irqchip=on|off|split +Controls KVM in-kernel irqchip support. The default is full acceleration of the +interrupt controllers. On x86, split irqchip reduces the kernel attack +surface, at a performance cost for non-MSI interrupts. Disabling the in-kernel +irqchip completely is not recommended except for debugging purposes. @item kvm-shadow-mem=size Defines the size of the KVM shadow MMU. @item tb-size=@var{n}
vl.c +2 -1
@@ -2639,7 +2639,8 @@ static int machine_set_property(void *opaque,object_register_sugar_prop (ACCEL_CLASS_NAME ("xen" ), qom_name, value);return 0 ; } -if (g_str_equal (qom_name,"kvm-shadow-mem" )) { +if (g_str_equal (qom_name,"kvm-shadow-mem" ) || +g_str_equal (qom_name,"kernel-irqchip" )) {object_register_sugar_prop (ACCEL_CLASS_NAME ("kvm" ), qom_name, value);return 0 ; }
Signature · 1 line
1.8.3.1
[PULL 20/62] vl: warn for unavailable accelerators, clarify messages
In reply to Paolo BonziniSo far, specifying an accelerator that was not compiled in did not result in an error; fix that.
While at it, clarify the mysterious "Back to TCG" message.
--- vl.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
vl.c +6 -1
@@ -2848,6 +2848,8 @@ static int do_configure_accelerator(void *opaque, QemuOpts *opts, Error **errp)int ret;if (!ac) { + *p_init_failed = true; +error_report ("invalid accelerator %s" , acc);return 0 ; } ret =accel_init_machine (ac, current_machine);
@@ -2902,6 +2904,9 @@ static void configure_accelerators(const char *progname)*/ if (accel_find (*tmp)) {qemu_opts_parse_noisily (qemu_find_opts ("accel" ), *tmp, true); + }else { + init_failed = true; +error_report ("invalid accelerator %s" , *tmp); } } }else {
@@ -2921,7 +2926,7 @@ static void configure_accelerators(const char *progname)if (init_failed) {AccelClass *ac =ACCEL_GET_CLASS (current_machine->accelerator); -error_report ("Back to %s accelerator" , ac->name); +error_report ("falling back to %s" , ac->name); }if (use_icount && !(tcg_enabled () ||qtest_enabled ())) {
Signature · 1 line
1.8.3.1
[PULL 38/62] tests: skip block layer tests if !CONFIG_TOOLS
In reply to Paolo BonziniFrom: Marc-André Lureau <[email protected]>
The block tests, as well as ahci-test needs qemu-img. Do not run them if it wasn't built.
--- tests/Makefile.include | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tests/Makefile.include +3 -1
@@ -169,7 +169,7 @@ check-qtest-pci-$(CONFIG_IVSHMEM_DEVICE) += tests/ivshmem-test$(EXESUF) check-qtest-i386-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF) check-qtest-i386-y += tests/fdc-test$(EXESUF) check-qtest-i386-y += tests/ide-test$(EXESUF) -check-qtest-i386-y += tests/ahci-test$(EXESUF) +check-qtest-i386-$(CONFIG_TOOLS) += tests/ahci-test$(EXESUF) check-qtest-i386-y += tests/hd-geo-test$(EXESUF) check-qtest-i386-y += tests/boot-order-test$(EXESUF) check-qtest-i386-y += tests/bios-tables-test$(EXESUF)
@@ -1193,7 +1193,9 @@ check-acceptance: check-venv $(TESTS_RESULTS_DIR) .PHONY: check-block check-qapi-schema check-qtest check-unit check check-clean check-qapi-schema: check-tests/qapi-schema/frontend check-tests/qapi-schema/doc-good.texi check-qtest: $(patsubst %,check-qtest-%, $(QTEST_TARGETS)) +ifeq ($(CONFIG_TOOLS),y) check-block: $(patsubst %,check-%, $(check-block-y)) +endif check: check-block check-qapi-schema check-unit check-softfloat check-qtest check-decodetree check-clean: rm -rf $(check-unit-y) tests/*.o $(QEMU_IOTESTS_HELPERS-y)
Signature · 1 line
1.8.3.1
[PULL 34/62] migration: fix maybe-uninitialized warning
In reply to Paolo BonziniFrom: Marc-André Lureau <[email protected]>
../migration/ram.c: In function ‘multifd_recv_thread’:/home/elmarco/src/qq/include/qapi/error.h:165:5: error: ‘block’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
165 | error_setg_internal((errp), __FILE__, __LINE__, __func__, \
| ^~~~~~~~~~~~~~~~~~~
../migration/ram.c:818:15: note: ‘block’ was declared here
818 | RAMBlock *block;
| ^~~~~--- migration/ram.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
migration/ram.c +11 -9
@@ -864,15 +864,17 @@ static int multifd_recv_unfill_packet(MultiFDRecvParams *p, Error **errp) p->next_packet_size =be32_to_cpu (packet->next_packet_size); p->packet_num =be64_to_cpu (packet->packet_num); -if (p->pages->used) { -/* make sure that ramblock is 0 terminated */ - packet->ramblock[255 ] =0 ; - block =qemu_ram_block_by_name (packet->ramblock); -if (!block) { -error_setg (errp,"multifd: unknown ram block %s" , - packet->ramblock); -return -1 ; - } +if (p->pages->used ==0 ) { +return 0 ; + } + +/* make sure that ramblock is 0 terminated */ + packet->ramblock[255 ] =0 ; + block =qemu_ram_block_by_name (packet->ramblock); +if (!block) { +error_setg (errp,"multifd: unknown ram block %s" , + packet->ramblock); +return -1 ; }for (i =0 ; i < p->pages->used; i++) {
Signature · 1 line
1.8.3.1
[PULL 33/62] build-sys: do not include Windows SLIRP dependencies in $LIBS
In reply to Paolo BonziniWhen including the internal SLIRP library, we should add all the libraries that it needs for the build. Right now they are all included by QEMU, but -liphlpapi is not needed without slirp. Move it from LIBS to slirp_libs.
Based on a patch by Marc-André Lureau.
--- configure | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
configure +4 -1
@@ -926,7 +926,7 @@ if test "$mingw32" = "yes" ; then DSOSUF=".dll" # MinGW needs -mthreads for TLS and macro _MT. QEMU_CFLAGS="-mthreads $QEMU_CFLAGS" - LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS" + LIBS="-lwinmm -lws2_32 $LIBS" write_c_skeleton; if compile_prog "" "-liberty" ; then LIBS="-liberty $LIBS"
@@ -6053,6 +6053,9 @@ case "$slirp" in mkdir -p slirp slirp_cflags="-I\$(SRC_PATH)/slirp/src -I\$(BUILD_DIR)/slirp/src" slirp_libs="-L\$(BUILD_DIR)/slirp -lslirp" + if test "$mingw32" = "yes" ; then + slirp_libs="$slirp_libs -lws2_32 -liphlpapi" + fi ;; system)
Signature · 1 line
1.8.3.1
[PULL 22/62] qom: add object_new_with_class
In reply to Paolo BonziniSimilar to CPU and machine classes, "-accel" class names are mangled, so we have to first get a class via accel_find and then instantiate it. Provide a new function to instantiate a class without going through object_class_get_name, and use it for CPUs and machines already.
--- accel/accel.c | 4 +--- include/qom/object.h | 12 ++++++++++++ qom/object.c | 5 +++++ target/i386/cpu.c | 8 ++++---- target/s390x/cpu_models.c | 4 ++-- vl.c | 3 +-- 6 files changed, 25 insertions(+), 11 deletions(-)
accel/accel.c +1 -3
@@ -48,9 +48,7 @@ AccelClass *accel_find(const char *opt_name)int accel_init_machine (AccelClass *acc,MachineState *ms) { -ObjectClass *oc =OBJECT_CLASS (acc); -const char *cname =object_class_get_name (oc); -AccelState *accel =ACCEL (object_new (cname)); +AccelState *accel =ACCEL (object_new_with_class (OBJECT_CLASS (acc)));int ret; ms->accelerator = accel; *(acc->allowed) = true;
include/qom/object.h +12 -0
@@ -593,6 +593,18 @@ struct InterfaceClass __FILE__, __LINE__, __func__))/** +* object_new_with_class: +* @klass: The class to instantiate. +* +* This function will initialize a new object using heap allocated memory. +* The returned object has a reference count of 1, and will be freed when +* the last reference is dropped. +* +* Returns: The newly allocated and instantiated object. +*/ +Object *object_new_with_class (ObjectClass *klass); + +/** * object_new: * @typename: The name of the type of the object to instantiate. *
qom/object.c +5 -0
@@ -658,6 +658,11 @@ static Object *object_new_with_type(Type type)return obj; } +Object *object_new_with_class (ObjectClass *klass) +{ +return object_new_with_type (klass->type); +} +Object *object_new (const char *typename) {TypeImpl *ti =type_get_by_name (typename);
target/i386/cpu.c +4 -4
@@ -4640,7 +4640,7 @@ static void x86_cpu_class_check_missing_features(X86CPUClass *xcc,return ; } - xc =X86_CPU (object_new (object_class_get_name (OBJECT_CLASS (xcc)))); + xc =X86_CPU (object_new_with_class (OBJECT_CLASS (xcc)));x86_cpu_expand_features (xc, &err);if (err) {
@@ -4711,7 +4711,7 @@ static GSList *get_sorted_cpu_model_list(void)static char *x86_cpu_class_get_model_id (X86CPUClass *xc) { -Object *obj =object_new (object_class_get_name (OBJECT_CLASS (xc))); +Object *obj =object_new_with_class (OBJECT_CLASS (xc));char *r =object_property_get_str (obj,"model-id" , &error_abort);object_unref (obj);return r;
@@ -5092,7 +5092,7 @@ static X86CPU *x86_cpu_from_model(const char *model, QDict *props, Error **errp) goto out; } - xc =X86_CPU (object_new (object_class_get_name (OBJECT_CLASS (xcc)))); + xc =X86_CPU (object_new_with_class (OBJECT_CLASS (xcc)));if (props) {object_apply_props (OBJECT (xc), props, &err);if (err) {
@@ -5936,7 +5936,7 @@ static void x86_cpu_apic_create(X86CPU *cpu, Error **errp)APICCommonState *apic;ObjectClass *apic_class =OBJECT_CLASS (apic_get_class ()); - cpu->apic_state =DEVICE (object_new (object_class_get_name (apic_class))); + cpu->apic_state =DEVICE (object_new_with_class (apic_class));object_property_add_child (OBJECT (cpu),"lapic" ,OBJECT (cpu->apic_state), &error_abort);
target/s390x/cpu_models.c +2 -2
@@ -440,7 +440,7 @@ static void create_cpu_model_list(ObjectClass *klass, void *opaque)if (cpu_list_data->model) {Object *obj;S390CPU *sc; - obj =object_new (object_class_get_name (klass)); + obj =object_new_with_class (klass); sc =S390_CPU (obj);if (sc->model) { info->has_unavailable_features = true;
@@ -501,7 +501,7 @@ static void cpu_model_from_info(S390CPUModel *model, const CpuModelInfo *info,error_setg (errp,"The CPU definition '%s' requires KVM" , info->name);return ; } - obj =object_new (object_class_get_name (oc)); + obj =object_new_with_class (oc); cpu =S390_CPU (obj);if (!cpu->model) {
vl.c +1 -2
@@ -3966,8 +3966,7 @@ int main(int argc, char **argv, char **envp) cleanup_add_fd, NULL, &error_fatal);#endif - current_machine =MACHINE (object_new (object_class_get_name ( -OBJECT_CLASS (machine_class)))); + current_machine =MACHINE (object_new_with_class (OBJECT_CLASS (machine_class)));if (machine_help_func (qemu_get_machine_opts (), current_machine)) {exit (0 ); }
Signature · 1 line
1.8.3.1
[PULL 35/62] monitor: fix maybe-uninitialized
In reply to Paolo BonziniFrom: Marc-André Lureau <[email protected]>
../monitor/misc.c: In function ‘mon_get_cpu_sync’:/home/elmarco/src/qq/include/sysemu/hw_accel.h:22:9: error: ‘cpu’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
22 | kvm_cpu_synchronize_state(cpu);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~../monitor/misc.c:397:15: note: ‘cpu’ was declared here
397 | CPUState *cpu;
| ^~~
--- monitor/misc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
monitor/misc.c +2 -1
@@ -394,7 +394,7 @@ int monitor_set_cpu(int cpu_index)/* Callers must hold BQL. */ static CPUState *mon_get_cpu_sync (bool synchronize) { -CPUState *cpu; +CPUState *cpu =NULL ;if (cur_mon->mon_cpu_path) { cpu = (CPUState *) object_resolve_path_type(cur_mon->mon_cpu_path,
@@ -411,6 +411,7 @@ static CPUState *mon_get_cpu_sync(bool synchronize)monitor_set_cpu (first_cpu->cpu_index); cpu = first_cpu; } +assert (cpu !=NULL );if (synchronize) {cpu_synchronize_state (cpu); }
Signature · 1 line
1.8.3.1
[PULL 40/62] crypto: move common bits for all emulators to libqemuutil
In reply to Paolo Bonziniqcrypto_random_*, AES and qcrypto_init do not need to be linked as a whole and are the only parts that are used by user-mode emulation. Place them in libqemuutil, so that whatever needs them will pick them up automatically.
--- Makefile | 3 +-- Makefile.objs | 3 +-- Makefile.target | 2 -- crypto/Makefile.objs | 12 +++++------- 4 files changed, 7 insertions(+), 13 deletions(-)
Makefile +1 -2
@@ -436,7 +436,6 @@ dummy := $(call unnest-vars,, \ block-obj-y \ block-obj-m \ crypto-obj-y \ - crypto-user-obj-y \ qom-obj-y \ io-obj-y \ common-obj-y \
@@ -524,7 +523,7 @@ subdir-capstone: capstone/all subdir-slirp: slirp/all $(filter %/all, $(TARGET_DIRS_RULES)): libqemuutil.a $(common-obj-y) \ - $(qom-obj-y) $(crypto-user-obj-$(CONFIG_USER_ONLY)) + $(qom-obj-y) ROM_DIRS = $(addprefix pc-bios/, $(ROMS)) ROM_DIRS_RULES=$(foreach t, all clean, $(addsuffix /$(t), $(ROM_DIRS)))
Makefile.objs +1 -2
@@ -1,7 +1,7 @@ ####################################################################### # Common libraries for tools and emulators stub-obj-y = stubs/ util/ crypto/ -util-obj-y = util/ qobject/ qapi/ +util-obj-y = crypto/ util/ qobject/ qapi/ chardev-obj-y = chardev/
@@ -25,7 +25,6 @@ block-obj-m = block/ # crypto-obj-y is code used by both qemu system emulation and qemu-img crypto-obj-y = crypto/ -crypto-user-obj-y = crypto/ ####################################################################### # qom-obj-y is code used by both qemu system emulation and qemu-img
Makefile.target +0 -2
@@ -184,7 +184,6 @@ dummy := $(call unnest-vars,.., \ block-obj-m \ chardev-obj-y \ crypto-obj-y \ - crypto-user-obj-y \ qom-obj-y \ io-obj-y \ common-obj-y \
@@ -193,7 +192,6 @@ all-obj-y += $(common-obj-y) all-obj-y += $(qom-obj-y) all-obj-$(CONFIG_SOFTMMU) += $(authz-obj-y) all-obj-$(CONFIG_SOFTMMU) += $(block-obj-y) $(chardev-obj-y) -all-obj-$(CONFIG_USER_ONLY) += $(crypto-user-obj-y) all-obj-$(CONFIG_SOFTMMU) += $(crypto-obj-y) all-obj-$(CONFIG_SOFTMMU) += $(io-obj-y)
crypto/Makefile.objs +5 -7
@@ -19,10 +19,6 @@ crypto-obj-y += tlscredspsk.o crypto-obj-y += tlscredsx509.o crypto-obj-y += tlssession.o crypto-obj-y += secret.o -crypto-rng-obj-$(CONFIG_GCRYPT) += random-gcrypt.o -crypto-rng-obj-$(if $(CONFIG_GCRYPT),n,$(CONFIG_GNUTLS)) += random-gnutls.o -crypto-rng-obj-$(if $(CONFIG_GCRYPT),n,$(if $(CONFIG_GNUTLS),n,y)) += random-platform.o -crypto-obj-y += $(crypto-rng-obj-y) crypto-obj-y += pbkdf.o crypto-obj-$(CONFIG_NETTLE) += pbkdf-nettle.o crypto-obj-$(if $(CONFIG_NETTLE),n,$(CONFIG_GCRYPT)) += pbkdf-gcrypt.o
@@ -36,7 +32,9 @@ crypto-obj-y += block.o crypto-obj-y += block-qcow.o crypto-obj-y += block-luks.o -# Let the userspace emulators avoid linking stuff they won't use. -crypto-user-obj-y = aes.o $(crypto-rng-obj-y) init.o - stub-obj-y += pbkdf-stub.o + +util-obj-$(CONFIG_GCRYPT) += random-gcrypt.o +util-obj-$(if $(CONFIG_GCRYPT),n,$(CONFIG_GNUTLS)) += random-gnutls.o +util-obj-$(if $(CONFIG_GCRYPT),n,$(if $(CONFIG_GNUTLS),n,y)) += random-platform.o +util-obj-y += aes.o init.o
Signature · 1 line
1.8.3.1
[PULL 41/62] stubs: replace stubs with lnot if applicable
In reply to Paolo BonziniThe stubs mechanism relies on static libraries and compilation order, which is a bit brittle and should be avoided unless necessary. Replace it with Boolean operations on CONFIG_* symbols.
--- Makefile.objs | 2 +- crypto/Makefile.objs | 3 +-- util/Makefile.objs | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-)
Makefile.objs +1 -1
@@ -1,6 +1,6 @@ ####################################################################### # Common libraries for tools and emulators -stub-obj-y = stubs/ util/ crypto/ +stub-obj-y = stubs/ util-obj-y = crypto/ util/ qobject/ qapi/ chardev-obj-y = chardev/
crypto/Makefile.objs +1 -2
@@ -22,6 +22,7 @@ crypto-obj-y += secret.o crypto-obj-y += pbkdf.o crypto-obj-$(CONFIG_NETTLE) += pbkdf-nettle.o crypto-obj-$(if $(CONFIG_NETTLE),n,$(CONFIG_GCRYPT)) += pbkdf-gcrypt.o +crypto-obj-$(if $(CONFIG_NETTLE),n,$(if $(CONFIG_GCRYPT),n,y)) += pbkdf-stub.o crypto-obj-y += ivgen.o crypto-obj-y += ivgen-essiv.o crypto-obj-y += ivgen-plain.o
@@ -32,8 +33,6 @@ crypto-obj-y += block.o crypto-obj-y += block-qcow.o crypto-obj-y += block-luks.o -stub-obj-y += pbkdf-stub.o - util-obj-$(CONFIG_GCRYPT) += random-gcrypt.o util-obj-$(if $(CONFIG_GCRYPT),n,$(CONFIG_GNUTLS)) += random-gnutls.o util-obj-$(if $(CONFIG_GCRYPT),n,$(if $(CONFIG_GNUTLS),n,y)) += random-platform.o
util/Makefile.objs +1 -2
@@ -52,8 +52,7 @@ util-obj-y += stats64.o util-obj-y += systemd.o util-obj-y += iova-tree.o util-obj-$(CONFIG_INOTIFY1) += filemonitor-inotify.o +util-obj-$(call lnot,$(CONFIG_INOTIFY1)) += filemonitor-stub.o util-obj-$(CONFIG_LINUX) += vfio-helpers.o util-obj-$(CONFIG_POSIX) += drm.o util-obj-y += guest-random.o - -stub-obj-y += filemonitor-stub.o
Signature · 1 line
1.8.3.1
[PULL 23/62] accel: pass object to accel_init_machine
In reply to Paolo BonziniWe will have to set QOM properties before accel_init_machine, based on the options provided to -accel. Construct the object outside it so that it will be possible to iterate on properties between object_new_with_class and accel_init_machine.
--- accel/accel.c | 4 ++-- include/sysemu/accel.h | 2 +- vl.c | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-)
accel/accel.c +2 -2
@@ -46,9 +46,9 @@ AccelClass *accel_find(const char *opt_name)return ac; } -int accel_init_machine (AccelClass *acc,MachineState *ms) +int accel_init_machine (AccelState *accel,MachineState *ms) { -AccelState *accel =ACCEL (object_new_with_class (OBJECT_CLASS (acc))); +AccelClass *acc =ACCEL_GET_CLASS (accel);int ret; ms->accelerator = accel; *(acc->allowed) = true;
include/sysemu/accel.h +1 -1
@@ -67,7 +67,7 @@ typedef struct AccelClass {extern unsigned long tcg_tb_size;AccelClass *accel_find (const char *opt_name); -int accel_init_machine (AccelClass *acc,MachineState *ms); +int accel_init_machine (AccelState *accel,MachineState *ms);/* Called just before os_setup_post (ie just before drop OS privs) */ void accel_setup_post (MachineState *ms);
vl.c +3 -1
@@ -2841,6 +2841,7 @@ static int do_configure_accelerator(void *opaque, QemuOpts *opts, Error **errp)bool *p_init_failed = opaque;const char *acc =qemu_opt_get (opts,"accel" );AccelClass *ac =accel_find (acc); +AccelState *accel;int ret;if (!ac) {
@@ -2848,7 +2849,8 @@ static int do_configure_accelerator(void *opaque, QemuOpts *opts, Error **errp)error_report ("invalid accelerator %s" , acc);return 0 ; } - ret =accel_init_machine (ac, current_machine); + accel =ACCEL (object_new_with_class (OBJECT_CLASS (ac))); + ret =accel_init_machine (accel, current_machine);if (ret <0 ) { *p_init_failed = true; error_report("failed to initialize %s: %s",
Signature · 1 line
1.8.3.1
[PULL 46/62] hw: replace hw/i386/pc.h with a header just for the i8259
In reply to Paolo BonziniRemove the need to include i386/pc.h to get to the i8259 functions. This is enough to remove the inclusion of hw/i386/pc.h from all non-x86 files.
--- hw/alpha/alpha_sys.h | 3 ++- hw/alpha/dp264.c | 1 + hw/hppa/hppa_sys.h | 3 ++- hw/hppa/machine.c | 1 + hw/i386/kvm/i8259.c | 1 + hw/i386/microvm.c | 1 + hw/i386/pc.c | 1 + hw/i386/x86.c | 1 + hw/input/pckbd.c | 1 - hw/intc/Kconfig | 2 ++ hw/intc/apic.c | 2 +- hw/intc/i8259.c | 2 +- hw/intc/i8259_common.c | 2 +- hw/intc/ioapic.c | 3 ++- hw/isa/i82378.c | 2 +- hw/isa/lpc_ich9.c | 1 - hw/isa/piix4.c | 2 +- hw/mips/gt64xxx_pci.c | 2 +- hw/mips/mips_fulong2e.c | 2 +- hw/mips/mips_jazz.c | 2 +- hw/mips/mips_r4k.c | 2 +- hw/pci-host/bonito.c | 1 - hw/pci-host/prep.c | 2 +- include/hw/i386/pc.h | 8 -------- include/hw/intc/i8259.h | 12 ++++++++++++ include/hw/isa/i8259_internal.h | 2 +- target/i386/monitor.c | 1 - 27 files changed, 37 insertions(+), 26 deletions(-) create mode 100644 include/hw/intc/i8259.h
hw/alpha/alpha_sys.h +2 -1
@@ -7,7 +7,8 @@#include "hw/pci/pci.h" #include "hw/pci/pci_host.h" #include "hw/ide.h" -#include "hw/i386/pc.h" +#include "hw/boards.h" +#include "hw/intc/i8259.h" PCIBus *typhoon_init(ram_addr_t, ISABus **, qemu_irq *, AlphaCPU *[4],
hw/alpha/dp264.c +1 -0
@@ -19,6 +19,7 @@#include "hw/timer/i8254.h" #include "hw/isa/superio.h" #include "hw/dma/i8257.h" +#include "net/net.h" #include "qemu/cutils.h" #define MAX_IDE_BUS 2
hw/hppa/hppa_sys.h +2 -1
@@ -6,7 +6,8 @@#include "hw/pci/pci.h" #include "hw/pci/pci_host.h" #include "hw/ide.h" -#include "hw/i386/pc.h" +#include "hw/boards.h" +#include "hw/intc/i8259.h" #include "hppa_hardware.h"
hw/hppa/machine.c +1 -0
@@ -19,6 +19,7 @@#include "hppa_sys.h" #include "qemu/units.h" #include "qapi/error.h" +#include "net/net.h" #include "qemu/log.h" #define MAX_IDE_BUS 2
hw/i386/kvm/i8259.c +1 -0
@@ -12,6 +12,7 @@#include "qemu/osdep.h" #include "hw/isa/i8259_internal.h" +#include "hw/intc/i8259.h" #include "qemu/module.h" #include "hw/i386/apic_internal.h" #include "hw/irq.h"
hw/i386/microvm.c +1 -0
@@ -34,6 +34,7 @@#include "hw/i386/x86.h" #include "hw/i386/pc.h" #include "target/i386/cpu.h" +#include "hw/intc/i8259.h" #include "hw/timer/i8254.h" #include "hw/rtc/mc146818rtc.h" #include "hw/char/serial.h"
hw/i386/pc.c +1 -0
@@ -44,6 +44,7 @@#include "migration/vmstate.h" #include "multiboot.h" #include "hw/rtc/mc146818rtc.h" +#include "hw/intc/i8259.h" #include "hw/dma/i8257.h" #include "hw/timer/i8254.h" #include "hw/input/i8042.h"
hw/i386/x86.c +1 -0
@@ -39,6 +39,7 @@#include "target/i386/cpu.h" #include "hw/i386/topology.h" #include "hw/i386/fw_cfg.h" +#include "hw/intc/i8259.h" #include "hw/acpi/cpu_hotplug.h" #include "hw/nmi.h"
hw/input/pckbd.c +0 -1
@@ -26,7 +26,6 @@#include "qemu/log.h" #include "hw/isa/isa.h" #include "migration/vmstate.h" -#include "hw/i386/pc.h" #include "hw/input/ps2.h" #include "hw/irq.h" #include "hw/input/i8042.h"
hw/intc/Kconfig +2 -0
@@ -9,6 +9,7 @@ config PL190 config IOAPIC bool + select I8259 config ARM_GIC bool
@@ -21,6 +22,7 @@ config OPENPIC config APIC bool select MSI_NONBROKEN + select I8259 config ARM_GIC_KVM bool
hw/intc/apic.c +1 -1
@@ -22,10 +22,10 @@#include "hw/i386/apic_internal.h" #include "hw/i386/apic.h" #include "hw/i386/ioapic.h" +#include "hw/intc/i8259.h" #include "hw/pci/msi.h" #include "qemu/host-utils.h" #include "trace.h" -#include "hw/i386/pc.h" #include "hw/i386/apic-msidef.h" #include "qapi/error.h"
hw/intc/i8259.c +1 -1
@@ -23,7 +23,7 @@*/ #include "qemu/osdep.h" -#include "hw/i386/pc.h" +#include "hw/intc/i8259.h" #include "hw/irq.h" #include "hw/isa/isa.h" #include "qemu/timer.h"
hw/intc/i8259_common.c +1 -1
@@ -24,7 +24,7 @@*/ #include "qemu/osdep.h" -#include "hw/i386/pc.h" +#include "hw/intc/i8259.h" #include "hw/isa/i8259_internal.h" #include "hw/qdev-properties.h" #include "migration/vmstate.h"
hw/intc/ioapic.c +2 -1
@@ -23,10 +23,11 @@#include "qemu/osdep.h" #include "qapi/error.h" #include "monitor/monitor.h" -#include "hw/i386/pc.h" #include "hw/i386/apic.h" #include "hw/i386/ioapic.h" #include "hw/i386/ioapic_internal.h" +#include "hw/i386/x86.h" +#include "hw/intc/i8259.h" #include "hw/pci/msi.h" #include "hw/qdev-properties.h" #include "sysemu/kvm.h"
hw/isa/i82378.c +1 -1
@@ -19,8 +19,8 @@#include "qemu/osdep.h" #include "hw/pci/pci.h" -#include "hw/i386/pc.h" #include "hw/irq.h" +#include "hw/intc/i8259.h" #include "hw/timer/i8254.h" #include "migration/vmstate.h" #include "hw/audio/pcspk.h"
hw/isa/lpc_ich9.c +0 -1
@@ -35,7 +35,6 @@#include "hw/isa/isa.h" #include "hw/sysbus.h" #include "migration/vmstate.h" -#include "hw/i386/pc.h" #include "hw/irq.h" #include "hw/isa/apm.h" #include "hw/i386/ioapic.h"
hw/isa/piix4.c +1 -1
@@ -26,11 +26,11 @@#include "qemu/osdep.h" #include "qapi/error.h" #include "hw/irq.h" -#include "hw/i386/pc.h" #include "hw/southbridge/piix.h" #include "hw/pci/pci.h" #include "hw/isa/isa.h" #include "hw/sysbus.h" +#include "hw/intc/i8259.h" #include "hw/dma/i8257.h" #include "hw/timer/i8254.h" #include "hw/rtc/mc146818rtc.h"
hw/mips/gt64xxx_pci.c +1 -1
@@ -30,7 +30,7 @@#include "hw/pci/pci_host.h" #include "hw/southbridge/piix.h" #include "migration/vmstate.h" -#include "hw/i386/pc.h" +#include "hw/intc/i8259.h" #include "hw/irq.h" #include "exec/address-spaces.h" #include "trace.h"
hw/mips/mips_fulong2e.c +1 -1
@@ -23,7 +23,7 @@#include "qemu/units.h" #include "qapi/error.h" #include "cpu.h" -#include "hw/i386/pc.h" +#include "hw/intc/i8259.h" #include "hw/dma/i8257.h" #include "hw/isa/superio.h" #include "net/net.h"
hw/mips/mips_jazz.c +1 -1
@@ -26,7 +26,7 @@#include "qemu-common.h" #include "hw/mips/mips.h" #include "hw/mips/cpudevs.h" -#include "hw/i386/pc.h" +#include "hw/intc/i8259.h" #include "hw/dma/i8257.h" #include "hw/char/serial.h" #include "hw/char/parallel.h"
hw/mips/mips_r4k.c +1 -1
@@ -15,7 +15,7 @@#include "cpu.h" #include "hw/mips/mips.h" #include "hw/mips/cpudevs.h" -#include "hw/i386/pc.h" +#include "hw/intc/i8259.h" #include "hw/char/serial.h" #include "hw/isa/isa.h" #include "net/net.h"
hw/pci-host/bonito.c +0 -1
@@ -40,7 +40,6 @@#include "qemu/osdep.h" #include "qemu/error-report.h" #include "hw/pci/pci.h" -#include "hw/i386/pc.h" #include "hw/irq.h" #include "hw/mips/mips.h" #include "hw/pci/pci_host.h"
hw/pci-host/prep.c +1 -1
@@ -32,7 +32,7 @@#include "hw/pci/pci_host.h" #include "hw/qdev-properties.h" #include "migration/vmstate.h" -#include "hw/i386/pc.h" +#include "hw/intc/i8259.h" #include "hw/irq.h" #include "hw/loader.h" #include "hw/or-irq.h"
include/hw/i386/pc.h +0 -8
@@ -134,14 +134,6 @@ typedef struct PCMachineClass {#define PC_MACHINE_CLASS (klass) \ OBJECT_CLASS_CHECK(PCMachineClass, (klass), TYPE_PC_MACHINE) -/* i8259.c */ - -extern DeviceState *isa_pic; -qemu_irq *i8259_init (ISABus *bus,qemu_irq parent_irq); -qemu_irq *kvm_i8259_init (ISABus *bus); -int pic_read_irq (DeviceState *d); -int pic_get_output (DeviceState *d); -/* ioapic.c */ /* Global System Interrupts */
include/hw/intc/i8259.h new file +12 -0
@@ -0,0 +1,12 @@ +#ifndef HW_I8259_H +#define HW_I8259_H + +/* i8259.c */ + +extern DeviceState *isa_pic; +qemu_irq *i8259_init (ISABus *bus,qemu_irq parent_irq); +qemu_irq *kvm_i8259_init (ISABus *bus); +int pic_get_output (DeviceState *d); +int pic_read_irq (DeviceState *d); + +#endif
include/hw/isa/i8259_internal.h +1 -1
@@ -25,9 +25,9 @@#ifndef QEMU_I8259_INTERNAL_H #define QEMU_I8259_INTERNAL_H -#include "hw/i386/pc.h" #include "hw/isa/isa.h" #include "hw/intc/intc.h" +#include "hw/intc/i8259.h" typedef struct PICCommonState PICCommonState ;
target/i386/monitor.c +0 -1
@@ -28,7 +28,6 @@#include "monitor/hmp-target.h" #include "monitor/hmp.h" #include "qapi/qmp/qdict.h" -#include "hw/i386/pc.h" #include "sysemu/kvm.h" #include "sysemu/sev.h" #include "qapi/error.h"
Signature · 1 line
1.8.3.1
[PULL 37/62] os-posix: simplify os_find_datadir
In reply to Paolo BonziniFrom: Marc-André Lureau <[email protected]>
Use g_build_filename instead of sprintf, and g_autofree instead of manual freeing.
--- os-posix.c | 41 +++++++++++++---------------------------- 1 file changed, 13 insertions(+), 28 deletions(-)
os-posix.c +13 -28
@@ -80,41 +80,26 @@ void os_setup_signal_handling(void)sigaction (SIGTERM , &act,NULL ); } -/* Find a likely location for support files using the location of the binary. -For installed binaries this will be "$bindir/../share/qemu". When -running from the build tree this will be "$bindir/../pc-bios". */ -#define SHARE_SUFFIX "/share/qemu" -#define BUILD_SUFFIX "/pc-bios" +/* +* Find a likely location for support files using the location of the binary. +* When running from the build tree this will be "$bindir/../pc-bios". +* Otherwise, this is CONFIG_QEMU_DATADIR. +*/ char *os_find_datadir (void ) { -char *dir, *exec_dir; -char *res; -size_t max_len; + g_autofree char *exec_dir = NULL; + g_autofree char *dir = NULL; exec_dir =qemu_get_exec_dir (); -if (exec_dir ==NULL ) { -return NULL ; - } - dir =g_path_get_dirname (exec_dir); - - max_len =strlen (dir) + -MAX (strlen (SHARE_SUFFIX ),strlen (BUILD_SUFFIX )) +1 ; - res =g_malloc0 (max_len); -snprintf (res, max_len,"%s%s" , dir,SHARE_SUFFIX ); -if (access (res,R_OK )) { -snprintf (res, max_len,"%s%s" , dir,BUILD_SUFFIX ); -if (access (res,R_OK )) { -g_free (res); - res =NULL ; - } +g_return_val_if_fail (exec_dir !=NULL ,NULL ); + + dir =g_build_filename (exec_dir,".." ,"pc-bios" ,NULL ); +if (g_file_test (dir,G_FILE_TEST_IS_DIR )) { +return g_steal_pointer (&dir); } -g_free (dir); -g_free (exec_dir); -return res; +return g_strdup (CONFIG_QEMU_DATADIR ); } -#undef SHARE_SUFFIX -#undef BUILD_SUFFIXvoid os_set_proc_name (const char *s) {
Signature · 1 line
1.8.3.1
[PULL 45/62] fw_cfg: allow building without other devices
In reply to Paolo BonziniThe microvm machine type uses fw_cfg but lacks SMBIOS and ACPI. Do not include the files if the symbol is not present in QEMU and remove dependencies on machine-specific files.
--- hw/i386/fw_cfg.c | 7 +++++++ hw/i386/pc.c | 2 -- 2 files changed, 7 insertions(+), 2 deletions(-)
hw/i386/fw_cfg.c +7 -0
@@ -22,6 +22,9 @@#include "hw/nvram/fw_cfg.h" #include "e820_memory_layout.h" #include "kvm_i386.h" +#include "config-devices.h" + +struct hpet_fw_config hpet_cfg = {.count =UINT8_MAX };const char *fw_cfg_arch_key_name (uint16_t key) {
@@ -46,6 +49,7 @@ const char *fw_cfg_arch_key_name(uint16_t key)void fw_cfg_build_smbios (MachineState *ms,FWCfgState *fw_cfg) { +#ifdef CONFIG_SMBIOS uint8_t *smbios_tables, *smbios_anchor;size_t smbios_tables_len, smbios_anchor_len;struct smbios_phys_mem_area *mem_array;
@@ -83,6 +87,7 @@ void fw_cfg_build_smbios(MachineState *ms, FWCfgState *fw_cfg)fw_cfg_add_file (fw_cfg,"etc/smbios/smbios-anchor" , smbios_anchor, smbios_anchor_len); } +#endif } FWCfgState *fw_cfg_arch_create(MachineState *ms,
@@ -114,8 +119,10 @@ FWCfgState *fw_cfg_arch_create(MachineState *ms,*/ fw_cfg_add_i16 (fw_cfg,FW_CFG_MAX_CPUS , apic_id_limit);fw_cfg_add_i64 (fw_cfg,FW_CFG_RAM_SIZE , (uint64_t )ram_size); +#ifdef CONFIG_ACPI fw_cfg_add_bytes (fw_cfg,FW_CFG_ACPI_TABLES , acpi_tables, acpi_tables_len); +#endif fw_cfg_add_i32 (fw_cfg,FW_CFG_IRQ0_OVERRIDE ,kvm_allows_irq0_override ()); fw_cfg_add_bytes(fw_cfg, FW_CFG_E820_TABLE,
hw/i386/pc.c +0 -2
@@ -101,8 +101,6 @@#define DPRINTF (fmt, ...)#endif -struct hpet_fw_config hpet_cfg = {.count =UINT8_MAX }; -GlobalProperty pc_compat_4_1[] = {};const size_t pc_compat_4_1_len =G_N_ELEMENTS (pc_compat_4_1);
Signature · 1 line
1.8.3.1
[PULL 25/62] tcg: add "-accel tcg,tb-size" and deprecate "-tb-size"
In reply to Paolo Bonzini-tb-size fits nicely in the new framework for accelerator-specific options. It is a very niche option, so insta-deprecate it.
--- accel/tcg/tcg-all.c | 40 +++++++++++++++++++++++++++++++++++++--- include/sysemu/accel.h | 2 -- qemu-deprecated.texi | 6 ++++++ qemu-options.hx | 8 ++++++-- vl.c | 8 ++++---- 5 files changed, 53 insertions(+), 11 deletions(-)
accel/tcg/tcg-all.c +37 -3
@@ -34,11 +34,13 @@#include "include/qapi/error.h" #include "include/qemu/error-report.h" #include "include/hw/boards.h" +#include "qapi/qapi-builtin-visit.h" typedef struct TCGState {AccelState parent_obj;bool mttcg_enabled; +unsigned long tb_size; }TCGState ;#define TYPE_TCG_ACCEL ACCEL_CLASS_NAME("tcg")
@@ -46,8 +48,6 @@ typedef struct TCGState {#define TCG_STATE (obj) \ OBJECT_CHECK(TCGState, (obj), TYPE_TCG_ACCEL) -unsigned long tcg_tb_size; -/* mask must never be zero, except for A20 change call */ static void tcg_handle_interrupt (CPUState *cpu,int mask) {
@@ -126,7 +126,7 @@ static int tcg_init(MachineState *ms) {TCGState *s =TCG_STATE (current_machine->accelerator); -tcg_exec_init (tcg_tb_size *1024 *1024 ); +tcg_exec_init (s->tb_size *1024 *1024 ); cpu_interrupt_handler = tcg_handle_interrupt; mttcg_enabled = s->mttcg_enabled;return 0 ;
@@ -167,6 +167,33 @@ static void tcg_set_thread(Object *obj, const char *value, Error **errp) } } +static void tcg_get_tb_size (Object *obj,Visitor *v, +const char *name,void *opaque, +Error **errp) +{ +TCGState *s =TCG_STATE (obj); +uint32_t value = s->tb_size; + +visit_type_uint32 (v, name, &value, errp); +} + +static void tcg_set_tb_size (Object *obj,Visitor *v, +const char *name,void *opaque, +Error **errp) +{ +TCGState *s =TCG_STATE (obj); +Error *error =NULL ; +uint32_t value; + +visit_type_uint32 (v, name, &value, &error); +if (error) { +error_propagate (errp, error); +return ; + } + + s->tb_size = value; +} +static void tcg_accel_class_init (ObjectClass *oc,void *data) {AccelClass *ac =ACCEL_CLASS (oc);
@@ -178,6 +205,13 @@ static void tcg_accel_class_init(ObjectClass *oc, void *data) tcg_get_thread, tcg_set_thread, NULL); + +object_class_property_add (oc,"tb-size" ,"int" , + tcg_get_tb_size, tcg_set_tb_size, +NULL ,NULL , &error_abort); +object_class_property_set_description (oc,"tb-size" , +"TCG translation block cache size" , &error_abort); + }static const TypeInfo tcg_accel_type = {
include/sysemu/accel.h +0 -2
@@ -64,8 +64,6 @@ typedef struct AccelClass {#define ACCEL_GET_CLASS (obj) \ OBJECT_GET_CLASS(AccelClass, (obj), TYPE_ACCEL) -extern unsigned long tcg_tb_size; -AccelClass *accel_find (const char *opt_name);int accel_init_machine (AccelState *accel,MachineState *ms);
qemu-deprecated.texi +6 -0
@@ -142,6 +142,12 @@ QEMU 4.1 has three options, please migrate to one of these three: to do is specify the kernel they want to boot with the -kernel option 3. ``-bios <file>`` - Tells QEMU to load the specified file as the firmwrae. +@subsection -tb-size option (since 5.0) + +QEMU 5.0 introduced an alternative syntax to specify the size of the translation +block cache, @option{-accel tcg,tb-size=}. The new syntax deprecates the +previously available @option{-tb-size} option. + @section QEMU Machine Protocol (QMP) commands @subsection change (since 2.5.0)
qemu-options.hx +6 -2
@@ -118,8 +118,9 @@ Select CPU model (@code{-cpu help} for list and additional feature selection) ETEXI DEF("accel", HAS_ARG, QEMU_OPTION_accel, - "-accel [accel=]accelerator[,thread=single|multi]\n" + "-accel [accel=]accelerator[,prop[=value][,...]]\n" " select accelerator (kvm, xen, hax, hvf, whpx or tcg; use 'help' for a list)\n" + " tb-size=n (TCG translation block cache size)\n" " thread=single|multi (enable multi-threaded TCG)\n", QEMU_ARCH_ALL) STEXI @item -accel @var{name}[,prop=@var{value}[,...]]
@@ -129,6 +130,8 @@ kvm, xen, hax, hvf, whpx or tcg can be available. By default, tcg is used. If th more than one accelerator specified, the next one is used if the previous one fails to initialize. @table @option +@item tb-size=@var{n} +Controls the size (in MiB) of the TCG translation block cache. @item thread=single|multi Controls number of TCG threads. When the TCG is multi-threaded there will be one thread per vCPU therefor taking advantage of additional host cores. The default
@@ -4002,7 +4005,8 @@ DEF("tb-size", HAS_ARG, QEMU_OPTION_tb_size, \ STEXI @item -tb-size @var{n} @findex -tb-size -Set TB size. +Set TCG translation block cache size. Deprecated, use @samp{-accel tcg,tb-size=@var{n}} +instead. ETEXI DEF("incoming", HAS_ARG, QEMU_OPTION_incoming, \
vl.c +4 -4
@@ -2852,6 +2852,7 @@ static int do_configure_accelerator(void *opaque, QemuOpts *opts, Error **errp)return 0 ; } accel =ACCEL (object_new_with_class (OBJECT_CLASS (ac))); +object_apply_compat_props (OBJECT (accel));qemu_opt_foreach (opts, accelerator_set_property, accel, &error_fatal);
@@ -2863,6 +2864,7 @@ static int do_configure_accelerator(void *opaque, QemuOpts *opts, Error **errp) acc, strerror(-ret));return 0 ; } +return 1 ; }
@@ -3722,10 +3724,8 @@ int main(int argc, char **argv, char **envp)error_report ("TCG is disabled" );exit (1 );#endif -if (qemu_strtoul (optarg,NULL ,0 , &tcg_tb_size) <0 ) { -error_report ("Invalid argument to -tb-size" ); -exit (1 ); - } +warn_report ("The -tb-size option is deprecated, use -accel tcg,tb-size instead" ); +object_register_sugar_prop (ACCEL_CLASS_NAME ("tcg" ),"tb-size" , optarg);break ;case QEMU_OPTION_icount: icount_opts = qemu_opts_parse_noisily(qemu_find_opts("icount"),
Signature · 1 line
1.8.3.1
[PULL 49/62] hw/i386/pc: Convert DPRINTF() to trace events
In reply to Paolo BonziniFrom: Philippe Mathieu-Daudé <[email protected]>
Convert the deprecated DPRINTF() macro to trace events.
--- hw/i386/pc.c | 19 +++++-------------- hw/i386/trace-events | 6 ++++++ 2 files changed, 11 insertions(+), 14 deletions(-)
hw/i386/pc.c +5 -14
@@ -91,16 +91,7 @@#include "config-devices.h" #include "e820_memory_layout.h" #include "fw_cfg.h" - -/* debug PC/ISA interrupts */ -//#define DEBUG_IRQ - -#ifdef DEBUG_IRQ -#define DPRINTF (fmt, ...) \ - do { printf("CPUIRQ: " fmt , ## __VA_ARGS__); } while (0) -#else -#define DPRINTF (fmt, ...) -#endif +#include "trace.h" GlobalProperty pc_compat_4_1[] = {};const size_t pc_compat_4_1_len =G_N_ELEMENTS (pc_compat_4_1);
@@ -347,7 +338,7 @@ void gsi_handler(void *opaque, int n, int level) {GSIState *s = opaque; -DPRINTF ("pc: %s GSI %d\n" , level ?"raising" :"lowering" , n); +trace_pc_gsi_interrupt (n, level);if (n <ISA_NUM_IRQS ) {qemu_set_irq (s->i8259_irq[n], level); }
@@ -425,7 +416,7 @@ static void pic_irq_request(void *opaque, int irq, int level)CPUState *cs = first_cpu;X86CPU *cpu =X86_CPU (cs); -DPRINTF ("pic_irqs: %s irq %d\n" , level?"raise" :"lower" , irq); +trace_pc_pic_interrupt (irq, level);if (cpu->apic_state && !kvm_irqchip_in_kernel ()) {CPU_FOREACH (cs) { cpu =X86_CPU (cs);
@@ -759,7 +750,7 @@ static void port92_write(void *opaque, hwaddr addr, uint64_t val,Port92State *s = opaque;int oldval = s->outport; -DPRINTF ("port92: write 0x%02" PRIx64"\n" , val); +trace_port92_write (val); s->outport = val;qemu_set_irq (s->a20_out, (val >>1 ) &1 );if ((val &1 ) && !(oldval &1 )) {
@@ -774,7 +765,7 @@ static uint64_t port92_read(void *opaque, hwaddr addr,uint32_t ret; ret = s->outport; -DPRINTF ("port92: read 0x%02x\n" , ret); +trace_port92_read (ret);return ret; }
hw/i386/trace-events +6 -0
@@ -111,3 +111,9 @@ amdvi_ir_irte_ga_val(uint64_t hi, uint64_t lo) "hi 0x%"PRIx64" lo 0x%"PRIx64 # vmport.c vmport_register(unsigned char command, void *func, void *opaque) "command: 0x%02x func: %p opaque: %p" vmport_command(unsigned char command) "command: 0x%02x" + +# pc.c +pc_gsi_interrupt(int irqn, int level) "GSI interrupt #%d level:%d" +pc_pic_interrupt(int irqn, int level) "PIC interrupt #%d level:%d" +port92_read(uint8_t val) "port92: read 0x%02x" +port92_write(uint8_t val) "port92: write 0x%02x"
Signature · 1 line
1.8.3.1
[PULL 39/62] libvixl: remove per-target compiler flags
In reply to Paolo BonziniWe are already including -D__STDC_LIMIT_MACROS in the global CXXFLAGS, so it makes sense to do the same for -D__STDC_CONSTANT_MACROS and -D__STDC_FORMAT_MACROS instead of limiting that to libvixl.
The -Wno-sign-compare option can also be removed since GCC 4.6 is not supported anymore.
--- configure | 3 ++- disas/libvixl/Makefile.objs | 11 +---------- 2 files changed, 3 insertions(+), 11 deletions(-)
configure +2 -1
@@ -101,7 +101,7 @@ update_cxxflags() { # Set QEMU_CXXFLAGS from QEMU_CFLAGS by filtering out those # options which some versions of GCC's C++ compiler complain about # because they only make sense for C programs. - QEMU_CXXFLAGS="$QEMU_CXXFLAGS -D__STDC_LIMIT_MACROS" + QEMU_CXXFLAGS="$QEMU_CXXFLAGS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS" for arg in $QEMU_CFLAGS; do case $arg in
@@ -596,6 +596,7 @@ QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS" QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS" QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS" QEMU_INCLUDES="-iquote . -iquote \$(SRC_PATH) -iquote \$(SRC_PATH)/accel/tcg -iquote \$(SRC_PATH)/include" +QEMU_INCLUDES="$QEMU_INCLUDES -iquote \$(SRC_PATH)/disas/libvixl" if test "$debug_info" = "yes"; then CFLAGS="-g $CFLAGS" LDFLAGS="-g $LDFLAGS"
disas/libvixl/Makefile.objs +1 -10
@@ -1,14 +1,5 @@ -libvixl_OBJS = vixl/utils.o \ +common-obj-$(CONFIG_ARM_A64_DIS) = vixl/utils.o \ vixl/compiler-intrinsics.o \ vixl/a64/instructions-a64.o \ vixl/a64/decoder-a64.o \ vixl/a64/disasm-a64.o - -# The -Wno-sign-compare is needed only for gcc 4.6, which complains about -# some signed-unsigned equality comparisons which later gcc versions do not. -$(addprefix $(obj)/,$(libvixl_OBJS)): QEMU_CXXFLAGS := -I$(SRC_PATH)/disas/libvixl $(QEMU_CXXFLAGS) -Wno-sign-compare -# Ensure that C99 macros are defined regardless of the inclusion order of -# headers in vixl. This is required at least on NetBSD. -$(addprefix $(obj)/,$(libvixl_OBJS)): QEMU_CXXFLAGS += -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS - -common-obj-$(CONFIG_ARM_A64_DIS) += $(libvixl_OBJS)
Signature · 1 line
1.8.3.1
[PULL 51/62] acpi: move PC stubs out of stubs/
In reply to Paolo BonziniThis is a small cleanup that lets microvm build entirely without include/hw/i386/pc.h.
--- hw/acpi/Makefile.objs | 3 ++- stubs/pc_madt_cpu_entry.c => hw/acpi/acpi-x86-stub.c | 0 stubs/Makefile.objs | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) rename stubs/pc_madt_cpu_entry.c => hw/acpi/acpi-x86-stub.c (100%)
hw/acpi/Makefile.objs +2 -1
@@ -8,6 +8,7 @@ common-obj-$(CONFIG_ACPI_NVDIMM) += nvdimm.o common-obj-$(CONFIG_ACPI_VMGENID) += vmgenid.o common-obj-$(CONFIG_ACPI_HW_REDUCED) += generic_event_device.o common-obj-$(call lnot,$(CONFIG_ACPI_X86)) += acpi-stub.o +common-obj-$(call lnot,$(CONFIG_PC)) += acpi-x86-stub.o common-obj-y += acpi_interface.o common-obj-y += bios-linker-loader.o
@@ -20,4 +21,4 @@ common-obj-$(call lnot,$(CONFIG_IPMI)) += ipmi-stub.o else common-obj-y += acpi-stub.o endif -common-obj-$(CONFIG_ALL) += acpi-stub.o ipmi-stub.o +common-obj-$(CONFIG_ALL) += acpi-stub.o acpi-x86-stub.o ipmi-stub.o
hw/acpi/acpi-x86-stub.c renamed from stubs/pc_madt_cpu_entry.c +0 -0
stubs/Makefile.objs +0 -1
@@ -33,7 +33,6 @@ stub-obj-y += fd-register.o stub-obj-y += qmp_memory_device.o stub-obj-y += target-monitor-defs.o stub-obj-y += target-get-monitor-def.o -stub-obj-y += pc_madt_cpu_entry.o stub-obj-y += vmgenid.o stub-obj-y += xen-common.o stub-obj-y += xen-hvm.o
Signature · 1 line
1.8.3.1
[PULL 26/62] xen: convert "-machine igd-passthru" to an accelerator property
In reply to Paolo BonziniThe first machine property to fall is Xen's Intel integrated graphics passthrough. The "-machine igd-passthru" option does not set anymore a property on the machine object, but desugars to a GlobalProperty on accelerator objects.
The setter is very simple, since the value ends up in a global variable, so this patch also provides an example before the more complicated cases that follow it.
--- hw/core/machine.c | 20 -------------------- hw/xen/xen-common.c | 18 ++++++++++++++++++ hw/xen/xen_pt.c | 2 ++ include/hw/boards.h | 1 - qemu-options.hx | 7 ++++--- vl.c | 14 ++++---------- 6 files changed, 28 insertions(+), 34 deletions(-)
hw/core/machine.c +0 -20
@@ -417,20 +417,6 @@ static void machine_set_graphics(Object *obj, bool value, Error **errp) ms->enable_graphics = value; } -static bool machine_get_igd_gfx_passthru (Object *obj,Error **errp) -{ -MachineState *ms =MACHINE (obj); - -return ms->igd_gfx_passthru; -} - -static void machine_set_igd_gfx_passthru (Object *obj,bool value,Error **errp) -{ -MachineState *ms =MACHINE (obj); - - ms->igd_gfx_passthru = value; -} -static char *machine_get_firmware (Object *obj,Error **errp) {MachineState *ms =MACHINE (obj);
@@ -867,12 +853,6 @@ static void machine_class_init(ObjectClass *oc, void *data)object_class_property_set_description (oc,"graphics" ,"Set on/off to enable/disable graphics emulation" , &error_abort); -object_class_property_add_bool (oc,"igd-passthru" , - machine_get_igd_gfx_passthru, machine_set_igd_gfx_passthru, - &error_abort); -object_class_property_set_description (oc,"igd-passthru" , -"Set on/off to enable/disable igd passthrou" , &error_abort); -object_class_property_add_str (oc,"firmware" , machine_get_firmware, machine_set_firmware, &error_abort);
hw/xen/xen-common.c +18 -0
@@ -11,7 +11,9 @@#include "qemu/osdep.h" #include "qemu/error-report.h" #include "qemu/module.h" +#include "qapi/error.h" #include "hw/xen/xen-legacy-backend.h" +#include "hw/xen/xen_pt.h" #include "chardev/char.h" #include "sysemu/accel.h" #include "sysemu/runstate.h"
@@ -124,6 +126,16 @@ static void xen_change_state_handler(void *opaque, int running, } } +static bool xen_get_igd_gfx_passthru (Object *obj,Error **errp) +{ +return has_igd_gfx_passthru; +} + +static void xen_set_igd_gfx_passthru (Object *obj,bool value,Error **errp) +{ + has_igd_gfx_passthru = value; +} +static void xen_setup_post (MachineState *ms,AccelState *accel) {int rc;
@@ -177,6 +189,12 @@ static void xen_accel_class_init(ObjectClass *oc, void *data) ac->compat_props =g_ptr_array_new ();compat_props_add (ac->compat_props, compat,G_N_ELEMENTS (compat)); + +object_class_property_add_bool (oc,"igd-passthru" , + xen_get_igd_gfx_passthru, xen_set_igd_gfx_passthru, + &error_abort); +object_class_property_set_description (oc,"igd-passthru" , +"Set on/off to enable/disable igd passthrou" , &error_abort); }#define TYPE_XEN_ACCEL ACCEL_CLASS_NAME("xen")
hw/xen/xen_pt.c +2 -0
@@ -65,6 +65,8 @@#include "qemu/range.h" #include "exec/address-spaces.h" +bool has_igd_gfx_passthru; +#define XEN_PT_NR_IRQS (256)static uint8_t xen_pt_mapped_machine_irq[XEN_PT_NR_IRQS ] = {0 };
include/hw/boards.h +0 -1
@@ -287,7 +287,6 @@ struct MachineState {bool mem_merge;bool usb;bool usb_disabled; -bool igd_gfx_passthru;char *firmware;bool iommu;bool suppress_vmdesc;
qemu-options.hx +4 -3
@@ -37,7 +37,6 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \ " kvm_shadow_mem=size of KVM shadow MMU in bytes\n" " dump-guest-core=on|off include guest memory in a core dump (default=on)\n" " mem-merge=on|off controls memory merge support (default: on)\n" - " igd-passthru=on|off controls IGD GFX passthrough support (default=off)\n" " aes-key-wrap=on|off controls support for AES key wrapping (default=on)\n" " dea-key-wrap=on|off controls support for DEA key wrapping (default=on)\n" " suppress-vmdesc=on|off disables self-describing migration (default=off)\n"
@@ -71,8 +70,6 @@ more than one accelerator specified, the next one is used if the previous one fails to initialize. @item kernel_irqchip=on|off Controls in-kernel irqchip support for the chosen accelerator when available. -@item gfx_passthru=on|off -Enables IGD GFX passthrough support for the chosen machine when available. @item vmport=on|off|auto Enables emulation of VMWare IO port, for vmmouse etc. auto says to select the value based on accel. For accel=xen the default is off otherwise the default
@@ -120,6 +117,7 @@ ETEXI DEF("accel", HAS_ARG, QEMU_OPTION_accel, "-accel [accel=]accelerator[,prop[=value][,...]]\n" " select accelerator (kvm, xen, hax, hvf, whpx or tcg; use 'help' for a list)\n" + " igd-passthru=on|off (enable Xen integrated Intel graphics passthrough, default=off)\n" " tb-size=n (TCG translation block cache size)\n" " thread=single|multi (enable multi-threaded TCG)\n", QEMU_ARCH_ALL) STEXI
@@ -130,6 +128,9 @@ kvm, xen, hax, hvf, whpx or tcg can be available. By default, tcg is used. If th more than one accelerator specified, the next one is used if the previous one fails to initialize. @table @option +@item igd-passthru=on|off +When Xen is in use, this option controls whether Intel integrated graphics +devices can be passed through to the guest (default=off) @item tb-size=@var{n} Controls the size (in MiB) of the TCG translation block cache. @item thread=single|multi
vl.c +4 -10
@@ -1257,13 +1257,6 @@ static void configure_msg(QemuOpts *opts) } -/* Now we still need this for compatibility with XEN. */ -bool has_igd_gfx_passthru; -static void igd_gfx_passthru (void ) -{ - has_igd_gfx_passthru = current_machine->igd_gfx_passthru; -} -/***********************************************************/ /* USB devices */
@@ -2642,6 +2635,10 @@ static int machine_set_property(void *opaque,if (g_str_equal (qom_name,"accel" )) {return 0 ; } +if (g_str_equal (qom_name,"igd-passthru" )) { +object_register_sugar_prop (ACCEL_CLASS_NAME ("xen" ), qom_name, value); +return 0 ; + }return object_parse_property_opt (opaque, name, value,"type" , errp); }
@@ -4433,9 +4430,6 @@ int main(int argc, char **argv, char **envp)exit (1 ); } -/* Check if IGD GFX passthrough. */ -igd_gfx_passthru (); -/* init generic devices */ rom_set_order_override (FW_CFG_ORDER_OVERRIDE_DEVICE ); qemu_opts_foreach(qemu_find_opts("device"),
Signature · 1 line
1.8.3.1
[PULL 50/62] x86: move more x86-generic functions out of PC files
In reply to Paolo BonziniThese are needed by microvm too, so move them outside of PC-specific files. With this patch, microvm.c need not include pc.h anymore.
--- hw/i386/acpi-build.c | 1 + hw/i386/fw_cfg.c | 1 - hw/i386/fw_cfg.h | 2 + hw/i386/kvm/ioapic.c | 2 +- hw/i386/microvm.c | 3 +- hw/i386/pc.c | 101 +------------------------------------------------ hw/i386/trace-events | 6 ++- hw/i386/x86.c | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++ include/hw/i386/pc.h | 20 ---------- include/hw/i386/x86.h | 18 +++++++++ target/i386/kvm.c | 2 +- target/i386/machine.c | 2 +- 12 files changed, 133 insertions(+), 128 deletions(-)
hw/i386/acpi-build.c +1 -0
@@ -53,6 +53,7 @@/* Supported chipsets: */ #include "hw/southbridge/piix.h" #include "hw/acpi/pcihp.h" +#include "hw/i386/fw_cfg.h" #include "hw/i386/ich9.h" #include "hw/pci/pci_bus.h" #include "hw/pci-host/q35.h"
hw/i386/fw_cfg.c +0 -1
@@ -16,7 +16,6 @@#include "sysemu/numa.h" #include "hw/acpi/acpi.h" #include "hw/firmware/smbios.h" -#include "hw/i386/pc.h" #include "hw/i386/fw_cfg.h" #include "hw/timer/hpet.h" #include "hw/nvram/fw_cfg.h"
hw/i386/fw_cfg.h +2 -0
@@ -12,6 +12,8 @@#include "hw/boards.h" #include "hw/nvram/fw_cfg.h" +#define FW_CFG_IO_BASE 0x510 +#define FW_CFG_ACPI_TABLES (FW_CFG_ARCH_LOCAL + 0)#define FW_CFG_SMBIOS_ENTRIES (FW_CFG_ARCH_LOCAL + 1)#define FW_CFG_IRQ0_OVERRIDE (FW_CFG_ARCH_LOCAL + 2)
hw/i386/kvm/ioapic.c +1 -1
@@ -12,7 +12,7 @@#include "qemu/osdep.h" #include "monitor/monitor.h" -#include "hw/i386/pc.h" +#include "hw/i386/x86.h" #include "hw/irq.h" #include "hw/qdev-properties.h" #include "hw/i386/ioapic_internal.h"
hw/i386/microvm.c +1 -2
@@ -32,7 +32,6 @@#include "hw/kvm/clock.h" #include "hw/i386/microvm.h" #include "hw/i386/x86.h" -#include "hw/i386/pc.h" #include "target/i386/cpu.h" #include "hw/intc/i8259.h" #include "hw/timer/i8254.h"
@@ -133,7 +132,7 @@ static void microvm_devices_init(MicrovmMachineState *mms)if (mms->pic ==ON_OFF_AUTO_ON || mms->pic ==ON_OFF_AUTO_AUTO ) {qemu_irq *i8259; - i8259 =i8259_init (isa_bus,pc_allocate_cpu_irq ()); + i8259 =i8259_init (isa_bus,x86_allocate_cpu_irq ());for (i =0 ; i <ISA_NUM_IRQS ; i++) { gsi_state->i8259_irq[i] = i8259[i]; }
hw/i386/pc.c +1 -100
137 lines not on this page · raw message
hw/i386/trace-events +4 -2
@@ -112,8 +112,10 @@ amdvi_ir_irte_ga_val(uint64_t hi, uint64_t lo) "hi 0x%"PRIx64" lo 0x%"PRIx64 vmport_register(unsigned char command, void *func, void *opaque) "command: 0x%02x func: %p opaque: %p" vmport_command(unsigned char command) "command: 0x%02x" +# x86.c +x86_gsi_interrupt(int irqn, int level) "GSI interrupt #%d level:%d" +x86_pic_interrupt(int irqn, int level) "PIC interrupt #%d level:%d" + # pc.c -pc_gsi_interrupt(int irqn, int level) "GSI interrupt #%d level:%d" -pc_pic_interrupt(int irqn, int level) "PIC interrupt #%d level:%d" port92_read(uint8_t val) "port92: read 0x%02x" port92_write(uint8_t val) "port92: write 0x%02x"
hw/i386/x86.c +103 -0
126 lines not on this page · raw message
include/hw/i386/pc.h +0 -20
@@ -3,11 +3,9 @@#include "exec/memory.h" #include "hw/boards.h" -#include "hw/isa/isa.h" #include "hw/block/fdc.h" #include "hw/block/flash.h" #include "net/net.h" -#include "hw/i386/ioapic.h" #include "hw/i386/x86.h" #include "qemu/range.h"
@@ -134,17 +132,6 @@ typedef struct PCMachineClass {/* ioapic.c */ -/* Global System Interrupts */ - -#define GSI_NUM_PINS IOAPIC_NUM_PINS - -typedef struct GSIState { -qemu_irq i8259_irq[ISA_NUM_IRQS ]; -qemu_irq ioapic_irq[IOAPIC_NUM_PINS ]; -}GSIState ; - -void gsi_handler (void *opaque,int n,int level); -GSIState *pc_gsi_create (qemu_irq **irqs,bool pci_enabled);/* vmport.c */
@@ -188,7 +175,6 @@ void pc_memory_init(PCMachineState *pcms, MemoryRegion *rom_memory, MemoryRegion **ram_memory);uint64_t pc_pci_hole64_start (void ); -qemu_irq pc_allocate_cpu_irq (void );DeviceState *pc_vga_init (ISABus *isa_bus,PCIBus *pci_bus); void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi, ISADevice **rtc_state,
@@ -206,18 +192,12 @@ void pc_pci_device_init(PCIBus *pci_bus);typedef void (*cpu_set_smm_t )(int smm,void *arg);void pc_i8259_create (ISABus *isa_bus,qemu_irq *i8259_irqs); -void ioapic_init_gsi (GSIState *gsi_state,const char *parent_name);ISADevice *pc_find_fdc0 (void );int cmos_get_fd_drive_type (FloppyDriveType fd0); -#define FW_CFG_IO_BASE 0x510 -#define PORT92_A20_LINE "a20" -/* hpet.c */ -extern int no_hpet; -/* pc_sysfw.c */ void pc_system_flash_create (PCMachineState *pcms);void pc_system_firmware_init (PCMachineState *pcms,MemoryRegion *rom_memory);
include/hw/i386/x86.h +18 -0
@@ -23,6 +23,8 @@#include "hw/boards.h" #include "hw/nmi.h" +#include "hw/isa/isa.h" +#include "hw/i386/ioapic.h" typedef struct { /*< private >*/
@@ -100,4 +102,20 @@ void x86_load_linux(X86MachineState *x86ms,bool x86_machine_is_smm_enabled (X86MachineState *x86ms); +/* Global System Interrupts */ + +#define GSI_NUM_PINS IOAPIC_NUM_PINS + +typedef struct GSIState { +qemu_irq i8259_irq[ISA_NUM_IRQS ]; +qemu_irq ioapic_irq[IOAPIC_NUM_PINS ]; +}GSIState ; + +qemu_irq x86_allocate_cpu_irq (void ); +void gsi_handler (void *opaque,int n,int level); +void ioapic_init_gsi (GSIState *gsi_state,const char *parent_name); + +/* hpet.c */ +extern int no_hpet; +#endif
target/i386/kvm.c +1 -1
@@ -35,7 +35,7 @@#include "qemu/main-loop.h" #include "qemu/config-file.h" #include "qemu/error-report.h" -#include "hw/i386/pc.h" +#include "hw/i386/x86.h" #include "hw/i386/apic.h" #include "hw/i386/apic_internal.h" #include "hw/i386/apic-msidef.h"
target/i386/machine.c +1 -1
@@ -1,10 +1,10 @@#include "qemu/osdep.h" #include "cpu.h" #include "exec/exec-all.h" -#include "hw/i386/pc.h" #include "hw/isa/isa.h" #include "migration/cpu.h" #include "hyperv.h" +#include "hw/i386/x86.h" #include "kvm_i386.h" #include "sysemu/kvm.h"
Signature · 1 line
1.8.3.1
[PULL 43/62] configure: simplify vhost condition with Kconfig
In reply to Paolo BonziniFrom: Marc-André Lureau <[email protected]>
--- Kconfig.host | 5 +++++ Makefile | 1 + hw/virtio/Kconfig | 3 +++ hw/virtio/Makefile.objs | 4 ++-- 4 files changed, 11 insertions(+), 2 deletions(-)
Kconfig.host +5 -0
@@ -25,6 +25,11 @@ config TPM config VHOST_USER bool + select VHOST + +config VHOST_KERNEL + bool + select VHOST config XEN bool
Makefile +1 -0
@@ -382,6 +382,7 @@ MINIKCONF_ARGS = \ CONFIG_OPENGL=$(CONFIG_OPENGL) \ CONFIG_X11=$(CONFIG_X11) \ CONFIG_VHOST_USER=$(CONFIG_VHOST_USER) \ + CONFIG_VHOST_KERNEL=$(CONFIG_VHOST_KERNEL) \ CONFIG_VIRTFS=$(CONFIG_VIRTFS) \ CONFIG_LINUX=$(CONFIG_LINUX) \ CONFIG_PVRDMA=$(CONFIG_PVRDMA)
hw/virtio/Kconfig +3 -0
@@ -1,3 +1,6 @@ +config VHOST + bool + config VIRTIO bool
hw/virtio/Makefile.objs +2 -2
@@ -2,8 +2,8 @@ ifeq ($(CONFIG_VIRTIO),y) common-obj-y += virtio-bus.o obj-y += virtio.o -obj-$(call lor,$(CONFIG_VHOST_USER),$(CONFIG_VHOST_KERNEL)) += vhost.o vhost-backend.o -common-obj-$(call lnot,$(call lor,$(CONFIG_VHOST_USER),$(CONFIG_VHOST_KERNEL))) += vhost-stub.o +obj-$(CONFIG_VHOST) += vhost.o vhost-backend.o +common-obj-$(call lnot,$(CONFIG_VHOST)) += vhost-stub.o obj-$(CONFIG_VHOST_USER) += vhost-user.o common-obj-$(CONFIG_VIRTIO_RNG) += virtio-rng.o
Signature · 1 line
1.8.3.1
[PULL 52/62] pc: stubify x86 iommu
In reply to Paolo BonziniAllow building microvm without x86-iommu.c.
--- hw/i386/Kconfig | 6 ++++++ hw/i386/Makefile.objs | 3 ++- hw/i386/x86-iommu-stub.c | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 hw/i386/x86-iommu-stub.c
hw/i386/Kconfig +6 -0
@@ -103,11 +103,17 @@ config MICROVM select MC146818RTC select VIRTIO_MMIO +config X86_IOMMU + bool + depends on PC + config VTD bool + select X86_IOMMU config AMD_IOMMU bool + select X86_IOMMU config VMPORT bool
hw/i386/Makefile.objs +2 -1
@@ -6,7 +6,8 @@ obj-$(CONFIG_I440FX) += pc_piix.o obj-$(CONFIG_Q35) += pc_q35.o obj-$(CONFIG_MICROVM) += microvm.o obj-y += fw_cfg.o -obj-y += x86-iommu.o +obj-$(CONFIG_X86_IOMMU) += x86-iommu.o +obj-$(call lnot,$(CONFIG_X86_IOMMU)) += x86-iommu-stub.o obj-$(CONFIG_VTD) += intel_iommu.o obj-$(CONFIG_AMD_IOMMU) += amd_iommu.o obj-$(CONFIG_XEN) += ../xenpv/ xen/
hw/i386/x86-iommu-stub.c new file +34 -0
@@ -0,0 +1,34 @@ +/* +* Stubs for X86 IOMMU emulation +* +* Copyright (C) 2019 Red Hat, Inc. +* +* Author: Paolo Bonzini <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. + +* 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/>. +*/ + +#include "qemu/osdep.h" +#include "hw/i386/x86-iommu.h" + +void x86_iommu_iec_register_notifier (X86IOMMUState *iommu, +iec_notify_fn fn,void *data) +{ +} + +X86IOMMUState *x86_iommu_get_default (void ) +{ +return NULL ; +} +
Signature · 1 line
1.8.3.1
[PULL 31/62] object: Improve documentation of interfaces
In reply to Paolo BonziniFrom: Greg Kurz <[email protected]>
QOM interfaces allow a limited form of multiple inheritance, at the condition of being stateless. That is, they cannot be instantiated and a pointer to an interface shouldn't be dereferenceable in any way. This is achieved by making the QOM instance type an incomplete type, which is, as mentioned by Markus Armbruster, the closest you can get to abstract class in C.
Incomplete types are widely used to hide implementation details, but people usually expect to find at least one place where the type is fully defined. The fact that it doesn't happen with QOM interfaces is quite disturbing, especially since it isn't documented anywhere as recently discussed in this thread:
https://lists.gnu.org/archive/html/qemu-devel/2019-12/msg01579.html
Amend the documentation in the object.h header file to provide more details about why and how to implement QOM interfaces using incomplete types.
--- include/qom/object.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
include/qom/object.h +8 -2
@@ -200,8 +200,14 @@ typedef struct InterfaceInfo InterfaceInfo;* * Interfaces allow a limited form of multiple inheritance. Instances are * similar to normal types except for the fact that are only defined by -* their classes and never carry any state. You can dynamically cast an object -* to one of its #Interface types and vice versa. +* their classes and never carry any state. As a consequence, a pointer to +* an interface instance should always be of incomplete type in order to be +* sure it cannot be dereferenced. That is, you should define the +* 'typedef struct SomethingIf SomethingIf' so that you can pass around +* 'SomethingIf *si' arguments, but not define a 'struct SomethingIf { ... }'. +* The only things you can validly do with a 'SomethingIf *' are to pass it as +* an argument to a method on its corresponding SomethingIfClass, or to +* dynamically cast it to an object that implements the interface. * * # Methods # *
Signature · 1 line
1.8.3.1
[PULL 53/62] hw/i386: De-duplicate gsi_handler() to remove kvm_pc_gsi_handler()
In reply to Paolo BonziniFrom: Philippe Mathieu-Daudé <[email protected]>
Both gsi_handler() and kvm_pc_gsi_handler() have the same content, except one comment. Move the comment, and de-duplicate the code.
--- hw/i386/kvm/ioapic.c | 12 ------------ hw/i386/pc.c | 4 +--- hw/i386/x86.c | 1 + include/sysemu/kvm.h | 1 - 4 files changed, 2 insertions(+), 16 deletions(-)
hw/i386/kvm/ioapic.c +0 -12
@@ -48,18 +48,6 @@ void kvm_pc_setup_irq_routing(bool pci_enabled) } } -void kvm_pc_gsi_handler (void *opaque,int n,int level) -{ -GSIState *s = opaque; - -if (n <ISA_NUM_IRQS ) { -/* Kernel will forward to both PIC and IOAPIC */ -qemu_set_irq (s->i8259_irq[n], level); - }else { -qemu_set_irq (s->ioapic_irq[n], level); - } -} -typedef struct KVMIOAPICState KVMIOAPICState ;struct KVMIOAPICState {
hw/i386/pc.c +1 -3
@@ -341,10 +341,8 @@ GSIState *pc_gsi_create(qemu_irq **irqs, bool pci_enabled) s =g_new0 (GSIState,1 );if (kvm_ioapic_in_kernel ()) {kvm_pc_setup_irq_routing (pci_enabled); - *irqs =qemu_allocate_irqs (kvm_pc_gsi_handler, s,GSI_NUM_PINS ); - }else { - *irqs =qemu_allocate_irqs (gsi_handler, s,GSI_NUM_PINS ); } + *irqs =qemu_allocate_irqs (gsi_handler, s,GSI_NUM_PINS );return s; }
hw/i386/x86.c +1 -0
@@ -295,6 +295,7 @@ void gsi_handler(void *opaque, int n, int level)trace_x86_gsi_interrupt (n, level);if (n <ISA_NUM_IRQS ) { +/* Under KVM, Kernel will forward to both PIC and IOAPIC */ qemu_set_irq (s->i8259_irq[n], level); }qemu_set_irq (s->ioapic_irq[n], level);
include/sysemu/kvm.h +0 -1
@@ -515,7 +515,6 @@ int kvm_irqchip_add_irqfd_notifier(KVMState *s, EventNotifier *n,int kvm_irqchip_remove_irqfd_notifier (KVMState *s,EventNotifier *n,qemu_irq irq);void kvm_irqchip_set_qemuirq_gsi (KVMState *s,qemu_irq irq,int gsi); -void kvm_pc_gsi_handler (void *opaque,int n,int level);void kvm_pc_setup_irq_routing (bool pci_enabled);void kvm_init_irq_routing (KVMState *s);
Signature · 1 line
1.8.3.1
[PULL 56/62] hw/i386/pc: Use TYPE_PORT92 instead of hardcoded string
In reply to Paolo BonziniFrom: Philippe Mathieu-Daudé <[email protected]>
By using the TYPE_* definitions for devices, we can:
- quickly find where devices are used with 'git-grep'
- easily rename a device (one-line change).
--- hw/i386/pc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/i386/pc.c +1 -1
@@ -1275,7 +1275,7 @@ static void pc_superio_init(ISABus *isa_bus, bool create_fdctrl, bool no_vmport)qdev_prop_set_ptr (dev,"ps2_mouse" , i8042);qdev_init_nofail (dev); } - port92 =isa_create_simple (isa_bus,"port92" ); + port92 =isa_create_simple (isa_bus,TYPE_PORT92 ); a20_line =qemu_allocate_irqs (handle_a20_line_change, first_cpu,2 );i8042_setup_a20_line (i8042, a20_line[0 ]);
Signature · 1 line
1.8.3.1
[PULL 60/62] qsp: Use WITH_RCU_READ_LOCK_GUARD
In reply to Paolo BonziniFrom: "Dr. David Alan Gilbert" <[email protected]>
The automatic rcu read lock maintenance works quite nicely in this case where it previously relied on a comment to delimit the lifetime and now has a block.
--- util/qsp.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)
util/qsp.c +10 -12
@@ -598,7 +598,6 @@ static void qsp_ht_delete(void *p, uint32_t h, void *htp)static void qsp_mktree (GTree *tree,bool callsite_coalesce) { -QSPSnapshot *snap;struct qht ht, coalesce_ht;struct qht *htp;
@@ -610,20 +609,19 @@ static void qsp_mktree(GTree *tree, bool callsite_coalesce)* We must remain in an RCU read-side critical section until we're done * with the snapshot. */ -rcu_read_lock (); - snap =atomic_rcu_read (&qsp_snapshot); + WITH_RCU_READ_LOCK_GUARD() { +QSPSnapshot *snap =atomic_rcu_read (&qsp_snapshot); -/* Aggregate all results from the global hash table into a local one */ -qht_init (&ht, qsp_entry_no_thread_cmp,QSP_INITIAL_SIZE , -QHT_MODE_AUTO_RESIZE |QHT_MODE_RAW_MUTEXES ); -qht_iter (&qsp_ht, qsp_aggregate, &ht); +/* Aggregate all results from the global hash table into a local one */ +qht_init (&ht, qsp_entry_no_thread_cmp,QSP_INITIAL_SIZE , +QHT_MODE_AUTO_RESIZE |QHT_MODE_RAW_MUTEXES ); +qht_iter (&qsp_ht, qsp_aggregate, &ht); -/* compute the difference wrt the snapshot, if any */ -if (snap) { -qsp_diff (&snap->ht, &ht); +/* compute the difference wrt the snapshot, if any */ +if (snap) { +qsp_diff (&snap->ht, &ht); + } } -/* done with the snapshot; RCU can reclaim it */ -rcu_read_unlock (); htp = &ht;if (callsite_coalesce) {
Signature · 1 line
1.8.3.1
[PULL 42/62] configure: set $PYTHON to a full path
In reply to Paolo BonziniThis will make it possible to replace it in a shebang line.
--- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
configure +1 -1
@@ -909,7 +909,7 @@ for binary in "${PYTHON-python3}" python python2 do if has "$binary" then - python="$binary" + python=$(command -v "$binary") break fi done
Signature · 1 line
1.8.3.1
[PULL 61/62] memory: use RCU_READ_LOCK_GUARD
In reply to Paolo Bonzini--- include/exec/memory.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
include/exec/memory.h +1 -2
@@ -2165,7 +2165,7 @@ MemTxResult address_space_read(AddressSpace *as, hwaddr addr,if (__builtin_constant_p (len)) {if (len) { -rcu_read_lock (); +RCU_READ_LOCK_GUARD (); fv =address_space_to_flatview (as); l = len; mr =flatview_translate (fv, addr, &addr1, &l, false, attrs);
@@ -2176,7 +2176,6 @@ MemTxResult address_space_read(AddressSpace *as, hwaddr addr, result =flatview_read_continue (fv, addr, attrs, buf, len, addr1, l, mr); } -rcu_read_unlock (); } }else { result =address_space_read_full (as, addr, attrs, buf, len);
Signature · 1 line
1.8.3.1
[PULL 59/62] hyperv: Use auto rcu_read macros
In reply to Paolo BonziniFrom: "Dr. David Alan Gilbert" <[email protected]>
Use RCU_READ_LOCK_GUARD and WITH_RCU_READ_LOCK_GUARD to replace the manual rcu_read_(un)lock calls.
--- hw/hyperv/hyperv.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-)
hw/hyperv/hyperv.c +9 -13
@@ -546,14 +546,14 @@ uint16_t hyperv_hcall_post_message(uint64_t param, bool fast) } ret =HV_STATUS_INVALID_CONNECTION_ID ; -rcu_read_lock (); - QLIST_FOREACH_RCU(mh, &msg_handlers, link) { -if (mh->conn_id == (msg->connection_id &HV_CONNECTION_ID_MASK )) { - ret = mh->handler (msg, mh->data); -break ; + WITH_RCU_READ_LOCK_GUARD() { + QLIST_FOREACH_RCU(mh, &msg_handlers, link) { +if (mh->conn_id == (msg->connection_id &HV_CONNECTION_ID_MASK )) { + ret = mh->handler (msg, mh->data); +break ; + } } } -rcu_read_unlock (); unmap:cpu_physical_memory_unmap (msg, len,0 ,0 );
@@ -619,7 +619,6 @@ int hyperv_set_event_flag_handler(uint32_t conn_id, EventNotifier *notifier)uint16_t hyperv_hcall_signal_event (uint64_t param,bool fast) { -uint16_t ret;EventFlagHandler *handler;if (unlikely (!fast)) {
@@ -645,15 +644,12 @@ uint16_t hyperv_hcall_signal_event(uint64_t param, bool fast)return HV_STATUS_INVALID_HYPERCALL_INPUT ; } - ret =HV_STATUS_INVALID_CONNECTION_ID ; -rcu_read_lock (); +RCU_READ_LOCK_GUARD (); QLIST_FOREACH_RCU(handler, &event_flag_handlers, link) {if (handler->conn_id == param) {event_notifier_set (handler->notifier); - ret =0 ; -break ; +return 0 ; } } -rcu_read_unlock (); -return ret; +return HV_STATUS_INVALID_CONNECTION_ID ; }
Signature · 1 line
1.8.3.1
[PULL 44/62] i386: conditionally compile more files
In reply to Paolo Bonzini--- hw/i386/Makefile.objs | 6 +++--- hw/i386/kvm/Makefile.objs | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-)
hw/i386/Makefile.objs +3 -3
@@ -1,11 +1,11 @@ obj-$(CONFIG_KVM) += kvm/ obj-y += e820_memory_layout.o multiboot.o obj-y += x86.o -obj-y += pc.o +obj-$(CONFIG_PC) += pc.o pc_sysfw.o obj-$(CONFIG_I440FX) += pc_piix.o obj-$(CONFIG_Q35) += pc_q35.o obj-$(CONFIG_MICROVM) += microvm.o -obj-y += fw_cfg.o pc_sysfw.o +obj-y += fw_cfg.o obj-y += x86-iommu.o obj-$(CONFIG_VTD) += intel_iommu.o obj-$(CONFIG_AMD_IOMMU) += amd_iommu.o
@@ -14,4 +14,4 @@ obj-$(CONFIG_VMPORT) += vmport.o obj-$(CONFIG_VMMOUSE) += vmmouse.o obj-y += kvmvapic.o -obj-y += acpi-build.o +obj-$(CONFIG_PC) += acpi-build.o
hw/i386/kvm/Makefile.objs +5 -1
@@ -1 +1,5 @@ -obj-y += clock.o apic.o i8259.o ioapic.o i8254.o +obj-y += clock.o +obj-$(CONFIG_APIC) += apic.o +obj-$(CONFIG_IOAPIC) += ioapic.o +obj-$(CONFIG_I8254) += i8254.o +obj-$(CONFIG_I8259) += i8259.o
Signature · 1 line
1.8.3.1
[PULL 62/62] colo: fix return without releasing RCU
In reply to Paolo BonziniUse WITH_RCU_READ_LOCK_GUARD to avoid exiting colo_init_ram_cache without releasing RCU.
--- migration/ram.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-)
migration/ram.c +17 -16
@@ -3891,26 +3891,27 @@ int colo_init_ram_cache(void) {RAMBlock *block; -rcu_read_lock (); -RAMBLOCK_FOREACH_NOT_IGNORED (block) { - block->colo_cache =qemu_anon_ram_alloc (block->used_length, -NULL , - false); -if (!block->colo_cache) { -error_report ("%s: Can't alloc memory for COLO cache of block %s," -"size 0x" RAM_ADDR_FMT , __func__, block->idstr, - block->used_length); -RAMBLOCK_FOREACH_NOT_IGNORED (block) { -if (block->colo_cache) { -qemu_anon_ram_free (block->colo_cache, block->used_length); - block->colo_cache =NULL ; + WITH_RCU_READ_LOCK_GUARD() { +RAMBLOCK_FOREACH_NOT_IGNORED (block) { + block->colo_cache =qemu_anon_ram_alloc (block->used_length, +NULL , + false); +if (!block->colo_cache) { +error_report ("%s: Can't alloc memory for COLO cache of block %s," +"size 0x" RAM_ADDR_FMT , __func__, block->idstr, + block->used_length); +RAMBLOCK_FOREACH_NOT_IGNORED (block) { +if (block->colo_cache) { +qemu_anon_ram_free (block->colo_cache, block->used_length); + block->colo_cache =NULL ; + } } +return -errno; } -return -errno; +memcpy (block->colo_cache, block->host, block->used_length); } -memcpy (block->colo_cache, block->host, block->used_length); } -rcu_read_unlock (); +/* * Record the dirty pages that sent by PVM, we use this dirty bitmap together * with to decide which page in cache should be flushed into SVM's RAM. Here
Signature · 1 line
1.8.3.1
[PULL 47/62] pci-stub: add more MSI functions
In reply to Paolo BonziniOn x86, KVM needs some function from the PCI subsystem in order to set up interrupt routes. Provide some stubs to support x86 machines that lack PCI.
--- hw/pci/pci-stub.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
hw/pci/pci-stub.c +27 -0
@@ -26,6 +26,7 @@#include "qapi/qmp/qerror.h" #include "hw/pci/pci.h" #include "hw/pci/msi.h" +#include "hw/pci/msix.h" bool msi_nonbroken;bool pci_available;
@@ -64,3 +65,29 @@ void msi_notify(PCIDevice *dev, unsigned int vector) {g_assert_not_reached (); } + +/* Required by target/i386/kvm.c */ +bool msi_is_masked (const PCIDevice *dev,unsigned vector) +{ +g_assert_not_reached (); +} + +MSIMessage msi_get_message (PCIDevice *dev,unsigned int vector) +{ +g_assert_not_reached (); +} + +int msix_enabled (PCIDevice *dev) +{ +return false; +} + +bool msix_is_masked (PCIDevice *dev,unsigned vector) +{ +g_assert_not_reached (); +} + +MSIMessage msix_get_message (PCIDevice *dev,unsigned int vector) +{ +g_assert_not_reached (); +}
Signature · 1 line
1.8.3.1
[PULL 48/62] x86: move SMM property to X86MachineState
In reply to Paolo BonziniAdd it to microvm as well, it is a generic property of the x86 architecture.
--- hw/i386/pc.c | 49 ------------------------------------------------- hw/i386/pc_piix.c | 6 +++--- hw/i386/pc_q35.c | 2 +- hw/i386/x86.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- include/hw/i386/pc.h | 3 --- include/hw/i386/x86.h | 5 +++++ target/i386/kvm.c | 3 +-- 7 files changed, 59 insertions(+), 59 deletions(-)
hw/i386/pc.c +0 -49
@@ -2028,48 +2028,6 @@ static void pc_machine_set_vmport(Object *obj, Visitor *v, const char *name,visit_type_OnOffAuto (v, name, &pcms->vmport, errp); } -bool pc_machine_is_smm_enabled (PCMachineState *pcms) -{ -bool smm_available = false; - -if (pcms->smm ==ON_OFF_AUTO_OFF ) { -return false; - } - -if (tcg_enabled () ||qtest_enabled ()) { - smm_available = true; - }else if (kvm_enabled ()) { - smm_available =kvm_has_smm (); - } - -if (smm_available) { -return true; - } - -if (pcms->smm ==ON_OFF_AUTO_ON ) { -error_report ("System Management Mode not supported by this hypervisor." ); -exit (1 ); - } -return false; -} - -static void pc_machine_get_smm (Object *obj,Visitor *v,const char *name, -void *opaque,Error **errp) -{ -PCMachineState *pcms =PC_MACHINE (obj); -OnOffAuto smm = pcms->smm; - -visit_type_OnOffAuto (v, name, &smm, errp); -} - -static void pc_machine_set_smm (Object *obj,Visitor *v,const char *name, -void *opaque,Error **errp) -{ -PCMachineState *pcms =PC_MACHINE (obj); - -visit_type_OnOffAuto (v, name, &pcms->smm, errp); -} -static bool pc_machine_get_smbus (Object *obj,Error **errp) {PCMachineState *pcms =PC_MACHINE (obj);
@@ -2116,7 +2074,6 @@ static void pc_machine_initfn(Object *obj) {PCMachineState *pcms =PC_MACHINE (obj); - pcms->smm =ON_OFF_AUTO_AUTO ;#ifdef CONFIG_VMPORT pcms->vmport =ON_OFF_AUTO_AUTO ;#else
@@ -2223,12 +2180,6 @@ static void pc_machine_class_init(ObjectClass *oc, void *data) pc_machine_get_device_memory_region_size,NULL , NULL, NULL, &error_abort); -object_class_property_add (oc,PC_MACHINE_SMM ,"OnOffAuto" , - pc_machine_get_smm, pc_machine_set_smm, -NULL ,NULL , &error_abort); -object_class_property_set_description (oc,PC_MACHINE_SMM , -"Enable SMM (pc & q35)" , &error_abort); -object_class_property_add (oc,PC_MACHINE_VMPORT ,"OnOffAuto" , pc_machine_get_vmport, pc_machine_set_vmport,NULL ,NULL , &error_abort);
hw/i386/pc_piix.c +3 -3
@@ -281,7 +281,7 @@ else {/* TODO: Populate SPD eeprom data. */ pcms->smbus =piix4_pm_init (pci_bus, piix3_devfn +3 ,0xb100 , x86ms->gsi[9 ], smi_irq, -pc_machine_is_smm_enabled (pcms), +x86_machine_is_smm_enabled (x86ms), &piix4_pm);smbus_eeprom_init (pcms->smbus,8 ,NULL ,0 );
@@ -309,9 +309,9 @@ else {static void pc_compat_2_3_fn (MachineState *machine) { -PCMachineState *pcms =PC_MACHINE (machine); +X86MachineState *x86ms =X86_MACHINE (machine);if (kvm_enabled ()) { - pcms->smm =ON_OFF_AUTO_OFF ; + x86ms->smm =ON_OFF_AUTO_OFF ; } }
hw/i386/pc_q35.c +1 -1
@@ -276,7 +276,7 @@ static void pc_q35_init(MachineState *machine) 0xff0104);/* connect pm stuff to lpc */ -ich9_lpc_pm_init (lpc,pc_machine_is_smm_enabled (pcms)); +ich9_lpc_pm_init (lpc,x86_machine_is_smm_enabled (x86ms));if (pcms->sata_enabled) {/* ahci and SATA device, for q35 1 ahci controller is built-in */
hw/i386/x86.c +49 -1
68 lines not on this page · raw message
include/hw/i386/pc.h +0 -3
@@ -43,7 +43,6 @@ struct PCMachineState {/* Configuration options: */ OnOffAuto vmport; -OnOffAuto smm;bool acpi_build_enabled;bool smbus_enabled;
@@ -61,7 +60,6 @@ struct PCMachineState {#define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device"#define PC_MACHINE_DEVMEM_REGION_SIZE "device-memory-region-size"#define PC_MACHINE_VMPORT "vmport" -#define PC_MACHINE_SMM "smm"#define PC_MACHINE_SMBUS "smbus"#define PC_MACHINE_SATA "sata"#define PC_MACHINE_PIT "pit"
@@ -165,7 +163,6 @@ void vmmouse_set_data(const uint32_t *data);/* pc.c */ extern int fd_bootchk; -bool pc_machine_is_smm_enabled (PCMachineState *pcms);void pc_acpi_smi_interrupt (void *opaque,int irq,int level);void pc_hot_add_cpu (MachineState *ms,const int64_t id,Error **errp);
include/hw/i386/x86.h +5 -0
@@ -60,6 +60,8 @@ typedef struct {uint16_t boot_cpus;unsigned smp_dies; +OnOffAuto smm; +/* * Address space used by IOAPIC device. All IOAPIC interrupts * will be translated to MSI messages in the address space.
@@ -68,6 +70,7 @@ typedef struct { } X86MachineState;#define X86_MACHINE_MAX_RAM_BELOW_4G "max-ram-below-4g" +#define X86_MACHINE_SMM "smm"#define TYPE_X86_MACHINE MACHINE_TYPE_NAME("x86")#define X86_MACHINE (obj) \
@@ -95,4 +98,6 @@ void x86_load_linux(X86MachineState *x86ms,bool pvh_enabled, bool linuxboot_dma_enabled); +bool x86_machine_is_smm_enabled (X86MachineState *x86ms); +#endif
target/i386/kvm.c +1 -2
@@ -2173,8 +2173,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s) }if (kvm_check_extension (s,KVM_CAP_X86_SMM ) && -object_dynamic_cast (OBJECT (ms),TYPE_PC_MACHINE ) && -pc_machine_is_smm_enabled (PC_MACHINE (ms))) { +x86_machine_is_smm_enabled (X86_MACHINE (ms))) { smram_machine_done.notify = register_smram_listener;qemu_add_machine_init_done_notifier (&smram_machine_done); }
Signature · 1 line
1.8.3.1
[PULL 54/62] hw/i386: Simplify ioapic_init_gsi()
In reply to Paolo BonziniFrom: Philippe Mathieu-Daudé <[email protected]>
All callers of ioapic_init_gsi() provide a parent. We want new uses to follow the same good practice and provide the parent name, so do not make this optional: assert the parent name is provided, and simplify the code.
--- hw/i386/x86.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
hw/i386/x86.c +3 -4
@@ -307,15 +307,14 @@ void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name)SysBusDevice *d;unsigned int i; +assert (parent_name);if (kvm_ioapic_in_kernel ()) { dev =qdev_create (NULL ,TYPE_KVM_IOAPIC ); }else { dev =qdev_create (NULL ,TYPE_IOAPIC ); } -if (parent_name) { -object_property_add_child (object_resolve_path (parent_name,NULL ), -"ioapic" ,OBJECT (dev),NULL ); - } +object_property_add_child (object_resolve_path (parent_name,NULL ), +"ioapic" ,OBJECT (dev),NULL );qdev_init_nofail (dev); d =SYS_BUS_DEVICE (dev);sysbus_mmio_map (d,0 ,IO_APIC_DEFAULT_ADDRESS );
Signature · 1 line
1.8.3.1
[PULL 55/62] hw/isa/isa-bus: cleanup irq functions
In reply to Paolo BonziniThe irq number is unsigned; we reject negative values. But -1 is used for the isairq array, which is declared unsigned! And since we have a definition for the number of ISA IRQs, use it.
Based on a patch by Philippe Mathieu-Daudé.
--- hw/isa/isa-bus.c | 11 +++++++---- include/hw/isa/isa.h | 8 ++++---- 2 files changed, 11 insertions(+), 8 deletions(-)
hw/isa/isa-bus.c +7 -4
@@ -82,24 +82,27 @@ void isa_bus_irqs(ISABus *bus, qemu_irq *irqs)* This function is only for special cases such as the 'ferr', and * temporary use for normal devices until they are converted to qdev. */ -qemu_irq isa_get_irq (ISADevice *dev,int isairq) +qemu_irq isa_get_irq (ISADevice *dev,unsigned isairq) {assert (!dev ||ISA_BUS (qdev_get_parent_bus (DEVICE (dev))) == isabus); -if (isairq <0 || isairq >15 ) { +if (isairq >=ISA_NUM_IRQS ) {hw_error ("isa irq %d invalid" , isairq); }return isabus->irqs[isairq]; } -void isa_init_irq (ISADevice *dev,qemu_irq *p,int isairq) +void isa_init_irq (ISADevice *dev,qemu_irq *p,unsigned isairq) {assert (dev->nirqs <ARRAY_SIZE (dev->isairq)); +if (isairq >=ISA_NUM_IRQS ) { +hw_error ("isa irq %d invalid" , isairq); + } dev->isairq[dev->nirqs] = isairq; *p =isa_get_irq (dev, isairq); dev->nirqs++; } -void isa_connect_gpio_out (ISADevice *isadev,int gpioirq,int isairq) +void isa_connect_gpio_out (ISADevice *isadev,int gpioirq,unsigned isairq) {qemu_irq irq;isa_init_irq (isadev, &irq, isairq);
include/hw/isa/isa.h +4 -4
@@ -88,7 +88,7 @@ struct ISADevice {DeviceState parent_obj;/*< public >*/ -uint32_t isairq[2 ]; +int8_t isairq[2 ];/* -1 = unassigned */ int nirqs;int ioport_id; };
@@ -96,9 +96,9 @@ struct ISADevice {ISABus *isa_bus_new (DeviceState *dev,MemoryRegion *address_space,MemoryRegion *address_space_io,Error **errp);void isa_bus_irqs (ISABus *bus,qemu_irq *irqs); -qemu_irq isa_get_irq (ISADevice *dev,int isairq); -void isa_init_irq (ISADevice *dev,qemu_irq *p,int isairq); -void isa_connect_gpio_out (ISADevice *isadev,int gpioirq,int isairq); +qemu_irq isa_get_irq (ISADevice *dev,unsigned isairq); +void isa_init_irq (ISADevice *dev,qemu_irq *p,unsigned isairq); +void isa_connect_gpio_out (ISADevice *isadev,int gpioirq,unsigned isairq);void isa_bus_dma (ISABus *bus,IsaDma *dma8,IsaDma *dma16);IsaDma *isa_get_dma (ISABus *bus,int nchan);MemoryRegion *isa_address_space (ISADevice *dev);
Signature · 1 line
1.8.3.1
[PULL 57/62] hw/i386/pc: Inline port92_init()
In reply to Paolo BonziniFrom: Philippe Mathieu-Daudé <[email protected]>
This one-line function is not very helpful, so remove it by inlining the call to qdev_connect_gpio_out_named().
--- hw/i386/pc.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
hw/i386/pc.c +4 -8
@@ -707,11 +707,6 @@ static uint64_t port92_read(void *opaque, hwaddr addr,return ret; } -static void port92_init (ISADevice *dev,qemu_irq a20_out) -{ -qdev_connect_gpio_out_named (DEVICE (dev),PORT92_A20_LINE ,0 , a20_out); -} -static const VMStateDescription vmstate_port92_isa = { .name ="port92" , .version_id =1 ,
@@ -767,8 +762,8 @@ static void port92_class_initfn(ObjectClass *klass, void *data) dc->vmsd = &vmstate_port92_isa;/* * Reason: unlike ordinary ISA devices, this one needs additional -* wiring: its A20 output line needs to be wired up by -* port92_init(). +* wiring: its A20 output line needs to be wired up with +* qdev_connect_gpio_out_named(). */ dc->user_creatable = false; }
@@ -1279,7 +1274,8 @@ static void pc_superio_init(ISABus *isa_bus, bool create_fdctrl, bool no_vmport) a20_line =qemu_allocate_irqs (handle_a20_line_change, first_cpu,2 );i8042_setup_a20_line (i8042, a20_line[0 ]); -port92_init (port92, a20_line[1 ]); +qdev_connect_gpio_out_named (DEVICE (port92), +PORT92_A20_LINE ,0 , a20_line[1 ]);g_free (a20_line); }
Signature · 1 line
1.8.3.1
[PULL 58/62] hw/i386/pc: Extract the port92 device
In reply to Paolo BonziniFrom: Philippe Mathieu-Daudé <[email protected]>
This device is only used by the PC machines. The pc.c file is already big enough, with 2255 lines. By removing 113 lines of it, we reduced it by 5%. It is now a bit easier to navigate the file.
--- hw/i386/Makefile.objs | 1 + hw/i386/pc.c | 113 -------------------------------------------- hw/i386/port92.c | 126 ++++++++++++++++++++++++++++++++++++++++++++++++++ hw/i386/trace-events | 2 +- include/hw/i386/pc.h | 3 ++ 5 files changed, 131 insertions(+), 114 deletions(-) create mode 100644 hw/i386/port92.c
hw/i386/Makefile.objs +1 -0
@@ -13,6 +13,7 @@ obj-$(CONFIG_AMD_IOMMU) += amd_iommu.o obj-$(CONFIG_XEN) += ../xenpv/ xen/ obj-$(CONFIG_VMPORT) += vmport.o obj-$(CONFIG_VMMOUSE) += vmmouse.o +obj-$(CONFIG_PC) += port92.o obj-y += kvmvapic.o obj-$(CONFIG_PC) += acpi-build.o
hw/i386/pc.c +0 -113
119 lines not on this page · raw message
hw/i386/port92.c new file +126 -0
126 lines not on this page · raw message
hw/i386/trace-events +1 -1
@@ -116,6 +116,6 @@ vmport_command(unsigned char command) "command: 0x%02x" x86_gsi_interrupt(int irqn, int level) "GSI interrupt #%d level:%d" x86_pic_interrupt(int irqn, int level) "PIC interrupt #%d level:%d" -# pc.c +# port92.c port92_read(uint8_t val) "port92: read 0x%02x" port92_write(uint8_t val) "port92: write 0x%02x"
include/hw/i386/pc.h +3 -0
@@ -196,8 +196,11 @@ void pc_i8259_create(ISABus *isa_bus, qemu_irq *i8259_irqs);ISADevice *pc_find_fdc0 (void );int cmos_get_fd_drive_type (FloppyDriveType fd0); +/* port92.c */ #define PORT92_A20_LINE "a20" +#define TYPE_PORT92 "port92" +/* pc_sysfw.c */ void pc_system_flash_create (PCMachineState *pcms);void pc_system_firmware_init (PCMachineState *pcms,MemoryRegion *rom_memory);
Signature · 1 line
1.8.3.1
Quoted 22 lines · Paolo Bonzini
The following changes since commit
084a398bf8aa7634738e6c6c0103236ee1b3b72f:Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging (2019-12-13 18:14:07 +0000)
are available in the git repository at:
git://github.com/bonzini/qemu.gittags/for-upstreamfor you to fetch changes up to
cfba0eb1146e7ccf839df29fd99cb90dd3c7640a:colo: fix return without releasing RCU (2019-12-16 17:25:46 +0100)
----------------------------------------------------------------
* More uses ofRCU_READ_LOCK_GUARD(Dave, myself)
* QOM doc improvments (Greg)
* Cleanups from the Meson conversion (Marc-André)
* Support for multiple -accel options (myself)
* Many x86 machine cleanup (Philippe, myself)
* tests/migration-test cleanup (Juan)
Quoted 1 line
----------------------------------------------------------------
This generates a set of extra warnings from the clang runtime sanitizers:
(1) in the bios-tables-test:
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} QTEST_QEMU_BINARY=i386-softmmu/qemu-system-i386 QTEST_QEMU_IMG=qemu-img tests/bios-tabl
es-test -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="bios-tables-test" /home/petmay01/linaro/qemu-for-merges/qom/object.c:390:16: runtime
error: load of value 22, which is not a valid value for type 'bool'
Looking for expected file 'tests/data/acpi/pc/FACP'
Using expected file 'tests/data/acpi/pc/FACP'
Looking for expected file 'tests/data/acpi/pc/APIC'
Using expected file 'tests/data/acpi/pc/APIC'
Looking for expected file 'tests/data/acpi/pc/HPET'
Using expected file 'tests/data/acpi/pc/HPET'
Looking for expected file 'tests/data/acpi/pc/FACS'
Using expected file 'tests/data/acpi/pc/FACS'
Looking for expected file 'tests/data/acpi/pc/DSDT'
Using expected file 'tests/data/acpi/pc/DSDT'
PASS 1 bios-tables-test /i386/acpi/piix4 /home/petmay01/linaro/qemu-for-merges/qom/object.c:390:16: runtime
error: load of value 151, which is not a valid value for type 'bool'
(and others similar)
and in the migration-test:
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} QTEST_QEMU_BINARY=i386-softmmu/qemu-system-i386 QTEST_QEMU_IMG=qemu-img tests/migration-test -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="migration-test" PASS 1 migration-test /i386/migration/deprecated /home/petmay01/linaro/qemu-for-merges/tests/migration-test.c:689:15:
runtime error: load of value 255, which is not a valid value for type 'bool' /home/petmay01/linaro/qemu-for-merges/tests/migration-test.c:690:16:
runtime error: null pointer passed as argument 1, which is declared to never be null/usr/include/unistd.h:828:48: note: nonnull attribute specified here PASS 2 migration-test /i386/migration/bad_dest
PASS 3 migration-test /i386/migration/fd_proto
PASS 4 migration-test /i386/migration/validate_uuid
PASS 5 migration-test /i386/migration/validate_uuid_error
I also saw a hang in migration-test (x86 host, aarch64 guest), but that didn't reoccur on my rerun, so it's intermittent and might be present already in master.
thanks
-- PMM
Quoted 53 lines · * Peter Maydell ([email protected]) wrote:
Quoted 22 lines · Paolo Bonzini
The following changes since commit
084a398bf8aa7634738e6c6c0103236ee1b3b72f:Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging (2019-12-13 18:14:07 +0000)
are available in the git repository at:
git://github.com/bonzini/qemu.gittags/for-upstreamfor you to fetch changes up to
cfba0eb1146e7ccf839df29fd99cb90dd3c7640a:colo: fix return without releasing RCU (2019-12-16 17:25:46 +0100)
----------------------------------------------------------------
* More uses ofRCU_READ_LOCK_GUARD(Dave, myself)
* QOM doc improvments (Greg)
* Cleanups from the Meson conversion (Marc-André)
* Support for multiple -accel options (myself)
* Many x86 machine cleanup (Philippe, myself)
* tests/migration-test cleanup (Juan)Quoted 1 line
----------------------------------------------------------------
This generates a set of extra warnings from the clang runtime sanitizers:
(1) in the bios-tables-test:
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} QTEST_QEMU_BINARY=i386-softmmu/qemu-system-i386 QTEST_QEMU_IMG=qemu-img tests/bios-tabl
es-test -m=quick -k --tap </dev/null|./scripts/tap-driver.pl--test-name="bios-tables-test"/home/petmay01/linaro/qemu-for-merges/qom/object.c:390:16: runtime
error: load of value 22, which is not a valid value for type 'bool'Looking for expected file 'tests/data/acpi/pc/FACP'
Using expected file 'tests/data/acpi/pc/FACP'
Looking for expected file 'tests/data/acpi/pc/APIC'
Using expected file 'tests/data/acpi/pc/APIC'
Looking for expected file 'tests/data/acpi/pc/HPET'
Using expected file 'tests/data/acpi/pc/HPET'
Looking for expected file 'tests/data/acpi/pc/FACS'
Using expected file 'tests/data/acpi/pc/FACS'
Looking for expected file 'tests/data/acpi/pc/DSDT'
Using expected file 'tests/data/acpi/pc/DSDT'
PASS 1 bios-tables-test /i386/acpi/piix4/home/petmay01/linaro/qemu-for-merges/qom/object.c:390:16: runtime
error: load of value 151, which is not a valid value for type 'bool'(and others similar)
Quoted 13 lines
and in the migration-test:
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} QTEST_QEMU_BINARY=i386-softmmu/qemu-system-i386 QTEST_QEMU_IMG=qemu-img tests/migration-test -m=quick -k --tap </dev/null|./scripts/tap-driver.pl--test-name="migration-test" PASS 1 migration-test /i386/migration/deprecated/home/petmay01/linaro/qemu-for-merges/tests/migration-test.c:689:15:
runtime error: load of value 255, which is not a valid value for type 'bool'/home/petmay01/linaro/qemu-for-merges/tests/migration-test.c:690:16:
runtime error: null pointer passed as argument 1, which is declared to never be null/usr/include/unistd.h:828:48: note: nonnull attribute specified here
That's a use-after-free from Juan's 'migration-test: Use a struct for test_migrate_start parameters'; it's calling migrate_start_destroy and then checks args->use_shmem.
Dave
Quoted 5 lines
PASS 2 migration-test /i386/migration/bad_dest PASS 3 migration-test /i386/migration/fd_proto PASS 4 migration-test /i386/migration/validate_uuid PASS 5 migration-test /i386/migration/validate_uuid_error
Quoted 7 lines
I also saw a hang in migration-test (x86 host, aarch64 guest), but that didn't reoccur on my rerun, so it's intermittent and might be present already in master.
thanks
-- PMM
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Quoted 16 lines · Dr. David Alan Gilbert
Quoted 15 lines
(and others similar)
and in the migration-test:
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} QTEST_QEMU_BINARY=i386-softmmu/qemu-system-i386 QTEST_QEMU_IMG=qemu-img tests/migration-test -m=quick -k --tap </dev/null|./scripts/tap-driver.pl--test-name="migration-test" PASS 1 migration-test /i386/migration/deprecated/home/petmay01/linaro/qemu-for-merges/tests/migration-test.c:689:15:
runtime error: load of value 255, which is not a valid value for type 'bool'/home/petmay01/linaro/qemu-for-merges/tests/migration-test.c:690:16:
runtime error: null pointer passed as argument 1, which is declared to never be null/usr/include/unistd.h:828:48: note: nonnull attribute specified here
Quoted 3 lines
That's a use-after-free from Juan's 'migration-test: Use a struct for
test_migrate_startparameters'; it's callingmigrate_start_destroyand then checksargs->use_shmem.
Hi
New series with the fix posted upstream.
Paolo, should I did the pull requset, or will you do it?
Thanks, Juan.
PD. Just curious, how should I launch clang to give me that error?
Quoted 21 lines · Juan Quintela
Quoted 16 lines · Dr. David Alan Gilbert
Quoted 15 lines
(and others similar)
and in the migration-test:
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} QTEST_QEMU_BINARY=i386-softmmu/qemu-system-i386 QTEST_QEMU_IMG=qemu-img tests/migration-test -m=quick -k --tap </dev/null|./scripts/tap-driver.pl--test-name="migration-test" PASS 1 migration-test /i386/migration/deprecated/home/petmay01/linaro/qemu-for-merges/tests/migration-test.c:689:15:
runtime error: load of value 255, which is not a valid value for type 'bool'/home/petmay01/linaro/qemu-for-merges/tests/migration-test.c:690:16:
runtime error: null pointer passed as argument 1, which is declared to never be null/usr/include/unistd.h:828:48: note: nonnull attribute specified hereQuoted 3 lines
That's a use-after-free from Juan's 'migration-test: Use a struct for
test_migrate_startparameters'; it's callingmigrate_start_destroyand then checksargs->use_shmem.
Quoted 5 lines
Hi
New series with the fix posted upstream.
Paolo, should I did the pull requset, or will you do it?
I can do it.
Quoted 1 line
PD. Just curious, how should I launch clang to give me that error?
"make docker-test-debug@fedora".
Paolo
Quoted 22 lines · Paolo Bonzini
Quoted 21 lines · Juan Quintela
Quoted 19 lines · Dr. David Alan Gilbert
Quoted 15 lines
(and others similar)
and in the migration-test:
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} QTEST_QEMU_BINARY=i386-softmmu/qemu-system-i386 QTEST_QEMU_IMG=qemu-img tests/migration-test -m=quick -k --tap </dev/null|./scripts/tap-driver.pl--test-name="migration-test" PASS 1 migration-test /i386/migration/deprecated/home/petmay01/linaro/qemu-for-merges/tests/migration-test.c:689:15:
runtime error: load of value 255, which is not a valid value for type 'bool'/home/petmay01/linaro/qemu-for-merges/tests/migration-test.c:690:16:
runtime error: null pointer passed as argument 1, which is declared to never be null/usr/include/unistd.h:828:48: note: nonnull attribute specified hereThat's a use-after-free from Juan's 'migration-test: Use a struct for
test_migrate_startparameters'; it's callingmigrate_start_destroyand then checksargs->use_shmem.
Quoted 7 lines
Quoted 5 lines
Hi
New series with the fix posted upstream.
Paolo, should I did the pull requset, or will you do it?
I can do it.
Thanks
Quoted 3 lines
Quoted 1 line
PD. Just curious, how should I launch clang to give me that error?
"make docker-test-debug@fedora".
Double thanks.
Later, Juan.